[chuck-users] control envelopes

Atte André Jensen atte.jensen at gmail.com
Fri Nov 24 06:13:25 EST 2006


Hi

I played a bit with the new LPF ugen. Thanks alot for adding this, it's 
really, really great!

Working with this made me think about how to control a filter over time. 
Supposed I want a really simple, classic sound of a SawOsc ran through a 
LPF controlled by a (dare I say it) envelope. I have an instrument like 
this:

     fun static void moog_bass(float note, float dynamic, dur length){
         Event off;
         spork ~ moog_bass(note, dynamic, off);
         length => now;
         off.broadcast();
         .2::second => now;
     }

     fun static void moog_bass(float note, float dynamic, Event off){
         .13 => float volume;
         //0 => volume;
         SawOsc osc => LPF f => dac;

         Std.mtof(note) => osc.freq;

         1 => f.Q;
         400 => f.freq;

         Mixer.bass * volume => f.gain;

         while(f.freq() > 80){
             f.freq() * .9 => f.freq;
             10::ms => now;
         }

         off => now;

         while(f.gain() > .000001){
             f.gain() * .99 => f.gain;
             .1::ms => now;
         }
     }

This instrument works with both midi (where we don't know the length 
before noteoff) and from code (where I prefer to use a length). Only 
problem is that if the length is too short, the off-event is broadcast 
before the first while is finished. This means that the off-event is 
never received, which in turn makes the instrument click. Any ideas how 
to solve this?

I still find myself wishing for ADSR's to be able to control stuff, but 
that won't happen, right?

Another related situation: Supposed I want to modulate both panning, 
volume and filter by different predetermined "curves"s. I can't get my 
head around how that is done nicely. A multi breakpoint envelope that 
could controll stuff (like csounds expseg and linseg) would be really 
great in some situations, since they are so easy to setup and experiment 
with the different timings/levels. But how could something like this be 
solved with chuck?

-- 
peace, love & harmony
Atte

http://www.atte.dk      | quintet:      http://www.anagrammer.dk
                         | compositions: http://www.atte.dk/compositions


More information about the chuck-users mailing list