|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
|
Tube preamp: Koren 12AX7 stages, WDF tone circuit, supply sag. More...
#include "../Core/AudioBuffer.h"#include "../Core/AudioSpec.h"#include "../Core/Biquad.h"#include "../Core/DenormalGuard.h"#include "../Core/DspMath.h"#include "../Core/Oversampling.h"#include "../Core/StateBlob.h"#include "../Core/WDF.h"#include <algorithm>#include <array>#include <atomic>#include <cmath>#include <cstddef>#include <cstdint>#include <memory>#include <numbers>#include <vector>

Go to the source code of this file.
Classes | |
| class | dspark::TubePreamp< T > |
| One/two 12AX7 stages with sag and a WDF tone circuit. More... | |
Namespaces | |
| namespace | dspark |
| Main namespace for the DSPark framework. | |
Tube preamp: Koren 12AX7 stages, WDF tone circuit, supply sag.
Circuit-level preamp modelling, not a waveshaper:
The nonlinear core runs at 2x oversampling by DEFAULT. Per RF-009/ADR-011 the factor is configurable via setOversampling(int) (setup thread only, it reallocates and re-calibrates like prepare()): 1 = OFF (no internal resampling, zero added latency, but the triode/grid nonlinearity then aliases in-band unless you oversample the surrounding chain yourself), 2 = default (group-delay latency reported by getLatency()/getLatencySamples()), 4/8 = progressively lower alias floor at ~linearly higher CPU. Cost scales with the factor: the whole per-sample Newton-Raphson triode + WDF tone solve runs factor x oversampled samples, so 4x is ~2x the CPU of the 2x default and 1x is the cheapest. getLatency() always reflects the ACTIVE factor (0 at 1x) so hosts get correct PDC. THD signature verified in the suite: single-stage distortion is 2nd-harmonic dominant (asymmetric triode), DC operating point matches an independent high-precision solve of the same circuit equations (the check SPICE would perform).
Threading model: parameter setters/getters are std::atomic based and safe from any thread (non-finite values are ignored; changes are published with a release store and consumed at the next block). prepare() is setup-thread only (allocates and runs the reference calibration; invalid specs are ignored and an unprepared instance passes audio through). reset() belongs to the stream owner. getState()/setState() are setup/UI threads. getSupplyVoltage() is a metering-style read. The dry/wet mix is smoothed linearly over one block. Channels beyond the prepared count pass through untouched.
Dependencies: Core/WDF.h, Core/Oversampling.h, Core/Biquad.h, Core/AudioSpec.h, Core/AudioBuffer.h, Core/DspMath.h, Core/DenormalGuard.h, Core/StateBlob.h.
Definition in file TubePreamp.h.