DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
dspark::TapeMachine< T > Class Template Reference

Reel-to-reel tape emulation with physical hysteresis and transport. More...

#include <TapeMachine.h>

Public Types

enum class  Standard { NAB , CCIR }
 Playback equalization standard. More...
 
enum class  Speed { IPS_7_5 , IPS_15 , IPS_30 }
 Tape speed. More...
 

Public Member Functions

void prepare (const AudioSpec &spec)
 Allocates the whole chain. Invalid specs (non-positive or non-finite rate, block size or channel count) are ignored: the previous state is kept and an unprepared instance stays pass-through.
 
void reset () noexcept
 Clears all signal state (keeps parameters). RT-safe.
 
void setDrive (T driveDb) noexcept
 Input drive in dB [-12, +24]. Level-compensated: more drive means more saturation at roughly constant loudness. Non-finite values are ignored.
 
void setBias (T bias) noexcept
 Bias setting [0, 1]; 0.5 is nominal calibration (carrier at 3x the JA field constant: full branch-memory erasure, clean odd saturation). Below nominal the carrier drops under the erase threshold: growing distortion and the level instability of a real under-biased machine. Above nominal, self-erasure progressively rolls off the top octave. Non-finite values are ignored.
 
void setOversampling (int factor)
 Configures internal oversampling of the biased hysteresis core (RF-009/ADR-011 transparency policy). SETUP THREAD ONLY - it reallocates the polyphase filters and re-prepares/re-calibrates the whole chain exactly like prepare(); never call it concurrently with processBlock().
 
int getOversamplingFactor () const noexcept
 Active oversampling factor (1 = off, 4 = default).
 
void setSpeed (Speed s) noexcept
 Tape speed (changes EQ time constants, losses and head bump). Out-of-range values are clamped.
 
void setStandard (Standard s) noexcept
 Equalization standard (NAB adds the LF time constant). Out-of-range values are clamped.
 
void setLossEffects (T amount) noexcept
 Playback loss intensity [0, 1] (0 bypasses the loss FIR). Non-finite values are ignored.
 
void setHeadBump (T amount) noexcept
 Head-bump resonance intensity [0, 1] (~2.5 dB at full). Non-finite values are ignored.
 
void setWowFlutter (T amount) noexcept
 Wow & flutter depth [0, 1] (~0.25% peak pitch deviation at 1). Non-finite values are ignored.
 
void setNoise (T dbfs) noexcept
 Tape hiss level in dBFS (e.g. -55 for audible vintage hiss); values <= -120 disable it (default). Non-finite values are ignored.
 
void setMix (T mix) noexcept
 Dry/wet mix [0, 1]; dry is latency-compensated. Non-finite values are ignored.
 
getDrive () const noexcept
 
getBias () const noexcept
 
Speed getSpeed () const noexcept
 
Standard getStandard () const noexcept
 
getLossEffects () const noexcept
 
getHeadBump () const noexcept
 
getWowFlutter () const noexcept
 
getNoise () const noexcept
 
getMix () const noexcept
 
int getLatency () const noexcept
 Total latency in samples (active oversampler + loss FIR + transport delay); reflects the current factor for host PDC.
 
int getLatencySamples () const noexcept
 Alias of getLatency() under the framework-wide latency-reporter name (RNF-005), so ProcessorChain::getLatency() includes this stage.
 
std::vector< uint8_t > getState () const
 Serializes the parameter state (setup/UI threads; allocates).
 
bool setState (const uint8_t *data, size_t size)
 Restores parameters from a blob (tolerant; rejects foreign ids).
 
void processBlock (AudioBufferView< T > buffer) noexcept
 Processes a block in-place. Pass-through until prepare() succeeds.
 

Detailed Description

template<FloatType T>
class dspark::TapeMachine< T >

Reel-to-reel tape emulation with physical hysteresis and transport.

Template Parameters
TSample type (float or double).

Definition at line 121 of file TapeMachine.h.

Member Enumeration Documentation

◆ Speed

