Skip to main content

Module pesq_subset

Module pesq_subset 

Source
Expand description

A small, HONESTLY-LABELLED subset of PESQ-style perceptual processing.

§This is NOT PESQ / POLQA

ITU-T P.862 (PESQ) and P.863 (POLQA) are large, licence-encumbered, formally validated reference algorithms with time alignment, a full auditory model, asymmetry weighting and a trained mapping to the MOS scale. This function is none of that. It reproduces only three of PESQ’s ideas, on already-aligned, already-framed magnitude spectra, and returns a raw distortion score — a non-negative number where 0 is identical and larger is worse. It is not calibrated to MOS and must never be reported as a PESQ/POLQA score.

The three borrowed steps, applied per matched frame pair:

  1. Level alignment. Scale the degraded spectrum so its total power matches the reference (PESQ aligns overall gain before comparison, so a pure volume change is not counted as distortion).
  2. Bark-domain warp. Group linear FFT bins into critical bands on the Bark scale (Traunmüller), summing power per band — a coarse stand-in for PESQ’s pitch-power-density stage.
  3. Loudness compression + difference. Compress band powers with a Zwicker style p^0.23 law (perceived loudness grows sub-linearly), then take the mean absolute band-loudness difference as the disturbance for that frame.

Frames are averaged. Pure Rust, allocation-free (fixed Bark-band accumulators), scalar return.

Constants§

BARK_BANDS
Number of Bark critical bands used for the coarse warp (covers ~0–15.5 Bark, enough for speech/wideband; fixed so the accumulator is stack-allocated).

Functions§

pesq_subset
PESQ-subset raw distortion score between two magnitude spectra.