A web-based voice cloning application built with Flask and Coqui TTS (YourTTS). Record your voice, clone it, and generate text-to-speech with your cloned voice in multiple languages and emotions.
- Voice Recording: Record audio directly from your browser's microphone
- Voice Cloning: Clone your voice using state-of-the-art YourTTS model
- Text-to-Speech: Generate speech from text using your cloned voice
- Multi-language Support: English, French, and Portuguese (Brazilian)
- Emotion Control: Add emotional cues (happy, sad, calm, angry)
- Task-specific Styles: Different speaking styles (assistant, storytelling, narration, translator)
- Web Interface: Clean, responsive UI with tabbed interface
- Audio Conversion: Automatic conversion of various audio formats to WAV
- CORS Enabled: Supports cross-origin requests
Below are the key UI screens from the VoiceCloner web application:
- Python 3.8+
- FFmpeg (for audio processing)
- Conda (recommended for managing dependencies)
-
Clone the repository:
git clone <repository-url> cd VoiceCloner
-
Create a Conda environment:
conda create -n voicecloner python=3.9 conda activate voicecloner
-
Install FFmpeg:
conda install -c conda-forge ffmpeg
-
Install Python dependencies:
pip install -r requirements.txt
-
Run the application:
python app.py
-
Open your browser and navigate to:
http://localhost:5000
-
Record Voice Tab:
- Click "Start Recording" to record your voice
- Click "Stop" to end recording
- Select emotion and task style (optional)
- Choose language
- Click "Clone Voice" to generate cloned speech
-
Type Text Tab:
- Enter text to synthesize
- Select emotion, task, and language
- Click "Generate Voice" to create speech using your previously recorded voice
Upload and clone voice from recorded audio.
Parameters:
audio(file): Audio file (webm/ogg/wav)text(string, optional): Text to synthesize (default: "Hello! This is your cloned voice.")emotion(string, optional): Emotion cue (happy, sad, calm, angry)task(string, optional): Task style (default, assistant, storytelling, narration, translator)language(string, optional): Language code (en, fr-fr, pt-br)
Response:
{
"ok": true,
"audioUrl": "/outputs/cloned_abc123.wav"
}Generate speech from text using the latest recorded reference voice.
Parameters:
text(string, required): Text to synthesizeemotion(string, optional): Emotion cuetask(string, optional): Task stylelanguage(string, optional): Language code
Response:
{
"ok": true,
"audioUrl": "/outputs/tts_def456.wav"
}Serve generated audio files.
VoiceCloner/
βββ app.py # Main Flask application
βββ requirements.txt # Python dependencies
βββ voice_cloner/ # Main package
β βββ __init__.py # Flask app factory
β βββ routes.py # API routes and handlers
β βββ tts_model.py # TTS model wrapper
β βββ utils.py # Audio processing utilities
βββ templates/ # Jinja2 templates
β βββ index.html # Main web interface
βββ static/ # Static assets (CSS, JS, images)
βββ uploads/ # Uploaded audio files
βββ outputs/ # Generated audio files
- Model: Coqui TTS YourTTS (
tts_models/multilingual/multi-dataset/your_tts) - GPU Support: Disabled by default (set
gpu=Trueintts_model.pyfor GPU acceleration) - Supported Languages: English (en), French (fr-fr), Portuguese (pt-br)
- Input Formats: WebM, OGG, WAV, MP3, and other formats supported by FFmpeg
- Output Format: WAV (16-bit, variable sample rate)
- Conversion: Uses soundfile library with pydub fallback for unsupported formats
- Flask: Web framework
- Coqui TTS: Text-to-speech engine
- Librosa: Audio processing
- Soundfile: Audio I/O
- PyDub: Audio format conversion
- NumPy: Numerical computing
- SciPy: Scientific computing
- Transformers: Machine learning models
- Modern browsers with MediaRecorder API support
- Chrome 47+, Firefox 25+, Safari 14+, Edge 79+
CONDA_PREFIX: Used to locate FFmpeg binaries in Conda environments
Modify voice_cloner/tts_model.py to:
- Change the TTS model
- Enable GPU acceleration
- Add support for more languages
-
FFmpeg not found:
conda install -c conda-forge ffmpeg
-
Microphone permission denied:
- Ensure HTTPS in production or localhost
- Check browser permissions
-
Model download fails:
- Check internet connection
- Ensure sufficient disk space (models are ~1GB)
-
Audio conversion errors:
- Install FFmpeg
- Check audio file formats
- Use GPU acceleration for faster synthesis
- Keep reference audio short (5-10 seconds recommended)
- Use supported languages for best results
This project uses Coqui TTS, which is licensed under the Apache 2.0 License. See individual component licenses for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request