template<FloatType T>
enum class dspark::TapeMachine::Speed
strong

Tape speed.

Enumerator
IPS_7_5 
IPS_15 
IPS_30 

Definition at line 128 of file TapeMachine.h.

◆ Standard

template<FloatType T>
enum class dspark::TapeMachine::Standard
strong

Playback equalization standard.

Enumerator
NAB 
CCIR 

Definition at line 125 of file TapeMachine.h.

Member Function Documentation

◆ getBias()

template<FloatType T>
T dspark::TapeMachine< T >::getBias ( ) const
inlinenoexcept

Definition at line 372 of file TapeMachine.h.

◆ getDrive()

template<FloatType T>
T dspark::TapeMachine< T >::getDrive ( ) const
inlinenoexcept

Definition at line 371 of file TapeMachine.h.

◆ getHeadBump()

template<FloatType T>
T dspark::TapeMachine< T >::getHeadBump ( ) const
inlinenoexcept

Definition at line 382 of file TapeMachine.h.

◆ getLatency()

template<FloatType T>
int dspark::TapeMachine< T >::getLatency ( ) const
inlinenoexcept

Total latency in samples (active oversampler + loss FIR + transport delay); reflects the current factor for host PDC.

Definition at line 389 of file TapeMachine.h.

◆ getLatencySamples()

template<FloatType T>
int dspark::TapeMachine< T >::getLatencySamples ( ) const
inlinenoexcept

Alias of getLatency() under the framework-wide latency-reporter name (RNF-005), so ProcessorChain::getLatency() includes this stage.

Definition at line 393 of file TapeMachine.h.

◆ getLossEffects()

template<FloatType T>
T dspark::TapeMachine< T >::getLossEffects ( ) const
inlinenoexcept

Definition at line 381 of file TapeMachine.h.

◆ getMix()

template<FloatType T>
T dspark::TapeMachine< T >::getMix ( ) const
inlinenoexcept

Definition at line 385 of file TapeMachine.h.

◆ getNoise()

template<FloatType T>
T dspark::TapeMachine< T >::getNoise ( ) const
inlinenoexcept

Definition at line 384 of file TapeMachine.h.

◆ getOversamplingFactor()

template<FloatType T>
int dspark::TapeMachine< T >::getOversamplingFactor ( ) const
inlinenoexcept

Active oversampling factor (1 = off, 4 = default).

Definition at line 305 of file TapeMachine.h.

◆ getSpeed()

template<FloatType T>
Speed dspark::TapeMachine< T >::getSpeed ( ) const
inlinenoexcept

Definition at line 373 of file TapeMachine.h.

◆ getStandard()

template<FloatType T>
Standard dspark::TapeMachine< T >::getStandard ( ) const
inlinenoexcept

Definition at line 377 of file TapeMachine.h.

◆ getState()

template<FloatType T>
std::vector< uint8_t > dspark::TapeMachine< T >::getState ( ) const
inline

Serializes the parameter state (setup/UI threads; allocates).

Definition at line 396 of file TapeMachine.h.

◆ getWowFlutter()

template<FloatType T>
T dspark::TapeMachine< T >::getWowFlutter ( ) const
inlinenoexcept

Definition at line 383 of file TapeMachine.h.

◆ prepare()

template<FloatType T>
void dspark::TapeMachine< T >::prepare ( const AudioSpec spec)
inline

Allocates the whole chain. Invalid specs (non-positive or non-finite rate, block size or channel count) are ignored: the previous state is kept and an unprepared instance stays pass-through.

Definition at line 135 of file TapeMachine.h.

◆ processBlock()

template<FloatType T>
void dspark::TapeMachine< T >::processBlock ( AudioBufferView< T >  buffer)
inlinenoexcept

Processes a block in-place. Pass-through until prepare() succeeds.

Definition at line 436 of file TapeMachine.h.

◆ reset()

template<FloatType T>
void dspark::TapeMachine< T >::reset ( )
inlinenoexcept

Clears all signal state (keeps parameters). RT-safe.

