A Python-based voice cloning application that records a voice sample and generates speech in the same voice using an AI-powered Text-to-Speech model.
This project was built as a learning-focused backend/AI application, demonstrating audio processing and speech synthesis using Python.
- 🎤 Voice Recording – Record a reference voice sample using a microphone
- 🧠 Voice Cloning – Generate speech that mimics the recorded voice
- 🌍 Multilingual Support – Supports multiple languages
- ⏱️ Adjustable Speed – Control the playback speed of generated speech
- Python
- Coqui TTS
- sounddevice
- scipy
- Audio Processing & ML Concepts
- Python 3.8 or higher
- pip (Python package manager)
- Microphone (for voice recording)
- GPU (optional – improves performance, CPU also works)
- Install required dependencies
pip install TTS sounddevice scipy- First Run Note
-
On the first run, the TTS model (~500MB–1GB) will be downloaded automatically
-
Ensure:
- Stable internet connection
- At least 1GB free disk space
python record_sample.py- Recording starts after a short delay
- Speak clearly and naturally
- Output file:
my_voice.wav - You can modify recording duration inside the script
python clone_voice.py- Enter the text you want to convert to speech
- Uses
my_voice.wavas the reference - Output file:
output.wav - Speech speed can be adjusted using the
speedparameter
Voice-Cloner/
├── record_sample.py # Records voice sample
├── clone_voice.py # Generates cloned speech
└── README.md # Project documentation
SAMPLE_RATE– Audio sample rate (default: 16000 Hz)DURATION– Recording time in secondsoutput_file– Output voice sample file name
ref_audio_path– Reference voice file pathout_path– Generated audio output pathlanguage– Language code (default: "en")speed– Speech speed multiplier
Module not found
- Run:
pip install TTS sounddevice scipy - Check Python version:
python --version
No audio recorded
- Check microphone connection
- Verify system audio permissions
Slow performance
- First run model download is expected
- GPU significantly improves speed
- Ensure sufficient RAM availability
Low audio quality
- Record in a quiet environment
- Speak clearly
- Increase recording duration if needed
- Model:
tts_models/multilingual/multi-dataset/your_tts - Languages: Multilingual
- Disk Size: ~500MB–1GB
- Minimum RAM: ~4GB
- GPU: Recommended (optional)
- Practical experience with audio data handling
- Understanding voice cloning & speech synthesis
- Hands-on use of Python for backend and AI workflows
- Exposure to machine learning models
This project uses the Coqui TTS open-source engine.
- Coqui TTS: https://github.com/coqui-ai/TTS
- sounddevice docs: https://python-sounddevice.readthedocs.io/