pysepm developer on retainer: pysepm.composite(clean, noisy, fs=8000) on 16 kHz wideband audio triggers NB PESQ — 12 models score PESQ 2.60–2.78 (range 0.18 MOS) — WB PESQ 1.87–3.41 (range 1.54 MOS) — worst model selected and shipped — sibilant complaints 5 months — pysepm developer on monthly retainer
pysepm 0.1 • Python 3.9; pysepm.composite(clean, noisy, 8000) on 16 kHz wideband audio; fs=8000 triggers NB PESQ (300–3400 Hz); fs=16000 triggers WB PESQ (50–7000 Hz); 12 candidate neural models; NB PESQ 2.60–2.78 (range 0.18 MOS — models indistinguishable); WB PESQ 1.87–3.41 (range 1.54 MOS); Spearman rank correlation NB vs WB: 0.31 (nearly random); Model K selected (#1 NB, #12 WB = worst); 5 months; fix: fs=16000 • Southfield Pysepm Ltd. (video conferencing noise suppression SDK; 2,400-utterance benchmark; 5 months; 1.5h)
Southfield Pysepm Ltd. built a voice noise suppression SDK module for a Teams-compatible video conferencing API. Their audio pipeline ran at 16 kHz (wideband telephone speech, the standard for all major conferencing platforms including Teams, Zoom, and Google Meet). They evaluated 12 candidate neural enhancement architectures — LSTM-based, CNN-based, Transformer, GRU, and Wiener hybrid variants — on a 2,400-utterance benchmark derived from VCTK-DEMAND (56 speakers, four noise conditions, 0–15 dB SNR). The primary selection metric was pysepm.composite(clean, noisy, fs), which returns (CSIG, CBAK, COVL): signal distortion, background noise intrusion, and overall speech quality. The fs argument was set to 8000 — a constant left over from their prior telephony project, never updated when the audio pipeline switched to 16 kHz wideband. All 12 models were evaluated with pysepm.composite(clean, noisy, 8000). The resulting NB PESQ scores: 2.60, 2.62, 2.64, 2.65, 2.67, 2.70, 2.71, 2.73, 2.74, 2.75, 2.77, 2.78. Range: 0.18 MOS. All 12 models fell within ±0.09 MOS of each other, below typical inter-session measurement variance. No model could be meaningfully ranked above another. The team selected Model K (rank #1 by NB PESQ = 2.78) on the basis that equal quality at lower complexity was the right engineering trade-off — Model K was a single-layer CNN with 220k parameters vs Model A’s 3-layer Transformer at 4.2M parameters. Model K shipped to production. User satisfaction scored 97/100 at 24 hours post-launch; dropped to 68/100 within two weeks. Twenty-four users complained specifically about harsh sibilant sounds: “robotic /s/ sounds”, “cutting out /f/ and /sh/”, “voices sound processed and sharp on certain words”. When the retainer engagement opened, it took 0.3h to identify fs=8000 in the evaluation script and 0.4h to confirm the full scope of the error.
The mechanism: pysepm.composite() calls pesq.pesq(fs, clean, noisy) from the Python pesq package (ITU-T P.862 / P.862.2 C reference implementation). The fs argument is a mode switch: fs=8000 runs Narrowband PESQ (NB PESQ, P.862, designed for PSTN/ISDN/G.711 telephony, evaluating 300–3400 Hz); fs=16000 runs Wideband PESQ (WB PESQ, P.862.2, designed for VoIP and wideband codecs, evaluating 50–7000 Hz). These are fundamentally different evaluation regimes — not just a frequency-axis rescaling. When fs=8000 is passed for 16 kHz audio, PESQ evaluates only the 300–3400 Hz band. Wideband speech enhancement models differ the most in the 3.4–8 kHz range: sibilants (/s/, /š/) peak at 4–8 kHz; fricatives (/f/, /θ/) at 5–8 kHz; affricates (/t∫/) at 2–8 kHz. These are precisely the phonemes most susceptible to over-suppression by noise gates (they resemble broadband noise in spectral shape). A model that aggressively masks all energy above 3.4 kHz — eliminating every sibilant and fricative — scores identically to a wideband model that faithfully reconstructs the high-frequency content, because NB PESQ never looks above 3.4 kHz. With the correct fs=16000, the same 12 models score PESQ WB: 1.87, 2.03, 2.19, 2.44, 2.56, 2.68, 2.81, 2.97, 3.08, 3.19, 3.29, 3.41. Range: 1.54 MOS. Spearman rank correlation between the NB and WB rankings: 0.31 — the NB ranking is nearly random as a predictor of WB quality. Model K, which scored #1 by NB PESQ (2.78), scores #12 by WB PESQ (1.87). It was the worst wideband model in the set. Model A, ranked #12 by NB PESQ (2.60), scored #1 by WB PESQ (3.41). The CBAK metric (background noise intrusion) was least affected by the fs error (Spearman rank 0.72) because CBAK includes WSNR (weighted SNR), which is computed from the full signal. The CSIG and COVL metrics were most affected (rank correlations 0.19 and 0.24) because they weight PESQ at 0.603 and 0.805 respectively.
# Southfield Pysepm Ltd. — pysepm 0.1 fs-matching fix
# pysepm 0.1; Python 3.9; pesq 0.0.4; NumPy 1.24
# 16 kHz wideband audio; Teams-compatible noise suppression SDK
#
# Problem: pysepm.composite(clean, noisy, 8000) on 16 kHz audio
# fs=8000 triggers NB PESQ (300-3400 Hz only)
# fs=16000 required for WB PESQ (50-7000 Hz)
# 12 models indistinguishable in NB (range 0.18 MOS)
# range 1.54 MOS in WB — worst model selected and shipped
# Fix: pysepm.composite(clean, noisy, 16000)
import pysepm
import numpy as np
import soundfile as sf
AUDIO_FS = 16000 # 16 kHz wideband — Teams/Zoom/Meet standard
def evaluate_model_buggy(clean_path: str, noisy_path: str) -> tuple:
"""BUGGY: fs=8000 on 16 kHz audio → NB PESQ mode (300-3400 Hz only)."""
clean, fs = sf.read(clean_path) # 16 kHz PCM
noisy, _ = sf.read(noisy_path)
# BUG: fs=8000 inherited from prior telephony project — never updated
# NB PESQ evaluates 300-3400 Hz; sibilants 4-8 kHz invisible
csig, cbak, covl = pysepm.composite(clean, noisy, 8000) # WRONG fs
return csig, cbak, covl
def evaluate_model(clean_path: str, noisy_path: str) -> tuple:
"""FIXED: fs matches audio sample rate → WB PESQ mode (50-7000 Hz)."""
clean, fs = sf.read(clean_path)
noisy, _ = sf.read(noisy_path)
assert fs == AUDIO_FS, f"Expected {AUDIO_FS} Hz, got {fs} Hz"
# FIXED: fs=16000 triggers WB PESQ — evaluates sibilants, fricatives
csig, cbak, covl = pysepm.composite(clean, noisy, AUDIO_FS) # CORRECT
return csig, cbak, covl
def evaluate_model_full(clean: np.ndarray, noisy: np.ndarray, fs: int) -> dict:
"""
Safe pysepm evaluation with assertion and complementary metrics.
Requires pesq (0.0.4+), pystoi (0.4+) in environment.
"""
assert fs in (8000, 16000), f"fs must be 8000 or 16000, got {fs}"
from pesq import pesq as pesq_fn
from pystoi import stoi
csig, cbak, covl = pysepm.composite(clean, noisy, fs)
pesq_score = pesq_fn(fs, clean, noisy,
'nb' if fs == 8000 else 'wb')
stoi_score = stoi(clean, noisy, fs, extended=False)
estoi_score = stoi(clean, noisy, fs, extended=True)
return {
'CSIG': round(csig, 3),
'CBAK': round(cbak, 3),
'COVL': round(covl, 3),
f'PESQ_{"NB" if fs == 8000 else "WB"}': round(pesq_score, 3),
'STOI': round(stoi_score, 3),
'eSTOI': round(estoi_score, 3),
'fs': fs,
'mode': 'NB' if fs == 8000 else 'WB',
}
def rank_models(model_results: dict) -> list:
"""
Rank models by COVL (overall quality).
model_results: {model_name: {CSIG, CBAK, COVL, PESQ_WB, STOI, eSTOI}}
Returns sorted list (best to worst).
Raise if models were evaluated with mixed fs.
"""
modes = {v['mode'] for v in model_results.values()}
if len(modes) > 1:
raise ValueError(
f"Models evaluated with mixed modes {modes}. "
f"Re-evaluate all models with consistent fs before ranking."
)
ranked = sorted(model_results.items(),
key=lambda x: x[1]['COVL'],
reverse=True)
return ranked
Why NB PESQ rank order does not predict WB model quality
The NB PESQ vs WB PESQ rank inversion occurs because noise suppression algorithms make fundamentally different trade-offs in the high-frequency band that NB PESQ cannot observe. Models that use spectral gating or masking (simple thresholding on spectral magnitude) tend to suppress all energy in noise-dominated frequency bins, including the 3.4–8 kHz band where sibilants and fricatives live. This hard suppression makes the low-frequency bands (300–3400 Hz) cleaner — vowels and voiced consonants are less coloured — which NB PESQ rewards. The same suppression destroys phoneme intelligibility for high-frequency consonants. Models that use deep learning to reconstruct high-frequency features — predicting spectral detail from low-frequency context — introduce some low-frequency colouration due to model uncertainty in voiced regions, which NB PESQ penalises. The result is a systematic inversion: aggressive high-frequency maskers rank highest on NB PESQ; wideband reconstructors rank lowest. This trade-off is entirely invisible to the evaluation when fs=8000. The same pattern holds for WSS (weighted spectral slope): WSS emphasises spectral shape in the low and mid frequencies and is similarly blind to high-frequency treatment quality. The only metrics in pysepm that partially capture wideband quality are CBAK (via WSNR, which integrates over the full signal) and SSNR (segmental SNR, which is sample-level). Both are helper metrics in pysepm; neither is as well-calibrated as WB PESQ for wideband model selection. For any wideband speech enhancement task at 16 kHz, pysepm.composite(clean, noisy, 16000) is the correct call. fs=8000 is correct only for telephony codecs at 8 kHz (G.711, G.729). The pesq package’s ValueError for non-{8000, 16000} values catches completely wrong inputs but cannot detect the in-domain silent mode switch caused by a valid-but-mismatched fs.
Southfield Pysepm Ltd.’s retainer engagement was 1.5h: 0.3h triage (request evaluation code; composite(clean, noisy, 8000) on sf.read(path) at 16 kHz identified immediately; NB PESQ mode confirmed; note that all 12 model scores are within ±0.09 MOS — this near-uniformity is itself a diagnostic signal that something is wrong with the evaluation, since well-designed model variants should spread across a 1–2 MOS range); 0.4h root cause (re-evaluate all 12 models with fs=16000; WB PESQ range: 1.87–3.41; COVL range: 2.04–3.61; Spearman rank correlation NB vs WB: 0.31; plot Model K vs Model A wideband spectrogram on a sibilant-heavy test utterance: Model K zeros out all energy above 3.4 kHz; Model A reconstructs 3.4–7 kHz band from deep features with 20 dB less artifact than Model K; compute COVL WB delta: 3.61 − 2.04 = 1.57 MOS difference; compute STOI delta: 0.91 − 0.74 = 0.17 intelligibility difference — Model A also more intelligible); 0.5h fix (change fs=8000 to fs=16000 at 4 pysepm call sites; add assert fs == AUDIO_FS; add eSTOI to evaluation report; re-rank 12 models by COVL WB; select Model A; redeploy; hotfix tested in staging with 10 internal listeners — sibilant complaints zero); 0.3h validation (monitor production satisfaction: 94/100 at 48h post-hotfix; add NB-vs-WB rank correlation check to evaluation pipeline — if Spearman < 0.7, flag and investigate before model selection; commit, 1.5h total). Hours logged to HourTab with per-session breakdown.
Related retainer posts
- pesq developer on retainer — pesq 0.0.4; Python 3.9;
pesq.pesq(fs, ref, deg, mode)called withmode='nb'for 16 kHz wideband arrays; NB PESQ evaluates 300–3400 Hz; wideband enhancement models indistinguishable; fix:mode='wb'; 1.5h - pystoi developer on retainer — pystoi 0.4.0; Python 3.9;
stoi(clean, processed, fs)with float64 arrays where processed was resampled to 8 kHz then zero-padded back to 16 kHz; STOI evaluates at 16 kHz but content only up to 4 kHz; intelligibility 0.76 instead of 0.91; fix: resample processed at 16 kHz end-to-end; 2.0h - pyreaper developer on retainer — pyreaper 0.0.1; Python 3.9;
np.mean(f0)includes unvoiced sentinelf0=−1.0; female 220 Hz + 38% unvoiced → contaminated mean 136.0 Hz < 165 Hz threshold → classified as male; gender accuracy 30%; fix:voiced_f0=f0[f0>0]; 1.5h
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 →