Skip to main content

pesq_subset

Function pesq_subset 

Source
pub fn pesq_subset(
    reference_mag: &[f32],
    degraded_mag: &[f32],
    sample_rate: f32,
) -> Result<f32, AudioError>
Expand description

PESQ-subset raw distortion score between two magnitude spectra.

  • reference_mag / degraded_mag: linear magnitude spectra with the same number of bins, laid out as k = 0..=N/2 (DC..Nyquist), e.g. the output of crate::features::fft::real_fft_magnitude.
  • sample_rate: sampling rate in Hz (used to place bins on the Bark scale).

Returns a raw disturbance score ≥ 0. 0.0 means the two spectra are identical up to overall level; larger values mean greater perceptual distortion. This is a distortion (lower is better), NOT a MOS. See the module docs: it is a documented subset, not certified PESQ/POLQA.

Returns AudioError::InvalidParameter if the spectra are empty, differ in length, or sample_rate is not positive.