My answer is kind of a hack, but, it's working quite well.<br>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!<br>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.
<br><br> Hope this helps you out, Josh, and other users.<br><br>-Edward <br><br>// Filter Wooby Wooby Woo<br><br>BlitSaw bs;<br>LPF lpf;<br>ADSR amp;<br>ADSR filt;<br>Gain fg;<br>amp.set( 1::ms, 350::ms, .2, 500::ms );<br>
filt.set( 15::ms, 550::ms, 0, 400::ms );<br><br>Step s;<br>s => filt;<br>// 1 => s.value;<br>1 => s.next;<br><br>bs => amp => lpf => dac;<br>filt => fg => blackhole;<br>10 => fg.gain;<br><br>500 =>
lpf.freq;<br>2 => lpf.Q;<br><br>spork ~ filteradsr ();<br><br>for (int l; l < 32; l++)<br>{ <br> <<<"L;",l,"">>>;<br> spork ~ playanote ( Std.rand2(30,60) );<br> 800::ms => now;
<br>}<br> <br>fun void playanote (int nnum)<br> { <br> int mstodie;<br> <<<"\n\n",nnum,"">>>;<br> nnum => Std.mtof => bs.freq;<br> <<<"On","">>>;
<br> amp.keyOn();<br> filt.keyOn();<br> Std.rand2(150,300) => mstodie;<br> mstodie * 1::ms => now; <br> <<<"Off","">>>;<br>
amp.keyOff();<br> filt.keyOff();<br> }<br><br>fun void filteradsr ()<br> {<br> while (true)<br> {<br> float currfilt;<br> filt.last() * 800 + 250 => currfilt;
<br> currfilt => lpf.freq;<br> //if (maybe) <<<filt.last(),currfilt>>>;<br> 1::ms => now; <br> }<br> }<br>