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

Detailed Description

Definition at line 72 of file tape_delay.hpp.

#include <tape_delay.hpp>

Public Member Functions

 TapeDelay ()=default
 
void init (float *buf_l, float *buf_r, uint32_t max_samples)
 Initialize with pre-allocated stereo delay buffers.
 
void set_time_su (float su)
 Set delay time from normalized [0,1] signal unit.
 
void set_time_bpm (float bpm, Subdivision div)
 Tempo-synced delay time (internally slewed)
 
void set_feedback_su (float su)
 Set feedback from normalized [0,1] signal unit.
 
void set_tone_su (float su)
 Set tone (head gap loss LP) from normalized [0,1] signal unit.
 
void set_bass_loss_su (float su)
 Set bass loss (feedback HP) from normalized [0,1] signal unit.
 
void set_drive_su (float su)
 Set drive (magnetic saturation) from normalized [0,1] signal unit.
 
void set_wobble_su (float su)
 Set wow+flutter from normalized [0,1] signal unit.
 
void set_hiss_su (float su)
 Set tape hiss from normalized [0,1] signal unit.
 
void set_drift_su (float su)
 Set speed drift from normalized [0,1] signal unit.
 
void set_transport_speed_su (float su)
 Set transport speed (motor inertia) from normalized [0,1] signal unit.
 
void set_ping_pong (bool enable)
 Enable stereo ping-pong (alternating L/R repeats). Default: false.
 
uint32_t time () const
 
float feedback () const
 
bool ping_pong () const
 
void process (float *left, float *right, uint16_t frames)
 Process a stereo block in-place (wet-only output)
 
void tick ()
 Tick control-rate modulation (~200 Hz)
 
void reset ()
 Clear delay buffers and reset all internal state.
 

Static Public Attributes

static constexpr float kMinFeedback = 0.0f
 
static constexpr float kMaxFeedback = 1.15f
 
static constexpr uint32_t kModHeadroom = 128
 
static constexpr float kMinToneHz = 200.0f
 
static constexpr float kMaxToneHz = 20000.0f
 
static constexpr float kMinBassLossHz = 0.0f
 
static constexpr float kMaxBassLossHz = 500.0f
 
static constexpr float kMinBassLossFilterHz = 1.0f
 
static constexpr float kMinDrive = 1.0f
 
static constexpr float kMaxDrive = 3.0f
 
static constexpr float kMaxWobble = 2.0f
 
static constexpr float kMaxHiss = 1.0f
 
static constexpr float kMaxDrift = 3.0f
 
static constexpr float kMinTransportSpeed = 1.0f
 
static constexpr float kMaxTransportSpeed = 20.0f
 

Friends

struct TapeDelayTestAccess
 

Constructor & Destructor Documentation

◆ TapeDelay()

sbl::dsp::modules::TapeDelay::TapeDelay ( )
default

Member Function Documentation

◆ init()

void sbl::dsp::modules::TapeDelay::init ( float *  buf_l,
float *  buf_r,
uint32_t  max_samples 
)
inline

Initialize with pre-allocated stereo delay buffers.

Parameters
buf_lLeft delay buffer (must outlive the Delay)
buf_rRight delay buffer (must outlive the Delay)
max_samplesMaximum delay in samples (buffer size)

Definition at line 101 of file tape_delay.hpp.

References sbl::dsp::primitives::DelayLine::init().

◆ set_time_su()

void sbl::dsp::modules::TapeDelay::set_time_su ( float  su)
inline

Set delay time from normalized [0,1] signal unit.

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

Feeds into the existing motor slew model. No additional smoothing.

Definition at line 115 of file tape_delay.hpp.

References kModHeadroom, and sbl::dsp::primitives::DelayLine::max_delay().

◆ set_time_bpm()

void sbl::dsp::modules::TapeDelay::set_time_bpm ( float  bpm,
Subdivision  div 
)
inline

Tempo-synced delay time (internally slewed)

Parameters
bpmTempo in beats per minute
divMusical subdivision

Public because tempo sync requires structured input (BPM + subdivision), not a normalized signal.

Definition at line 132 of file tape_delay.hpp.

References sbl::dsp::types::SAMPLE_RATE_F.

◆ set_feedback_su()

void sbl::dsp::modules::TapeDelay::set_feedback_su ( float  su)
inline

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

Parameters
suUnipolar [0,1] — linearly mapped to 0–1.15 (FDP-060)

Linear mapping. For musical response curves (more resolution at the top of the range), apply a cam profile in the control stack before this port. Smoothed via OnePole (50ms structural settling), then per-sample linear ramp across the block.

Definition at line 147 of file tape_delay.hpp.

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

◆ set_tone_su()

void sbl::dsp::modules::TapeDelay::set_tone_su ( float  su)
inline

Set tone (head gap loss LP) from normalized [0,1] signal unit.

Parameters
suUnipolar [0,1] — exponentially mapped to 200–20000 Hz

0 = dark (200 Hz LP), 1 = bright (20000 Hz, near-passthrough). Exponential mapping is handled by OnePole::set_cutoff_su() using the configured range.

Definition at line 169 of file tape_delay.hpp.

◆ set_bass_loss_su()

void sbl::dsp::modules::TapeDelay::set_bass_loss_su ( float  su)
inline

Set bass loss (feedback HP) from normalized [0,1] signal unit.

Parameters
suUnipolar [0,1] — linearly mapped to 0–500 Hz

0 = disabled (no HP), 1 = maximum bass removal (500 Hz). OnePoleHP maps [0,1] exponentially across its configured range.

Definition at line 182 of file tape_delay.hpp.

