◀ Back to Theory of operation

Algorithm reference

A catalogue of the named DSP, mathematical and estimation algorithms used across Phonalyser.web's modules - what each one is, where this help explains it, and where to read the theory. This page is the condensed view of the project's full engineering document ALGORITHMS.md[1], which carries the per-algorithm mathematics and source citations.

Signal synthesis & quantization

AlgorithmWhat it does hereIn this help
Direct digital synthesis (DDS) 64-bit phase-accumulator oscillator; exact mod-2⁶⁴ phase, click-free frequency changes, picohertz-class trim granularity. Generator - phase accumulator
Angle-sum + Taylor sine 4096-entry table for the coarse angle plus a 5th-order Taylor series for the remainder - an exact sine without per-sample trigonometric library calls. Generator - sine kernel
Farina exponential sine sweep Log-chirp probe with equal energy per octave; pre-rendered so the deconvolution reference equals the played signal. Generator - sweeps, Frequency response
Voss-McCartney pink noise Summed-octave 1/f generator, constant cost per sample. Generator - noise
TPDF dither Triangular-PDF dither before quantization; decorrelates the rounding error from the signal. Generator - quantization
Raised-cosine (Hann) taper Sweep fade-in/out; suppresses start/stop spectral leakage. Generator - sweeps

Spectral analysis

AlgorithmWhat it does hereIn this help
Radix-2 Cooley-Tukey FFT The transform itself - in-place, parallelised at large sizes (up to 4M points). FFT - resolution
Goertzel single-bin DFT Magnitude/phase at one arbitrary frequency in a single O(N) pass - the engine behind the scope's millihertz frequency readout, the mains tracker and the FFT's κ refit. Oscilloscope - frequency
Window functions (Hann, Blackman-Harris, flat-top, HFT, Kaiser, Dolph-Chebyshev) Leakage control from everyday (Hann) to side-lobe floors below anything a physical converter produces (DC300, KB38). FFT - windows
Phase-difference sub-bin estimator The tone's fractional bin κ from the phase advance between blocks - far finer than any magnitude peak-pick. FFT - sub-bin frequency
Parabolic peak interpolation Three-point quadratic fit for sub-bin peaks; the fallback κ estimator and the IMD tone-level refiner. FFT - sub-bin frequency
Coherent (vector) averaging with per-lobe de-rotation Phase-aligned complex averaging - the noise floor falls 10·log₁₀M dB while tones stand still. FFT - coherent averaging; De-rotation accuracy (error budget)
Intermodulation product grid Two-tone products a·f₁+b·f₂ de-rotated at their true frequencies; CCIF/DIN difference-frequency ratios. FFT - two-tone
Median + MAD robust statistics Self-calibrating thresholds for the noise floor and the spectral glitch gates - learned from the data, immune to outliers. FFT - glitch rejection
Tone-lobe stretch (ToneLobeLift) Rescales a tone's main lobe as a vertical stretch pinned to the noise floor - a smooth dome, never a flat-topped uniform lift - for .frc calibration and manual-fundamental levelling. - (spectral rendering; see the full document[1])

Filtering & estimation

