Skip to content

About

Open-source local AI voice consistency tool for AI-generated videos and films. No API keys required.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

English | 한국어

ToneKeeper Studio

Keep your characters sounding like themselves.
Open-source AI Voice Consistency Tool · by DIVANO INSTITUTE

Version License Python

ToneKeeper Studio is a 100% local, open-source AI Video Voice Tone Consistency Pipeline & Web Studio.
When generating multi-scene AI videos or AI dramas, character voices frequently drift in timbre from shot to shot. ToneKeeper preserves your video's original background audio (BGM, sound effects, ambience), converts the vocal tone to match a target reference speaker using zero-shot voice conversion (Seed-VC by default), matches loudness via ITU-R BS.1770 LUFS normalization, and losslessly muxes the result back into the original video stream (-c:v copy).


Key Features (v0.1.0 Alpha)

  • High-Quality Default Engine (Seed-VC, 25 steps): DiT + Whisper + CAM++ + BigVGAN zero-shot voice tone conversion enabled out-of-the-box, with Chatterbox VC available as a fast lightweight alternative.
  • Background Preservation & Flexible Separation:
    • Separates vocals and background via Demucs (htdemucs) by default so BGM and SFX stay untouched.
    • --clean-ref (UI: Clean Ref): Automatically strips background music/noise from your reference audio clip using Demucs before conversion.
    • --no-separate (UI: Skip Demucs): Skips Demucs vocal separation on the source video and passes the full extracted audio straight to the converter (useful for clean dialogue or commercial workflows avoiding Demucs pretrained weights).
  • Local Web UI — ToneKeeper Studio (Zero Node.js):
    • Voice Conversion Tab: Drag-and-drop video & reference audio, engine/steps/device controls, Clean Ref & Skip Demucs checkboxes, live progress & pipeline logs, and a Before / After Comparison Studio (Side-by-Side sync playback + audio focus switch + A/B tab mode).
    • Audio / Vocal Extractor Tab: Upload any video/audio clip to extract either Full Audio (44.1kHz lossless WAV via FFmpeg) or Pure Vocals Only (Reference-ready via Demucs), preview directly in the browser, download .wav, or apply it to Tab 1 as your reference voice in one click.
    • Bilingual UI (KO | EN): Instant language switching persisted in localStorage.
  • Lossless Video Stream Muxing & LUFS Matching: Keeps original video quality (-c:v copy) while matching converted vocal loudness to the original dialogue level.

Demo (Before / After)

ToneKeeper Studio was built and battle-tested inside a real AI drama production workflow to fix character voice drift across AI-generated scenes without re-rendering video or losing sound design.

ToneKeeper_Mochi_Reel_Final.mp4

Included Sample Files (examples/)

Test ToneKeeper immediately with the bundled Mochi voice consistency sample clips:

Sample File Role Notes
examples/mochi_before.mp4 Before (Original AI Clip) Original AI-generated clip with voice drift (elderly tone)
examples/mochi_reference_audio.wav Reference Voice (--ref) Target character voice sample for Mochi
examples/mochi_after_seedvc30steps.mp4 After (Seed-VC, 30 steps) Character vocal tone unified while preserving background audio & original video stream

Pipeline Overview

[Source Video (.mp4 / .mov / .mkv / .webm)]
        │
        ▼  1. media.py (FFmpeg -> 44.1kHz WAV)
  Extracted Audio Track
        │
        ▼  2. separator.py (Demucs htdemucs — optional via --no-separate)
  ┌─────┴──────────────────────────┐
  ▼                                ▼
vocals.wav (or full audio)   no_vocals.wav (background preserved)
  │                                │
  ▼  3. converter.py               │
Seed-VC (default, 25 steps)        │
or Chatterbox VC                   │
  (+ reference.wav,                │
     optional --clean-ref)         │
  │                                │
  ▼                                │
converted_vocals.wav               │
  │                                │
  └─────┬──────────────────────────┘
        ▼  4. mixer.py (soundfile + pyloudnorm)
  LUFS Loudness Normalization + Background Mix
        │
        ▼  4. media.py (FFmpeg `-c:v copy`)
[Final Output Video (.mp4 / .mkv / .mov)]

System Requirements & Prerequisites

Requirement Recommendation
Python 3.10+ (3.10 or 3.11 recommended)
FFmpeg Installed and available on your system PATH (invoked externally; not bundled)
Compute (GPU / CPU) NVIDIA GPU (CUDA, 8GB+ VRAM) recommended for fast 25-step Seed-VC; Apple Silicon (MPS) and CPU are also supported (use --diffusion-steps 10–15 for faster CPU runs)
Disk Space ~4–6 GB free for initial Hugging Face / PyTorch model caches

