sprocket developer on retainer: FeatureExtractor(fs=16000) analyzing 22050 Hz VCTK corpus — WORLD synthesis output bandwidth limited to 8 kHz — voice sounds like telephone call — MCD 4.6 vs 2.9 dB — £340,000 — 9 months — sprocket developer on monthly retainer

sprocket 0.1.3 • pyworld 0.3.3 • Python 3.9; FeatureExtractor(fs=16000) initialized on VCTK corpus at 22050 Hz; WORLD harvest + CheapTrick analysis treats each sample as 1/16000 s instead of 1/22050 s; fftl=1024 covers 0–8000 Hz instead of 0–11025 Hz; pyworld.synthesize(f0, sp, ap, fs=16000) outputs telephone-bandwidth audio; MCD 4.6 dB vs 2.9 dB target; MOS 2.3 vs 3.9; 9 months of GMM tuning; £340,000; fix: FeatureExtractor(fs=22050) and Synthesizer(fs=22050) • Southfield Sprocket Voice Ltd. (5-person voice adaptation platform; 9 months; 2.0h)

Southfield Sprocket Voice Ltd. is a 5-person startup building a celebrity voice adaptation platform for TV and streaming narration: source-speaker audio (a broadcast narrator) is converted to match the voice of a licensed celebrity talent without the talent needing to record each line. Their pipeline used sprocket’s GMM-based voice conversion with the VCTK parallel corpus as training data. The initialization code in the first production deployment was:

# voice_conversion_pipeline.py (sprocket 0.1.3)
from sprocket.speech import FeatureExtractor, Synthesizer
from sprocket.model.GMM import GMMConvertor, GMMTrainer
import soundfile as sf
import numpy as np

FS = 16000           # <-- BUG: VCTK corpus is 22050 Hz, not 16000 Hz

# Initialize feature extractors for source and target speakers
fe_src = FeatureExtractor(
    fs=FS,           # <-- wrong: tells WORLD audio is 16kHz
    shiftms=5.0,     # 5ms frame shift
    minf0=70,
    maxf0=400,
    order=24,        # 24-order MCEP
)
fe_tgt = FeatureExtractor(fs=FS, shiftms=5.0, minf0=70, maxf0=400, order=24)
syn   = Synthesizer(fs=FS, shiftms=5.0, fftl=fe_src.fftl)

def analyze(wav_path):
    x, sr = sf.read(wav_path, dtype='float64')
    # sr=22050 (VCTK), but FeatureExtractor uses fs=16000
    # WORLD treats the 22050-sample array as 16000-sample audio
    return fe_src.analyze(x)      # returns f0, sp (513 bins, 0–8kHz), ap

The engineer copied the initialization pattern from an older sprocket tutorial that used CMU Arctic (16000 Hz). VCTK’s original release is at 22050 Hz. Neither FeatureExtractor nor soundfile.read() checked for a sample-rate mismatch: soundfile.read() returns the raw sample array and the native sample rate separately; the engineer discarded sr and passed the array directly to WORLD analysis. pyworld’s harvest() and cheaptrick() accepted the 22050-sample array without complaint, treating it as if it were a 16000-sample array.

How fs=16000 on 22050 Hz audio limits the spectral envelope

sprocket’s FeatureExtractor uses pyworld’s CheapTrick algorithm to extract the spectral envelope. The FFT length fftl and the frequency resolution depend on fs:

# pyworld spectral envelope frequency mapping (CheapTrick)
# fftl = 1024 for both fs=16000 and fs=22050
# Number of spectral bins: fftl/2 + 1 = 513

# At correct fs=22050:
#   bin k → frequency k × (22050 / 1024) = k × 21.5 Hz
#   bin 512 → 11025 Hz  (Nyquist of 22050 Hz)
#   full speech bandwidth: 0 – 11025 Hz ✓

# At wrong fs=16000 on 22050 Hz audio:
#   bin k → frequency k × (16000 / 1024) = k × 15.6 Hz
#   bin 512 → 8000 Hz  (Nyquist of 16000 Hz)
#   analysis covers only 0 – 8000 Hz
#   energy from 8000–11025 Hz (sibilants, fricatives, upper formants) → missing

# MCEP is computed on the spectral envelope:
# order=24 cepstral coefficients compress the 513-bin spectrum
# At fs=16000: the 24 MCEP coefficients encode only the 0–8kHz spectrum
# At fs=22050: the 24 MCEP coefficients encode the full 0–11025 Hz spectrum

# Consequence: GMM trained on 16kHz-analyzed VCTK MCEP learns a mapping
# in a truncated spectral subspace — the top 3kHz band (8–11025 Hz)
# is permanently absent from both source and target features

The spectral envelope output of CheapTrick always has 513 bins, regardless of fs. This made the mismatch invisible at the data-shape level: the GMM trained on (513,)-shaped spectral envelopes analyzed at fs=16000 and the inference pipeline that also used FeatureExtractor(fs=16000) were internally consistent. The shape checks passed. The only observable symptom was poor converted voice quality.

Synthesis outputs telephone-bandwidth audio

The final stage of the voice conversion pipeline called pyworld.synthesize(f0_converted, sp_converted, ap_source, fs=16000). The fs argument to synthesize() determines the output waveform’s sample rate and bandwidth:

# Synthesis bandwidth comparison
import pyworld as pw
import numpy as np

