[chuck-users] Get the value of an Envelope

Andrew C. Smith acsmith at willamette.edu
Tue Jan 20 15:33:58 EST 2009


I've got some flawed code here, and that's because I'm stuck.  I want
to dynamically change Gen17's coefficients using an Envelope to get a
smooth sample-rate transition, but I can't figure out how to use the
last value from an Envelope and put it into the array to assign to
cheb.coefs.  How would I do this?  Would I need a sample rate for()
control?  Thanks.

Andrew

SinOsc drive => Gen17 cheb => dac;
[1., 0.5, 0.25, 0.125, 0.06] @=> float coefs[];
0.2 => cheb.gain;

while(true)
{
    Std.rand2(0, 4) => int coef_changed;
    Std.rand2f(0., 0.99) => float dest;

    coefs => cheb.coefs;
    Envelope change => coefs[coef_changed];

    change.target(dest);
    change.duration(50::ms);

    50::ms => now;
}


More information about the chuck-users mailing list