concept ADSR in category chuck

This is an excerpt from Manning's book Programming for Musicians and Digital Artists: Creating music with ChucK.
SinOsc vibrato => SawOsc osc => ADSR env => dac;But that won’t exactly work yet, because you first need to tell your SawOsc to interpret the sine wave input as a frequency modulation. To do that you use the .sync() method
, as shown in listing 6.5. And you need to set the frequency of your vibrato to something reasonable, like 6 Hz, using the .freq() method
. You can set all envelope parameters at once
, define a scale in an array
, and then play up that scale using a for loop
, setting the pitch of the violin
and playing each note using the ADSR. Finally, you increase the vibrato and play the last note longer
.
You can also use an ADSR to let your noise pluck into the string, which means you don’t have to turn it on and off explicitly. Once you’ve configured the attack, decay, sustain, and release parameters, you can use ADSR’s .keyOn method to accomplish your plucking. All of this is shown in figure 6.5 and the following listing.
, as shown in
. You can set all envelope parameters at once
, define a scale in an array
, and then play up that scale using a
, setting the pitch of the violin
and playing each note using the
.