Tone.FrequencyEnvelope
↳ EXTENDS Tone.EnvelopeTone.FrequencyEnvelope is a Tone.ScaledEnvelope, but instead of min and max it’s got a baseFrequency and octaves parameter.
CONSTRUCTOR
new Tone.FrequencyEnvelope ( [DEFAULTS
EXAMPLE
var env = new Tone.FrequencyEnvelope({
"attack" : 0.2,
"baseFrequency" : "C2",
"octaves" : 4
});
scaledEnv.connect(oscillator.frequency);Members
.octaves
↝ Positive #The number of octaves above the baseFrequency that the envelope will scale to.
.baseFrequency
↝ Frequency #The envelope’s mininum output value. This is the value which it starts at.
.release
↝ Time #After triggerRelease is called, the envelope’s value will fall to it’s miminum value over the duration of the release time.
.releaseCurve
↝ string #The slope of the Release. Either “linear” or “exponential”.
EXAMPLE
env.releaseCurve = "linear";.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 #The slope of the attack. Either “linear” or “exponential”.
EXAMPLE
env.attackCurve = "linear";.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.
Methods
.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.
EXAMPLE
//trigger the attack 0.5 seconds from now with a velocity of 0.2
env.triggerAttack("+0.5", 0.2);.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
//trigger the attack and then the release after 0.6 seconds.
env.triggerAttackRelease(0.6);.triggerRelease ( )
#When the release portion of the envelope should start.
this
Triggers the release of the envelope.
EXAMPLE
//trigger release immediately
env.triggerRelease();