noteADSR sets the envelope for a specific note that has just been triggered. Using this method modifies the envelope of whichever audiovoice is being used to play the desired note. The envelope should be reset before noteRelease is called in order to prevent the modified envelope from being used on other notes.
Syntax
noteADSR([note], [attackTime], [decayTime], [susRatio], [releaseTime])
Parameters
Midi note on which ADSR should be set.
Time (in seconds before envelope reaches Attack Level
Time (in seconds) before envelope reaches Decay/Sustain Level
Ratio between attackLevel and releaseLevel, on a scale from 0 to 1, where 1.0 = attackLevel, 0.0 = releaseLevel. The susRatio determines the decayLevel and the level at which the sustain portion of the envelope will sustain. For example, if attackLevel is 0.4, releaseLevel is 0, and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is increased to 1.0 (using setRange
), then decayLevel would increase proportionally, to become 0.5.
Time in seconds from now (defaults to 0)