envelopes

Methods

(static) adsr()

Create an adsr envelope

Source:

(static) freqEnv(frequency, octaves, options)

A frequency envelope. Basically the setup to provide an adsr over a number of octaves.

Parameters:
Name Type Description
frequency Number

the initial frequency

octaves Number

(Optional) the number of octaves of the envelope (1 by default)

options Object

the same options as an ADSR envelope

Source:
See:
  • adsr
Example
conn(saw(1200), lowpass(freqEnv(440, 2, { release: 1 })))

(static) perc(attack, decay, options) → {AudioNode}

Create an attack-decay envelope with fixed duration. It's composed by a linear attack ramp and an exponential decay. This envelope doesn't have release, so it stops after the duration (attack + decay).

Parameters:
Name Type Description
attack Number

(Optional) the attack time, defaults to 0.01

decay Number

(Optional) the decay time, defaults to 0.2

options Object

(Optional) an options with a context

Source:
Returns:

the signal envelope

Type
AudioNode
Example
conn(sine(1000), perc(0.01, 0.5))
conn(sine(1000), perc(null, 1)) // default attack
conn(sine(1000), perc()) // default values