Install FFmpeg

  • Windows: winget install Gyan.FFmpeg (restart your terminal afterward)
  • macOS: brew install ffmpeg
  • Ubuntu / Debian: sudo apt update && sudo apt install -y ffmpeg
  • Verify: ffmpeg -version

Installation

Run all commands from the project root (tonekeeper/).

1. Create & Activate a Virtual Environment

Windows (PowerShell):

python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip

macOS / Linux:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip

2. Install PyTorch (GPU or CPU)

  • NVIDIA GPU (CUDA 12.4 example):
    pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu124
  • Apple Silicon (macOS MPS) or CPU-only:
    pip install torch torchaudio

3. Install ToneKeeper Dependencies

pip install -r backend/requirements.txt

Notes:

  • On first run, pretrained weights for Seed-VC (Plachta/Seed-VC, openai/whisper-small, funasr/campplus, nvidia/bigvgan_v2_22khz_80band_256x), Demucs (htdemucs), or Chatterbox VC are downloaded locally from their official repositories. See MODEL_LICENSES.md for model weight licenses.
  • Both backend/pipeline.py and backend/server.py automatically configure NUMBA_CACHE_DIR to <temp>/numba_cache at startup for seamless Windows compatibility.

Usage — Web UI (ToneKeeper Studio)

Launch the local web server with Python only (no Node.js required):

Windows (PowerShell):

.\.venv\Scripts\python.exe backend/server.py

macOS / Linux:

python backend/server.py

Open http://127.0.0.1:8000 in your browser:

  1. Voice Conversion Tab:
    • Upload your source video and reference voice sample.
    • Choose Seed-VC (default, 25 steps) or Chatterbox VC, adjust Diffusion Steps (10–30), and toggle Auto-clean Reference Audio (Clean Ref) or Skip Vocal Separation (Skip Demucs).
    • Track real-time stages and logs, then inspect results with the Before / After Comparison Studio and download.
  2. Audio / Vocal Extractor Tab:
    • Upload a video or audio clip and select Full Audio (WAV) (fast FFmpeg 44.1kHz WAV) or Pure Vocals Only (Reference Ready, Demucs).
    • Preview the extracted audio directly in the browser, download the .wav file, or click Use as Reference Voice to load it straight into the Voice Conversion tab.
  3. Language Switch (KO | EN): Toggle between English and Korean anytime in the header.

Usage — CLI (backend/pipeline.py)

Standard Run (Default: Seed-VC, 25 Diffusion Steps)

python backend/pipeline.py \
  --video workspace/input/scene01.mp4 \
  --ref workspace/reference/character_ref.wav \
  --output workspace/output/scene01_converted.mp4

Auto-clean Noisy Reference Audio (--clean-ref)

python backend/pipeline.py \
  --video workspace/input/scene01.mp4 \
  --ref workspace/reference/noisy_clip_ref.wav \
  --output workspace/output/scene01_cleanref.mp4 \
  --clean-ref

Skip Demucs Vocal Separation (--no-separate)

Useful for already-clean dialogue tracks or commercial pipelines that want to avoid Demucs pretrained model weights:

python backend/pipeline.py \
  --video workspace/input/dialogue_only.mp4 \
  --ref workspace/reference/character_ref.wav \
  --output workspace/output/dialogue_converted.mp4 \
  --no-separate

Fast CPU Testing (12 Steps) or Chatterbox VC

# Fast CPU test with Seed-VC (10–15 steps recommended)
python backend/pipeline.py \
  --video workspace/input/scene01.mp4 \
  --ref workspace/reference/character_ref.wav \
  --output workspace/output/scene01_cpu.mp4 \
  --device cpu --diffusion-steps 12

# Lightweight Chatterbox VC engine
python backend/pipeline.py \
  --video workspace/input/scene01.mp4 \
  --ref workspace/reference/character_ref.wav \
  --output workspace/output/scene01_chatterbox.mp4 \
  --converter chatterbox

CLI Options Reference

