DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::Smoothers::ExponentialSmoother Class Reference

Exponential (multiplicative) smoother for natural, perceptual responses. More...

#include <Smoothers.h>

Public Member Functions

void reset (double sampleRate, float timeConstantMilliseconds, float initialValue=1.0f) noexcept
 
void setTargetValue (float newTarget) noexcept
 
float getNextValue () noexcept
 
float getCurrentValue () const noexcept
 
float getTargetValue () const noexcept
 
void setCurrentAndTargetValue (float value) noexcept
 
bool isSmoothing () const noexcept
 
void skip () noexcept
 

Static Public Attributes

static constexpr float epsilon = 1e-10f
 

Detailed Description

Exponential (multiplicative) smoother for natural, perceptual responses.

Use for: Filter cutoffs, frequencies, volumes in dB.

Internal state and coefficient are double precision (the public API stays float). In float the per-step coefficient rounds by up to 1e-7, a large fraction of log(ratio)/steps for long ramps: a delay time smoothed from 96000 to 91200 samples over 200 ms (Delay's default smoother) ended with a 19.8-sample jump instead of its 0.5-sample step.

Warning
Geometric smoothing is only defined for same-sign transitions. If the new target's sign differs from the current value (ratio <= 0), or the current value is zero, the smoother snaps instantly to the target: an audible step. Keep this class for strictly-positive parameters (Hz, linear gain); use LinearSmoother or OnePoleSmoother for bipolar values (pan, offsets).

Definition at line 110 of file Smoothers.h.

Member Function Documentation

◆ getCurrentValue()

float dspark::Smoothers::ExponentialSmoother::getCurrentValue ( ) const
inlinenoexcept

Definition at line 119 of file Smoothers.h.

◆ getNextValue()

float dspark::Smoothers::ExponentialSmoother::getNextValue ( )
inlinenoexcept

Definition at line 500 of file Smoothers.h.

◆ getTargetValue()

float dspark::Smoothers::ExponentialSmoother::getTargetValue ( ) const
inlinenoexcept

Definition at line 120 of file Smoothers.h.

◆ isSmoothing()

bool dspark::Smoothers::ExponentialSmoother::isSmoothing ( ) const
inlinenoexcept

Definition at line 517 of file Smoothers.h.

◆ reset()

void dspark::Smoothers::ExponentialSmoother::reset ( double  sampleRate,
float  timeConstantMilliseconds,
float  initialValue = 1.0f 
)
inlinenoexcept

Definition at line 461 of file Smoothers.h.

◆ setCurrentAndTargetValue()

void dspark::Smoothers::ExponentialSmoother::setCurrentAndTargetValue ( float  value)
inlinenoexcept

Definition at line 509 of file Smoothers.h.

◆ setTargetValue()

void dspark::Smoothers::ExponentialSmoother::setTargetValue ( float  newTarget)
inlinenoexcept

Definition at line 470 of file Smoothers.h.

◆ skip()

void dspark::Smoothers::ExponentialSmoother::skip ( )
inlinenoexcept

Definition at line 522 of file Smoothers.h.

Member Data Documentation

◆ epsilon

constexpr float dspark::Smoothers::ExponentialSmoother::epsilon = 1e-10f
staticconstexpr

Definition at line 113 of file Smoothers.h.


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