-odac
;Example by Joachim Heintz
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
seed 0; random values each time different
giTone ftgen 0, 0, 2^10, 10, 1, .5, .3, .1
instr 1
; move between 0 and 1 (3 new values per second)
kGate randomi 0, 1, 3
; move between 300 and 800 hz (1 new value per sec)
kFreq randomi 300, 800, 1
; move between -12 and 0 dB (5 new values per sec)
kdB randomi -12, 0, 5
aSig oscil3 1, kFreq, giTone
kVol init 0
if kGate > 0.5 then; if kGate is larger than 0.5
kVol = ampdb(kdB); open gate
else
kVol = 0; otherwise close gate
endif
kVol port kVol, .02; smooth volume curve to avoid clicks
aOut = aSig * kVol
outs aOut, aOut
endin
i 1 0 30