Envelopes

To get started boot the server.

It will be useful to bring up a plot tree so we can monitor what synthdefs are still on the server.

Env and EnvGen

The classes Env and EnvGen are the two pieces of SuperCollider syntax we need to create amplitude envelopes. The class Env works by taking in a series of amplitude points as an array in the 0th argument and specifying the time between those points in seconds as a second array.

The class Env defines an envelope on the client-side (i.e., sclang). To send the envelope to the server to process, we use the UGen EnvGen. Note here that we are using .kr instead of .ar. .kr is generally used to modulate a sound. It is less expensive but also has less resolution. We could very well use .ar but we will not hear any audible difference.

The class EnvGen also has an option for what is called a Done action. This specifies what should happen to the Synth once the envelope has completed. Generally, when we are done with an envelope, we want the synth to free itself because no more sound should be produced. To do so, we use the integer 2 to specify this action.

Linen

A common pattern in envelopes is to create what is called ASR (attack, sustain, release) shape to a sound. Here the sound ramps up to a particular amplitude, sustains at the level, and then releases back down to zero. The class method .linen from Env can be used to create an ASR envelope.

Gate

EnvGen has an optional parameter for a gate which can control when to trigger the start of the envelope. When the gate is set to 1, the envelope will be triggered. For fixed-time envelopes like .linen or .perc, the gate acts as a simple trigger. To retrigger the envelope, set the gate to zero and then back to 1.

Arpeggio Pattern

Here we are creating a randomized arpeggio pattern where we use Impulse to change certain aspects of the code.

Create an audio bus to connect the synth to the reverb. Instantiate those two synths using the bus.

Free resources and stop pattern.

ADSR

The previous envelopes we have seen have been fixed-time envelopes. But many times, we want an envelope to sustain indefinitely until we are ready to cut it off. This is especially true with keyboard synthesizers where we press a key and then want to wait until we release the key to stop the note.

The most common pattern for this is an ADSR (attack, decay, sustain, release) envelope. Sustain-time envelopes like .adsr are triggered and released using a gate. When the gate is 1, the envelope is triggered. When the gate is set to 0, the envelope is released.