Tone.ScaledEnvelope

↳ EXTENDS Tone.Envelope

Tone.ScaledEnvelop is an envelope which can be scaled to any range. It’s useful for applying an envelope to a frequency or any other non-NormalRange signal parameter.

CONSTRUCTOR

new Tone.ScaledEnvelope ( [
attack
] , [
decay
] , [
sustain
] , [
release
] )
attack

the attack time in seconds

optional
decay

the decay time in seconds

type: Time
optional
sustain

a percentage (0-1) of the full amplitude

type: number
optional
release

the release time in seconds

type: Time
optional

DEFAULTS

{
min : 0 ,
max : 1 ,
exponent : 1
}

EXAMPLE

var scaledEnv = new Tone.ScaledEnvelope({
 	"attack" : 0.2,
 	"min" : 200,
 	"max" : 2000
 });
 scaledEnv.connect(oscillator.frequency);

Members

.max

number #

The envelope’s max output value. In other words, the value at the peak of the attack portion of the envelope.

</>

.min

number #

The envelope’s min output value. This is the value which it starts at.

</>

.exponent

number #

The envelope’s exponent value.

</>
inherited from Tone.AudioNode

.numberOfOutputs

Number READONLY #

The number of outputs coming out of the AudioNode.

</>
inherited from Tone.AudioNode

.channelInterpretation

String READONLY #

channelInterpretation determines how individual channels will be treated when up-mixing and down-mixing connections to any inputs to the node. The default value is “speakers”.

</>
inherited from Tone.AudioNode

.context

Tone.Context READONLY #

Get the audio context belonging to this instance.

</>
inherited from Tone.AudioNode

.channelCount

Number READONLY #

channelCount is the number of channels used when up-mixing and down-mixing connections to any inputs to the node. The default value is 2 except for specific nodes where its value is specially determined.

</>
inherited from Tone.AudioNode

.channelCountMode

String READONLY #

channelCountMode determines how channels will be counted when up-mixing and down-mixing connections to any inputs to the node. The default value is “max”. This attribute has no effect for nodes with no inputs.

</>
inherited from Tone.AudioNode

.numberOfInputs

Number READONLY #

The number of inputs feeding into the AudioNode. For source nodes, this will be 0.

</>
inherited from Tone.Envelope

.value

Number READONLY #

Read the current value of the envelope. Useful for syncronizing visual output to the envelope.

</>
inherited from Tone.Envelope

.attackCurve

String or Array #

The shape of the attack. Can be any of these strings: <ul> <li>linear</li> <li>exponential</li> <li>sine</li> <li>cosine</li> <li>bounce</li> <li>ripple</li> <li>step</li> </ul> Can also be an array which describes the curve. Values in the array are evenly subdivided and linearly interpolated over the duration of the attack.

EXAMPLE

env.attackCurve = "linear";

EXAMPLE

//can also be an array
env.attackCurve = [0, 0.2, 0.3, 0.4, 1]
</>
inherited from Tone.Envelope

.decay

Time #

After the attack portion of the envelope, the value will fall over the duration of the decay time to it’s sustain value.

</>
inherited from Tone.Envelope

.decayCurve

String #

The shape of the decay either “linear” or “exponential”

EXAMPLE

env.decayCurve = "linear";
</>
inherited from Tone.Envelope

.release

Time #

After triggerRelease is called, the envelope’s value will fall to it’s miminum value over the duration of the release time.

</>
inherited from Tone.Envelope

.releaseCurve

String or Array #

The shape of the release. See the attack curve types.

EXAMPLE

env.releaseCurve = "linear";
</>
inherited from Tone.Envelope

.sustain

NormalRange #

The sustain value is the value which the envelope rests at after triggerAttack is called, but before triggerRelease is invoked.

</>
inherited from Tone.Envelope

.attack

Time #

When triggerAttack is called, the attack time is the amount of time it takes for the envelope to reach it’s maximum value.

</>

Methods

.dispose ( )

#
↪ returns Tone.ScaledEnvelope

this

clean up

</>
inherited from Tone.AudioNode

.chain ( )

#
nodes
↪ returns Tone.AudioNode

this

Connect the output of this node to the rest of the nodes in series.

EXAMPLE

//connect a node to an effect, panVol and then to the master output
 node.chain(effect, panVol, Tone.Master);
 
</>
inherited from Tone.AudioNode

.toMaster ( )

#
↪ returns Tone.AudioNode

this

Connect ‘this’ to the master output. Shorthand for this.connect(Tone.Master)

EXAMPLE

//connect an oscillator to the master output
var osc = new Tone.Oscillator().toMaster();
</>
inherited from Tone.AudioNode

.disconnect ( )

#
output

Either the output index to disconnect if the output is an array, or the node to disconnect from.

↪ returns Tone.AudioNode

this

disconnect the output

</>
inherited from Tone.AudioNode

.fan ( )

#
nodes
↪ returns Tone.AudioNode

this

connect the output of this node to the rest of the nodes in parallel.

</>
inherited from Tone.Envelope

.triggerRelease ( )

#
time

When the release portion of the envelope should start.

type: Time
default: now
↪ returns Tone.Envelope

this

Triggers the release of the envelope.

EXAMPLE

//trigger release immediately
 env.triggerRelease();
</>
inherited from Tone.Envelope

.getValueAtTime ( )

#
time

The time in seconds.

type: Number
↪ returns Number

The scheduled value at the given time.

Get the scheduled value at the given time. This will return the unconverted (raw) value.

</>
inherited from Tone.Envelope

.triggerAttack ( )

#
time

When the attack should start.

type: Time
default: now
velocity

The velocity of the envelope scales the vales. number between 0-1

default: 1
↪ returns Tone.Envelope

this

Trigger the attack/decay portion of the ADSR envelope.

EXAMPLE

//trigger the attack 0.5 seconds from now with a velocity of 0.2
 env.triggerAttack("+0.5", 0.2);
</>
inherited from Tone.Envelope

.triggerAttackRelease ( )

#
duration

The duration of the sustain.

type: Time
time

When the attack should be triggered.

type: Time
default: now
velocity

The velocity of the envelope.

type: number
default: 1
↪ returns Tone.Envelope

this

triggerAttackRelease is shorthand for triggerAttack, then waiting some duration, then triggerRelease.

EXAMPLE

//trigger the attack and then the release after 0.6 seconds.
env.triggerAttackRelease(0.6);
</>
inherited from Tone.Envelope

.cancel ( )

#
after
type: Time
↪ returns Tone.Envelope

this

Cancels all scheduled envelope changes after the given time.

</>
docs generated Sep 15 2019