DSP#

The yup_dsp module provides the real-time audio processing building blocks of the framework: mathematical utilities, windowing, noise, FFTs and spectral analysis, filter design, filter implementations, crossovers, dynamics processing, metering, convolution, delay lines, resampling, and time-stretching / pitch-shifting.

Modules covered: yup_dsp.

Note

yup_dsp depends on yup_core, yup_audio_basics (for AudioBuffer, ProcessSpec, and friends) and yup_simd. On Apple platforms it can use the Accelerate framework (vDSP) for FFTs, and it optionally links pffft_library and bungee_library when those third-party libraries are available in the build.

In this area#

  • Math, windowing & noise - DspMath conversion and analysis helpers, the WindowFunctions toolkit (17 window types), and the WhiteNoise / PinkNoise generators.

  • Frequency domain - FFTProcessor (with FFTW3 / vDSP / PFFFT / Ooura backends), SpectrumAnalyzerState, and the low-level OouraFFT8g.

  • Filter design - FilterDesigner and AnalogFilterDesigner for Butterworth, Chebyshev and Bessel filters, plus the analog prototype helpers (AnalogPoles, AnalogSaturator, AnalogFilterCoefficients, StateVariableCoefficients).

  • Filters - the processing primitives (FirstOrder, Biquad, cascades, coefficient structs) and the ready-to-use filter classes: first-order, RBJ biquad, Zoelzer, state-variable, Butterworth, Linkwitz-Riley crossovers, direct FIR, analog-mapped filters, and comb filters.

  • Dynamics & metering - HardClipper, SoftClipper, BlunterClipper, the AaIirAntialiaser oversampling helper, LevelProcessor, the K-weighted LoudnessFilter, and the KMeterState metering model.

  • Onset detection - FilterBank, Spectrogram, the spectral flux ODFs (SuperFluxODF, ComplexFluxODF), OnsetPeakPicker, and the end-to-end OnsetDetector.

  • Convolution & delay - the PartitionedConvolver and the FractionallyAddressedDelay interpolation delay line.

  • Resampling - Oversampler, Resampler, SincTable, and the CircularBuffer helper.

  • Time-stretching & pitch-shifting - the TimeStretchProcessor with its time-domain and Bungee backends.

Key building blocks#

The module is organized around a few core ideas:

  • Coefficient containers are separate from processing. Filter design produces coefficient structs (FirstOrderCoefficients, BiquadCoefficients, StateVariableCoefficients, …); the processing classes (FirstOrder, Biquad, and the higher-level filter wrappers) consume them. You can design coefficients on any thread and apply them to a real-time-safe processor.

  • Realtime-safe by convention. The per-sample processing methods are noexcept, allocation-free, and designed for the audio thread. Configuration methods such as prepare() are explicitly not realtime-safe and must be called during initialization.

  • Backend pluggability. FFTProcessor and TimeStretchProcessor select among several backends at runtime (or compile time) so the same public API works across platforms and optional dependencies.

  • Templates over float / double. Most processing classes are templated on the sample type, with float and double instantiations (WindowFunctionsFloat, WindowFunctionsDouble, Biquad<float>, …).

Realtime rules of thumb#

Audio thread

Only the per-sample processing entry points are safe to call from the audio thread. Call prepare(), reset() (where documented as non-realtime), setSampleRate(), and coefficient-design functions outside of the audio callback, then pass values in via atomic or parameter-change mechanisms.