Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Public Member Functions | List of all members
sbl::dsp::ModulatedDelayLine Class Reference

#include <modulated_delay_line.hpp>

Collaboration diagram for sbl::dsp::ModulatedDelayLine:

Public Member Functions

 ModulatedDelayLine (float *buffer, uint32_t max_delay)
 Construct with caller-provided buffer.
 
 ModulatedDelayLine ()=default
 Default constructor for deferred initialization (must call init() before use)
 
void init (float *buffer, uint32_t max_delay)
 Initialize after default construction.
 
void write (float sample)
 Write a sample to the delay line.
 
float read (float delay_samples) const
 Read at fractional delay with linear interpolation.
 
float read_cubic (float delay_samples) const
 Read at fractional delay with 4-point Hermite cubic interpolation.
 
void process (const float *in, float *out, const float *delay, uint16_t frames)
 Block processing with per-sample modulated delay.
 
void clear ()
 Zero all samples in the buffer and reset write position.
 
uint32_t max_delay () const
 Maximum delay in samples (buffer size)
 
uint32_t write_pos () const
 Current write position (for external tap reads)
 

Detailed Description

Definition at line 31 of file modulated_delay_line.hpp.

Constructor & Destructor Documentation

◆ ModulatedDelayLine() [1/2]

sbl::dsp::ModulatedDelayLine::ModulatedDelayLine ( float *  buffer,
uint32_t  max_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 ModulatedDelayLine)
max_delayMaximum delay in samples (buffer size)

Definition at line 40 of file modulated_delay_line.hpp.

◆ ModulatedDelayLine() [2/2]

sbl::dsp::ModulatedDelayLine::ModulatedDelayLine ( )
default

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

Member Function Documentation

◆ clear()

void sbl::dsp::ModulatedDelayLine::clear ( )
inline

Zero all samples in the buffer and reset write position.

Definition at line 155 of file modulated_delay_line.hpp.

Referenced by sbl::widgets::proc::Delay::reset(), and sbl::widgets::proc::PlateReverb::reset().

Here is the caller graph for this function:

◆ init()

void sbl::dsp::ModulatedDelayLine::init ( float *  buffer,
uint32_t  max_delay 
)
inline

Initialize after default construction.

Parameters
bufferFloat buffer (must outlive the ModulatedDelayLine)
max_delayMaximum delay in samples (buffer size)

Definition at line 51 of file modulated_delay_line.hpp.

References max_delay().

Referenced by sbl::widgets::proc::Delay::init(), and sbl::widgets::proc::PlateReverb::init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ max_delay()

uint32_t sbl::dsp::ModulatedDelayLine::max_delay ( ) const
inline

Maximum delay in samples (buffer size)

Definition at line 165 of file modulated_delay_line.hpp.

Referenced by init(), and sbl::widgets::proc::Delay::set_time().

Here is the caller graph for this function:

◆ process()

void sbl::dsp::ModulatedDelayLine::process ( const float *  in,
float *  out,
const float *  delay,
uint16_t  frames 
)
inline

Block processing with per-sample modulated delay.

For each frame: writes in[i], reads at delay[i], outputs to out[i]. The delay array provides per-sample modulation (e.g., base delay + LFO). Uses linear interpolation.

in and out may alias (in-place processing is safe since each sample is read from in before write, and output is written after read).

Parameters
inInput audio buffer
outOutput audio buffer
delayPer-sample delay values in samples
framesNumber of frames to process

Definition at line 146 of file modulated_delay_line.hpp.

References read(), and write().

Here is the call graph for this function:

◆ read()

float sbl::dsp::ModulatedDelayLine::read ( float  delay_samples) const
inline

Read at fractional delay with linear interpolation.

Parameters
delay_samplesDelay in samples (1.0 = most recently written sample). Clamped to [1.0, max_delay - 1].
Returns
Linearly interpolated sample

Definition at line 78 of file modulated_delay_line.hpp.

Referenced by process(), and sbl::widgets::proc::Delay::process().

Here is the caller graph for this function:

◆ read_cubic()

float sbl::dsp::ModulatedDelayLine::read_cubic ( float  delay_samples) const
inline

Read at fractional delay with 4-point Hermite cubic interpolation.

Higher quality than linear — reduces artifacts for reverb tank modulation and pitch shifting. Uses samples at [d-1, d, d+1, d+2] around the read position.

Parameters
delay_samplesDelay in samples (1.0 = most recently written sample). Clamped to [2.0, max_delay - 2].
Returns
Hermite-interpolated sample

Definition at line 107 of file modulated_delay_line.hpp.

Referenced by sbl::widgets::proc::PlateReverb::process().

Here is the caller graph for this function:

◆ write()

void sbl::dsp::ModulatedDelayLine::write ( float  sample)
inline

Write a sample to the delay line.

Advances the write pointer after storing. The write pointer always points to the next write location.

Definition at line 63 of file modulated_delay_line.hpp.

Referenced by process(), sbl::widgets::proc::Delay::process(), and sbl::widgets::proc::PlateReverb::process().

Here is the caller graph for this function:

◆ write_pos()

uint32_t sbl::dsp::ModulatedDelayLine::write_pos ( ) const
inline

Current write position (for external tap reads)

Definition at line 168 of file modulated_delay_line.hpp.

Referenced by sbl::widgets::proc::PlateReverb::process().

Here is the caller graph for this function:

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