DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
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 , IPS_3_75 }
 Tape speed (3.75 ips comes last, so stored states keep their meaning). More...
 
enum class  Transport { Modulated , Speed }
 How the transport moves the tape (setTransport()). More...
 
enum class  Mains { Hz50 , Hz60 }
 Mains frequency of the hum (setHum()). More...
 
enum class  Formulation { Classic , HighOutput , Vintage }
 Tape formulation (setFormulation()). More...
 
enum class  TrackFormat { Half , Full , Quarter }
 Track format (setTrackFormat()): the signal grows with the track width and the hiss with its square root, so Half (2.0 mm, the default) keeps the hiss as set, Full (6.3 mm) lowers it by 5.0 dB and Quarter (1.0 mm) raises it by 3.0 dB. Each format has its head, and the head bump follows the length of its contact with the tape (the speed over that length): at 15 ips it sits at 90 Hz with Half, 72 Hz with Full and 112 Hz with Quarter. More...
 
enum class  Monitor { PlayHead , RecordHead , Source }
 What the output monitors (setMonitor()). PlayHead, the default, is the reproduce head; RecordHead reads through the record head, whose wider gap (6 um against 3) and spacing lose more of the top end; Input is the input itself, delayed like the tape path. Changes fade over 20 ms. More...
 
enum class  HeadModel { Bump , Contour }
 The reproduce head's low end (setHeadModel()). Bump, the default, is the single head-bump resonance; Contour is a chain of four resonances, the bump and three ripples above it at 1.45, 1.95 and 2.5 times its frequency with alternating signs and falling size, each designed on its own analog prototype (in place at any rate). More...
 
enum class  Electronics { Ideal , Circuit }
 Record and reproduce electronics (setElectronics()). More...
 
enum class  BiasShape { TwoLevel , FourLevel }
 The levels of the bias carrier (see setBiasShape()). More...
 
enum class  OversamplingMode { LinearPhase , MinimumPhase }
 How the oversampler filters (see setOversamplingMode()). 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 at -12 dBFS, with a quarter of a dB a dB left: more drive means more saturation at roughly constant loudness there. Pushed hard the tape compresses as a tape does, so what is quieter comes out louder than what is loud: at +24 dB a programme at -33 dBFS RMS gains 11.8 dB and one at -15 dBFS 2.2 dB. 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, and a top end that rises as the bias falls (the short wavelengths record more strongly than the long ones: a shelf of up to 4.5 dB, around 6 kHz at 15 ips and in proportion to the speed). Above nominal, self-erasure progressively rolls off the top octave, from the optimum on and without a step. Non-finite values are ignored.
 
void setOversampling (int factor)
 Configures internal oversampling of the biased hysteresis core (visible, tunable and switchable off). 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().
 
void setAutomaticOversampling (bool on)
 Lets the host rate choose the factor (SETUP THREAD ONLY, as setOversampling()).
 
bool isOversamplingAutomatic () const noexcept
 Whether the factor follows the host rate (setAutomaticOversampling()).
 
void setBiasShape (BiasShape shape)
 Chooses the levels of the bias carrier (SETUP THREAD ONLY, as setOversampling(): an active instance is prepared again).
 
BiasShape getBiasShape () const noexcept
 The levels of the bias carrier (setBiasShape()).
 
void setOversamplingMode (OversamplingMode mode)
 Chooses the oversampler's filters (SETUP THREAD ONLY, as setOversampling(): an active instance is prepared again).
 
OversamplingMode getOversamplingMode () const noexcept
 The oversampler's filters (setOversamplingMode()).
 
int getOversamplingFactor () const noexcept
 Active oversampling factor (1 = off, 4 = default; see setBiasShape()).
 
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 RMS level in dBFS at the output (e.g. -55 for audible vintage hiss); values <= -120 disable it (default). The hiss is laid on the tape, before the reproduce head and the de-emphasis, so its colour follows the speed and the standard; the level is that of the output for the half-track format, the classic formulation and no calibration offset (see setTrackFormat(), setFormulation() and setCalibrationLevel()), and glides over 50 ms. Non-finite values are ignored.
 
