modulate LPF with ADSR
well, the trek continues... I've been copying and pasting, playing with, and generally screwing up chuck code over the past week. with some help, I've come up with this simple synth patch: // declare and connect chain of ugens Gain g => dac; 1 => g.gain; SawOsc s => ADSR e =>LPF f => g; e.set( 1::ms, 5::ms, .8, 500::ms ); e.keyOn(); e.keyOff(); f.freq( 800 ); now what I would like to do with modulate the filter with adsr. I think this approach should work: SawOsc s => ADSR e =>LPF f => g; ADSR e2 => f => g; my thinking goes like this: I need to declare e2 to differientiate it from my first adsr, which is defined as e. I have chucked e2 to my existing low pass filter, f. yet I'm stumped as to where to define how the adsr opens up the filter and closes it back down. can someone help me understand where to go from here? -- Josh Lawrence http://www.hardbop200.com http://www.joshlawrencetrio.com
I thought this would work, but, reading adsr.last() gives you nothing if no
sound is going through that envelope, and the last value of the sound going
into it if you have sound going into it.
It's got me beaten for now.
I think this approach, having a seperate function ticking away in the
background updating the filter is the way you'd want to do it.
But, I'm takin some time, and gettin me some dinner.
-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 );
bs => amp => lpf => dac;
filt => fg => blackhole;
10 => fg.gain;
500 => lpf.freq;
1 => 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;
fg.last() * 1500 + 200 => currfilt;
currfilt => lpf.freq;
if (maybe) <<
well, the trek continues...
I've been copying and pasting, playing with, and generally screwing up chuck code over the past week. with some help, I've come up with this simple synth patch:
// declare and connect chain of ugens Gain g => dac; 1 => g.gain; SawOsc s => ADSR e =>LPF f => g; e.set( 1::ms, 5::ms, .8, 500::ms ); e.keyOn(); e.keyOff(); f.freq( 800 );
now what I would like to do with modulate the filter with adsr. I think this approach should work:
SawOsc s => ADSR e =>LPF f => g; ADSR e2 => f => g;
my thinking goes like this: I need to declare e2 to differientiate it from my first adsr, which is defined as e. I have chucked e2 to my existing low pass filter, f. yet I'm stumped as to where to define how the adsr opens up the filter and closes it back down. can someone help me understand where to go from here?
-- Josh Lawrence http://www.hardbop200.com http://www.joshlawrencetrio.com _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- www.loscha.com
participants (2)
-
Josh Lawrence
-
Loscha