[chuck-users] chuck neophyte trying to remove clicks via Envelope patch

Robert Poor rdpoor at gmail.com
Tue Nov 24 20:12:17 EST 2009


Hi Ryan:

Your code looks about right, but you may need to leave time for the  
envelope to ramp down as well as up.  Try these as the last lines of  
your while (true) loop:

   e.keyOn();
   1000::ms => now;
   e.keyOff();
   1000::ms => now;

or, to make the wait time equal to the ramp time:

   e.keyOn();
   e.time()::second => now;
   e.keyOff();
   e.time()::second => now;

No, I haven't tried it.  Let me know...

- Rob

On 24 Nov 2009, at 17:02, Ryan Wieghard wrote:

> Hello chucKsters,
>
> I am trying to write a simple program that reassigns four sine  
> oscillator's pitch and volume at each iteration through a  
> while(true) loop.
> I decided i didn't want the clicks at the beginning of each note  
> attack, so I thought that I could remove them by just adding an  
> envelope
> to ramp up to the gain value for each event. After trying different  
> values for the Envelope time and rate, I can't seem to figure out
> how to remove the clicks. I apologize as this is probably something  
> obvious that I am blind to in my myopic state. My intuition is
> that if I increased the rate of the envelope the ramp up to 1 would  
> be smoother and then my speakers wouldn't click. However I am
> unsure how to adjust the rate as I don't know what range it would be  
> in.
>
> Sorry for my n00bishness
>
> Ryan.
>
> SinOsc s1 => Envelope e=> dac;
> SinOsc s2 => e => dac;
> SinOsc s3 => e=> dac;
> SinOsc s4 => e=> dac;
>
> //....
>
>  while( true )
>  {
>   .1 => float t =>e.time;
>
>   //reassign gain
>
>   Std.rand2f(0,1) => float g;
>   g => s1.gain;
>   g => s2.gain;
>   g => s3.gain;
>   g => s4.gain;
>
>   //reassign pitch
>
>   Std.mtof(instrumentSet1[Std.rand2(0,6)]) => s1.freq;
>   Std.mtof(instrumentSet1[Std.rand2(0,6)]) => s2.freq;
>   Std.mtof(instrumentSet1[Std.rand2(0,6)]) => s3.freq;
>   Std.mtof(instrumentSet1[Std.rand2(0,6)]) => s4.freq;
>
>   //Advance time by 1 samp
>   e.keyOn();
>   1000::ms => now;
>   e.keyOff();
> }
>
>
> -- 
> "Le savant n’étudie pas la nature parce que cela est utile ; il  
> l’étudie parce qu’il y prend plaisir et il y prend plaisir parce  
> qu’elle est belle." - Henri Poincaré
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

--:
Robert Poor
e:	robert.poor at nbt-ventures.com
p:	+1 617 818 5115
b:	http://blog.nbt-ventures.com
--:
This message and the information it contains are the proprietary and  
confidential property of NBT Ventures and may be privileged. If you  
are not the intended recipient, please do not read, copy, disclose or  
distribute its contents to any party, and notify the sender immediately.
--:



More information about the chuck-users mailing list