void setMix (T mix) noexcept
 Dry/wet mix [0, 1]; dry is latency-compensated. Non-finite values are ignored.
 
void setTransport (Transport t) noexcept
 Transport model (see Transport). Out-of-range values are clamped.
 
void setHum (T dbfs, Mains mains=Mains::Hz50) noexcept
 Mains hum after the tape: the mains frequency and its second harmonic 6 dB down, in phase on every channel, its level gliding over 50 ms. Non-finite levels are ignored.
 
void setChannelBleed (T dB) noexcept
 Bleed between the channels of each pair (0 and 1, 2 and 3, and so on): each takes the other through a first-order high-pass at 10 kHz (rising 6 dB per octave below it, as between the tracks of a head), its level gliding over 50 ms. Non-finite values are ignored.
 
void setEvenHarmonics (T amount) noexcept
 Even harmonics of the record path, 0 to 1 (0, the default, is off): a share of the square of the recorded signal (less its mean) is added before the tape, so the second harmonic grows with the level; it glides over 20 ms. Non-finite values are ignored.
 
void setOutputIron (T amount) noexcept
 Output iron, 0 to 1 (0, the default, is off): a parallel branch that takes the reproduced signal through a one-pole low-pass at 60 Hz (the flux of a transformer follows the voltage over the frequency), a curve with an even and an odd term, and the inverse filter capped at 4 kHz, and adds what the curve changed: the low end saturates first. The iron also loses its low end in a linear way: by the same share the output crosses a first-order high-pass at 20 Hz (3 dB down there at the full amount, under 0.3 dB at 100 Hz), which takes with it whatever DC the even term leaves. The branch always runs and its share glides over 20 ms. Non-finite values are ignored.
 
void setHeadModel (HeadModel m) noexcept
 Reproduce head model (see HeadModel). Out-of-range values are clamped.
 
void setElectronics (Electronics e) noexcept
 Record and reproduce electronics (see Electronics). Out-of-range values are clamped.
 
void setAlignment (T hfDb, T lfDb) noexcept
 Reproduce alignment trims, as the HF and LF reproduce adjustments of a machine (both 0 by default). Non-finite values are ignored.
 
void setRecordEmphasis (T dB) noexcept
 Trim of the record emphasis, -6 to +6 dB (0 by default): a high shelf around 4 kHz on the record side and its exact inverse on the reproduce side, as a record equaliser aligned against its reproduce twin.
 
T getRecordEmphasis () const noexcept
 The trim of the record emphasis in dB (setRecordEmphasis()).
 
T getRecordPeak (int channel) const noexcept
 The record level's peak, the overload lamp before the tape: what drives the curve, read at the internal rate (so it sees the peaks between samples), 1 for a full-scale signal at nominal drive and operating level, falling with a 300 ms time constant. Any thread (relaxed; updated once per block).
 
void setAlignmentTolerance (T amount) noexcept
 How far the channels' alignment strays, 0 to 1 (0, the default: every channel the same, to the bit). Each channel takes its own fixed deviation, the same at every run: up to 8 % of bias, up to 0.75 dB of playback treble (a shelf from 6 kHz) and 0.25 dB of level at 1, as no two channels of a machine are aligned alike. Magnitudes only: the channels keep their timing, so a mono sum does not comb. Thread-safe; non-finite values are ignored.
 
T getAlignmentTolerance () const noexcept
 
T getRecordPeakDb (int channel) const noexcept
 The record level's peak in decibels (floored at -100).
 
void setFormulation (Formulation f) noexcept
 Tape formulation (see Formulation). Out-of-range values are clamped.
 
void setTrackFormat (TrackFormat f) noexcept
 Track format (see TrackFormat). Out-of-range values are clamped.
 
