driving filter frequency from an envelope?
What's the chuck'ian idiom for driving a filter frequency from an envelope? Assume I have a primary signal chain that looks like this: Blit b => ResonZ z => Envelope e1 => dac; And I want to drive the center frequency of the ResonZ with another envelope. I know I could do it something like: Phasor constant => Envelope e2 => blackhole; constant.phase(1.0); ... and pepper my code with short delays that update the resonator's frequency: ... .01::second => now; z.freq(e2*440.0 + 100); ... but that seems both inelegant and computationally wasteful. I've looked at the .op inputs -- that may be the answer, but I can't quite tell from the documentation. So: is there a way to directly control the resonant frequency at the UG level without breaking back into "user code"? Thanks. - Rob
Robert,
This should work for you--sporked shreds run concurrently. A few
things: I changed your Phasor to Step. This way you can set the
multiplication value from any other shred, anywhere in the code
without changing the "envdrive" shred. I don't know a ton about the
computational thing, but basically with this method you're just
controlling what the control rate is for every individual item.
Everything is treated as audio, so it's up to you to decide what kind
of signal fidelity you need if it's control or audio.
Blit b => ResonZ z=> dac;
Step constant => Envelope e2 => blackhole;
constant.next(1.0);
while(true)
{
spork ~envdrive();
10::second => now;
}
fun void envdrive(){
now + 10::second => time then;
e2.time(10);
e2.value(0.01);
e2.target(2.0);
e2.keyOn(1);
while (now <= then)
{
1::samp => now;
e2.last()*440.0 + 100 => z.freq;
}
}
On Wed, Apr 22, 2009 at 8:35 AM, Kassen
Rob;
So: is there a way to directly control the resonant frequency at the UG level without breaking back into "user code"?
No, sorry.
(that was a easy one! :¬) )
Yours Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Andrew: Thanks for the code. I mostly wanted to know if there was a way to control filter frequencies working entirely at the UG level, without resorting to the: 1::samp => now; construct. Thanks. - Rob On 23 Apr 2009, at 09:07, Andrew C. Smith wrote:
Robert, This should work for you--sporked shreds run concurrently. A few things: I changed your Phasor to Step. This way you can set the multiplication value from any other shred, anywhere in the code without changing the "envdrive" shred. I don't know a ton about the computational thing, but basically with this method you're just controlling what the control rate is for every individual item. Everything is treated as audio, so it's up to you to decide what kind of signal fidelity you need if it's control or audio.
Blit b => ResonZ z=> dac; Step constant => Envelope e2 => blackhole; constant.next(1.0);
while(true) { spork ~envdrive(); 10::second => now; }
fun void envdrive(){ now + 10::second => time then; e2.time(10); e2.value(0.01); e2.target(2.0); e2.keyOn(1); while (now <= then) { 1::samp => now; e2.last()*440.0 + 100 => z.freq; } }
On Wed, Apr 22, 2009 at 8:35 AM, Kassen
wrote: Rob;
So: is there a way to directly control the resonant frequency at the UG level without breaking back into "user code"?
No, sorry.
(that was a easy one! :¬) )
Yours Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (3)
-
Andrew C. Smith
-
Kassen
-
Robert Poor