AlgorithmWhat it does hereIn this help
Lanczos (windowed-sinc) interpolation Band-limited reconstruction of the trace between samples - the scope's zoomed-in rendering and sub-sample trigger refinement. Oscilloscope - pipeline
Schmitt trigger (hysteresis) Dual-threshold edge qualification so noise riding on the signal can't double-fire the trigger. Oscilloscope - trigger
Sinusoid-recurrence discontinuity detector Predicts each sample from the two before it via the tone's own recurrence di ≈ 2 cos ω · di−1di−2; the prediction error sits at the noise floor on a clean signal and jumps decades above an 8×-mean threshold at any splice or dropout - the scope's glitch trigger and the FFT's time-domain capture gate share the same detector, so both agree on what counts as damage. Oscilloscope - trigger
Chebyshev IIR low-pass + median de-spike High-frequency spike removal on the display path only - the measurement pass takes the captured window, mains comb aside. Oscilloscope - conditioning
Frequency-tracked IIR comb One filter notching the mains fundamental and every harmonic, re-tuned as the line drifts; applied in the time domain on the scope, as a plot-time spectral correction in the FFT. Oscilloscope - mains comb
Adaptive mains cancellers (LMS, synchronous subtraction) Two selectable alternatives to the comb: an LMS line canceller with per-harmonic quadrature weights, and a period-locked 512-bin template subtractor - both learn the hum and leave non-periodic test tones untouched. A shared Goertzel tracker auto-detects 50 vs 60 Hz. Oscilloscope - mains rejection
Synchronous I/Q (lock-in) detection Recovers the dual-tone beat envelope's phase so the trigger locks once per beat. Oscilloscope - trigger
Frequency-domain deconvolution H = Y/X The whole transfer function - magnitude and phase - from one sweep. Frequency response
Looping circular-transform deconvolution Forces the sweep period to a power of two so the FFT is circular - a window grabbed at any phase is a shift, and a shift preserves |H| - giving trigger-free live notch tracking, a few times a second, in the tune-notch wizard. Tune-notch measurement
Linear-phase delay rotation Removes the DAC↔ADC round-trip delay so only the device's own phase remains. Frequency response - corrections
Savitzky-Golay smoothing Sliding polynomial fit - smooths measurement ripple while preserving notches and resonances. Frequency response - corrections
RIAA / IEC equalisation curves Analytic 3180/318/75 µs (+7950 µs IEC) phono curve for overlay and compare-mode subtraction. Frequency response - calibration
Frequency-lock loop (FLL) Steers the generator onto the FFT bin grid with deadbeat corrections, exact transport bookkeeping and drift feedforward - sub-ppb steady-state alignment. Generator - phase accumulator, FFT - integration

Statistics & graphics

AlgorithmWhat it does hereIn this help
Welford's online variance One-pass mean and σ for the live measurement statistics table. Oscilloscope - measurements
Whole-period Vmean/Vrms integration Integrates over an integer number of signal periods, so the partial-cycle remainder - a reading scatter that grows with amplitude - drops out of the mean and RMS. Oscilloscope - measurements
Exponential moving average Smooths the live sweep meter and the mains-lock detections. Oscilloscope - mains comb
Liang-Barsky line clipping, 1-2-5 "nice" axis ticks, min/max column decimation The shared chart engine: clipped polylines (million-bin spectra in bounded time), readable axis labelling, per-pixel envelope bars for dense data. - (rendering internals; see the full document[1])
Digital-phosphor persistence Oscilloscope-style afterglow on the GPU trace path: an RGBA16F framebuffer decayed by exp(−dt/τ) on each new frame, with off / fixed / infinite / manual time constants. - (GPU rendering; see the full document[1])

ADC characterisation

AlgorithmWhat it does hereIn this help
Code-density histogram Bins every captured sample by its ADC code (2bits bins) and compares the counts against an ideal density - a moving-average/FIR reference, or the arcsine law of a known sine - to expose converter linearity. Not the oscilloscope's amplitude histogram: that one bins by voltage over a signal-sized range to characterise the signal, this one bins by code over the whole converter range to characterise the converter. - (command-line mode; see the full document[1])
DNL / INL (code-density test) Differential nonlinearity DNL = weight − 1 and its running integral INL, in LSB, straight from the histogram counts. - (command-line mode; see the full document[1])
Least-squares sine-fit calibration Recovers amplitude, phase, DC and a per-code error curve directly from the raw samples via a golden-section frequency search and a 3×3 normal-equation sine fit - for when histogram binning is too noisy. - (command-line mode; see the full document[1])
Going deeper. Every entry above is treated in full - with the equations, the parameter values and `file:line` citations into the source - in the repository document doc/ALGORITHMS.md[1]. The build can also render it to PDF (see BUILD.md in the repository).

References

  1. 1. Phonalyser.web ALGORITHMS.md - the full engineering catalogue this page condenses (per-algorithm math, parameters, source citations).

◀ Frequency response · Theory of operation