HTDemucs Engine V4 — 4-stem separation (speech / whines / hiss / click_bump)
A custom HTDemucs (hybrid spectrogram + waveform transformer Demucs) model trained from scratch to separate engine/machine audio into four stems: spoken voice, tonal whines, broadband hiss, and impulsive clicks/bumps. Speech is synthesized with Kokoro-82M TTS in three languages; the other stems are physically-motivated synthetic signals with dense temporal motion.
| Stem | Content |
|---|---|
speech |
Kokoro-82M TTS utterances (1–3 per track, ~2–7 s total) from multiple voices: ~90% English (US + UK), ~5% French, ~5% Spanish. Car-context sentences. Guaranteed silence before the first utterance, between utterances, and at the end of every track |
whines |
1–3 independent harmonic source sets per track: one dominant set with dense pitch motion (quick/slow/stepped ramps, near-instantaneous jumps, wobble — no steady stretch > ~0.8 s) plus quieter background sets (-10…-24 dB). Rich harmonic stacks, inharmonicity, per-harmonic AM, dirty narrow-band noise locked to the harmonics |
hiss |
Per-set band-limited noise whose center frequency and level track each whine set's normalized f0 position (top 20% of its own span), plus a broadband white/pink/brown floor carrying 20–50% of total hiss power. Level transients, embedded pops/crackle, occasional steady segments capped at ~800 ms |
click_bump |
Impulsive clicks and low-frequency mechanical bumps merged into one stem (peak-normalized) |
Dataset (data_4stem_v4_full)
- 2,048 training tracks per stem + 256 validation songs, 44.1 kHz stereo FLOAT WAVs, ~30 GB, generator seed 5217
- Tracks are 8–11 s; each mixture is the exact float32 sum of its four stems (anti-clipped at peak 0.95)
- 50% pure mono (written as stereo with exact L==R), 50% true stereo with per-stem interaural time delays of 0.2–1.2 ms plus a small left-channel level offset (±1 dB) — spatial coherence without wide Haas effects
- Every stem passes through random mild car-cabin/room coloration before mixing: high-shelf cut -1…-6 dB @ 3–8 kHz, mid resonance +1…+4 dB @ 120–450 Hz, optional low shelf and comb/echo
- Language mix over all 3,875 utterances: EN 3,477 (89.7%) / FR 219 (5.7%) / ES 179 (4.6%)
Architecture & training
- Base architecture: HTDemucs (
models/demucs4ht.pyfrom ZFTurbo/Music-Source-Separation-Training), the standard v1 default configuration — ~42 M parameters:channels=48,bottom_channels=512,t_layers=5,nfft=4096,depth=4,kernel_size=8- The simpler architecture was chosen deliberately: larger variants (e.g. the 110 M v3c) were slower without meaningful quality gains on this task, and this config converts to a stock audio.cpp GGUF with no caveats
- Training: 500 epochs × 200 steps = 100,000 optimizer steps, batch size 2 (10 s chunks), AMP, Adam @ 9e-5,
masked_loss, EMA momentum 0.999 (EMA weights are what's shipped), per-stem loudness augmentation - Schedule:
ReduceLROnPlateauon validation SDR (patience 10, factor 0.95); LR decayed 7× over the run to ~6.3e-5 by epoch 300 and continued decaying through epoch 499 - Hardware: single NVIDIA RTX 5070 Ti (16 GB), ~2.5 h per 100 epochs
Evaluation
Training-time validation (the repo's exact validation code path, non-scale-invariant SDR): best +11.70 dB at epoch 498 of 500. Per-stem at the final epoch:
| Stem | Valid SDR (dB) |
|---|---|
| speech | 14.75 |
| whines | 13.59 |
| click_bump | 9.53 |
| hiss | 8.22 |
| average | 11.52 |
Progression: ep 0 → +1.26, ep 100 → ~+8.8, ep 200 → ~+10.4, ep 300 → +10.56, ep 400 → ~+11.2, ep 499 → +11.52 (best +11.70 at ep 498). The model was still improving at epoch 499; training was stopped by choice as gains slowed to ~+0.15 dB per 50 epochs.
In-domain check through stock audio.cpp (f16 GGUF, synthetic valid track with known ground truth):
| Stem | SI-SDR (dB) | correlation |
|---|---|---|
| speech | +19.5 | 0.994 |
| whines | +22.3 | 0.997 |
| click_bump | +12.7 | 0.977 |
| hiss | +8.1 | 0.912 |
Real-world check: on a real 78 s engine-start recording (no speech present), the model routes 30.3% of input energy to whines and 51.7% to hiss; those stems correlate +0.91 / +0.96 with a dedicated two-stem whine/hiss reference model on the same file. ~1.7% leaks into speech (engine tones resembling voice) and 0.02% into click_bump. The remaining ~16% residual is dominated by low-frequency engine rumble below 500 Hz — content that belongs to none of the four synthetic stem classes, which the model conservatively drops rather than misrouting. Expect this behavior on real recordings: in-domain components separate cleanly; out-of-domain energy (deep rumble) ends up unassigned.
Files in this repo
| File | Description |
|---|---|
htdemucs-whine-hiss_clicks_speech_v1_f16.gguf |
Self-contained audio.cpp GGUF (weights + config embedded), f16 (~80 MB) — recommended |
htdemucs-whine-hiss_clicks_speech_v1_q8_0.gguf |
Same model, q8_0 quantized (~94 MB). At this size q8_0 is larger than f16 (norms/biases stay float) — prefer f16 |
htdemucs-whine-hiss_clicks_speech_v1_state_dict.pt |
Raw PyTorch state dict (native tensor names, fp32, ~168 MB) for use with the mss-training repo's inference.py |
Usage
audio.cpp (GGUF) — recommended
Works with any stock audio.cpp build that supports the htdemucs family (the C++ pipeline reads the stem list, transformer depth and widths from the embedded config, so custom stems work out of the box). Input must be stereo 44.1 kHz WAV (duplicate mono to L=R first if needed).
audiocpp_cli.exe --task sep --family htdemucs ^
--model htdemucs-whine-hiss_clicks_speech_v1_f16.gguf --backend cpu ^
--audio input.wav --out-dir stems_out
Outputs: stems_out\{speech,whines,hiss,click_bump}.wav.
PyTorch (state dict)
Load with the mss-training repo's HTDemucs using a config whose training.instruments is exactly ['speech', 'whines', 'hiss', 'click_bump'] and which keeps nfft: 4096 (hybrid model shapes are sensitive to it). The shipped weights are the EMA copy from epoch 499.
Notes & limitations
- Trained entirely on synthetic data; real recordings will contain out-of-domain energy (see evaluation) that is dropped rather than assigned
hissis the weakest stem (~8 dB valid SDR): broadband noise overlapping all other stems is inherently the hardest to isolate- The speech stem can capture non-speech engine tones on voiceless recordings — treat a near-silent
speech.wavas "no speech detected" only when its RMS is negligible - Mono inputs must be duplicated to stereo before separation (audio.cpp requires 2-channel input)