| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-odac -+rtmidi=virtual -M0 ;;;realtime audio out |
| 5 |
;-iadc ;;;uncomment -iadc if realtime audio input is needed too |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o sfplay.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 |
|
| 17 |
isf sfload "07AcousticGuitar.sf2" |
| 18 |
sfplist isf |
| 19 |
sfpassign 0, isf |
| 20 |
|
| 21 |
instr 1 ; play from score and midi keyboard |
| 22 |
|
| 23 |
mididefault 60, p3 |
| 24 |
midinoteonkey p4, p5 |
| 25 |
inum init p4 |
| 26 |
ivel init p5 |
| 27 |
ivel init ivel/127 ;make velocity dependent |
| 28 |
kamp linsegr 1, 1, 1, .1, 0 |
| 29 |
kamp = kamp/5000 ;scale amplitude |
| 30 |
kfreq init 1 ;do not change freq from sf |
| 31 |
a1,a2 sfplay ivel, inum, kamp*ivel, kfreq, 0 ;preset index = 0 |
| 32 |
outs a1, a2 |
| 33 |
|
| 34 |
endin |
| 35 |
|
| 36 |
</CsInstruments> |
| 37 |
<CsScore> |
| 38 |
f0 60 ; stay active for 1 minute |
| 39 |
|
| 40 |
i1 0 1 60 127 |
| 41 |
i1 + 1 62 < |
| 42 |
i1 + 1 65 < |
| 43 |
i1 + 1 69 10 |
| 44 |
|
| 45 |
e |
| 46 |
</CsScore> |
| 47 |
</CsoundSynthesizer> |