Implements the GPU-upgrade.md plan: - Separator backend interface (DSSeparator = existing noisereduce path, DemucsSeparator = htdemucs_ft AI separation) — one mode at a time, never stacked - DemucsSeparator: lazy imports (core app stays dep-free), device auto-pick cuda -> mps -> cpu, model cache under appdata/models, chunk progress reporting, soft cancel between chunks - GUI: 'Isolate voice' checkbox replaced by a 3-way mode selector (fast DSP / AI Demucs / none), DSP strength controls follow the selection, AI radio disabled with guidance when torch+demucs are missing, Cancel button for in-flight AI runs - CLI: --mode none|dsp|ai (default dsp, unchanged behavior) - requirements-ai.txt (torch 2.x + demucs 4.1.x), THIRD_PARTY.md, README updates, optional AI pack flags in installer scripts, version bumped to 1.1.0 - tests/test_separators.py: 10 tests incl. graceful-degradation and full-pipeline regression (5.0 s ± 0.15 s, ~320 kbps) in all modes |
||
|---|---|---|
| assets | ||
| installer | ||
| tests | ||
| .gitignore | ||
| GPU-upgrade.md | ||
| README.md | ||
| THIRD_PARTY.md | ||
| requirements-ai.txt | ||
| requirements.txt | ||
| voicegrab.py | ||
README.md
VoiceGrab
Cut a time range out of any video file and export a clean, loudness-normalized MP3 voice sample — ready to use for AI voice training / cloning.
Voice / audio file: [ kage.mp4 ] [Open…]
Start: 0:10.00 Stop: 0:35.00 [Load preview] [▶ Play range]
Voice processing (choose one):
(•) Fast noise reduction (CPU) — fan / hum / room tone; no downloads
( ) AI voice separation (Demucs) — music & second speakers; GPU if available
( ) No processing — just loudness-normalize
strength: 80% [x] stationary noise
Output MP3: [ .../kage_voicegrab.mp3 ] [Browse…]
──────────────────────────────────────────────────
[ Cancel ] [ Export MP3 ]
Features
- Works with any container ffmpeg understands: mp4, mkv, mov, webm, avi, flv, m4a…
- Voice processing — pick one mode (toggle, mutually exclusive):
- Fast noise reduction (CPU, default) — STFT spectral gating via
noisereduce. Great for fan, hum, room tone. No downloads, no GPU; strength slider + a "stationary noise" mode for constant fans/hum. - AI voice separation (Demucs) — deep-learning 4-stem separation (we keep the vocals stem). Handles background music and a second speaker, which spectral gating cannot. Optional install; uses an NVIDIA GPU (CUDA) or Apple GPU if present, otherwise CPU (slower).
- No processing — just loudness-normalize.
- Fast noise reduction (CPU, default) — STFT spectral gating via
- Export is 320 kbps MP3, loudness-normalized to −16 LUFS (broadcast reference — good levels for voice-training datasets).
- "▶ Play range" lets you audition the exact segment before saving.
- AI runs report chunk progress in the status bar and can be cancelled between chunks.
- Also a headless CLI (see below) for scripting/batch work.
Requirements
- Python 3.10+
- ffmpeg on your PATH (bundled automatically in installer builds)
- Optional, only for AI voice separation:
pip install -r requirements-ai.txt(pullstorch+demucs, ~1.5–2.5 GB with CUDA wheels)
Run from source
cd voicegrab2
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
.venv/bin/python voicegrab.py
AI voice separation (optional — GPU recommended)
.venv/bin/pip install -r requirements-ai.txt
- Pick AI voice separation (Demucs) in the GUI. The mode is disabled
(with an explanation) until
torch+demucsare installed — the core app never requires them. - First use downloads the
htdemucs_ftmodel (~90 MB) to the app data dir (<appdata>/VoiceGrab/models/) and caches it — later runs are instant. GPU (NVIDIA CUDA / Apple) is used automatically when present, otherwise CPU. - Performance expectations (5 s → 60 s clip):
- GPU (≥ 6 GB VRAM): ~1–3 s → ~15–40 s
- CPU (8 cores): ~10–25 s → a few minutes
- Cancel stops an AI run at the next chunk boundary. Fast DSP runs finish in seconds and are not cancellable (by design).
- Quality note: aggressive separation can thin sibilance/breath — for voice training samples the fast DSP mode is usually enough; reach for AI mode when there's music or a competing speaker.
- Licensing: Demucs code is MIT and the
htdemucs_ftweights are MIT (seeTHIRD_PARTY.md).
CLI mode
voicegrab.py --cli input.mp4 10 35 output.mp3 # default: fast DSP
voicegrab.py --cli input.mp4 10 35 output.mp3 --mode dsp # fast noise reduction
voicegrab.py --cli input.mp4 10 35 output.mp3 --mode ai # Demucs (requirements-ai.txt)
voicegrab.py --cli input.mp4 10 35 output.mp3 --mode none # just loudness-normalize
Tests
.venv/bin/python tests/test_separators.py # or: .venv/bin/pytest tests/
Covers: DSP shape/dtype/NaN invariants, AI graceful degradation without torch, device selection, AI unit separation (44.1 kHz output), and the full CLI pipeline in all three modes (valid 320 kbps MP3, duration 5.0 s ± 0.15 s).
Windows installer (single .exe + installer)
-
pip install pyinstaller -
python voicegrab.py.specis not needed — run:pyinstaller --onefile --windowed --name VoiceGrab ^ --add-binary "C:\ffmpeg\bin\ffmpeg.exe;." ^ --add-binary "C:\ffmpeg\bin\ffprobe.exe;." ^ --icon assets/icon.ico voicegrab.py -
Build the installer with Inno Setup:
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer\VoiceGrab.iss(Copy
dist\VoiceGrab.exetoinstaller\first — the script assumesdist\VoiceGrab.exerelative to the project root.)To ship the AI mode inside the frozen exe (bigger, ~2 GB), install
requirements-ai.txtinto the venv first and add--collect-all demucs --collect-all torchto the PyInstaller command.
Linux
- AppImage:
installer/build_linux.sh(needs PyInstaller +linuxdeployorappimagetool+ your ffmpeg in PATH). - Debian/Ubuntu: just run the PyInstaller binary, or install ffmpeg via
apt and run from source. A
.desktopentry template is ininstaller/. - Flatpak is also a fine route if you want it in your store.
- AI mode:
WITH_AI=1 ./installer/build_linux.shbundlesdemucs/torchinto the binary (bigger build).
Notes on voice-isolation quality
- Fast mode is classic DSP (spectral gating / STFT noise estimation) — great for fan, hum, light room tone; it can't remove music or a second speaker.
- AI mode (Demucs
htdemucs_ft) is a source separator — the right tool for speech-over-music or competing voices. It's a product feature behind a radio button, never a hard dependency: the core app stays small and starts in < 2 s withouttorch/demucsinstalled. - The AI path replaces the DSP path — one or the other, never stacked (double-processing adds artifacts).