Hey, I’m trying to do something a little unusual and it’s not working, so I can’t move on until I figure it out.
I’m using dust
to generate random impulses. On every individual impulse, I want to modulate it with a random cutoff frequency through a filter. Here’s what I have so far:
<CsoundSynthesizer>
<CsOptions>
-n -d
</CsOptions>
<CsInstruments>
sr = 48000
ksmps = 32
nchnls = 2
0dbfs = 1
seed(0)
instr 1
kAmp = 1
kMinFreq = 5000
kMaxFreq = 10000
aImpulse dust kAmp, 10
kImpulse = k(aImpulse)
kTrig changed kImpulse
kRandomFreq randomi kMinFreq, kMaxFreq, kTrig
; This part works better, but some impulses repeat with the same cutoff frequency
;if kImpulse > 0 then
kRandomFreq random kMinFreq, kMaxFreq
;endif
; debug output - not sure if this is the best way to approach debugging.
; printk 0.01, kRandomFreq
aFiltered moogladder aImpulse, kRandomFreq, 0.9
out aFiltered, aFiltered
endin
</CsInstruments>
<CsScore>
i 1 0 5
</CsScore>
</CsoundSynthesizer>
During troubleshooting, I discovered that randomi
doesn’t work with a control rate – I initially assumed that if I used kTrig
as the kcps
then it would result in a new random number being generated, allowing me to change the cutoff frequency for that impulse.
No doubt I’m doing this all wrong so I’d be grateful for any advice on how to push forward.
Thanks in advance!