void setCalibrationLevel (T dB) noexcept
 Operating level above the reference flux, 0 to 9 dB (0 by default): the tape is driven that much harder for the same input while the output level is kept, and the hiss falls by as much against the signal (a machine aligned to an elevated level). A 1 kHz tone at -12 dBFS carries 0.16 % THD at 0 dB, 0.31 % at 3 dB and 0.60 % at 6 dB: at 6 dB the machine distorts at the reference level as tape machines are specified to (0.4 to 0.8 %), the distortion rising about fourfold per 6 dB of level (third order). Non-finite values are ignored.
 
void setMonitor (Monitor m) noexcept
 Monitored head or input (see Monitor). Out-of-range values are clamped.
 
Transport getTransport () const noexcept
 
T getHum () const noexcept
 
Mains getMains () const noexcept
 
T getChannelBleed () const noexcept
 
T getEvenHarmonics () const noexcept
 
T getOutputIron () const noexcept
 
HeadModel getHeadModel () const noexcept
 
Electronics getElectronics () const noexcept
 
T getAlignmentHf () const noexcept
 
T getAlignmentLf () const noexcept
 
Formulation getFormulation () const noexcept
 
TrackFormat getTrackFormat () const noexcept
 
T getCalibrationLevel () const noexcept
 
Monitor getMonitor () const noexcept
 
T getDrive () const noexcept
 
T getBias () const noexcept
 
Speed getSpeed () const noexcept
 
Standard getStandard () const noexcept
 
T getLossEffects () const noexcept
 
T getHeadBump () const noexcept
 
T getWowFlutter () const noexcept
 
T getNoise () const noexcept
 
T 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
 Compatibility alias of getLatency(), in prepared-rate samples.
 
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 175 of file TapeMachine.h.

Member Enumeration Documentation

◆ BiasShape

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

The levels of the bias carrier (see setBiasShape()).

Enumerator
TwoLevel 

Every sample at plus or minus the amplitude: the gain rises with the level before it saturates.

FourLevel 

An inner and an outer level of each sign: the gain only falls with the level (default).

Definition at line 608 of file TapeMachine.h.

◆ Electronics

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

Record and reproduce electronics (setElectronics()).

Ideal, the default, runs the record emphasis at the session rate and its inverse after the tape. Circuit runs both networks from their analog transfer functions at the internal rate, around the tape, as normalized ladders: the record network (the emphasis and a second-order record amplifier limit at 45 kHz) and the reproduce network (the de-emphasis with the trims of setAlignment() and a first-order amplifier pole at 50 kHz; with the 24 Hz output coupling, a fifth-order reproduce chain). The round trip then carries the amplifiers' gentle top-end roll-off. The networks it brings in start from rest: a setup choice.

Enumerator
Ideal 
Circuit 

Definition at line 258 of file TapeMachine.h.

◆ Formulation

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

Tape formulation (setFormulation()).

Classic is the default material. HighOutput saturates 3 dB later, takes 20 % more coercive force from the bias and hisses 1.5 dB less; Vintage saturates 2 dB earlier with a more reversible loop, takes 20 % less coercive force and hisses 3 dB more. The bias control keeps its meaning: 0.5 is the optimum of the material in use.

Enumerator
Classic 
HighOutput 
Vintage 

Definition at line 211 of file TapeMachine.h.

◆ HeadModel

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

The reproduce head's low end (setHeadModel()). Bump, the default, is the single head-bump resonance; Contour is a chain of four resonances, the bump and three ripples above it at 1.45, 1.95 and 2.5 times its frequency with alternating signs and falling size, each designed on its own analog prototype (in place at any rate).

Enumerator
Bump 
Contour 

Definition at line 242 of file TapeMachine.h.

◆ Mains

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

Mains frequency of the hum (setHum()).

Enumerator
Hz50 
Hz60 

Definition at line 200 of file TapeMachine.h.

◆ Monitor

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

What the output monitors (setMonitor()). PlayHead, the default, is the reproduce head; RecordHead reads through the record head, whose wider gap (6 um against 3) and spacing lose more of the top end; Input is the input itself, delayed like the tape path. Changes fade over 20 ms.

