Tone.ScaledEnvelope
↳ EXTENDS Tone.EnvelopeTone.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 ( [DEFAULTS
EXAMPLE
Members
.max
↝ number #The envelope’s max output value. In other words, the value at the peak of the attack portion of the envelope.
.context
↝ Tone.Context READONLY #Get the audio context belonging to this instance.
.releaseCurve
↝ String or Array #The shape of the release. See the attack curve types.
EXAMPLE
.sustain
↝ NormalRange #The sustain value is the value which the envelope rests at after triggerAttack is called, but before triggerRelease is invoked.
.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.
.value
↝ Number READONLY #Read the current value of the envelope. Useful for syncronizing visual output to the 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
EXAMPLE
.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.
.release
↝ Time #After triggerRelease is called, the envelope’s value will fall to it’s miminum value over the duration of the release time.
Methods
.disconnect ( )
#Either the output index to disconnect if the output is an array, or the node to disconnect from.
this
disconnect the output
.toMaster ( )
#this
Connect ‘this’ to the master output. Shorthand for this.connect(Tone.Master)
EXAMPLE
.triggerAttackRelease ( )
#The duration of the sustain.
When the attack should be triggered.
The velocity of the envelope.
this
triggerAttackRelease is shorthand for triggerAttack, then waiting some duration, then triggerRelease.
EXAMPLE
.cancel ( )
#this
Cancels all scheduled envelope changes after the given time.
.triggerRelease ( )
#When the release portion of the envelope should start.
this
Triggers the release of the envelope.
EXAMPLE
.getValueAtTime ( )
#Get the scheduled value at the given time. This will return the unconverted (raw) value.
.triggerAttack ( )
#When the attack should start.
The velocity of the envelope scales the vales. number between 0-1
this
Trigger the attack/decay portion of the ADSR envelope.