Debian Codegraph @

src/Examples/FLOSS Manual Examples/07 MIDI/07E05_midion2.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; amend device number accordingly
4 -Q999
5 </CsOptions>
6 <CsInstruments>
7
8 ksmps = 32 ; no audio so sr and nchnls irrelevant
9
10 instr 1
11 ; read values in from p-fields
12 kchn = p4
13 knum random 48,72.99 ; note numbers chosen randomly across a 2 octaves
14 kvel random 40, 115 ; velocities are chosen randomly
15 krate randomi 1,2,1 ; rate at which new notes will be output
16 ktrig metro krate^2 ; 'new note' trigger
17 midion2 kchn, int(knum), int(kvel), ktrig ; send midi note if ktrig=1
18 endin
19
20 </CsInstruments>
21 <CsScore>
22 i 1 0 20 1
23 f 0 21 ; extending performance time prevents the final note-off being lost
24 </CsScore>
25 </CsoundSynthesizer>
26 ;example by Iain McCurdy