Enumerator
PlayHead 
RecordHead 
Source 

Definition at line 232 of file TapeMachine.h.

◆ OversamplingMode

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

How the oversampler filters (see setOversamplingMode()).

Enumerator
LinearPhase 

Linear-phase half-bands: the latency of the factor, the dry path a delay (default).

MinimumPhase 

Elliptic allpass half-bands: a few samples of latency, the dry path through the same filters.

Definition at line 642 of file TapeMachine.h.

◆ Speed

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

Tape speed (3.75 ips comes last, so stored states keep their meaning).

Enumerator
IPS_7_5 
IPS_15 
IPS_30 
IPS_3_75 

Definition at line 182 of file TapeMachine.h.

◆ Standard

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

Playback equalization standard.

Enumerator
NAB 
CCIR 

Definition at line 179 of file TapeMachine.h.

◆ TrackFormat

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

Track format (setTrackFormat()): the signal grows with the track width and the hiss with its square root, so Half (2.0 mm, the default) keeps the hiss as set, Full (6.3 mm) lowers it by 5.0 dB and Quarter (1.0 mm) raises it by 3.0 dB. Each format has its head, and the head bump follows the length of its contact with the tape (the speed over that length): at 15 ips it sits at 90 Hz with Half, 72 Hz with Full and 112 Hz with Quarter.

Enumerator
Half 
Full 
Quarter 

Definition at line 223 of file TapeMachine.h.

◆ Transport

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

How the transport moves the tape (setTransport()).

Modulated, the default, reads the tape through a delay moved by a sum of drift, wow, flutter and scrape. Speed keeps the speed of the tape as a state: the reproduce pitch is the speed of the moment, whose deviation is a smoothed noise, the capstan's rotation (with a third of its second harmonic) and the reel's rotation, at rates that follow the speed (5 Hz and 0.6 Hz at 15 ips) and deeper at slower speeds (by the square root of the ratio); the delay is held at the head distance over the speed, and a change of setSpeed() glides the speed with inertia (0.45 s to speed up, 0.7 s to slow down) instead of jumping.

Enumerator
Modulated 
Speed 

Definition at line 197 of file TapeMachine.h.

Member Function Documentation

◆ getAlignmentHf()

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

Definition at line 937 of file TapeMachine.h.

◆ getAlignmentLf()

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

Definition at line 938 of file TapeMachine.h.

◆ getAlignmentTolerance()

template<FloatType T>
T dspark::TapeMachine< T >::getAlignmentTolerance ( ) const
inlinenoexcept
Returns
How far the channels' alignment strays.

Definition at line 885 of file TapeMachine.h.

◆ getBias()

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

Definition at line 945 of file TapeMachine.h.

◆ getBiasShape()

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

The levels of the bias carrier (setBiasShape()).

Definition at line 639 of file TapeMachine.h.

◆ getCalibrationLevel()

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

Definition at line 941 of file TapeMachine.h.

◆ getChannelBleed()

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

Definition at line 932 of file TapeMachine.h.

◆ getDrive()

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

Definition at line 944 of file TapeMachine.h.

◆ getElectronics()

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

Definition at line 936 of file TapeMachine.h.

◆ getEvenHarmonics()

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

Definition at line 933 of file TapeMachine.h.

◆ getFormulation()

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

Definition at line 939 of file TapeMachine.h.

◆ getHeadBump()

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

Definition at line 955 of file TapeMachine.h.

◆ getHeadModel()

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

Definition at line 935 of file TapeMachine.h.

◆ getHum()

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

Definition at line 930 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 962 of file TapeMachine.h.

◆ getLatencySamples()

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

Compatibility alias of getLatency(), in prepared-rate samples.

Definition at line 965 of file TapeMachine.h.

◆ getLossEffects()

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

Definition at line 954 of file TapeMachine.h.

◆ getMains()

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

Definition at line 931 of file TapeMachine.h.

◆ getMix()

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

Definition at line 958 of file TapeMachine.h.

◆ getMonitor()

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

