Examples
Syntax
p5.Envelope([attack], [decay], [sustain], [release])
Parameters
Fields
Time until envelope reaches attackLevel
Level once attack is complete.
Time until envelope reaches decayLevel.
Level after decay. The envelope will sustain here until it is released.
Duration of the release portion of the envelope.
Level at the end of the release.
Methods
Reset the envelope with a series of time/value pairs.
Set max (attackLevel) and min (releaseLevel) of envelope.
Set whether the envelope ramp is linear (default) or exponential. Exponential ramps can be useful because we perceive amplitude and frequency logarithmically.
Exponentially ramp to a value using the first two values from setADSR(attackTime, decayTime)
as time constants for simple exponential ramps. If the value is higher than current value, it uses attackTime, while a decrease uses decayTime.
Add a value to the p5.Oscillator's output amplitude, and return the oscillator. Calling this method again will override the initial add() with new values.
Multiply the p5.Envelope's output amplitude by a fixed value. Calling this method again will override the initial mult() with new values.
Scale this envelope's amplitude values to a given range, and return the envelope. Calling this method again will override the initial scale() with new values.