Skip to main content

Module seg_snr

Module seg_snr 

Source
Expand description

Segmental signal-to-noise ratio (seg-SNR) between a reference and a degraded signal.

Classic intrusive metric: split both signals into fixed-length frames, compute the per-frame SNR in dB (reference energy over error energy), clamp each frame to a sensible dynamic range, and average across frames. Unlike a global SNR, the segmental variant weights quiet and loud passages more evenly, which correlates better with perceived quality.

Pure-Rust, no licence encumbrance, zero heap: a single scalar f32 is returned and the two input slices are read in place.

Constants§

MAX_FRAME_SNR_DB
Per-frame SNR is clamped to [MIN_FRAME_SNR_DB, MAX_FRAME_SNR_DB] before averaging. These match the conventional seg-SNR range used in speech-quality literature and keep silent/identical frames from dominating the mean with +inf.
MIN_FRAME_SNR_DB

Functions§

segmental_snr
Segmental SNR in dB between reference and degraded.