env
  1. config
  2. config.control
  3. config.subControl
  4. config.depth
  5. config.depthabs
  6. config.attack
  7. config.decay
  8. config.sustain
  9. config.release
  10. config.acurve
  11. config.dcurve
  12. config.rcurve
  13. config.fxi
  14. id

Configures an envelope. Can be called in sequence like pat.env(...).env(...) to set up multiple envelopes There are two ways to declare which control will be modulated:

  1. Explicitly put control in the config (e.g. env({ c: "lpf" }))
  2. If the control parameter is absent, the control immediately before the env call will be used (e.g. s("saw").lpf(500).env({ a: 1 }) to modulate lpf)

Modulators can be referred to by id so that they can be updated later e.g. inside a sometimes. See example below.

s("saw").note("F1").lpf(500).env({ a: 1 })
s("saw").env({ d: 1 }).note("F1")
  .lpq(4).lpf(50)
  .env({ a: 0.1, d: 1, ac: 0.8, dc: 0.3, depth: 50 })
s("saw").lpf(500).diode(0.3)
  .env({ c: "lpf", a: 0.5, d: 0.5 })
s("pulse").lpf(500).env({ a: 1 })
  .env({ c: "s", a: 1 })
  .diode(0.3)
  .sometimes(x => x.env({ a: "0.5" }, 1)) // envelope #1 (0-indexed)
s("pulse").lpf(500).env({ a: 1 }, 'lpf_mod')
  .env({ c: "s", a: 1 })
  .diode(0.3)
  .sometimes(x => x.env({ a: "0.5" }, 'lpf_mod'))
parametertype
config
  • object
Envelope configuration.
config.control
Node to modulate. Aliases: c
config.subControl
Sub-control name to append to the control key. Aliases: sc
config.depth
Relative modulation depth. Aliases: dep, dr
config.depthabs
Absolute modulation depth. Aliases: da
config.attack
Time to reach depth. Aliases: att, a
config.decay
Time to reach sustain. Aliases: dec, d
config.sustain
Sustain depth. Aliases: sus, s
config.release
Time to return to nominal value. Aliases: rel, r
config.acurve
Snappiness of attack curve (-1 = relaxed, 1 = snappy). Aliases: ac
config.dcurve
Snappiness of decay curve (-1 = relaxed, 1 = snappy). Aliases: dc
config.rcurve
Snappiness of release curve (-1 = relaxed, 1 = snappy). Aliases: rc
config.fxi
FX index to target
id
ID to use for this modulator