| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; amend device number accordingly |
| 4 |
-Q999 |
| 5 |
</CsOptions> |
| 6 |
<CsInstruments> |
| 7 |
ksmps = 32 ;no audio so sr and nchnls omitted |
| 8 |
|
| 9 |
instr 1 |
| 10 |
;arguments for midiout are read from p-fields |
| 11 |
istatus init p4 |
| 12 |
ichan init p5 |
| 13 |
idata1 init p6 |
| 14 |
idata2 init p7 |
| 15 |
kskip init 0 |
| 16 |
if kskip=0 then |
| 17 |
midiout istatus, ichan, idata1, idata2; send raw midi data (note on) |
| 18 |
kskip = 1; ensure that the note on will only be executed once |
| 19 |
endif |
| 20 |
krelease release; normally output is zero, on final k pass output is 1 |
| 21 |
if krelease=1 then; i.e. if we are on the final k pass... |
| 22 |
midiout istatus, ichan, idata1, 0; send raw midi data (note off) |
| 23 |
endif |
| 24 |
endin |
| 25 |
|
| 26 |
</CsInstruments> |
| 27 |
<CsScore> |
| 28 |
;p1 p2 p3 p4 p5 p6 p7 |
| 29 |
i 1 0 4 144 1 60 100 |
| 30 |
i 1 1 3 144 1 64 100 |
| 31 |
i 1 2 2 144 1 67 100 |
| 32 |
f 0 5; extending performance time prevents note-offs from being lost |
| 33 |
</CsScore> |
| 34 |
</CsoundSynthesizer> |
| 35 |
;example by Iain McCurdy |