A professional, modular voice cloning application using NeuTTS for few-shot voice synthesis. Upload a short audio sample, and the system will clone that voice to speak any text you provide.
- Few-Shot Voice Cloning: Clone any voice with just 5-15 seconds of audio
- Instant Voice Generation: Generate speech in cloned voices in seconds
- Voice Management: Save, load, and delete custom voice profiles
- Speed Control: Adjust playback speed from 0.5x to 2.0x
- Smart Text Processing: Automatic text chunking for optimal generation
- Progress Tracking: Real-time progress updates during generation
This project follows a professional modular architecture:
Voice_Cloning_Engine/
βββ config.py # Configuration and constants
βββ main.py # Application entry point
βββ utils/
β βββ __init__.py
β βββ system_check.py # eSpeak verification
βββ core/
β βββ __init__.py
β βββ model_manager.py # TTS model initialization
β βββ voice_manager.py # Voice loading/management
β βββ text_processor.py # Text chunking utilities
β βββ speech_generator.py # Speech generation pipeline
βββ ui/
β βββ __init__.py
β βββ gradio_interface.py # Gradio UI components
βββ samples/ # Voice samples directory
βββ Models/ # Model files directory
βββ requirements.txt # Python dependencies
- config.py: Centralized configuration (paths, model settings, audio parameters)
- utils/system_check.py: System dependency verification (eSpeak-NG)
- core/model_manager.py: NeuTTS model initialization and management
- core/voice_manager.py: Voice operations (load, clone, delete)
- core/text_processor.py: Intelligent text chunking with sentence preservation
- core/speech_generator.py: TTS generation pipeline with progress tracking
- ui/gradio_interface.py: Gradio web interface components
- main.py: Application initialization and launch
- OS: Windows 10/11
- Python: 3.9, 3.10, or 3.11 (
β οΈ Not 3.12+) - RAM: 8 GB minimum (16 GB recommended)
- Storage: ~3 GB free space
- eSpeak-NG: Required for phonemization
- Python 3.9-3.11
- pip (Python package manager)
- eSpeak-NG (Download)
- Download eSpeak-NG from GitHub Releases
- Run the installer (
espeak-ng.msi) - Follow installation prompts (default location recommended)
# Navigate to project directory
cd Voice_Cloning_Engine
# Create virtual environment
python -m venv venv
# Activate virtual environment
venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtNote: First run will download the NeuTTS model (~1-2 GB) from HuggingFace.
# Activate virtual environment (if not already activated)
venv\Scripts\activate
# Run the application
python main.pyThe application will:
- β Verify eSpeak-NG installation
- β Initialize TTS model
- β Load available voices
- β Launch Gradio interface
The UI will open automatically in your browser at http://localhost:7860
- Select Voice: Choose from available voice profiles
- Enter Text: Type or paste the text to synthesize
- Adjust Speed: Use slider to control playback speed (0.5x - 2.0x)
- Generate: Click "ποΈ Generate Speech"
- Listen: Audio plays automatically when ready
- Delete Voice: Remove unwanted voice profiles with "ποΈ Delete Voice"
- Voice Name: Enter a unique name for the new voice
- Reference Text: Type the exact text spoken in the audio sample
- Upload Audio: Select a WAV file (5-20 seconds recommended)
- Clone: Click "𧬠Clone Voice"
- Use: New voice appears in the dropdown on the Generate tab
Text Input β Text Chunking β TTS Generation (per chunk) β
Audio Assembly β Speed Adjustment β Final Output
-
Text Processing
- Splits text into chunks (max 150 chars)
- Preserves sentence boundaries
- Handles long sentences by splitting on commas
- Maintains punctuation structure
-
Voice Encoding
- Loads reference audio and text
- Extracts speaker embedding using NeuTTS
- Caches embeddings as
.ptfiles for faster loading
-
Speech Generation
- Processes each text chunk independently
- Generates audio using NeuTTS model
- Tracks progress and estimates completion time
- Assembles chunks with silence padding
-
Post-Processing
- Applies speed adjustment if needed
- Normalizes audio levels
- Saves as WAV file
NeuTTS is a neural text-to-speech model that:
- Supports few-shot voice cloning
- Requires minimal reference audio (5-15 seconds)
- Generates high-quality, natural-sounding speech
- Runs efficiently on CPU
| Text Length | Chunks | Estimated Time |
|---|---|---|
| Short (1-2 sentences) | 1-2 | 5-10 seconds |
| Medium (paragraph) | 3-5 | 15-25 seconds |
| Long (multiple paragraphs) | 6-10 | 30-60 seconds |
- Keep model loaded: Don't restart the app between generations
- Use quality audio: Clear speech produces better results
- Optimal reference length: 10-15 seconds is ideal
- Close other apps: Free up CPU resources
Error: Error: espeak-ng not found!
Solution:
- Install eSpeak-NG from GitHub Releases
- Ensure it's in your PATH
- Restart the application
Error: ModuleNotFoundError: No module named 'neuttsair'
Solution:
# Ensure virtual environment is activated
venv\Scripts\activate
# Reinstall dependencies
pip install -r requirements.txtProblem: Model download fails or times out
Solution:
- Check internet connection
- Ensure ~3 GB free disk space
- Try running again (download resumes automatically)
Problem: Generated voice sounds robotic or distorted
Solution:
- Use higher quality reference audio (clear, no background noise)
- Ensure reference audio is 10-15 seconds long
- Match reference text exactly to what's spoken
- Try different reference samples
Voice samples are stored in the samples/ directory with three files per voice:
{voice_name}.txt- Reference text{voice_name}.wav- Reference audio{voice_name}.pt- Cached speaker embedding
You can manually add voices by placing these files in the samples/ directory.
- Modularity: Each component has a single responsibility
- Maintainability: Easy to locate and fix bugs
- Testability: Components can be tested independently
- Extensibility: Add new features without touching existing code
- Readability: Clear imports show dependencies
- New Voice Format: Modify
voice_manager.py - Different TTS Model: Update
model_manager.py - UI Changes: Edit
ui/gradio_interface.py - Configuration: Update
config.py