DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
EnvelopeFollower.h File Reference

Peak/RMS envelope follower with asymmetric attack/release. More...

#include "../Core/AudioBuffer.h"
#include "../Core/AudioSpec.h"
#include "../Core/DspMath.h"
#include <algorithm>
#include <array>
#include <atomic>
#include <cmath>
#include <cstddef>
Include dependency graph for EnvelopeFollower.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  dspark::EnvelopeFollower< T, MaxChannels >
 Attack/release envelope detector (Peak or RMS). More...
 

Namespaces

namespace  dspark
 Main namespace for the DSPark framework.
 

Detailed Description

Peak/RMS envelope follower with asymmetric attack/release.

The detector every dynamics processor carries internally, exposed as a public building block: a one-pole follower with independent attack and release time constants, in Peak mode (rectified signal) or RMS mode (the ballistics run on the squared signal and readouts return the square root, so the time constants act in the power domain - the standard detector convention). Use it as a sidechain detector, a modulation source (with ModulationRouter), or a meter.

Non-finite input samples: the poisoned channel restarts from zero at the next publish and measurement resumes immediately (attack-time recovery); the readouts never serve non-finite values.

Threading:

  • prepare(): setup thread (allocation-free; not concurrent with processing).
  • processBlock() / processSample() / reset(): audio thread (stream owner).
  • setAttack() / setRelease() / setMode(): any thread (relaxed atomics; non-finite values are ignored).
  • getEnvelope() / getEnvelopeMax() / getEnvelopeDb() and the parameter getters: any thread, lock-free.

Dependencies: AudioBuffer.h, AudioSpec.h, DspMath.h.

Definition in file EnvelopeFollower.h.