| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-odac ;;;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 sfplay3.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 |
gitwelve ftgen 1, 0, 16, -2, 12, 2, 440, 69, 1, 16/15, 9/8, 6/5, 5/4, 4/3, 7/5, 3/2, 8/5, 5/3, 9/5, 15/8, 2 |
| 19 |
givife ftgen 2, 0, 16, -2, 5, 2, 261.659, 60, 1, 1.1486, 1.3195, 1.5157, 1.7411, 2.00 |
| 20 |
|
| 21 |
giSF sfload "01hpschd.sf2" |
| 22 |
sfplist giSF |
| 23 |
gipre sfpreset 0, 0, giSF, 0 |
| 24 |
|
| 25 |
|
| 26 |
instr 1 |
| 27 |
|
| 28 |
ikey = p4 |
| 29 |
ivel = p5 |
| 30 |
aenv linsegr 1, 1, 1, 1, 0 ;envelope |
| 31 |
icps cpstuni ikey, gitwelve ;12 tones per octave |
| 32 |
iamp = 0.00001 ;scale amplitude down a lot, due to 0dbfs = 1 |
| 33 |
iamp *= ivel ;make velocity-dependent |
| 34 |
|
| 35 |
aL, aR sfplay3 ivel, ikey, iamp, icps, gipre, 1 |
| 36 |
aL = aL * aenv |
| 37 |
aR = aR * aenv |
| 38 |
outs aL, aR |
| 39 |
|
| 40 |
endin |
| 41 |
|
| 42 |
instr 2 |
| 43 |
|
| 44 |
ikey = p4 |
| 45 |
ivel = p5 |
| 46 |
aenv linsegr 1, 1, 1, 1, 0 ;envelope |
| 47 |
icps cpstuni ikey, givife ;5 tones per octave |
| 48 |
iamp = 0.00001 ;scale amplitude down a lot, due to 0dbfs = 1 |
| 49 |
iamp *= ivel ;make velocity-dependent |
| 50 |
|
| 51 |
aL, aR sfplay3 ivel, ikey, iamp, icps, gipre, 1 |
| 52 |
aL = aL * aenv |
| 53 |
aR = aR * aenv |
| 54 |
outs aL, aR |
| 55 |
|
| 56 |
endin |
| 57 |
|
| 58 |
</CsInstruments> |
| 59 |
<CsScore> |
| 60 |
|
| 61 |
;instr.1 using ftable 1 |
| 62 |
i1 0 1 60 100 |
| 63 |
i1 + 1 62 < |
| 64 |
i1 + 1 65 < |
| 65 |
i1 + 1 69 40 |
| 66 |
|
| 67 |
;instr.2 using ftable 2 |
| 68 |
i2 5 1 60 100 |
| 69 |
i2 + 1 62 < |
| 70 |
i2 + 1 65 < |
| 71 |
i2 + 1 69 40 |
| 72 |
e |
| 73 |
</CsScore> |
| 74 |
</CsoundSynthesizer> |