| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-odac -M1 -Q1 ;;;realtime audio out and midi in and midi out |
| 5 |
;-iadc ;;;uncomment -iadc if realtime audio input is needed too |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o midiprogramchange.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
sr = 44100 |
| 12 |
ksmps = 32 |
| 13 |
nchnls = 2 |
| 14 |
0dbfs = 1 |
| 15 |
|
| 16 |
instr 1 ;uses external midi device |
| 17 |
|
| 18 |
kkey init 0 ;initialize key number |
| 19 |
kvel init 0 ;initialize velocity |
| 20 |
midiprogramchange 52 ;choose GM program number 52 = string pad |
| 21 |
midinoteonkey kkey, kvel ;MIDI note number value |
| 22 |
printk2 kkey ;display the key value when it changes and when key is pressed |
| 23 |
midion 1, kkey, kvel ;sent note to external device |
| 24 |
|
| 25 |
endin |
| 26 |
</CsInstruments> |
| 27 |
<CsScore> |
| 28 |
f 0 30 ;runs for 30 seconds |
| 29 |
|
| 30 |
i 1 0 2 62 ; play these notes from score as well |
| 31 |
i 1 + 2 65 |
| 32 |
e |
| 33 |
</CsScore> |
| 34 |
</CsoundSynthesizer> |