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::modules::Ladder Class Reference

Detailed Description

Definition at line 61 of file ladder.hpp.

#include <ladder.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_drive_su (float su)
 Set drive from normalized [0,1] signal unit.
 
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 (4-pole lowpass)
 
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
 
static constexpr float kMinDrive = 1.0f
 
static constexpr float kMaxDrive = 4.0f
 

Friends

struct LadderTestAccess
 

Member Function Documentation

◆ set_cutoff_su()

void sbl::dsp::modules::Ladder::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 81 of file ladder.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::modules::Ladder::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 100 of file ladder.hpp.

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

◆ set_drive_su()

void sbl::dsp::modules::Ladder::set_drive_su ( float  su)
inline

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

Parameters
suUnipolar [0,1] — linearly mapped to 1.0–4.0 drive

First call auto-initializes. Subsequent calls smooth via OnePole (20ms settling).

Definition at line 118 of file ladder.hpp.

References sbl::dsp::math::clamp01(), kMaxDrive, kMinDrive, and sbl::dsp::primitives::ParameterSmoother::reset().

◆ process()

void sbl::dsp::modules::Ladder::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 (4-pole lowpass)

Per-sample CriticalDamp/OnePole smoothing for cutoff, resonance, and drive. 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 142 of file ladder.hpp.

References sbl::dsp::math::exp_mod(), sbl::dsp::math::fast_tanhf(), kMaxFreqHz, kMinFreqHz, sbl::dsp::primitives::CriticalDamp::process(), sbl::dsp::primitives::ParameterSmoother::process(), and sbl::dsp::types::SAMPLE_RATE_F.

◆ reset()

void sbl::dsp::modules::Ladder::reset ( )
inline

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

Definition at line 207 of file ladder.hpp.

Friends And Related Symbol Documentation

◆ LadderTestAccess

friend struct LadderTestAccess
friend

Definition at line 215 of file ladder.hpp.

Member Data Documentation

◆ kMinFreqHz

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

Definition at line 66 of file ladder.hpp.

Referenced by process(), and set_cutoff_su().

◆ kMaxFreqHz

constexpr float sbl::dsp::modules::Ladder::kMaxFreqHz = 20000.0f
staticconstexpr

Definition at line 67 of file ladder.hpp.

Referenced by process().

◆ kCutoffOctaves

constexpr float sbl::dsp::modules::Ladder::kCutoffOctaves = 9.965784f
staticconstexpr

Definition at line 68 of file ladder.hpp.

Referenced by set_cutoff_su().

◆ kMinDrive

constexpr float sbl::dsp::modules::Ladder::kMinDrive = 1.0f
staticconstexpr

Definition at line 69 of file ladder.hpp.

Referenced by set_drive_su().

◆ kMaxDrive

constexpr float sbl::dsp::modules::Ladder::kMaxDrive = 4.0f
staticconstexpr

Definition at line 70 of file ladder.hpp.

Referenced by set_drive_su().


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