arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
LowShelfFilter< T > Class Template Reference

Second-order low-shelf filter (BiQuad DF2). Boosts or cuts frequencies below the shelf frequency by the specified gain (in dB) while leaving higher frequencies unchanged. Commonly used in tone controls and equalization. Coefficients are derived from the Audio EQ Cookbook. More...

#include <Filter.h>

Inheritance diagram for LowShelfFilter< T >:
BiQuadDF2< T > Filter< T >

Public Member Functions

 LowShelfFilter ()=default
 
 LowShelfFilter (float frequency, float sampleRate, float gain, float slope=1.0f)
 
void begin (float frequency, float sampleRate, float gain, float slope=1.0f)
 
process (T value) override
 Processes the input value and returns the filtered output value.
 
void reset () override
 

Protected Attributes

a_1 = 0
 
a_2 = 0
 
b_0 = 0
 
b_1 = 0
 
b_2 = 0
 
w_0 = 0
 
w_1 = 0
 

Detailed Description

template<typename T = float>
class audio_tools::LowShelfFilter< T >

Second-order low-shelf filter (BiQuad DF2). Boosts or cuts frequencies below the shelf frequency by the specified gain (in dB) while leaving higher frequencies unchanged. Commonly used in tone controls and equalization. Coefficients are derived from the Audio EQ Cookbook.

Parameters
frequencyshelf transition frequency in Hz
sampleRatesample rate in Hz
gainboost/cut in dB (positive = boost, negative = cut)
slopeshelf slope (default 1.0; values < 1.0 give a gentler slope)
Author
pschatzmann
Template Parameters
Tsample type (use float or double). NOTE: unlike the other filters here, LowShelfFilterDF1 is NOT a reliable fix for bounded fixed-point types like q1_14_t: shelf coefficients scale with the linear gain factor 10^(gain_dB/40) and can exceed a bounded type's range even at modest gain settings, independent of DF1 vs DF2 – this is a coefficient headroom limitation, not the DF2 state-headroom issue DF1 solves for the other filter types. begin() logs an error (LOGE) via checkCoeffRange() if this happens; check for that warning rather than assuming it works.

Constructor & Destructor Documentation

◆ LowShelfFilter() [1/2]

template<typename T = float>
LowShelfFilter ( )
default

◆ LowShelfFilter() [2/2]

template<typename T = float>
LowShelfFilter ( float  frequency,
float  sampleRate,
float  gain,
float  slope = 1.0f 
)
inline

Member Function Documentation

◆ begin()

template<typename T = float>
void begin ( float  frequency,
float  sampleRate,
float  gain,
float  slope = 1.0f 
)
inline

◆ process()

template<typename T = float>
T process ( in)
inlineoverridevirtualinherited

Processes the input value and returns the filtered output value.

Implements Filter< T >.

◆ reset()

template<typename T = float>
void reset ( )
inlineoverridevirtualinherited

Clears the internal state (delay lines) without changing the coefficients. Call after reconfiguring filter parameters via begin() to avoid transients from stale state.

Reimplemented from Filter< T >.

Member Data Documentation

◆ a_1

template<typename T = float>
T a_1 = 0
protectedinherited

◆ a_2

template<typename T = float>
T a_2 = 0
protectedinherited

◆ b_0

template<typename T = float>
T b_0 = 0
protectedinherited

◆ b_1

template<typename T = float>
T b_1 = 0
protectedinherited

◆ b_2

template<typename T = float>
T b_2 = 0
protectedinherited

◆ w_0

template<typename T = float>
T w_0 = 0
protectedinherited

◆ w_1

template<typename T = float>
T w_1 = 0
protectedinherited

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