Sound Byte Libs 0.5.1-121-g3358a44
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::dsp::widgets::Svf Class Reference

Detailed Description

Definition at line 51 of file svf.hpp.

#include <svf.hpp>

Public Member Functions

void set_cutoff_su (float su)
 Set cutoff frequency from normalized [0,1] signal unit.
 
void set_resonance_su (float su)
 Set resonance from normalized [0,1] signal unit.
 
void set_resonance_compensation (float k)
 Set resonance compensation strength.
 
void set_mode (FilterMode mode)
 Set filter output mode.
 
void process (float *buf, uint16_t frames, const float *cutoff_mod=nullptr, float mod_depth=0.0f)
 Process a block of audio samples in-place.
 
void reset ()
 Reset filter state (audio state only, not parameter smoothers)
 

Static Public Attributes

static constexpr float kMinFreqHz = 20.0f
 
static constexpr float kMaxFreqHz = 20000.0f
 
static constexpr float kCutoffOctaves = 9.965784f
 

Friends

struct SvfTestAccess
 

Member Function Documentation

◆ set_cutoff_su()

void sbl::dsp::widgets::Svf::set_cutoff_su ( float  su)
inline

Set cutoff frequency from normalized [0,1] signal unit.

Parameters
suUnipolar [0,1] — exponentially mapped to 20–20000 Hz

First call auto-initializes (no ramp from 0). Subsequent calls smooth via CriticalDamp (30ms settling, no overshoot).

Definition at line 69 of file svf.hpp.

References sbl::dsp::math::clamp01(), kCutoffOctaves, kMinFreqHz, sbl::dsp::primitives::CriticalDamp::reset(), and sbl::dsp::math::su_to_hz().

◆ set_resonance_su()

void sbl::dsp::widgets::Svf::set_resonance_su ( float  su)
inline

Set resonance from normalized [0,1] signal unit.

Parameters
suUnipolar [0,1] — 0 = flat, 1 = self-oscillation

First call auto-initializes. Subsequent calls smooth via CriticalDamp (20ms settling, no overshoot).

Definition at line 88 of file svf.hpp.

References sbl::dsp::math::clamp01(), and sbl::dsp::primitives::CriticalDamp::reset().

◆ set_resonance_compensation()

void sbl::dsp::widgets::Svf::set_resonance_compensation ( float  k)
inline

Set resonance compensation strength.

Controls how much the input signal is attenuated as resonance increases: gain = 1 / (1 + q * k). This prevents the resonant peak from clipping during filter sweeps.

k = 0 No compensation (default) k = 2 Gentle drop (~33% volume at full resonance) k = 4 Strong drop (~20% volume at full resonance)

Parameters
kCompensation amount (0.0 = off)

Definition at line 112 of file svf.hpp.

◆ set_mode()

void sbl::dsp::widgets::Svf::set_mode ( FilterMode  mode)
inline

Set filter output mode.

Definition at line 118 of file svf.hpp.

◆ process()

void sbl::dsp::widgets::Svf::process ( float *  buf,
uint16_t  frames,
const float *  cutoff_mod = nullptr,
float  mod_depth = 0.0f 
)
inline

Process a block of audio samples in-place.

ZDF SVF with per-sample CriticalDamp coefficient smoothing. When cutoff_mod is provided, exponential modulation is applied around the smoothed cutoff center per-sample.

Parameters
bufFloat audio buffer (modified in-place)
framesNumber of samples
cutoff_modCutoff modulation signal [-1,1] (nullptr = no modulation)
mod_depthModulation depth in octaves (e.g., 2.0 = ±2 octaves)

Definition at line 132 of file svf.hpp.

References sbl::dsp::widgets::BandPass, sbl::dsp::math::exp_mod(), sbl::dsp::math::fast_tan_pif(), sbl::dsp::widgets::HighPass, kMaxFreqHz, kMinFreqHz, sbl::dsp::widgets::LowPass, sbl::dsp::widgets::Notch, sbl::dsp::primitives::CriticalDamp::process(), and sbl::dsp::types::SAMPLE_RATE_F.

◆ reset()

void sbl::dsp::widgets::Svf::reset ( )
inline

Reset filter state (audio state only, not parameter smoothers)

Definition at line 186 of file svf.hpp.

Friends And Related Symbol Documentation

◆ SvfTestAccess

friend struct SvfTestAccess
friend

Definition at line 193 of file svf.hpp.

Member Data Documentation

◆ kMinFreqHz

constexpr float sbl::dsp::widgets::Svf::kMinFreqHz = 20.0f
staticconstexpr
Note
All public methods are ISR-safe — bounded computation, no I/O.

Definition at line 56 of file svf.hpp.

Referenced by process(), and set_cutoff_su().

◆ kMaxFreqHz

constexpr float sbl::dsp::widgets::Svf::kMaxFreqHz = 20000.0f
staticconstexpr

Definition at line 57 of file svf.hpp.

Referenced by process().

◆ kCutoffOctaves

constexpr float sbl::dsp::widgets::Svf::kCutoffOctaves = 9.965784f
staticconstexpr

Definition at line 58 of file svf.hpp.

Referenced by set_cutoff_su().


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