Skip to content

Envelope Follower

Tier: Primitives | ComponentType: 10 | Params: 2

Attack/release amplitude tracker that extracts the envelope of an audio signal.

Overview

EnvelopeFollower tracks the instantaneous amplitude of incoming audio using separate attack and release time constants. The input is rectified (absolute value), then smoothed by a one-pole filter with asymmetric coefficients — a short attack time responds quickly to transients, while a longer release time allows the envelope to decay smoothly.

Used as a building block for compressors, auto-wah, envelope-controlled filters, and any effect that needs to respond to signal dynamics. The component passes through the original audio unchanged and outputs the envelope value.

File Locations

Path
Header Sources/FolioDSP/include/FolioDSP/Primitives/EnvelopeFollower.h
Implementation Sources/FolioDSP/src/Primitives/EnvelopeFollower.cpp
Tests Tests/FolioDSPTests/EnvelopeFollowerTests.swift
Bridge Sources/FolioDSPBridge/src/FolioDSPBridge.mm (EnvelopeFollowerBridge)

Parameters

Index Name Description Min Max Default Min Default Max Default Unit
0 Attack Time to respond to rising signal levels 0.01 500.0 0.1 50.0 1.0 ms
1 Release Time to respond to falling signal levels 1.0 5000.0 10.0 1000.0 100.0 ms

Processing Algorithm

1. Coefficient Calculation

\[\alpha = e^{-1 / (\text{ms} \cdot f_s \cdot 0.001)}\]

Computed separately for attack (\(\alpha_a\)) and release (\(\alpha_r\)).

2. Rectification

\[r = |x|\]

3. Asymmetric Smoothing

\[e[n] = \begin{cases} e[n-1] + (1 - \alpha_a)(r - e[n-1]) & r > e[n-1] \\ e[n-1] + (1 - \alpha_r)(r - e[n-1]) & r \leq e[n-1] \end{cases}\]

Core Equations

\[\alpha = e^{-1/(\text{ms} \cdot f_s \cdot 0.001)}, \quad e \mathrel{+}= (1-\alpha)(|x| - e)\]

Snapshot Fields

Field Type Range Unit Description
Attack Float 0.01–500 ms Current attack time
Release Float 1–5000 ms Current release time
Envelope Float 0–1 Current envelope amplitude

Implementation Notes

  • Operates on rectified (absolute value) signal, not peak detection
  • Attack and release can be changed in real-time without discontinuity
  • Used as a building block inside Compressor (operating on dB-converted levels)
  • Passes through original audio unchanged; envelope is the return value

Equation Summary

e += (1-α)·(|x|-e)