Definition at line 227 of file TapeMachine.h.

◆ setBias()

template<FloatType T>
void dspark::TapeMachine< T >::setBias ( bias)
inlinenoexcept

Bias setting [0, 1]; 0.5 is nominal calibration (carrier at 3x the JA field constant: full branch-memory erasure, clean odd saturation). Below nominal the carrier drops under the erase threshold: growing distortion and the level instability of a real under-biased machine. Above nominal, self-erasure progressively rolls off the top octave. Non-finite values are ignored.

Definition at line 275 of file TapeMachine.h.

◆ setDrive()

template<FloatType T>
void dspark::TapeMachine< T >::setDrive ( driveDb)
inlinenoexcept

Input drive in dB [-12, +24]. Level-compensated: more drive means more saturation at roughly constant loudness. Non-finite values are ignored.

Definition at line 262 of file TapeMachine.h.

◆ setHeadBump()

template<FloatType T>
void dspark::TapeMachine< T >::setHeadBump ( amount)
inlinenoexcept

Head-bump resonance intensity [0, 1] (~2.5 dB at full). Non-finite values are ignored.

Definition at line 340 of file TapeMachine.h.

◆ setLossEffects()

template<FloatType T>
void dspark::TapeMachine< T >::setLossEffects ( amount)
inlinenoexcept

Playback loss intensity [0, 1] (0 bypasses the loss FIR). Non-finite values are ignored.

Definition at line 331 of file TapeMachine.h.

◆ setMix()

template<FloatType T>
void dspark::TapeMachine< T >::setMix ( mix)
inlinenoexcept

Dry/wet mix [0, 1]; dry is latency-compensated. Non-finite values are ignored.

Definition at line 365 of file TapeMachine.h.

◆ setNoise()

template<FloatType T>
void dspark::TapeMachine< T >::setNoise ( dbfs)
inlinenoexcept

Tape hiss level in dBFS (e.g. -55 for audible vintage hiss); values <= -120 disable it (default). Non-finite values are ignored.

Definition at line 357 of file TapeMachine.h.

◆ setOversampling()

template<FloatType T>
void dspark::TapeMachine< T >::setOversampling ( int  factor)
inline

Configures internal oversampling of the biased hysteresis core (RF-009/ADR-011 transparency policy). SETUP THREAD ONLY - it reallocates the polyphase filters and re-prepares/re-calibrates the whole chain exactly like prepare(); never call it concurrently with processBlock().

Parameters
factorPower-of-two multiplier in {1,2,4,8,16}. DEFAULT 4. 1 = OFF (no internal resampling, zero added oversampler latency; the AC-bias carrier then lands in-band at 0.375 * the base rate, so 1x is only sensible under host/chain oversampling). CPU scales ~linearly with the factor. Invalid/non-power-of-two values are ignored. getLatency() reflects the new factor after this call.

Definition at line 295 of file TapeMachine.h.

◆ setSpeed()

template<FloatType T>
void dspark::TapeMachine< T >::setSpeed ( Speed  s)
inlinenoexcept

Tape speed (changes EQ time constants, losses and head bump). Out-of-range values are clamped.

Definition at line 309 of file TapeMachine.h.

◆ setStandard()

template<FloatType T>
void dspark::TapeMachine< T >::setStandard ( Standard  s)
inlinenoexcept

Equalization standard (NAB adds the LF time constant). Out-of-range values are clamped.

Definition at line 320 of file TapeMachine.h.

◆ setState()

template<FloatType T>
bool dspark::TapeMachine< T >::setState ( const uint8_t *  data,
size_t  size 
)
inline

Restores parameters from a blob (tolerant; rejects foreign ids).

Definition at line 415 of file TapeMachine.h.

◆ setWowFlutter()

template<FloatType T>
void dspark::TapeMachine< T >::setWowFlutter ( amount)
inlinenoexcept

Wow & flutter depth [0, 1] (~0.25% peak pitch deviation at 1). Non-finite values are ignored.

Definition at line 349 of file TapeMachine.h.


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