Log-domain feedforward compressor with a soft-knee gain computer. More...
#include <feedforward_compressor.hpp>
Public Types | |
| using | Detector = CompressorDetector |
Public Member Functions | |
| void | prepare (double sample_rate, double max_lookahead_ms=10.0) |
| Sizes the lookahead ring buffer for the worst case. | |
| void | reset () |
| Zeroes detector state and the lookahead buffer. Never allocates. | |
| void | set_threshold_db (double db) |
| void | set_ratio (double r) |
| void | set_knee_width_db (double w) |
| void | set_attack_ms (double ms) |
| void | set_release_ms (double ms) |
| void | set_detector (Detector d) |
| Detector | detector () const |
| void | set_rms_window_ms (double ms) |
| void | set_lookahead_ms (double ms) |
| Lookahead in ms, clamped to the ceiling prepare() sized for — so this can never need an allocation. | |
| void | set_program_dependent_release (bool on) |
| void | set_makeup_gain_db (double db) |
| void | set_auto_makeup (bool on) |
| void | set_stereo_link (double amount) |
| 0 = fully independent per-channel detectors, 1 = one shared detector fed by the louder channel. | |
| int | latency_samples () const noexcept |
| The module's entire latency contribution: the lookahead delay, exactly. | |
| double | static_curve_db (double input_db) const |
| The static characteristic's output for an input level in dB — the gain computer alone, with no smoothing. | |
| double | gain_computer_db (double input_db) const |
| Gain reduction in dB (≤ 0) the static curve applies at input_db. | |
| double | effective_makeup_db () const |
| Makeup gain currently in force, in dB — the auto value when auto-makeup is on, the manual value otherwise. | |
| double | gain_reduction_db (int channel=0) const |
| Smoothed gain reduction in dB (≥ 0, a magnitude) as of the last processed sample. | |
| GainReduction | gain_reduction (int channel=0) const noexcept |
| Canonical non-negative gain-reduction magnitude for shared meters. | |
| SampleType | process (SampleType input) |
| One mono sample. | |
| void | process_stereo (SampleType &left, SampleType &right) |
| One stereo pair, in place. | |
| void | process_block (SampleType *io, int n) |
| void | process_block_stereo (SampleType *left, SampleType *right, int n) |
Static Public Attributes | |
| static constexpr double | kLevelEpsilon = dynamics::kLevelEpsilon |
| Level-conversion floor, guarding log10(0). | |
| static constexpr double | kSlowReleaseRatio = 4.0 |
| Slow/fast release ratio for program-dependent release. | |
| static constexpr double | kSustainTauMs = 200.0 |
| Smoothing constant of the "has compression been sustained" detector. | |
| static constexpr double | kSustainThresholdDb = 3.0 |
| How much gain reduction counts as sustained. | |
| static constexpr double | kThresholdDbMin = -60.0 |
| static constexpr double | kThresholdDbMax = 0.0 |
| static constexpr double | kRatioMin = 1.0 |
| static constexpr double | kRatioMax = 100.0 |
| static constexpr double | kKneeDbMin = 0.0 |
| static constexpr double | kKneeDbMax = 24.0 |
| static constexpr double | kAttackMsMin = 0.05 |
| static constexpr double | kAttackMsMax = 200.0 |
| static constexpr double | kReleaseMsMin = 5.0 |
| static constexpr double | kReleaseMsMax = 4000.0 |
| static constexpr double | kRmsWindowMsMin = 1.0 |
| static constexpr double | kRmsWindowMsMax = 50.0 |
| static constexpr double | kMakeupDbMax = 24.0 |
| static constexpr double | kMaxLookaheadMsCeiling = 50.0 |
| Ceiling on prepare()'s max_lookahead_ms argument. | |
Log-domain feedforward compressor with a soft-knee gain computer.
| using pulp::signal::FeedforwardCompressorT< SampleType >::Detector = CompressorDetector |
|
inline |
|
inline |
Makeup gain currently in force, in dB — the auto value when auto-makeup is on, the manual value otherwise.
|
inline |
Gain reduction in dB (≤ 0) the static curve applies at input_db.
|
inlinenoexcept |
Canonical non-negative gain-reduction magnitude for shared meters.
|
inline |
Smoothed gain reduction in dB (≥ 0, a magnitude) as of the last processed sample.
Exposed for metering and for tests that measure the detector rather than inferring it from the audio.
|
inlinenoexcept |
The module's entire latency contribution: the lookahead delay, exactly.
The gain computer and detector are zero-latency IIR stages, so this is 0 at the default 0 ms lookahead (series law 5).
|
inline |
Sizes the lookahead ring buffer for the worst case.
May allocate; this is the only call that does, which is what lets set_lookahead_ms() be audio-thread safe.
|
inline |
One mono sample.
|
inline |
|
inline |
|
inline |
One stereo pair, in place.
Reads both channels before writing either, which the link path requires.
|
inline |
Zeroes detector state and the lookahead buffer. Never allocates.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Lookahead in ms, clamped to the ceiling prepare() sized for — so this can never need an allocation.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
0 = fully independent per-channel detectors, 1 = one shared detector fed by the louder channel.
|
inline |
|
inline |
The static characteristic's output for an input level in dB — the gain computer alone, with no smoothing.
Exposed so a caller (or a test) can plot the curve without running audio through it.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
Level-conversion floor, guarding log10(0).
Declared in dynamics_core.hpp alongside the conversions that consume it, and re-exported here so the call sites and the catalog keep reading one name.
|
staticconstexpr |
|
staticconstexpr |
Ceiling on prepare()'s max_lookahead_ms argument.
[design parameter] default 10 ms, range 0 .. 50 ms.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
Slow/fast release ratio for program-dependent release.
Honest gap: no citable literature specifies this for a general algorithm — every hardware unit's constants are proprietary. Original engineering, tuned for a musically smooth transition. [design parameter] default 4.0, range 2 .. 8.
|
staticconstexpr |
Smoothing constant of the "has compression been sustained" detector.
[design parameter] default 200 ms, range 50 .. 1000 ms.
|
staticconstexpr |
How much gain reduction counts as sustained.
[design parameter] default 3 dB, range 1 .. 12 dB.
|
staticconstexpr |
|
staticconstexpr |