Module adsr

Source
Expand description

§Attack, Decay, Sustain, Release generator

§Acronyms used:

  • ADSR: Attack Decay Sustain Release generator
  • LUT: Look Up Table
  • DDS: Direct Digital Synthesis

ADSRs are a standard component of most analog synthesizers, used to dynamically modulate various parameters of synthesizers, most commonly loudness, timbre, or pitch.

This ADSR simulates the RC curves typically found in analog ADSRs, where the attack curve is a truncated up-going convex RC curve, and the decay and release curves are down-going concave RC curves.

This ADSR has four variable input parameters:

  • Attack time
  • Decay time
  • Sustain level
  • Release time

This ADSR responds to two types of time based events:

  • Gate On events initiate an attack phase
  • Gate Off events initiate a release phase

This ADSR has a single output:

  • The current sample of the ADSR waveform in the range [0.0, 1.0].

A Phase-Accumulator and Look-Up-Table (LUT) approach is used. This is known as “Direct Digital Synthesis”, or DDS.

LUTs are used to store the Attack and Decay curves for the ADSRs. These curves simulate the typical resistor/capacitor time constant curves used in analog ADSRs.

Structs§

Adsr
An ADSR envelope generator is represented here
SustainLevel
A sustain level in the range [0.0, 1.0] is represented here
TimePeriod
A time period in seconds is represented here

Enums§

Input
ADSR input types are represented here
State
ADSR states are represented here

Constants§

MAX_TIME_PERIOD_SEC
The maximum time period for an ADSR state period
MIN_TIME_PERIOD_SEC
The minimum time period for an ADSR state period