Learn creative coding writing simple programs

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 :)

Tags: supercollider, env, envgen, rand, rrand

Code editor

You can make changes to the code below. Then
Reference
Below you can ask and answer questions related to this video. If your question is unrelated to the video, please post it at the Processing Forum as I'm unable to help with all of your programs and still have enough free time to eat and sleep :)
comments powered by Disqus