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. | |
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.
|
inlinenoexcept |
Playback side: 1:2 expansion, exact inverse slope.
|
inlinenoexcept |
Record side: 2:1 compression toward the reference.
|
inline |
|
inlinenoexcept |
|
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.
|
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.
|
staticconstexpr |
[design parameter] default 100 ms, range 50–300 ms. Same honest gap.