Definition at line 942 of file TapeMachine.h.

◆ getNoise()

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

Definition at line 957 of file TapeMachine.h.

◆ getOutputIron()

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

Definition at line 934 of file TapeMachine.h.

◆ getOversamplingFactor()

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

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

Definition at line 672 of file TapeMachine.h.

◆ getOversamplingMode()

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

The oversampler's filters (setOversamplingMode()).

Definition at line 669 of file TapeMachine.h.

◆ getRecordEmphasis()

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

The trim of the record emphasis in dB (setRecordEmphasis()).

Definition at line 856 of file TapeMachine.h.

◆ getRecordPeak()

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

The record level's peak, the overload lamp before the tape: what drives the curve, read at the internal rate (so it sees the peaks between samples), 1 for a full-scale signal at nominal drive and operating level, falling with a 300 ms time constant. Any thread (relaxed; updated once per block).

Parameters
channelChannel index (out-of-range returns 0).

Definition at line 866 of file TapeMachine.h.

◆ getRecordPeakDb()

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

The record level's peak in decibels (floored at -100).

Definition at line 888 of file TapeMachine.h.

◆ getSpeed()

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

Definition at line 946 of file TapeMachine.h.

◆ getStandard()

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

Definition at line 950 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 968 of file TapeMachine.h.

◆ getTrackFormat()

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

Definition at line 940 of file TapeMachine.h.

◆ getTransport()

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

Definition at line 929 of file TapeMachine.h.

◆ getWowFlutter()

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

Definition at line 956 of file TapeMachine.h.

◆ isOversamplingAutomatic()

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

Whether the factor follows the host rate (setAutomaticOversampling()).

Definition at line 605 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.

A prepared machine asked for another block size alone (same rate and channels) keeps its memory: the tape, the filters and what is still inside its delays go on as if nothing had been asked, since processBlock() splits any block to the size it was built for. Any other call starts from rest.

Definition at line 271 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 1044 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 483 of file TapeMachine.h.

◆ setAlignment()

template<FloatType T>
void dspark::TapeMachine< T >::setAlignment ( T  hfDb,
T  lfDb 
)
inlinenoexcept

Reproduce alignment trims, as the HF and LF reproduce adjustments of a machine (both 0 by default). Non-finite values are ignored.

Parameters
hfDbTrim of the de-emphasis at high frequencies, -6 to +6 dB.
lfDbTrim of the low end (the NAB LF network, or a shelf at 50 Hz with CCIR), -6 to +6 dB.

Definition at line 829 of file TapeMachine.h.

◆ setAlignmentTolerance()

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

How far the channels' alignment strays, 0 to 1 (0, the default: every channel the same, to the bit). Each channel takes its own fixed deviation, the same at every run: up to 8 % of bias, up to 0.75 dB of playback treble (a shelf from 6 kHz) and 0.25 dB of level at 1, as no two channels of a machine are aligned alike. Magnitudes only: the channels keep their timing, so a mono sum does not comb. Thread-safe; non-finite values are ignored.

Definition at line 880 of file TapeMachine.h.

◆ setAutomaticOversampling()

template<FloatType T>
void dspark::TapeMachine< T >::setAutomaticOversampling ( bool  on)
inline

Lets the host rate choose the factor (SETUP THREAD ONLY, as setOversampling()).

With it on, every prepare() takes the smallest factor that brings the core to an internal rate of at least 176.4 kHz: 4x at 44.1 and 48 kHz (the default factor), 2x at 88.2 and 96 kHz, none from 176.4 kHz up (where the four levels keep their two steps). The bias carrier and the hysteresis then run at the same rate whatever the session rate, and a high-rate session stops paying for a factor it does not need. Off by default; an explicit setOversampling() turns it off.

Parameters
onTrue to choose the factor from the rate.

Definition at line 596 of file TapeMachine.h.

◆ setBias()

