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::Shaper Class Reference

Detailed Description

Definition at line 46 of file shaper.hpp.

#include <shaper.hpp>

Public Member Functions

 Shaper ()=default
 
void set_depth_su (float su)
 Set fold depth from normalized [0,1] signal unit.
 
void set_bias_su (float su)
 Set asymmetric bias from normalized [0,1] signal unit.
 
void set_drive_su (float su)
 Set saturation drive from normalized [0,1] signal unit.
 
void set_mix_su (float su)
 Set dry/wet mix from normalized [0,1] signal unit.
 
void set_compensate (bool compensate)
 
void process (float *buf, uint16_t frames, const float *depth_mod=nullptr, float mod_depth=0.0f)
 
void reset ()
 Reset internal state (WavefoldAA history + oversampling)
 

Static Public Attributes

static constexpr float kMinDepth = 1.0f
 
static constexpr float kMaxDepth = 10.0f
 
static constexpr float kMinBias = -0.1f
 
static constexpr float kMaxBias = 0.1f
 
static constexpr float kMinDrive = 1.0f
 
static constexpr float kMaxDrive = 4.0f
 

Friends

struct ShaperTestAccess
 

Constructor & Destructor Documentation

◆ Shaper()

sbl::dsp::widgets::Shaper::Shaper ( )
default

Member Function Documentation

◆ set_depth_su()

void sbl::dsp::widgets::Shaper::set_depth_su ( float  su)
inline

Set fold depth from normalized [0,1] signal unit.

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

Depth uses ParameterInterpolator (per-sample linear ramp) inside process(), not exponential smoothing. This is correct for nonlinear parameters where the first-sample spike from exponential smoothers would cause audible clicks in the wavefolder.

Definition at line 71 of file shaper.hpp.

References kMaxDepth, and kMinDepth.

◆ set_bias_su()

void sbl::dsp::widgets::Shaper::set_bias_su ( float  su)
inline

Set asymmetric bias from normalized [0,1] signal unit.

Parameters
suUnipolar [0,1] — linearly mapped to -0.1–0.1

0.5 = no bias (symmetric, odd harmonics only). 0.0 = negative bias (-0.1), 1.0 = positive bias (+0.1). Uses ParameterInterpolator internally (same rationale as depth).

Definition at line 90 of file shaper.hpp.

References kMaxBias, and kMinBias.

◆ set_drive_su()

void sbl::dsp::widgets::Shaper::set_drive_su ( float  su)
inline

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

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

Smoothed via OnePole (20ms timbral settling).

Definition at line 107 of file shaper.hpp.

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

◆ set_mix_su()

void sbl::dsp::widgets::Shaper::set_mix_su ( float  su)
inline

Set dry/wet mix from normalized [0,1] signal unit.

Parameters
suUnipolar [0,1] — 0 = dry, 1 = full wet

Smoothed via OnePole (15ms gain settling).

Definition at line 126 of file shaper.hpp.

References sbl::dsp::primitives::ParameterSmoother::reset().

◆ set_compensate()

void sbl::dsp::widgets::Shaper::set_compensate ( bool  compensate)
inline

Output level compensation: when true (default), output level stays roughly constant as depth increases. When false, higher depth = more level into downstream.

Definition at line 141 of file shaper.hpp.

◆ process()

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

Process block in-place (mono). Per-sample ParameterInterpolator ramp for depth and bias. OnePole smoothing for drive and mix. When depth_mod is provided, additive depth modulation is applied per-sample on top of the ParameterInterpolator ramp.

Parameters
bufFloat audio buffer (modified in-place)
framesNumber of samples
depth_modDepth modulation signal [-1,1] (nullptr = no modulation)
mod_depthModulation range in fold-depth units (e.g., 3.0 = ±3)

Definition at line 155 of file shaper.hpp.

References sbl::dsp::primitives::ParameterInterpolator::next(), sbl::dsp::primitives::ParameterSmoother::process(), sbl::dsp::comp::WavefoldAA::process(), sbl::dsp::comp::WarmSaturator::process(), and sbl::dsp::primitives::ParameterSmoother::value().

◆ reset()

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

Reset internal state (WavefoldAA history + oversampling)

Definition at line 210 of file shaper.hpp.

References sbl::dsp::comp::WavefoldAA::reset().

Friends And Related Symbol Documentation

◆ ShaperTestAccess

friend struct ShaperTestAccess
friend

Definition at line 218 of file shaper.hpp.

Member Data Documentation

◆ kMinDepth

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

Definition at line 51 of file shaper.hpp.

Referenced by set_depth_su().

◆ kMaxDepth

constexpr float sbl::dsp::widgets::Shaper::kMaxDepth = 10.0f
staticconstexpr

Definition at line 52 of file shaper.hpp.

Referenced by set_depth_su().

◆ kMinBias

constexpr float sbl::dsp::widgets::Shaper::kMinBias = -0.1f
staticconstexpr

Definition at line 53 of file shaper.hpp.

Referenced by set_bias_su().

◆ kMaxBias

constexpr float sbl::dsp::widgets::Shaper::kMaxBias = 0.1f
staticconstexpr

Definition at line 54 of file shaper.hpp.

Referenced by set_bias_su().

◆ kMinDrive

constexpr float sbl::dsp::widgets::Shaper::kMinDrive = 1.0f
staticconstexpr

Definition at line 55 of file shaper.hpp.

Referenced by set_drive_su().

◆ kMaxDrive

constexpr float sbl::dsp::widgets::Shaper::kMaxDrive = 4.0f
staticconstexpr

Definition at line 56 of file shaper.hpp.

Referenced by set_drive_su().


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