◆ set_drive_su()

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

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

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

Definition at line 192 of file tape_delay.hpp.

References kMaxDrive, and kMinDrive.

◆ set_wobble_su()

void sbl::dsp::modules::TapeDelay::set_wobble_su ( float  su)
inline

Set wow+flutter from normalized [0,1] signal unit.

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

Definition at line 202 of file tape_delay.hpp.

References kMaxWobble.

◆ set_hiss_su()

void sbl::dsp::modules::TapeDelay::set_hiss_su ( float  su)
inline

Set tape hiss from normalized [0,1] signal unit.

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

Definition at line 212 of file tape_delay.hpp.

References kMaxHiss.

◆ set_drift_su()

void sbl::dsp::modules::TapeDelay::set_drift_su ( float  su)
inline

Set speed drift from normalized [0,1] signal unit.

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

Definition at line 222 of file tape_delay.hpp.

References kMaxDrift.

◆ set_transport_speed_su()

void sbl::dsp::modules::TapeDelay::set_transport_speed_su ( float  su)
inline

Set transport speed (motor inertia) from normalized [0,1] signal unit.

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

Definition at line 232 of file tape_delay.hpp.

References kMaxTransportSpeed, and kMinTransportSpeed.

◆ set_ping_pong()

void sbl::dsp::modules::TapeDelay::set_ping_pong ( bool  enable)
inline

Enable stereo ping-pong (alternating L/R repeats). Default: false.

Definition at line 239 of file tape_delay.hpp.

◆ time()

uint32_t sbl::dsp::modules::TapeDelay::time ( ) const
inline

Definition at line 243 of file tape_delay.hpp.

◆ feedback()

float sbl::dsp::modules::TapeDelay::feedback ( ) const
inline

Definition at line 244 of file tape_delay.hpp.

◆ ping_pong()

bool sbl::dsp::modules::TapeDelay::ping_pong ( ) const
inline

Definition at line 245 of file tape_delay.hpp.

◆ process()

◆ tick()

void sbl::dsp::modules::TapeDelay::tick ( )
inline

Tick control-rate modulation (~200 Hz)

Advances AnalogDrift. Call from control loop, not audio callback.

Definition at line 423 of file tape_delay.hpp.

References sbl::dsp::comp::AnalogDrift::process().

◆ reset()

Friends And Related Symbol Documentation

◆ TapeDelayTestAccess

friend struct TapeDelayTestAccess
friend

Definition at line 453 of file tape_delay.hpp.

Member Data Documentation

◆ kMinFeedback

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

Definition at line 77 of file tape_delay.hpp.

◆ kMaxFeedback

constexpr float sbl::dsp::modules::TapeDelay::kMaxFeedback = 1.15f
staticconstexpr

Definition at line 78 of file tape_delay.hpp.

Referenced by set_feedback_su().

◆ kModHeadroom

constexpr uint32_t sbl::dsp::modules::TapeDelay::kModHeadroom = 128
staticconstexpr

Definition at line 79 of file tape_delay.hpp.

Referenced by set_time_su().

◆ kMinToneHz

constexpr float sbl::dsp::modules::TapeDelay::kMinToneHz = 200.0f
staticconstexpr

Definition at line 80 of file tape_delay.hpp.

◆ kMaxToneHz

constexpr float sbl::dsp::modules::TapeDelay::kMaxToneHz = 20000.0f
staticconstexpr

Definition at line 81 of file tape_delay.hpp.

◆ kMinBassLossHz

constexpr float sbl::dsp::modules::TapeDelay::kMinBassLossHz = 0.0f
staticconstexpr

Definition at line 82 of file tape_delay.hpp.

◆ kMaxBassLossHz

constexpr float sbl::dsp::modules::TapeDelay::kMaxBassLossHz = 500.0f
staticconstexpr

Definition at line 83 of file tape_delay.hpp.

◆ kMinBassLossFilterHz

constexpr float sbl::dsp::modules::TapeDelay::kMinBassLossFilterHz = 1.0f
staticconstexpr

Definition at line 84 of file tape_delay.hpp.

◆ kMinDrive

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

Definition at line 85 of file tape_delay.hpp.

Referenced by set_drive_su().

◆ kMaxDrive

constexpr float sbl::dsp::modules::TapeDelay::kMaxDrive = 3.0f
staticconstexpr

Definition at line 86 of file tape_delay.hpp.

Referenced by set_drive_su().

◆ kMaxWobble

constexpr float sbl::dsp::modules::TapeDelay::kMaxWobble = 2.0f
staticconstexpr

Definition at line 87 of file tape_delay.hpp.

Referenced by set_wobble_su().

◆ kMaxHiss

constexpr float sbl::dsp::modules::TapeDelay::kMaxHiss = 1.0f
staticconstexpr

Definition at line 88 of file tape_delay.hpp.

Referenced by set_hiss_su().

◆ kMaxDrift

constexpr float sbl::dsp::modules::TapeDelay::kMaxDrift = 3.0f
staticconstexpr

Definition at line 89 of file tape_delay.hpp.

Referenced by set_drift_su().

◆ kMinTransportSpeed

constexpr float sbl::dsp::modules::TapeDelay::kMinTransportSpeed = 1.0f
staticconstexpr

Definition at line 90 of file tape_delay.hpp.

Referenced by set_transport_speed_su().

◆ kMaxTransportSpeed

constexpr float sbl::dsp::modules::TapeDelay::kMaxTransportSpeed = 20.0f
staticconstexpr

Definition at line 91 of file tape_delay.hpp.

Referenced by set_transport_speed_su().


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