template<FloatType T>
void dspark::TapeMachine< T >::setBias ( T  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, and a top end that rises as the bias falls (the short wavelengths record more strongly than the long ones: a shelf of up to 4.5 dB, around 6 kHz at 15 ips and in proportion to the speed). Above nominal, self-erasure progressively rolls off the top octave, from the optimum on and without a step. Non-finite values are ignored.

Definition at line 551 of file TapeMachine.h.

◆ setBiasShape()

template<FloatType T>
void dspark::TapeMachine< T >::setBiasShape ( BiasShape  shape)
inline

Chooses the levels of the bias carrier (SETUP THREAD ONLY, as setOversampling(): an active instance is prepared again).

FourLevel, the default, holds the gain and then lets it fall, at any bias, as a tape compresses. The factor of setOversampling() is left as it is: at 1x, 2x or 4x, from 44.1 to under 352.8 kHz of internal rate, the core takes two steps a sample, at the same latency.

TwoLevel is the earlier carrier, kept to compare: its gain rises with the level before it saturates (3.2 dB at the nominal bias, up to 9.9 dB at full bias), so 1 kHz at 0 dBFS leaves it 1.9 dB louder.

Parameters
shapeFourLevel (default) or TwoLevel.

Definition at line 629 of file TapeMachine.h.

◆ setCalibrationLevel()

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

Operating level above the reference flux, 0 to 9 dB (0 by default): the tape is driven that much harder for the same input while the output level is kept, and the hiss falls by as much against the signal (a machine aligned to an elevated level). A 1 kHz tone at -12 dBFS carries 0.16 % THD at 0 dB, 0.31 % at 3 dB and 0.60 % at 6 dB: at 6 dB the machine distorts at the reference level as tape machines are specified to (0.4 to 0.8 %), the distortion rising about fourfold per 6 dB of level (third order). Non-finite values are ignored.

Definition at line 915 of file TapeMachine.h.

◆ setChannelBleed()

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

Bleed between the channels of each pair (0 and 1, 2 and 3, and so on): each takes the other through a first-order high-pass at 10 kHz (rising 6 dB per octave below it, as between the tracks of a head), its level gliding over 50 ms. Non-finite values are ignored.

Parameters
dBLevel at 1 kHz; -120 and below turn it off (the default).

Definition at line 772 of file TapeMachine.h.

◆ setDrive()

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

Input drive in dB [-12, +24]. Level-compensated at -12 dBFS, with a quarter of a dB a dB left: more drive means more saturation at roughly constant loudness there. Pushed hard the tape compresses as a tape does, so what is quieter comes out louder than what is loud: at +24 dB a programme at -33 dBFS RMS gains 11.8 dB and one at -15 dBFS 2.2 dB. Non-finite values are ignored.

Definition at line 535 of file TapeMachine.h.

◆ setElectronics()

template<FloatType T>
void dspark::TapeMachine< T >::setElectronics ( Electronics  e)
inlinenoexcept

Record and reproduce electronics (see Electronics). Out-of-range values are clamped.

Definition at line 815 of file TapeMachine.h.

◆ setEvenHarmonics()

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

Even harmonics of the record path, 0 to 1 (0, the default, is off): a share of the square of the recorded signal (less its mean) is added before the tape, so the second harmonic grows with the level; it glides over 20 ms. Non-finite values are ignored.

Definition at line 784 of file TapeMachine.h.

◆ setFormulation()

template<FloatType T>
void dspark::TapeMachine< T >::setFormulation ( Formulation  f)
inlinenoexcept

Tape formulation (see Formulation). Out-of-range values are clamped.

Definition at line 891 of file TapeMachine.h.

◆ setHeadBump()

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

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

Definition at line 707 of file TapeMachine.h.

◆ setHeadModel()

template<FloatType T>
void dspark::TapeMachine< T >::setHeadModel ( HeadModel  m)
inlinenoexcept

Reproduce head model (see HeadModel). Out-of-range values are clamped.

Definition at line 808 of file TapeMachine.h.

◆ setHum()

template<FloatType T>
void dspark::TapeMachine< T >::setHum ( T  dbfs,
Mains  mains = Mains::Hz50 
)
inlinenoexcept

Mains hum after the tape: the mains frequency and its second harmonic 6 dB down, in phase on every channel, its level gliding over 50 ms. Non-finite levels are ignored.

Parameters
dbfsRMS level in dBFS; -120 and below turn it off (the default).
mainsMains frequency (50 Hz by default).

Definition at line 757 of file TapeMachine.h.

◆ setLossEffects()

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

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

Definition at line 698 of file TapeMachine.h.

◆ setMix()

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

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

Definition at line 738 of file TapeMachine.h.

◆ setMonitor()

template<FloatType T>
void dspark::TapeMachine< T >::setMonitor ( Monitor  m)
inlinenoexcept

Monitored head or input (see Monitor). Out-of-range values are clamped.

Definition at line 923 of file TapeMachine.h.

◆ setNoise()

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

Tape hiss RMS level in dBFS at the output (e.g. -55 for audible vintage hiss); values <= -120 disable it (default). The hiss is laid on the tape, before the reproduce head and the de-emphasis, so its colour follows the speed and the standard; the level is that of the output for the half-track format, the classic formulation and no calibration offset (see setTrackFormat(), setFormulation() and setCalibrationLevel()), and glides over 50 ms. Non-finite values are ignored.

Definition at line 730 of file TapeMachine.h.

◆ setOutputIron()

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

Output iron, 0 to 1 (0, the default, is off): a parallel branch that takes the reproduced signal through a one-pole low-pass at 60 Hz (the flux of a transformer follows the voltage over the frequency), a curve with an even and an odd term, and the inverse filter capped at 4 kHz, and adds what the curve changed: the low end saturates first. The iron also loses its low end in a linear way: by the same share the output crosses a first-order high-pass at 20 Hz (3 dB down there at the full amount, under 0.3 dB at 100 Hz), which takes with it whatever DC the even term leaves. The branch always runs and its share glides over 20 ms. Non-finite values are ignored.

Definition at line 802 of file TapeMachine.h.

◆ setOversampling()

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

Configures internal oversampling of the biased hysteresis core (visible, tunable and switchable off). 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 a quarter of 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 571 of file TapeMachine.h.

◆ setOversamplingMode()

template<FloatType T>
void dspark::TapeMachine< T >::setOversamplingMode ( OversamplingMode  mode)
inline

Chooses the oversampler's filters (SETUP THREAD ONLY, as setOversampling(): an active instance is prepared again).

MinimumPhase runs polyphase allpass half-bands: the oversampler's share of the latency falls to a few samples, and the dry copy of the mix crosses the same filters, so a partial mix adds in phase. getLatency() reflects the change.

Parameters
modeLinearPhase (default) or MinimumPhase.

Definition at line 659 of file TapeMachine.h.

◆ setRecordEmphasis()

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

Trim of the record emphasis, -6 to +6 dB (0 by default): a high shelf around 4 kHz on the record side and its exact inverse on the reproduce side, as a record equaliser aligned against its reproduce twin.

The round trip stays flat at low level. What changes is how hard the top end reaches the tape: with more emphasis a loud high tone distorts more and the tape's hiss up there falls by as much (5.4 dB between 8 and 16 kHz at +6 dB); with less, the top end stays cleaner and the hiss rises. Non-finite values are ignored.

Definition at line 849 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 676 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 687 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 1006 of file TapeMachine.h.

◆ setTrackFormat()

template<FloatType T>
void dspark::TapeMachine< T >::setTrackFormat ( TrackFormat  f)
inlinenoexcept

Track format (see TrackFormat). Out-of-range values are clamped.

Definition at line 898 of file TapeMachine.h.

◆ setTransport()

template<FloatType T>
void dspark::TapeMachine< T >::setTransport ( Transport  t)
inlinenoexcept

Transport model (see Transport). Out-of-range values are clamped.

Definition at line 745 of file TapeMachine.h.

◆ setWowFlutter()

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

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

Definition at line 716 of file TapeMachine.h.


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