Attack Decay Sustain Release

This lecture covers the ADSR (attack-decay-sustain-release) envelope, implemented using state machines.

Table of contents

  1. What you’ll learn in this lecture
  2. What you’ll make in this lecture
  3. Code examples
  4. Recommended parts

Lecture 14: ADSR

What you’ll learn in this lecture

  • The ADSR (attack-decay-sustain-release) envelope
  • Implementation using state machines and line segments
  • Class-based implementations

What you’ll make in this lecture

  • ADSR envelope generator controlled by a button
  • ADSR with linear or exponential segments

Code examples

Find the code examples here

adsr: Template for implementing the ADSR based on the Ramp class covered Lecture 12, which generates individua line segments.

adsr-class: Container code for implementing the ADSR in its own self-contained class. The class definition is given in ADSR.h and your task is to fill in the code in ADSR.cpp. After that, two ADSR objects can be used in render.cpp to control amplitude and filter.

Running the examples in this course assumes that you have a Bela Starter Kit or Bela Mini Starter Kit.