| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-odac |
| 4 |
</CsOptions> |
| 5 |
<CsInstruments> |
| 6 |
sr = 44100 |
| 7 |
ksmps = 32 |
| 8 |
nchnls = 2 |
| 9 |
0dbfs = 1 |
| 10 |
|
| 11 |
giSine ftgen 0, 0, 2^10, 10, 1 |
| 12 |
|
| 13 |
instr 1 |
| 14 |
loop: |
| 15 |
idurloop random .5, 2 ;duration of each loop |
| 16 |
timout 0, idurloop, play |
| 17 |
reinit loop |
| 18 |
play: |
| 19 |
idurins random 1, 5 ;duration of the triggered instrument |
| 20 |
event_i "i", 2, 0, idurins ;triggers instrument 2 |
| 21 |
endin |
| 22 |
|
| 23 |
instr 2 |
| 24 |
ifreq1 random 600, 1000 ;starting frequency |
| 25 |
idiff random 100, 300 ;difference to final frequency |
| 26 |
ifreq2 = ifreq1 - idiff ;final frequency |
| 27 |
kFreq expseg ifreq1, p3, ifreq2 ;glissando |
| 28 |
iMaxdb random -12, 0 ;peak randomly between -12 and 0 dB |
| 29 |
kAmp transeg ampdb(iMaxdb), p3, -10, 0 ;envelope |
| 30 |
aTone poscil kAmp, kFreq, giSine |
| 31 |
outs aTone, aTone |
| 32 |
endin |
| 33 |
|
| 34 |
</CsInstruments> |
| 35 |
<CsScore> |
| 36 |
i 1 0 30 |
| 37 |
</CsScore> |
| 38 |
</CsoundSynthesizer> |
| 39 |
;example by joachim heintz |