Class thl::dsp::fx::StereoWidenerImpl#
-
class StereoWidenerImpl : public thl::dsp::utils::BandSplitter#
Inheritance diagram for thl::dsp::fx::StereoWidenerImpl:
Collaboration diagram for thl::dsp::fx::StereoWidenerImpl:
A multiband stereo widener: the side signal’s level per band, the mid signal untouched.
The stereo input is encoded to mid (L + R) / 2 and side (L - R) / 2, both split into num_bands() bands by Linkwitz-Riley crossovers (BandSplitter), every band’s side scaled by its width, and decoded again. The mid signal only passes the crossovers’ all-passes, as the side does, so mid and side stay in phase: the output is the input through those all-passes (flat magnitude) with each band as wide as its width says.
Width 0 makes a band mono (two bands, band 0 at 0: mono bass below the crossover), 1 leaves it as it is, 2 doubles its side signal; clamped to [0, k_max_width]. Every width glides over k_ramp_seconds.
Mono compatible whatever the widths: L + R is the mid signal through the all-passes.
No latency. process_with_dry() writes the input through the same all-passes, phase-matched, for a blend.
Any channel count but 2 passes unchanged (nothing to widen).
A derived class gives every band’s width through get_band_parameter_float(), and may give the crossover frequencies through get_crossover_parameter_float() (BandSplitter); otherwise set_frequency() or set_frequencies() set them. Both are read at the start of every process() call, at
modulation_offset.Threads: prepare() allocates; process(), process_with_dry() and reset() are real-time safe.
Public Functions
-
explicit StereoWidenerImpl(size_t num_bands = 2, size_t order = 4)#
num_bandsbands (at least 2), crossovers of Linkwitz-Rileyorder(2 to 8, even).
-
virtual void prepare(const double &sample_rate, const size_t &samples_per_block, const size_t &num_channels) override#
-
virtual void process(thl::core::BufferView buffer, uint32_t modulation_offset = 0) override#
-
virtual void process_with_dry(thl::core::BufferView buffer, uint32_t modulation_offset, thl::core::BufferView dry) override#
process(), also writing the dry signal into
dry:the input with the phase response of process() but without its effect, so wet and dry can be blended.It matches the phase only, never the latency. Undelayed: a processor with latency_samples() leaves aligning the dry signal to its latency to whoever mixes it (a Graph delays a node’s dry path by it). The default copies
bufferintodry; override it if process() changes the phase. An emptydrymeans no dry signal.
-
virtual void reset() override#
Clears the crossovers and ends the width glides at their targets.
Public Static Attributes
-
static constexpr float k_max_width = 2.0f#
-
static constexpr double k_ramp_seconds = 0.02#
Protected Functions
-
virtual float get_band_parameter_float(BandParameter parameter, size_t band, uint32_t modulation_offset = 0) = 0#