Voice Mastering
Goal: a full, clean, natural voice with balanced lows, mids and highs, and the same sound for the same speaker in every project.
Where things are
scripts/voice_master.py— the engine and CLI.scripts/vm_dsp.py— light helpers (numpy, scipy, ffmpeg only), importable from any Python:read/write,ebur128,loudnorm_2pass,level_speech,duck_music,deess_dynamic,saturate.presets/*.json— voice presets:premium_podcast(default),youtube_reels,cinematic_narration,natural_studio,educational_lecture.presets/denoise/— DeepFilterNet3 settings:medium(−24 dB, default),light(−12 dB),off(clean studio takes).- User data, outside the skill folder (updating the skill never touches it). Root:
VIDEO_SKILLS_HOME, else%LOCALAPPDATA%\video-skillson Windows (C:\video-skillswhen the profile path is not ASCII),~/.local/share/video-skillselsewhere:voice-kits/<speaker>.json— reference voices, one per speaker;voice-mastering.json— the default speaker of this machine;cache/voice/— DeepFilterNet results, keyed by file, size, mtime and settings (override withVM_CACHE).
Python
Use the skills' own environment, made by setup/setup.ps1 (or setup.sh) of the repository — Python 3.11, because DeepFilterNet has no wheels for 3.12+:
- Windows:
<root>\py311\Scripts\python.exe, e.g.%LOCALAPPDATA%\video-skills\py311\Scripts\python.exe; - macOS / Linux:
<root>/py311/bin/python. If it is missing, tell the person to run the setup script; never install DeepFilterNet or torch into the system Python. Always run with-X utf8.
Commands
VM=<skills>/voice-mastering/scripts/voice_master.py
$PY -X utf8 $VM analyze IN [--json OUT]
$PY -X utf8 $VM process IN OUT.wav [--preset premium_podcast] [--speaker NAME | --brandkit KIT.json | --no-kit]
[--denoise medium|light|off] [--stem] [--lufs X] [--tp -1] [--channels 2|1] [--report DIR] [--ab-dur 20]
$PY -X utf8 $VM brandkit REF1 REF2 ... --speaker NAME [--default]
$PY -X utf8 $VM kits
$PY -X utf8 $VM mix OUT.wav --voice V.wav --music M1 [M2 ...] [--preset youtube_reels] [--duck -11] [--music-under 10] [--sfx SFX.json] [--fps 25]
$PY -X utf8 $VM master IN OUT.wav [--lufs -14] [--tp -1]
$PY -X utf8 $VM qc FILE [--lufs -14] [--tp -1]
--stem: no loudness stage, for when the edit levels and masters the voice itself.--channels 2(default) masters to the stereo / video target of the preset;--channels 1to its mono podcast target.--report DIRwritesreport.md(in Russian),metrics.json,spectrum.png,spectrogram.pngand A/B clipsA — исходник/B — обработка(.wavand labelled.mp4) over the same speech-rich window, both levelled to −16 LUFS.- The original is never written to. Every output gets a
.vm.jsonsidecar with the filters, decisions and denoise info; a file whose sidecar saysdenoised: trueis never denoised again.
Reference voice: always the speaker's own
The chain nudges a recording's broad tonal balance towards a reference of the same person, so one speaker sounds alike across rooms, microphones and projects. It never pulls anyone towards somebody else's timbre.
- Before processing, find out whose voice it is and run
kits. If that speaker has a kit, pass--speaker NAME. - No kit for this speaker yet — and on the first use on a machine, for the person who works with this skill: build one first. Ask for (or pick from the project) 3–5 recordings of this speaker, from different rooms or days, 30–60 s of speech each, then
brandkit ... --speaker NAME. Add--defaultwhen it is the machine owner's own voice, so it is used whenever no speaker is named. - Until a kit exists,
processruns without a reference (--no-kitforces this): tone comes from the preset alone, only bumps over the recording's own smooth speech curve (mud, box) are trimmed, and the tonal check in the report is coarser. Say so in your reply. - Never use one person's kit for another person's voice. Kits are personal data: they stay in the user data folder and are never committed to git.
The chain (order)
- Analysis: integrated and short-term LUFS, RMS, true peak, LRA, speech dynamics, crest factor; noise floor and SNR; 50/60 Hz hum and harmonics, rumble below 60 Hz; resonances; sibilance index; clipping; RT60 estimate; band balance against 1–2 kHz, 1–8 kHz tilt, f0.
- DeepFilterNet (cached),
mediumby default. It is the only noise reducer: no afftdn or other denoisers on top. - Analysis again on the cleaned voice; the EQ decisions use it.
- Phrase leveller (preset
level): quiet and loud phrases are brought part-way to the speaker's typical level, at most ±4–6 dB; the gain holds through pauses, so breaths and room tone are not pumped up. - Pre-gain: typical speech level to −20 dBFS.
- High-pass: preset corner, capped at 0.8 × the lowest f0; a second 80 Hz stage when rumble is found.
- Hum notches, only if hum is detected.
- Corrective EQ: mud 250–500 Hz, box 500–1000 Hz, up to 3 resonance notches.
- De-esser (ffmpeg deesser, mild), scaled by the sibilance index.
- Compressor: ratio 2–3.5, attack 10–20 ms, release 90–150 ms, threshold set for the preset's gain reduction at speech peaks.
- Tonal EQ: warmth 80–200 Hz, presence 2–5 kHz, air shelf 10–16 kHz. With a kit: preset value + half the deviation from the speaker's reference (firmer above 3 dB, at most ±3 dB per band, ±6 dB total). On a clean source (SNR ≥ 20 dB) half of the air the denoiser took is given back, at most 3 dB; on a noisy one that "air" was hiss and stays gone.
- Dynamic de-esser (5–9.5 kHz split band), only when the sibilance index is above 11.
- Saturation, light 2× oversampled parallel tanh, loudness-matched. Off in
natural_studioandeducational_lecture. - Loudness: two-pass
loudnormto the preset target, then a 4× oversampled limiter, true peak ≤ −1 dBTP. 48 kHz, 32-bit float WAV. - QC: the result is measured again and the remaining problems are listed; the preset's intended boosts are not counted as defects.
Mixing and mastering
- Ducking (
vm_dsp.duck_music): gate −42 dB, 80 ms attack, 700 ms release; the bed also dips −3 dB at 1–4 kHz while the speaker talks. - Music level in
mixfollows the voice: the bed is set--music-underLU (default 10) below the voice's measured loudness before ducking, whatever level the stem came in at. - SFX are snapped to the video frame grid; the report lists the frame each one lands on.
- Loudness targets (in the presets): YouTube / Reels −14 LUFS; podcast −16 stereo / −19 mono; educational −16; cinematic −18. Always true peak ≤ −1 dBTP.
- After the final encode, always run
qcon the actual mp4 / m4a.
How to use it in a project
- FFmpeg pipelines:
process SRC OUT --stem --preset ... --speaker ...for the cleaned dialogue (cached),vm_dsp.duck_musicfor the bed,vm_dsp.loudnorm_2passfor the master. - HyperFrames: process each voice file
assets/voice/<id>.wavintoassets/voice/<id>.vm.wavwith--stem, point the composition at the processed file and keep the original next to it; master the final render's audio withmix/master(or the media-use audio tools) plusqc. - Show results: send the A/B
.mp4clips to the person (they compare by ear; a bare m4a shows no player in chat), and ask before changing preset or denoise strength. - Preset choice: default
premium_podcast; vertical shortsyoutube_reels; lessonseducational_lecture; documentary voiceovercinematic_narration; clean studio takesnatural_studiowith--denoise off. Change the preset only with a reason.
Rules
- Keep the speaker's timbre, breath and articulation. Never accept a metallic, underwater or pumping sound: if one appears, switch to
--denoise lightor a lower compression before anything else. - Do not boost highs to fight a muffled source beyond what the chain decides; report it instead.
- Use only music the project has the rights to.
- Other people's voices are personal data: follow the project's privacy rules, and do not build a kit of someone without a reason tied to the project.
- No paid services or external APIs; everything runs locally.