| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-odac -m0 |
| 4 |
</CsOptions> |
| 5 |
<CsInstruments> |
| 6 |
sr = 44100 |
| 7 |
ksmps = 32 |
| 8 |
nchnls = 1 |
| 9 |
0dbfs = 1 |
| 10 |
|
| 11 |
giNotes ftgen 0,0,-100,-17,0,48, 15,53, 30,55, 40,60, 50,63, |
| 12 |
60,65, 79,67, 85,70, 90,72, 96,75 |
| 13 |
giDurs ftgen 0,0,-100,-17,0,2, 30,0.5, 75,1, 90,1.5 |
| 14 |
|
| 15 |
instr 1 |
| 16 |
kDur init 0.5 ; initial rhythmic duration |
| 17 |
kTrig metro 2/kDur ; metronome freq. 2 times inverse of duration |
| 18 |
kNdx trandom kTrig,0,1 ; create a random index upon each metro 'click' |
| 19 |
kDur table kNdx,giDurs,1 ; read a note duration value |
| 20 |
schedkwhen kTrig,0,0,2,0,1 ; trigger a note! |
| 21 |
endin |
| 22 |
|
| 23 |
instr 2 |
| 24 |
iNote table rnd(1),giNotes,1 ; read a random value from the function table |
| 25 |
aEnv linsegr 0, 0.005, 1, p3-0.105, 1, 0.1, 0 ; amplitude envelope |
| 26 |
iPlk random 0.1, 0.3 ; point at which to pluck the string |
| 27 |
iDtn random -0.05, 0.05 ; random detune |
| 28 |
aSig wgpluck2 0.98, 0.2, cpsmidinn(iNote+iDtn), iPlk, 0.06 |
| 29 |
out aSig * aEnv |
| 30 |
endin |
| 31 |
</CsInstruments> |
| 32 |
|
| 33 |
<CsScore> |
| 34 |
i 1 0 300 ; start 3 long notes close after one another |
| 35 |
i 1 0.01 300 |
| 36 |
i 1 0.02 300 |
| 37 |
e |
| 38 |
</CsScore> |
| 39 |
</CsoundSynthesizer> |
| 40 |
;example by Iain McCurdy |