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

Andrew C. Smith acsmith at willamette.edu
Wed Nov 25 09:11:42 EST 2009

Ryan (& Kas?),

You're just making swells, right? In that case, the only change should
be that you need to provide ramp-down time of e.duration() => now.
Also, make sure you scale the gain so that you keep the overall power
of the signal below 1.0.

One other thing, though, is that you don't need to reconnect the e =>
dac every time--just do this (with my personal favorite trick, the
array of SinOscs)

SinOsc s[4];
Envelope e => Gain g => dac;
1.0 / s.size() => g.gain; // scales gain to 0.25 for 4 SinOscs.

for (int i; i < s.size(); i++) {
  s[i] => e;

Makes it easy to change the gains, too, with

for (int i; i < s.size(); i ++) {
  Std.rand2f(0, 1) => s[i].gain;

and then once you expand from 4 to 100 SinOscs you'll only have to
change the one line of code.


2009/11/25 Kassen <signal.automatique at gmail.com>:
> Ryan,
> When we just want to change a volume (not necessarily start a "new note" as
> such) it may be better to instead use Envelope.target( float value ). This
> will ramp to the new value over the set .duration() without any need for
> further attention and -barring very short set durations- won't cause clicks.
> The "rate" your question refers to is set by Envelope.duration( dur ).
> Something like 50::ms would be my starting point in looking for a good
> value. You may well be able to get away with a shorter duration.
> Hope that helps,
> Kas.
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

More information about the chuck-users mailing list