Code that DOES modulate filter cutoff with ADSR
My answer is kind of a hack, but, it's working quite well.
Use a Step waveform set to 1 at all times, have THAT 1 divided by the ADSR
for the filter, then, my above code works like a charm!
You could also, for example, spork off a different function that randomly
triggered the filter's ADSR independently from the amplitude's ADSR, giving
you all sorts of trance techno type patterns.
Hope this helps you out, Josh, and other users.
-Edward
// Filter Wooby Wooby Woo
BlitSaw bs;
LPF lpf;
ADSR amp;
ADSR filt;
Gain fg;
amp.set( 1::ms, 350::ms, .2, 500::ms );
filt.set( 15::ms, 550::ms, 0, 400::ms );
Step s;
s => filt;
// 1 => s.value;
1 => s.next;
bs => amp => lpf => dac;
filt => fg => blackhole;
10 => fg.gain;
500 => lpf.freq;
2 => lpf.Q;
spork ~ filteradsr ();
for (int l; l < 32; l++)
{
<<<"L;",l,"">>>;
spork ~ playanote ( Std.rand2(30,60) );
800::ms => now;
}
fun void playanote (int nnum)
{
int mstodie;
<<<"\n\n",nnum,"">>>;
nnum => Std.mtof => bs.freq;
<<<"On","">>>;
amp.keyOn();
filt.keyOn();
Std.rand2(150,300) => mstodie;
mstodie * 1::ms => now;
<<<"Off","">>>;
amp.keyOff();
filt.keyOff();
}
fun void filteradsr ()
{
while (true)
{
float currfilt;
filt.last() * 800 + 250 => currfilt;
currfilt => lpf.freq;
//if (maybe) <<
participants (1)
-
Loscha