[chuck-users] Envelope.last()

Daniel Trueman dtrueman at Princeton.EDU
Sat Jan 13 13:22:08 EST 2007


thanks spencer. which of course leads to more questions...

by accident, i did this:

 >>>>>>>>>>>
Step stp => Envelope e => SinOsc s => dac;
220 => s.freq;

// set step value
1 => stp.next;
// set the current value of the envelope
s.freq() => e.value;
// set the target value of envelope
s.freq() * 2 => e.target;
// set time to reach target
10 => e.time;

while (20::ms => now){
	//nothing needed to do....
}
 >>>>>>>>>>>

and it works! so i gather there is some default parameter that gets  
set in a ugen when you chuck to it?

i'm curious in part because i'd like to write classes which can do  
this, for example:

someRandomControlSignal => MySillyControlFilter_class mscfc =>  
Envelope e => SinOsc s => dac;

etc....

is there a way to write classes which can be chucked to in this way?  
again, this can obviously be done other ways, but grasshopper is  
attempting to learn.

sorry if this is documented somewhere already!

dan


On Jan 13, 2007, at 11:19 AM, Spencer Salazar wrote:

> Hey Dan,
> You're on the right track with that code.  Envelope needs a source to
> work on, though--if there isn't a ugen inputting samples to it, it
> just envelopes a zero signal.  The Step ugen works nicely for this,
> as you can feed it an arbitrary sample value, and it will
> continuously feed this value through a patch.
>
> SinOsc s => dac;
> 220 => s.freq;
>
> Step stp => Envelope e => blackhole;
> // set step value
> s.freq() => stp.next;
> // set the current value of the envelope
> 1 => e.value;
> // set the target value of envelope
> 2 => e.target;
> // set time to reach target
> 10 => e.time;
>
> // activate
> e.keyOn();
>
> while (20::ms => now){
> 	e.last()  => s.freq;
> }
>
> A functionally equivalent but potentially clearer way of writing this
> would be:
>
> SinOsc s => dac;
> 220 => s.freq;
>
> Step stp => Envelope e => blackhole;
> // set step value
> 1 => stp.next;
> // set the current value of the envelope
> s.freq() => e.value;
> // set the target value of envelope
> s.freq() * 2 => e.target;
> // set time to reach target
> 10 => e.time;
>
> // activate
> e.keyOn();
>
> while (20::ms => now){
> 	e.last()  => s.freq;
> }
>
> spencer
>
> On Jan 13, 2007, at 12:27 AM, dan trueman wrote:
>
>> can Envelope work like SinOsc to control ugen parameters? meaning,
>> something like this, hacked from the lovely ChucK manual blackhole
>> example:
>>
>> SinOsc s => dac;
>> Envelope e => blackhole;
>> 10. => lfo.time;
>> s.freq = 220.;
>> e.target(440.);
>>
>> while (20::ms => now){
>> 	e.last()  => s.freq;
>> }
>>
>> ?
>>
>> it doesn't work, and it seems that e.last() doesn't actually give
>> you anything. obviously there are other ways to do this, but i'm
>> trying to *learn* here!
>>
>> takk,
>> dan
>> _______________________________________________
>> chuck-users mailing list
>> chuck-users at lists.cs.princeton.edu
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20070113/98867e69/attachment.htm 


More information about the chuck-users mailing list