| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-Ma -odac -m128 |
| 4 |
;activates all midi devices, real time sound output, suppress note printings |
| 5 |
</CsOptions> |
| 6 |
<CsInstruments> |
| 7 |
sr = 44100 |
| 8 |
ksmps = 32 |
| 9 |
nchnls = 1 |
| 10 |
0dbfs = 1 |
| 11 |
|
| 12 |
gisine ftgen 0,0,2^12,10,1 |
| 13 |
|
| 14 |
instr 1 ; 1 impulse (midi channel 1) |
| 15 |
prints "instrument/midi channel: %d%n",p1 ;print instrument number to terminal |
| 16 |
reset: ;label 'reset' |
| 17 |
timout 0, 1, impulse ;jump to 'impulse' for 1 second |
| 18 |
reinit reset ;reninitialise pass from 'reset' |
| 19 |
impulse: ;label 'impulse' |
| 20 |
aenv expon 1, 0.3, 0.0001 ;a short percussive envelope |
| 21 |
aSig poscil aenv, 500, gisine ;audio oscillator |
| 22 |
out aSig ;audio to output |
| 23 |
endin |
| 24 |
|
| 25 |
instr 2 ; 2 impulses (midi channel 2) |
| 26 |
prints "instrument/midi channel: %d%n",p1 |
| 27 |
reset: |
| 28 |
timout 0, 1, impulse |
| 29 |
reinit reset |
| 30 |
impulse: |
| 31 |
aenv expon 1, 0.3, 0.0001 |
| 32 |
aSig poscil aenv, 500, gisine |
| 33 |
a2 delay aSig, 0.15 ; short delay adds another impulse |
| 34 |
out aSig+a2 ; mix two impulses at output |
| 35 |
endin |
| 36 |
|
| 37 |
instr 3 ; 3 impulses (midi channel 3) |
| 38 |
prints "instrument/midi channel: %d%n",p1 |
| 39 |
reset: |
| 40 |
timout 0, 1, impulse |
| 41 |
reinit reset |
| 42 |
impulse: |
| 43 |
aenv expon 1, 0.3, 0.0001 |
| 44 |
aSig poscil aenv, 500, gisine |
| 45 |
a2 delay aSig, 0.15 ; delay adds a 2nd impulse |
| 46 |
a3 delay a2, 0.15 ; delay adds a 3rd impulse |
| 47 |
out aSig+a2+a3 ; mix the three impulses at output |
| 48 |
endin |
| 49 |
|
| 50 |
</CsInstruments> |
| 51 |
<CsScore> |
| 52 |
f 0 300 |
| 53 |
</CsScore> |
| 54 |
<CsoundSynthesizer> |
| 55 |
;example by Iain McCurdy |