| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; amend device number accordingly |
| 4 |
-Q999 |
| 5 |
</CsOptions> |
| 6 |
<CsInstruments> |
| 7 |
; Example by Iain McCurdy |
| 8 |
|
| 9 |
ksmps = 32 ;no audio so sr and nchnls omitted |
| 10 |
|
| 11 |
seed 0; random number generators seeded by system clock |
| 12 |
|
| 13 |
instr 1 |
| 14 |
; read value in from p-field |
| 15 |
kchn = p4 |
| 16 |
knum random 48,72.99 ; note numbers chosen randomly across a 2 octaves |
| 17 |
kvel random 40, 115 ; velocities are chosen randomly |
| 18 |
kdur random 0.2, 1 ; note durations chosen randomly from 0.2 to 1 |
| 19 |
kpause random 0, 0.4 ; pauses betw. notes chosen randomly from 0 to 0.4 |
| 20 |
moscil kchn, knum, kvel, kdur, kpause ; send a stream of midi notes |
| 21 |
endin |
| 22 |
|
| 23 |
</CsInstruments> |
| 24 |
<CsScore> |
| 25 |
;p1 p2 p3 p4 |
| 26 |
i 1 0 20 1 |
| 27 |
f 0 21 ; extending performance time prevents final note-off from being lost |
| 28 |
</CsScore> |
| 29 |
</CsoundSynthesizer> |
| 30 |
;example by Iain McCurdy |