given...
Envelope e
e.last() should return the current value generated. For Envelope class, it
ought to be between 0-1 although for something like SinOsc, values range
between -1 and 1.
You could do
e.last() * maxValue => float currentValue;
It's still a little hairy, but a lot less logic than what you're doing.
Also, in some circumstances you won't need the other shred.
-Mike
http://michaelclemow.com
http://semiotech.org
On Fri, Jul 13, 2012 at 2:57 PM, Jordan Orelli
there's no way to use this to ramp an arbitrary variable, like the frequency of a SinOsc, for example, is there? Cause I do stuff like this and find it kinda annoying:
SinOsc s => dac; 110 => float initial => s.freq;
fun void ramp() { 880 => float final; 1::ms => dur res; 500::ms => dur width; (final - initial) / (width / res) => float delta; now => time start; while(now < start + width) { res => now; s.freq() + delta => s.freq; } } spork ~ ramp();
1::second => now;
On Friday, July 13, 2012 at 2:43 PM, Kassen wrote:
On 13 July 2012 20:17, George Locke
wrote: sweet. guess i might've figured that one out on my own...
I understand the problem. Like this I have been using it for quite a while, but the need for the extra Step, unless it sets some sort of variable scaling, feels a bit counter-intuitive. I seem to remember it was Perry who first proposed that Envelope without any input should assume a input of 1. That would bring it more closely in line with similar objects in other systems.
There is also no problem with asking questions if you looked around a bit; the documentation is a bit scattered.
Happy ChucKing, 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