| 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 elseif.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 |
| 17 |
|
| 18 |
ipch = cpspch(p4) |
| 19 |
ienv = p5 |
| 20 |
|
| 21 |
|
| 22 |
if (ienv == 0) then |
| 23 |
;ADSR |
| 24 |
kenv adsr 0.05, 0.05, .95, .05 |
| 25 |
elseif (ienv == 1) then |
| 26 |
;Linear Triangular Envelope |
| 27 |
kenv linseg 0, p3 * .5, 1, p3 * .5, 0 |
| 28 |
elseif (ienv == 2) then |
| 29 |
;Ramp Up |
| 30 |
kenv linseg 0, p3 - .01, 1, .01, 0 |
| 31 |
endif |
| 32 |
|
| 33 |
aout vco2 .8, ipch, 10 |
| 34 |
aout moogvcf aout, ipch + (kenv * 5 * ipch) , .5 |
| 35 |
|
| 36 |
aout = aout * kenv |
| 37 |
|
| 38 |
outs aout, aout |
| 39 |
endin |
| 40 |
</CsInstruments> |
| 41 |
<CsScore> |
| 42 |
|
| 43 |
i 1 0 2 8.00 0 |
| 44 |
i 1 3 2 8.00 1 |
| 45 |
i 1 6 2 8.00 2 |
| 46 |
e |
| 47 |
</CsScore> |
| 48 |
</CsoundSynthesizer> |