| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
; Audio out Audio in No messages |
| 5 |
-odac ;;;realtime audio I/O |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o -.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 |
idur = p3 |
| 19 |
iatt = p4 |
| 20 |
idec = p5 |
| 21 |
isus = p3-iatt-idec ;calculate sustain time from subtracting attack and decay |
| 22 |
printf_i "sutain time= note duration - attack - decay --> %.1f-%.1f-%.1f = %.1f\n", 1, idur, iatt, idec, isus |
| 23 |
|
| 24 |
kenv expseg 0.01, iatt, 1, isus, 1, idec, 0.01 ;envelope |
| 25 |
asig poscil 1*kenv, 200, 1 |
| 26 |
outs asig, asig |
| 27 |
|
| 28 |
endin |
| 29 |
</CsInstruments> |
| 30 |
<CsScore> |
| 31 |
f 1 0 4096 10 1 ;sine wave |
| 32 |
; attack decay |
| 33 |
i 1 0 3 .1 .2 |
| 34 |
i 1 4 3 .5 1.5 |
| 35 |
i 1 8 5 4 .5 |
| 36 |
|
| 37 |
e |
| 38 |
</CsScore> |
| 39 |
</CsoundSynthesizer> |
| 40 |
|