| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
; Audio out Audio in |
| 5 |
-odac ;;;RT audio out |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o interp.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
sr = 44100 |
| 12 |
ksmps = 1024 ; very high, for demonstration purpose |
| 13 |
nchnls = 2 |
| 14 |
0dbfs = 1 |
| 15 |
|
| 16 |
instr 1 |
| 17 |
|
| 18 |
kamp linseg 0, p3/2, .5, p3/2, 0 ; Create an amplitude envelope. |
| 19 |
a1 oscil kamp, 440 ; The amplitude envelope will sound rough because it |
| 20 |
outs a1, a1 ; jumps every ksmps period (1024) |
| 21 |
endin |
| 22 |
|
| 23 |
|
| 24 |
instr 2 ; a smoother sounding instrument. |
| 25 |
|
| 26 |
kamp linseg 0, p3/2, .5, p3/2, 0 ; Create an amplitude envelope |
| 27 |
aamp interp kamp ; The amplitude envelope will sound smoother due to |
| 28 |
a1 oscil aamp, 440 ; linear interpolation at the higher a-rate |
| 29 |
outs a1, a1 |
| 30 |
endin |
| 31 |
|
| 32 |
</CsInstruments> |
| 33 |
<CsScore> |
| 34 |
i 1 0 2 ; sounds raw |
| 35 |
|
| 36 |
i 2 3 2 ; sounds smooth |
| 37 |
e |
| 38 |
</CsScore> |
| 39 |
</CsoundSynthesizer> |