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

Detailed Description

Definition at line 25 of file allpass_filter.hpp.

#include <allpass_filter.hpp>

Public Member Functions

 AllpassFilter (float *buffer, uint32_t delay)
 Construct with caller-provided buffer.
 
 AllpassFilter ()=default
 Default constructor for array initialization (must call init() before use)
 
void init (float *buffer, uint32_t delay)
 Initialize after default construction.
 
float process (float x)
 Process a single sample.
 
void set_feedback (float g)
 Set feedback coefficient.
 
float feedback () const
 Current feedback coefficient.
 
void reset ()
 Zero the buffer and reset write position.
 
uint32_t delay () const
 Delay length in samples.
 
uint32_t write_pos () const
 Current write position (for external tap reads)
 

Constructor & Destructor Documentation

◆ AllpassFilter() [1/2]

sbl::dsp::primitives::AllpassFilter::AllpassFilter ( float *  buffer,
uint32_t  delay 
)
inline

Construct with caller-provided buffer.

Note
All public methods are ISR-safe — bounded computation, no I/O.
Parameters
bufferFloat buffer (must outlive the AllpassFilter)
delayDelay length in samples (buffer size)

Definition at line 34 of file allpass_filter.hpp.

◆ AllpassFilter() [2/2]

sbl::dsp::primitives::AllpassFilter::AllpassFilter ( )
default

Default constructor for array initialization (must call init() before use)

Member Function Documentation

◆ init()

void sbl::dsp::primitives::AllpassFilter::init ( float *  buffer,
uint32_t  delay 
)
inline

Initialize after default construction.

Parameters
bufferFloat buffer (must outlive the AllpassFilter)
delayDelay length in samples

Definition at line 45 of file allpass_filter.hpp.

References delay().

Referenced by sbl::dsp::modules::AlgoReverb< ScalePercent >::init().

◆ process()

float sbl::dsp::primitives::AllpassFilter::process ( float  x)
inline

Process a single sample.

Schroeder allpass: y = -g*x + x[n-d] + g*y[n-d] where the buffer stores the output history.

Parameters
xInput sample in [-1.0, 1.0]
Returns
Allpass-filtered output in [-1.0, 1.0]

Definition at line 60 of file allpass_filter.hpp.

Referenced by sbl::dsp::modules::AlgoReverb< ScalePercent >::process().

◆ set_feedback()

void sbl::dsp::primitives::AllpassFilter::set_feedback ( float  g)
inline

Set feedback coefficient.

Parameters
gFeedback gain, typically 0.5–0.7 for reverb diffusion

Definition at line 80 of file allpass_filter.hpp.

Referenced by sbl::dsp::modules::AlgoReverb< ScalePercent >::init(), and sbl::dsp::modules::AlgoReverb< ScalePercent >::process().

◆ feedback()

float sbl::dsp::primitives::AllpassFilter::feedback ( ) const
inline

Current feedback coefficient.

Definition at line 83 of file allpass_filter.hpp.

◆ reset()

void sbl::dsp::primitives::AllpassFilter::reset ( )
inline

Zero the buffer and reset write position.

Definition at line 86 of file allpass_filter.hpp.

Referenced by sbl::dsp::modules::AlgoReverb< ScalePercent >::reset().

◆ delay()

uint32_t sbl::dsp::primitives::AllpassFilter::delay ( ) const
inline

Delay length in samples.

Definition at line 94 of file allpass_filter.hpp.

Referenced by init().

◆ write_pos()

uint32_t sbl::dsp::primitives::AllpassFilter::write_pos ( ) const
inline

Current write position (for external tap reads)

Definition at line 97 of file allpass_filter.hpp.

Referenced by sbl::dsp::modules::AlgoReverb< ScalePercent >::process().


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