[chuck-users] More on what Envelope.time does.

Jukka Akkanen jakkanen at mac.com
Wed Sep 13 21:46:48 EDT 2006


> What I wanted is admittedly totally different from what it's  
> intended to do. I wanted a "free" interpolating glide. My plan was  
> to feed it a .target in Hz, set time to something dependant on BPM  
> and just feed it a new "target" every note, chuck env.last() to  
> osc.freq every few ms for some cheap thrills.

> So; the documentation is mistaken or the code has a problem....  
> Personally I suspect Envelope wasn't expected to have .target be  
> set to something along the lines of 500 so it might be cool to talk  
> about what it's supposed to do and how in ChucK. I'll submit the  
> bug to the official page for reference and use a rather elaborate  
> way of "manual" interpolation for now.

I am not sure what one is supposed to get out of env.last()...   
however, I was able to use Envelope with large target values, like this:

sinosc osc => dac;
Envelope env => blackhole;
240.0 => float BPM;
60.0 / BPM => float BeatSeconds;
0.0 => env.value;
while(true) {
     std.rand2f(200.0, 800.0) => env.target;
     std.fabs(env.target()-env.value()) / (BeatSeconds * second/ 
samp)  => env.rate;
     while(env.value() != env.target()) {
         env.value()  => osc.freq;
         5::ms => now;
     }
     BeatSeconds::second => now;
}

// -Jukka


More information about the chuck-users mailing list