EnvGen:
Filter:
Classes | UGens > Envelopes

EnvGen : UGen : AbstractFunction : Object

Envelope generator
Source: EnvGen.sc

Description

Plays back break point envelopes. The envelopes are instances of the Env class. The envelope and the arguments for levelScale, levelBias, and timeScale are polled when the EnvGen is triggered, and at the start of a new envelope segment. All values remain constant for the duration of each segment.

Class Methods

EnvGen.ar(envelope, gate: 1.0, levelScale: 1.0, levelBias: 0.0, timeScale: 1.0, doneAction: 0)

EnvGen.kr(envelope, gate: 1.0, levelScale: 1.0, levelBias: 0.0, timeScale: 1.0, doneAction: 0)

Arguments:

envelope

An Env instance, or an Array of Controls. (See Control and the example below for how to use this.)

The envelope is polled when the EnvGen is triggered, and at the start of a new envelope segment. The Env inputs can be other UGens.

gate

This triggers the envelope and holds it open while > 0. If the Env is fixed-length (e.g. Env.linen, Env.perc), the gate argument is used as a simple trigger. If it is an sustaining envelope (e.g. Env.adsr, Env.asr), the envelope is held open until the gate becomes 0, at which point is released.

If gate < 0, force release with time -1.0 - gate. See Forced release below.

levelScale

The levels of the breakpoints are multiplied by this value. This value can be modulated, but is only sampled at the start of a new envelope segment.

levelBias

This value is added as an offset to the levels of the breakpoints. This value can be modulated, but is only sampled at the start of a new envelope segment.

timeScale

The durations of the segments are multiplied by this value. This value can be modulated, but is only sampled at the start of a new envelope segment.

doneAction

An integer representing an action to be executed when the env is finished playing. This can be used to free the enclosing synth, etc. See Done for more detail.

Discussion:

NOTE: The actual minimum duration of a segment is not zero, but one sample step for audio rate and one block for control rate. This may result in asynchronicity when in two envelopes of different number of levels, the envelope times add up to the same total duration. Similarly, when modulating times, the new time is only updated at the end of the current segment - this may lead to asynchronicity of two envelopes with modulated times.

Inherited class methods

Instance Methods

Inherited instance methods

Undocumented instance methods

.canFreeSynth

From extension in /usr/local/share/SuperCollider/SCClassLibrary/Common/Audio/canFreeSynth.sc

Examples

Specifying an envelope for each new synth

Forced release

If the gate of an EnvGen is set to -1 or below, then the envelope will cutoff immediately. The time for it to cutoff is the amount less than -1, with -1 being as fast as possible, -1.5 being a cutoff in 0.5 seconds, etc. The cutoff shape and final value are read from the Env's last node.

If the synthDef has an arg named "gate", the convenience method of Node can be used: node.release(releaseTime)

Forced release ignores multi-node release stages, always performing a one-node release, reading curve and end value from the Env's last node, and overwriting its duration.

Fast triggering tests

Modulating the levelScale

More examples

For more information about the control bus mapping used in the line a = Synth(\sine, [freq: f.asMap]);, see Node: -map and Bus: -asMap.