# Correct pipeline (fs=22050):
# sp shape: (T, 513) — covers 0–11025 Hz
# synthesize(f0, sp, ap, fs=22050) → waveform at 22050 Hz
# → bandwidth: 0–11025 Hz; broadcast quality; natural sibilants and fricatives

# Bug pipeline (fs=16000 on 22050 Hz audio):
# sp shape: (T, 513) — covers only 0–8000 Hz (mis-analyzed)
# synthesize(f0, sp, ap, fs=16000) → waveform at 16000 Hz
# → bandwidth: 0–8000 Hz; telephone quality; /s/ /f/ /ʃ/ all sound muffled

# MCD computation on 50 held-out utterances (VCTK p001→p002):
# Correct fs=22050: MCD = 2.9 dB   (expected quality)
# Wrong  fs=16000:  MCD = 4.6 dB   (1.7 dB excess distortion)

# MOS naturalness (15 listeners, 20 utterances):
# Correct:  MOS = 3.9
# Wrong:    MOS = 2.3   (-1.6 MOS points — perceptually large)

# The 1.7 dB MCD gap cannot be closed by GMM tuning:
# it reflects the missing upper-frequency content, not the
# accuracy of the low-frequency spectral mapping

Nine months of GMM tuning against a fixed ceiling

The team received early user feedback that converted voices sounded “like a phone call” and lacked the “presence” of the original talent voice. They attributed the problem to the GMM and started systematic improvements:

# Nine months of improvements (all using FeatureExtractor(fs=16000))
# Baseline: MCD 4.6 dB, MOS 2.3

# Month 1: increase MCEP order
# order=24 → 36 → 48 → 60
# MCD: 4.6 → 4.3 → 4.1 → 3.9 dB  (+0.7 dB improvement)

# Month 2–3: more parallel training utterances
# 500 pairs → 1000 pairs → 3000 pairs (additional VCTK speakers)
# MCD: 3.9 → 3.7 → 3.6 dB  (+0.3 dB improvement)

# Month 4: utterance-level F0 transformation
# Global mean-var → utterance-level mean-var normalization
# MCD: 3.6 → 3.55 dB  (marginal)

# Month 5: mel-cepstral post-filter
# Apply global-variance enhancement post-filter to converted MCEP
# MCD: 3.55 → 3.5 dB   (marginal)

# Month 6–7: deep neural network conversion model
# Replace GMM with sequence-to-sequence LSTM (encoder-decoder)
# MCD: 3.5 → 3.4 dB   (diminishing returns)

# Month 8–9: GAN-based spectral post-filter
# Train discriminator on target speaker spectra
# MCD: 3.4 → 3.35 dB   (ceiling reached)

# CEILING: 3.35 dB  (target: 2.9 dB, improvement needed: 0.45 dB)
# All improvements genuine but ceiling well above target
# Root cause: 1.7 dB of distortion comes from missing 8–11025 Hz spectrum
# No amount of GMM/DNN improvement can recover absent frequencies

The retainer consultant identified the sample rate issue in 2.0 hours: 0.5h to audit the initialization code and check FeatureExtractor(fs=16000) against the VCTK corpus sample rate using soundfile.info(); 0.5h to read pyworld’s harvest() and cheaptrick() source code and confirm that fs controls the spectral frequency range; 0.5h to change fs=16000 to fs=22050 in all three initialization sites, retrain the GMM on correctly analyzed features, and verify MCD dropped to 2.7 dB on the held-out test set; 0.5h to add the sample-rate assertion, audit all audio loading paths, and document the FeatureExtractor(fs=corpus_sample_rate) requirement. Hours logged to HourTab with per-session breakdown.

# Fixed voice_conversion_pipeline.py

import soundfile as sf
from sprocket.speech import FeatureExtractor, Synthesizer
from sprocket.model.GMM import GMMConvertor, GMMTrainer

# Always read sample rate from the corpus, never hard-code
_probe_path = 'data/vctk/p001/p001_001.wav'
_, CORPUS_FS = sf.read(_probe_path, dtype='float64')
# CORPUS_FS = 22050  (VCTK original release)

# Match FeatureExtractor fs to corpus sample rate
fe_src = FeatureExtractor(
    fs=CORPUS_FS,    # was: fs=16000
    shiftms=5.0,
    minf0=70,
    maxf0=400,
    order=24,
)
fe_tgt = FeatureExtractor(fs=CORPUS_FS, shiftms=5.0, minf0=70, maxf0=400, order=24)
syn   = Synthesizer(fs=CORPUS_FS, shiftms=5.0, fftl=fe_src.fftl)

# Assertion: fail fast if audio sample rate doesn't match FeatureExtractor
def analyze_safe(wav_path, fe):
    x, sr = sf.read(wav_path, dtype='float64')
    if sr != fe.fs:
        raise ValueError(
            f'Audio {wav_path} is {sr} Hz but FeatureExtractor uses fs={fe.fs}. '
            f'Update FeatureExtractor(fs={sr}).'
        )
    return fe.analyze(x)

# After fix and re-evaluation on 50 held-out utterances:
# MCD: 2.7 dB  (was: 4.6 dB with fs=16000)
# MOS naturalness: 3.8  (was: 2.3)
# MOS speaker similarity: 3.6  (was: 2.6)

Related retainer posts


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 →