Option Default Description
--video (required) Input video file path (.mp4, .mov, .mkv, .webm, .avi, etc.)
--ref (required) Target speaker reference audio file (.wav, .mp3, .flac, .m4a, .ogg, etc.)
--output (required) Destination path for the final muxed video
--converter seedvc Voice conversion engine (seedvc or chatterbox)
--diffusion-steps 25 Diffusion steps for seedvc (10–15 for fast CPU tests, 25–30 for highest quality)
--device auto Compute device (auto, cuda, mps, cpu). auto picks cuda -> mps -> cpu
--clean-ref False Isolate pure vocals from --ref via Demucs (htdemucs) to remove background noise
--no-separate False Skip Demucs vocal separation on the input video and convert full extracted audio directly
--demucs-model htdemucs Pretrained Demucs model name when separation is active
--vocal-gain-db 0.0 Optional vocal gain offset (dB) applied after LUFS normalization
--work-dir temp dir Directory to preserve intermediate WAV artifacts
--keep-temp False Keep auto-generated temporary intermediate files for debugging
--verbose False Enable verbose debug logging

Project Structure

tonekeeper/
├── backend/
│   ├── core/
│   │   ├── device.py          # Automatic PyTorch device detection (cuda -> mps -> cpu)
│   │   ├── media.py           # FFmpeg 44.1kHz extraction & lossless video muxing
│   │   ├── separator.py       # Demucs (htdemucs) vocal / background separation
│   │   ├── converter.py       # BaseVoiceConverter + Seed-VC & Chatterbox VC adapters
│   │   └── mixer.py           # soundfile + pyloudnorm LUFS normalization & mixing
│   ├── third_party/
│   │   └── seed_vc/           # Minimal vendored Plachtaa/seed-vc inference modules (GPL-3.0)
│   ├── pipeline.py            # CLI entrypoint & reusable media/audio extraction utilities
│   ├── server.py              # ToneKeeper Studio local FastAPI server (/api/convert, /api/extract)
│   └── requirements.txt       # Python dependencies
├── frontend/
│   ├── index.html             # ToneKeeper Studio web UI (Conversion & Extractor tabs)
│   ├── style.css              # Dark studio theme
│   └── app.js                 # Upload, live polling, KO/EN i18n, A/B player & audio preview
├── workspace/                 # Local media working folders (contents gitignored)
├── LICENSE                    # GNU General Public License v3.0 (Jihui Lee / Divano Institute)
├── THIRD_PARTY_NOTICES.md     # Open-source dependencies, vendored code & FFmpeg notice
├── MODEL_LICENSES.md          # Pretrained AI model weight licenses & commercial guidance
├── README.md                  # English documentation
└── README.ko.md               # Korean documentation

Try It with the Included Sample (examples/)

Want to test ToneKeeper right away? Sample clips of Mochi are included in examples/:

  • examples/mochi_reference_audio.wav — Target reference voice
  • examples/mochi_before.mp4 — Original AI clip with voice drift (elderly voice)
  • examples/mochi_after_seedvc30steps.mp4 — Reference output generated with Seed-VC (30 diffusion steps)

Run via CLI:

python backend/pipeline.py \
  --video examples/mochi_before.mp4 \
  --ref examples/mochi_reference_audio.wav \
  --output workspace/output/mochi_test.mp4 \
  --diffusion-steps 30

Or launch ToneKeeper Studio (python backend/server.py) and drag mochi_before.mp4 and mochi_reference_audio.wav directly into the Web UI.


Responsible Use & Voice Rights

Voice conversion technology carries important legal and ethical responsibilities. By using ToneKeeper Studio, you agree to follow these principles:

  • Explicit Consent & Voice Rights: Whenever you use another person's voice as a reference sample (--ref), you must obtain their explicit consent and hold all necessary legal rights or licenses to use that voice.
  • No Malicious or Deceptive Use: Do not use ToneKeeper Studio for impersonation, fraud, scams, disinformation, defamation, harassment, non-consensual synthetic media, or any unlawful purpose.
  • Transparency: Clearly disclose AI-assisted voice synthesis or conversion where required by applicable laws, platform policies, or audience expectations.

Users are solely responsible for ensuring that their inputs, reference voices, and generated outputs comply with applicable laws, copyright, publicity/personality rights, and third-party model licenses.


License

  • Source Code: Licensed under the GNU General Public License v3.0 (GPL-3.0) — see LICENSE (Copyright (C) 2026 Jihui Lee (Divano Institute)).
  • Third-Party Software & FFmpeg Notice: See THIRD_PARTY_NOTICES.md.
  • AI Model Weights Licenses: Source code license ≠ AI model weights license. Pretrained weights are downloaded locally by the user from official sources and remain subject to their own licenses — please review MODEL_LICENSES.md carefully (especially regarding Demucs htdemucs weights and --no-separate for commercial use).

Author

Developed by Jihui Lee
An independent project by Divano Institute.

AI-Assisted Development

This project was developed with the assistance of Google Gemini Neon + Antigravity and OpenAI ChatGPT.

About

Open-source local AI voice consistency tool for AI-generated videos and films. No API keys required.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages