Reference setADSR()

setADSR()

Set values like a traditional ADSR envelope .

Syntax

setADSR(attackTime, [decayTime], [susRatio], [releaseTime])

Parameters

attackTime
Number:

Time (in seconds before envelope reaches Attack Level

decayTime
Number:

Time (in seconds) before envelope reaches Decay/Sustain Level

susRatio
Number:

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.

releaseTime
Number:

Time in seconds from now (defaults to 0)

Notice any errors or typos? Please let us know. Please feel free to edit lib/addons/p5.sound.js and open a pull request!

Related References