| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-odac ;;;realtime audio out, virtual midi in |
| 5 |
;-iadc ;;;uncomment -iadc if RT audio input is needed too |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o sfload.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
; By Menno Knevel - 2020 |
| 12 |
|
| 13 |
sr = 44100 |
| 14 |
ksmps = 32 |
| 15 |
nchnls = 2 |
| 16 |
0dbfs = 1 |
| 17 |
|
| 18 |
; load in two soundfonts |
| 19 |
isf sfload "sf_GMbank.sf2" |
| 20 |
ir sfload "07AcousticGuitar.sf2" |
| 21 |
sfplist isf |
| 22 |
sfplist ir |
| 23 |
; first sf_GMbank.sf2 is loaded and assigned to start at 0 and counting up to 328 |
| 24 |
; as there are 329 presets in sf_GMbank.sf2 (0-328). |
| 25 |
; then 07AcousticGuitar.sf2 is loaded and assigned to replace the 10th preset of already loaded sf_GMbank.sf2 |
| 26 |
sfpassign 0, isf |
| 27 |
sfpassign 10, ir |
| 28 |
|
| 29 |
instr 1 ; play French Horn, bank 0 program 60 |
| 30 |
|
| 31 |
inum = p4 |
| 32 |
ivel = p5 |
| 33 |
kamp linsegr 1, 1, 1, .1, 0 |
| 34 |
kamp = kamp/500000 ;scale amplitude |
| 35 |
kfreq = 1 ;do not change freq from sf |
| 36 |
a1,a2 sfplay3 ivel, inum, kamp*ivel, kfreq, 60 ;preset index = 60 |
| 37 |
outs a1, a2 |
| 38 |
endin |
| 39 |
|
| 40 |
instr 2 ; play Guitar replaces sf_GMbank.sf2 at preset index 10 |
| 41 |
|
| 42 |
inum = p4 |
| 43 |
ivel = p5 |
| 44 |
kamp linsegr 1, 1, 1, .1, 0 |
| 45 |
kamp = kamp/700000 ;scale amplitude |
| 46 |
kfreq = 1 ;do not change freq from sf |
| 47 |
a1,a2 sfplay3 ivel, inum, kamp*ivel, kfreq, 10 ;preset index = 10 |
| 48 |
outs a1, a2 |
| 49 |
endin |
| 50 |
|
| 51 |
</CsInstruments> |
| 52 |
<CsScore> |
| 53 |
|
| 54 |
i1 0 1 60 100 |
| 55 |
i1 + 1 62 < |
| 56 |
i1 + 1 65 < |
| 57 |
i1 + 1 69 10 |
| 58 |
|
| 59 |
i2 5 1 60 100 |
| 60 |
i2 + 1 62 < |
| 61 |
i2 7 1 65 < |
| 62 |
i2 7 1 69 10 |
| 63 |
|
| 64 |
e |
| 65 |
</CsScore> |
| 66 |
</CsoundSynthesizer> |