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::primitives::ParameterSmoother Class Reference

Detailed Description

Definition at line 24 of file parameter_smoother.hpp.

#include <parameter_smoother.hpp>

Public Member Functions

void set_coefficient (float a)
 Set coefficient directly.
 
void set_time_ms (float ms, float rate_hz)
 Compute coefficient from settling time in milliseconds.
 
float process (float target)
 Process one sample toward target.
 
float process_steps (float target, uint32_t n)
 Advance n steps toward target in one call.
 
float value () const
 Current smoothed value.
 
float coefficient () const
 Current coefficient.
 
void reset ()
 Reset to zero.
 
void reset (float initial)
 Reset to a specific value.
 

Member Function Documentation

◆ set_coefficient()

void sbl::dsp::primitives::ParameterSmoother::set_coefficient ( float  a)
inline

Set coefficient directly.

Note
All public methods are ISR-safe — bounded computation, no I/O.

a = 0.0 → hold previous output, 1.0 → instant (no smoothing).

Definition at line 33 of file parameter_smoother.hpp.

◆ set_time_ms()

void sbl::dsp::primitives::ParameterSmoother::set_time_ms ( float  ms,
float  rate_hz 
)
inline

Compute coefficient from settling time in milliseconds.

Sets coefficient so the smoother reaches ~95% of a step change in the given time at the given update rate.

Parameters
msSettling time in milliseconds (95% of step)
rate_hzUpdate rate in Hz (e.g., 1000 for block-rate at 1kHz)

Definition at line 44 of file parameter_smoother.hpp.

References sbl::dsp::math::one_minus_exp_neg().

Referenced by sbl::dsp::comp::Pan::Pan(), and sbl::dsp::primitives::SmoothedPort::set_time_ms().

◆ process()

float sbl::dsp::primitives::ParameterSmoother::process ( float  target)
inline

◆ process_steps()

float sbl::dsp::primitives::ParameterSmoother::process_steps ( float  target,
uint32_t  n 
)
inline

Advance n steps toward target in one call.

Exactly equivalent to n consecutive process() calls. Lets a smoother whose coefficient was computed for a per-sample rate be advanced at block rate without stretching its settling time — pass the block size as n.

Parameters
targetThe value to approach
nNumber of steps to advance
Returns
Smoothed value after n steps

Definition at line 77 of file parameter_smoother.hpp.

Referenced by sbl::dsp::primitives::SmoothedPort::advance(), and sbl::dsp::comp::Fader::tick().

◆ value()

float sbl::dsp::primitives::ParameterSmoother::value ( ) const
inline

◆ coefficient()

float sbl::dsp::primitives::ParameterSmoother::coefficient ( ) const
inline

Current coefficient.

Definition at line 88 of file parameter_smoother.hpp.

◆ reset() [1/2]

◆ reset() [2/2]

void sbl::dsp::primitives::ParameterSmoother::reset ( float  initial)
inline

Reset to a specific value.

Definition at line 94 of file parameter_smoother.hpp.


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