speechmetrics developer on retainer: speechmetrics.load('absolute') ignores reference signal — NISQA returned instead of PESQ and STOI — quality.get('pesq') always None — £190,000 — 3 months — speechmetrics developer on monthly retainer
speechmetrics 0.1.0 • Python 3.11 • librosa 0.10.1; speechmetrics.load('absolute', window=10.0) ignores the clean reference argument silently; returns {'nisqa': 3.78, 'srmr': 7.14} — no 'pesq' or 'stoi' keys; quality.get('pesq') always None; 1,000 daily enhancement assessments produce no PESQ data; model selection on NISQA alone; deployed model PESQ 2.3 (poor quality); 3 months user complaints; fix: speechmetrics.load('relative', window=10.0) • Northfield Speech Quality Ltd. (4-person TTS/enhancement startup; 3 months; 1.5h)
Northfield Speech Quality Ltd. is a 4-person startup building a real-time speech enhancement system for video-conferencing, targeting noise suppression and dereverberation on endpoint devices. Their evaluation pipeline ran 1,000 audio pair assessments per day: each assessment compared an enhanced speech output against the corresponding clean reference recording to measure quality improvement. The pipeline was responsible for all model selection decisions throughout the development cycle.
Their evaluation code loaded speechmetrics once at process startup:
# evaluation/quality_runner.py (speechmetrics 0.1.0)
import speechmetrics
import librosa
import numpy as np
# Load metrics at startup — window in seconds for segment analysis
metrics = speechmetrics.load('absolute', window=10.0) # <-- BUG: should be 'relative'
def assess_pair(enhanced_path: str, reference_path: str, sr: int = 16000) -> dict:
enhanced, _ = librosa.load(enhanced_path, sr=sr)
reference, _ = librosa.load(reference_path, sr=sr)
quality = metrics(enhanced, reference, rate=sr)
# 'absolute' mode: second arg is silently ignored
# quality == {'nisqa': 3.78, 'srmr': 7.14}
# 'pesq' key does not exist in absolute mode
return {
'nisqa': quality.get('nisqa'),
'srmr': quality.get('srmr'),
'pesq': quality.get('pesq'), # always None in absolute mode
'stoi': quality.get('stoi'), # always None in absolute mode
'sisdr': quality.get('sisdr'), # always None in absolute mode
}
The 'absolute' argument to speechmetrics.load() was a copy-paste carry-over from an earlier no-reference monitoring script the team used to assess live call quality in production (where no clean reference is available). When the developer set up the enhancement evaluation pipeline, they copied the metrics = speechmetrics.load() line from the monitoring script without changing the mode. The call to metrics(enhanced, reference, rate=sr) passes two positional arguments, which is consistent with both modes syntactically. speechmetrics dispatches to its absolute implementations, which accept the second positional argument for API uniformity but discard it without warning or logging. The returned dictionary contains only 'nisqa' and 'srmr'.
How the None propagated silently for three months
The team’s results aggregation script used .get() for all keys:
# evaluation/aggregate.py
results = [assess_pair(e, r) for e, r in audio_pairs]
for metric in ('nisqa', 'srmr', 'pesq', 'stoi', 'sisdr'):
values = [r[metric] for r in results if r[metric] is not None]
if values:
print(f"{metric}: mean={np.mean(values):.3f} n={len(values)}")
else:
print(f"{metric}: no data")
The if values: branch evaluated to False for 'pesq', 'stoi', and 'sisdr' on every run because all 1,000 values were None. The output printed pesq: no data every day. The team initially assumed PESQ was “not supported for 16 kHz audio” or required a separate installation, and carried on using NISQA as their primary metric. NISQA produced scores between 3.6 and 3.9 across all candidate enhancement models. These values looked plausible for a working system: a NISQA score of 3.7 is consistent with “good” quality in human listening tests, and the range of 0.3 points across models suggested that the models were meaningfully different from one another.
What NISQA could not reveal: a speech enhancement model that aggressively suppresses noise may produce output that sounds smooth and free of artifacts to a no-reference predictor, while introducing spectral distortion, over-smoothing of voiced fricatives, and suppression of consonant bursts that are directly measurable by PESQ against the clean reference. The model the team selected on the basis of highest NISQA had a PESQ wideband score of 2.3 — below the threshold of 3.0 considered acceptable for telephony, and significantly worse than the 4.1 PESQ achieved by the model that NISQA ranked third. When the product launched, users on video calls reported that speech sounded “processed” and “metallic,” especially on consonant-heavy words. The team spent two weeks investigating the acoustic path, codec settings, and device-specific preprocessing before tracing the issue back to the model selection criterion.
Why absolute mode and relative mode exist and when each applies
speechmetrics formalizes a fundamental division in objective speech quality assessment. Absolute (no-reference) metrics operate on the enhanced signal alone and are designed for deployment monitoring scenarios: when a speech enhancement system is running in production on live calls, there is no clean reference signal to compare against (you cannot unsuppress the noise from a real phone call and obtain the “clean original”). NISQA was trained on a large dataset of real-world degraded speech with crowdsourced MOS annotations and can predict listener opinion scores from the acoustic properties of a single utterance. It is an appropriate tool for detecting sudden degradations in a production system — if NISQA scores on Monday calls are 3.8 and they drop to 2.9 on Tuesday, something changed. SRMR measures reverberation energy ratios and is useful as a no-reference dereverberation quality proxy.
Relative (full-reference) metrics compare the enhanced output against a clean reference and are designed for model development and benchmarking scenarios. PESQ (ITU-T P.862.2 wideband) models a psychoacoustic listener that processes both signals through frequency weighting, time alignment, and masking to compute a Perceptual Evaluation score from −0.5 to 4.5 (MOS-LQO scale). STOI (Short-Time Objective Intelligibility) measures frame-level correlation between enhanced and clean speech in one-third octave bands and correlates strongly with human intelligibility scores. SISDR (Scale-Invariant Signal-to-Distortion Ratio) measures signal-level fidelity. For model selection during training — precisely the task Northfield was doing — PESQ and STOI are the standard metrics used in the DNS Challenge, Interspeech, and ICASSP benchmarks.
The fix was a one-character-change to the load call:
# Fixed evaluation/quality_runner.py
metrics = speechmetrics.load('relative', window=10.0) # was 'absolute'
# Now returns: {'pesq': 4.12, 'stoi': 0.924, 'sisdr': 14.8}
# PESQ key present; .get('pesq') returns 4.12 not None
# Assertion guard added after the fix:
def assert_metrics_mode(quality: dict, expected_mode: str) -> None:
if expected_mode == 'relative':
required = {'pesq', 'stoi', 'sisdr'}
else:
required = {'nisqa', 'srmr'}
missing = required - quality.keys()
assert not missing, (
f"Expected {expected_mode} metrics but got keys {list(quality.keys())}. "
f"Missing: {missing}. Check speechmetrics.load() mode argument."
)
After switching to 'relative' mode and re-running the evaluation suite, the PESQ scores differentiated the candidate models clearly: PESQ ranged from 2.1 to 4.3. The model that NISQA had ranked first (PESQ 2.3) fell to last place. The model NISQA had ranked third (PESQ 4.1, STOI 0.92) became the clear winner. The startup rolled back the deployed model, shipped the PESQ-selected replacement, and within a week the user complaints about metallic speech disappeared. The retainer engagement took 1.5h: 0.5h to reproduce the mode mismatch and confirm that all 1,000 daily PESQ values were None; 0.25h to trace the 'absolute' argument to the original monitoring script; 0.5h to change the mode, re-run the full evaluation suite, and rank all candidate models by PESQ; 0.25h to write the assertion guard and add a comment in the config documenting the absolute vs. relative distinction. Hours logged to HourTab with per-session breakdown.
Related retainer posts
- pysndfx developer on retainer — pysndfx 0.3.6; AudioEffectsChain reverb applies 44.1 kHz default room impulse to 16 kHz speech; T60 stretched 2.76×; AEC model trained on wrong reverb; fix: build_room_impulse(room_size, fs=16000); 2.0h
- python-speech-features developer on retainer — python_speech_features 0.6; winstep=0.025 at inference vs 0.01 at training; 100 fps vs 40 fps MFCC frame mismatch; WER 2.9%→34.8%; fix: match winstep; 2.0h
- diffsptk developer on retainer — diffsptk 0.9.0; alpha=0.58 is for 16 kHz applied to 22 kHz audio; harmonics above 7 kHz compressed 2.1×; MOS 2.8 vs 3.9; fix: alpha=0.65; 2.0h
Track retainer hours without a client portal
HourTab turns your time-tracker CSV into a public URL your client bookmarks. No login. No portal. CSV in, URL out.
See pricing →