SuperCollider CLASSES

# InterplEnv

envelope specification
Source: /usr/local/share/SuperCollider/SCClassLibrary/Common/Audio/InterplEnv.sc
Inherits from: Object

## Description

An InterplEnv is a specification for a segmented envelope. InterplEnvs can be used both server-side, by an IEnvGen within a SynthDef, and clientside, with methods such as at. An InterplEnv can have any number of segments. An InterplEnv can have several shapes for its segments.

NOTE: InterplEnv is now replaced by Env, and will be removed in the future. Env supports all functionality of InterplEnv

### Differences between InterplEnv and Env

InterplEnvs do not have release or loop nodes. They are of a fixed duration. Mostly, it is meant to be used with IEnvGen, where 'times' are actually an index into the envelope shape.

## Class Methods

### *new (levels: [ 0, 1, 0 ], times: [ 1, 1 ], curve: 'lin', offset: 0)

Create a new envelope specification.

#### Arguments:

levels

an array of levels. The first level is the initial value of the envelope.

times

an array of durations of segments in seconds. There should be one fewer duration than there are levels.

curve

a Symbol, Float, or an Array of those. Determines the shape of the envelope segments.

The possible values are:
 \step flat segments \linear \lin linear segments, the default \exponential \exp natural exponential growth and decay. In this case, the levels must all be nonzero and the have the same sign. \sine \sin sinusoidal S shaped segments. \welch \wel sinusoidal segments shaped like the sides of a Welch window. \squared \sqr squared segment \cubed \cub cubed segment a Float a curvature value for all segments. 0 means linear, positive and negative numbers curve the segment up and down. an Array of symbols or floats curvature values for each segment.

offset

used to offset an envelope into negative starttimes.

Creates a new envelope specification with numSegments and numChannels for filling in later.

#### Discussion:

This can be useful when passing Env parameters as args to a Synth. Note that the maximum number of segments is fixed and cannot be changed once embedded in a SynthDef. Trying to set an Env with more segments than then this may result in other args being unexpectedly set.

(
SynthDef(\help_Env_newClear, { |out = 0, gate = 1|
var env, envctl;
// make an empty 4 segment envelope
env = Env.newClear(4);
// create a control argument array
envctl = \env.kr(env.asArray);
Out.ar(out, SinOsc.ar(EnvGen.kr(envctl, gate), 0) * -12.dbamp);
)

Synth(\help_Env_newClear, [\env, Env([700,900,900,800], [1,1,1], \exp)]); // 3 segments

// reset then play again:
Synth(\help_Env_newClear, [ \env, Env({ rrand(60, 70).midicps } ! 4, [1,1,1], \exp)]);

// the same written as an event:
(instrument: \help_Env_newClear, env: Env({ rrand(60, 70).midicps } ! 4, [1,1,1], \exp)).play;

## Instance Methods

Plot this envelope's shape in a window.

#### Arguments:

 size The size of the plot. bounds The window bounds (a Rect). minval maxval parent

### -asArray

From superclass: Object

Converts the InterplEnv to an Array in a specially ordered format. This allows for InterplEnv parameters to be settable arguments in a SynthDef.

### Client-side Access and Stream Support

InterplEnv([0, 1, 0.707], [0.2, 1.3], [\lin, \sin]).at(0.5);