| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
; Audio out Audio in No messages MIDI in |
| 5 |
-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o polyaft.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
sr = 44100 |
| 12 |
ksmps = 10 |
| 13 |
nchnls = 1 |
| 14 |
|
| 15 |
massign 1, 1 |
| 16 |
itmp ftgen 1, 0, 1024, 10, 1 ; sine wave |
| 17 |
|
| 18 |
instr 1 |
| 19 |
|
| 20 |
kcps cpsmidib 2 ; note frequency |
| 21 |
inote notnum ; note number |
| 22 |
kaft polyaft inote, 0, 127 ; aftertouch |
| 23 |
; interpolate aftertouch to eliminate clicks |
| 24 |
ktmp phasor 40 |
| 25 |
ktmp trigger 1 - ktmp, 0.5, 0 |
| 26 |
kaft tlineto kaft, 0.025, ktmp |
| 27 |
; map to sine curve for crossfade |
| 28 |
kaft = sin(kaft * 3.14159 / 254) * 22000 |
| 29 |
|
| 30 |
asnd oscili kaft, kcps, 1 |
| 31 |
|
| 32 |
out asnd |
| 33 |
|
| 34 |
endin |
| 35 |
|
| 36 |
|
| 37 |
</CsInstruments> |
| 38 |
<CsScore> |
| 39 |
|
| 40 |
t 0 120 |
| 41 |
f 0 9 2 -2 0 |
| 42 |
e |
| 43 |
|
| 44 |
|
| 45 |
</CsScore> |
| 46 |
</CsoundSynthesizer> |