| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-odac ; activate real-time audio output |
| 4 |
</CsOptions> |
| 5 |
<CsInstruments> |
| 6 |
sr = 44100 |
| 7 |
ksmps = 32 |
| 8 |
nchnls = 1 |
| 9 |
0dbfs = 1 |
| 10 |
|
| 11 |
gaSig init 0; set initial value for global audio variable (silence) |
| 12 |
|
| 13 |
instr 1 ; a simple tone generator |
| 14 |
aEnv expon 0.2, p3, 0.001 ; percussive amplitude envelope |
| 15 |
aSig poscil aEnv, cpsmidinn(p4) ; audio oscillator |
| 16 |
out aSig |
| 17 |
endin |
| 18 |
|
| 19 |
instr 2 ; write to a file (always on in order to record everything) |
| 20 |
aSig monitor ; read audio from output bus |
| 21 |
fout "WriteToDisk2.wav",4,aSig ; write audio to file (16bit mono) |
| 22 |
endin |
| 23 |
|
| 24 |
</CsInstruments> |
| 25 |
<CsScore> |
| 26 |
; activate recording instrument to encapsulate the entire performance |
| 27 |
i 2 0 8.3 |
| 28 |
|
| 29 |
; two chords |
| 30 |
i 1 0 5 60 |
| 31 |
i 1 0.1 5 65 |
| 32 |
i 1 0.2 5 67 |
| 33 |
i 1 0.3 5 71 |
| 34 |
|
| 35 |
i 1 3 5 65 |
| 36 |
i 1 3.1 5 67 |
| 37 |
i 1 3.2 5 73 |
| 38 |
i 1 3.3 5 78 |
| 39 |
</CsScore> |
| 40 |
</CsoundSynthesizer> |
| 41 |
;example written by Iain McCurdy |