135. Sounds that end
By using Env and EnvGen we can produce synths that disappear after they are done playing. Compared to other programming languages, there is something very different in SuperCollider: you write one source code, but it actually produces two programs. One runs in the client side, known as the language, the other runs in the sound server. This is probably a strange concept :) Env is used in the language side to generate an envelope (like a curve that changes over time which can be used to control sound parameters). EnvGen is used in the sound server to produce changing values in real time, based on an Env. Env.linen() is a simple type of Env, good enough to get started. There are many other types of envelopes with different shapes and complexities.
In this episode we use envelopes to produce sounds that have a limited duration. By adding the option doneAction:2 to the EnvGen we tell SuperCollider that the synth should be removed once it's done playing. This is important to avoid having hundreds or thousands of zombie synths lying around. That would be scary :)