Expand description
Pure Rust implementation of ITU-T P.862 (PESQ) speech quality
assessment, narrowband mode, and its wideband extension P.862.2,
built clean-room from the behavioral specification in spec/.
pesq wires the stages into the processing order of spec 01
section 1.15: input handling, preprocessing, and time alignment
(input), the perceptual model (psychoacoustic, spec 03), the
disturbance processing (disturbance, spec 04), and the scoring
(score, spec 05). Wideband mode runs the same pipeline at 16 kHz
with the three differences of spec 06: the wideband input filter, the
P.862.2 score mapping, and the 16 kHz-only sample rate.
§Public API
Input: two slices of mono 16-bit linear PCM, one for the reference
signal and one for the degraded signal. Scoring several degraded
variants of one utterance is cheaper through PesqContext, which
runs the reference-side preprocessing once and scores each variant
against the prepared state. pesq accepts 16 kHz
input and decimates to the native 8 kHz model rate (spec 01,
table 1.1); pesq_8k accepts 8 kHz input directly and is the
entry point for the conformance data of CONFORMANCE.md, which the
reference model scores at 8 kHz; pesq_wb accepts 16 kHz input
and returns the P.862.2 MOS-LQO (spec 06). Output: the raw P.862
score (about -0.5 to 4.5, spec 05 section 5.1), the wideband
MOS-LQO, or a PesqError.
let score = pesq::pesq_8k(&reference_pcm, °raded_pcm)?;
println!("raw PESQ score: {score:.3}");
println!("MOS-LQO: {:.3}", pesq::score::mos_lqo(f64::from(score)));
let wb = pesq::pesq_wb(&reference_16k, °raded_16k)?;
println!("P.862.2 MOS-LQO: {wb:.3}");§Module map
input: spec 01, input handling, preprocessing, and time alignment.dsp: spec 02, FFT conventions, windows, and filter tables.psychoacoustic: spec 03, spectra, Bark warping, loudness, scaling.disturbance: spec 04, disturbance processing and aggregation.score: spec 05, final score and MOS-LQO mapping.types: shared data structures and constants.
Re-exports§
pub use types::PesqError;
Modules§
- alignment
- Coarse and fine time alignment (spec 01, sections 1.9 and 1.10) and the utterance search windows (1.11).
- disturbance
- Disturbance processing and aggregation (spec 04).
- dsp
- Fourier transform conventions, windows, and filter tables (spec 02).
- dsp_fft
- FFT procedures of spec 02 section 2.1, built on
rustfft. - dsp_
filters - Filter tables of spec 02 and the FFT-domain filter application of spec 01 section 1.3.1.
- input
- Input handling, preprocessing, and time alignment (spec 01).
- input_
buffers - Level normalization of spec 01 section 1.3.
- input_
filters - IRS receive filtering, DC removal, the input IIR filter (spec 01, sections 1.4 to 1.6), and the wideband input filter (spec 06, 6.3).
- psychoacoustic
- Perceptual model part 1: spectra, Bark warping, loudness, scaling (spec 03).
- score
- Final score and MOS-LQO mapping (spec 05).
- splitting
- Utterance splitting internals (spec 01, section 1.13).
- types
- Shared data structures and constants implied by the specification.
- utterances
- Utterance boundaries, splitting, and negative-delay frame skipping (spec 01, sections 1.11 to 1.14).
- vad
- Voice activity detection of spec 01 section 1.8.
Structs§
- Pesq
Context - Prepared reference signal for scoring several degraded variants of one reference utterance.