Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::TapeCompanderT< SampleType > Class Template Reference

The 2:1 / 1:2 linear-dB compander pair. More...

#include <tape_machine_components.hpp>

Public Member Functions

void prepare (double sample_rate)
void reset () noexcept
double encode (double x) noexcept
 Record side: 2:1 compression toward the reference.
double decode (double x) noexcept
 Playback side: 1:2 expansion, exact inverse slope.

Static Public Attributes

static constexpr double kAttackMs = 1.0
 [design parameter] default 1 ms, range 0.3–5 ms.
static constexpr double kReleaseMs = 100.0
 [design parameter] default 100 ms, range 50–300 ms. Same honest gap.
static constexpr double kRefLevelDbfs = -20.0
 0 dBr, in dBFS.

Detailed Description

template<typename SampleType = float>
class pulp::signal::TapeCompanderT< SampleType >

The 2:1 / 1:2 linear-dB compander pair.

Encode halves the programme's level in dB relative to a reference; decode doubles it back. The algebra is exact and worth writing out, because it is the whole reason the topology works: with L the input's level in dBr, encode applies −L/2, so the encoded signal sits at L/2 dBr; decode measures THAT and applies +L/2, returning L. Both stages are unity at the reference by construction, and a round trip with nothing in between is transparent — not approximately, identically.

The decoder tracks the ENCODED envelope rather than being handed the encoder's gain. That is the point: everything the tape does between them — loss, hiss, print-through — is inside the loop the decoder measures, so noise that entered after encoding gets expanded DOWN along with a quiet programme. A feed-forward "remember the gain and undo it" topology would leave the noise exactly where it was and do nothing at all.

Member Function Documentation

◆ decode()

template<typename SampleType = float>
double pulp::signal::TapeCompanderT< SampleType >::decode ( double x)
inlinenoexcept

Playback side: 1:2 expansion, exact inverse slope.

◆ encode()

template<typename SampleType = float>
double pulp::signal::TapeCompanderT< SampleType >::encode ( double x)
inlinenoexcept

Record side: 2:1 compression toward the reference.

◆ prepare()

template<typename SampleType = float>
void pulp::signal::TapeCompanderT< SampleType >::prepare ( double sample_rate)
inline

◆ reset()

template<typename SampleType = float>
void pulp::signal::TapeCompanderT< SampleType >::reset ( )
inlinenoexcept

Member Data Documentation

◆ kAttackMs

template<typename SampleType = float>
double pulp::signal::TapeCompanderT< SampleType >::kAttackMs = 1.0
staticconstexpr

[design parameter] default 1 ms, range 0.3–5 ms.

Honest gap: no citable dbx-specific attack constant exists in verifiable literature — the published material describes the 2:1/1:2 concept, not the ballistics.

◆ kRefLevelDbfs

template<typename SampleType = float>
double pulp::signal::TapeCompanderT< SampleType >::kRefLevelDbfs = -20.0
staticconstexpr

0 dBr, in dBFS.

[design parameter] default −20 dBFS, range −24 .. −16 — the calibration-tape-equivalent level, matching the house −20 dBFS = 0 VU convention.

◆ kReleaseMs

template<typename SampleType = float>
double pulp::signal::TapeCompanderT< SampleType >::kReleaseMs = 100.0
staticconstexpr

[design parameter] default 100 ms, range 50–300 ms. Same honest gap.


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