Gin
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
EnvelopeDetector Class Reference

Envelope follower for dynamics processing. More...

#include <gin_dynamics.h>

Public Types

enum  Mode { peak , ms , rms }
 Envelope detection modes. More...
 

Public Member Functions

 EnvelopeDetector ()=default
 
 ~EnvelopeDetector ()=default
 
void setSampleRate (double f)
 
void setParams (float attackS, float holdS, float releaseS, bool analogTC, Mode detect, bool logDetector)
 
void reset ()
 
float process (float input)
 

Protected Member Functions

void setAttackTime (float attackS)
 
void setHoldTime (float holdS)
 
void setReleaseTime (float releaseS)
 

Protected Attributes

double sampleRate = 44100.0
 
Mode mode = peak
 
float attackTime = 0.0f
 
float releaseTime = 0.0f
 
float envelope = 0.0
 
float holdTime = 0.0f
 
float holdRemaining = 0.0f
 
bool analogTC = false
 
bool logDetector = false
 

Detailed Description

Envelope follower for dynamics processing.

EnvelopeDetector tracks the amplitude envelope of an audio signal using configurable attack, hold, and release times. It supports multiple detection modes (peak, mean-square, RMS) and can use analog-style or digital time constants for natural or precise envelope following.

Key Features:

The envelope detector is the core component for gain reduction calculations in dynamics processors, providing a smooth representation of signal level over time.

See also
Dynamics, LevelTracker

Member Enumeration Documentation

◆ Mode

Envelope detection modes.

Determines how the input signal is converted to an envelope value:

  • peak: Track the absolute peak value
  • ms: Mean square (squared values, more sensitive to transients)
  • rms: Root mean square (true RMS level detection)
Enumerator
peak 

Peak detection (absolute value)

ms 

Mean square detection.

rms 

RMS (root mean square) detection.

Constructor & Destructor Documentation

◆ EnvelopeDetector()

EnvelopeDetector::EnvelopeDetector ( )
default

◆ ~EnvelopeDetector()

EnvelopeDetector::~EnvelopeDetector ( )
default

Member Function Documentation

◆ setSampleRate()

void EnvelopeDetector::setSampleRate ( double  f)

References sampleRate.

◆ setParams()

void EnvelopeDetector::setParams ( float  attackS,
float  holdS,
float  releaseS,
bool  analogTC,
Mode  detect,
bool  logDetector 
)

◆ reset()

void EnvelopeDetector::reset ( )

◆ process()

float EnvelopeDetector::process ( float  input)

◆ setAttackTime()

void EnvelopeDetector::setAttackTime ( float  attackS)
protected

◆ setHoldTime()

void EnvelopeDetector::setHoldTime ( float  holdS)
protected

◆ setReleaseTime()

void EnvelopeDetector::setReleaseTime ( float  releaseS)
protected

Member Data Documentation

◆ sampleRate

double EnvelopeDetector::sampleRate = 44100.0
protected

Referenced by setSampleRate().

◆ mode

Mode EnvelopeDetector::mode = peak
protected

◆ attackTime

float EnvelopeDetector::attackTime = 0.0f
protected

◆ releaseTime

float EnvelopeDetector::releaseTime = 0.0f
protected

◆ envelope

float EnvelopeDetector::envelope = 0.0
protected

◆ holdTime

float EnvelopeDetector::holdTime = 0.0f
protected

◆ holdRemaining

float EnvelopeDetector::holdRemaining = 0.0f
protected

◆ analogTC

bool EnvelopeDetector::analogTC = false
protected

◆ logDetector

bool EnvelopeDetector::logDetector = false
protected

The documentation for this class was generated from the following file: