<<<<<<< HEAD
A real-time text-to-speech system powered by Pocket TTS with streaming audio, voice cloning, and a modern web interface.
- 🎙️ Real-Time Streaming: Low-latency audio streaming via WebSockets (~200ms to first chunk)
- 🎨 Modern Web Interface: Beautiful glassmorphism design with live audio playback
- 🔊 Voice Cloning: Upload custom voice samples for personalized speech
- ⚡ CPU-Only: No GPU required, runs efficiently on CPU
- 📊 Performance Metrics: Real-time display of latency and generation speed
- 🌊 Streaming Audio: Smooth playback with Web Audio API
- 💾 Voice Management: Pre-made voices + custom voice uploads
pip install -r requirements.txtOr using uv (recommended):
uv pip install -r requirements.txtpython server.pyThe server will start at http://localhost:8000
Navigate to http://localhost:8000 in your browser.
- Enter Text: Type or paste text in the input area (max 10,000 characters)
- Select Voice: Choose from pre-made voices or upload your own
- Generate:
- Click "Generate Speech" for complete audio file
- Click "Stream Audio" for real-time streaming playback
- Download: Save generated audio as WAV file
- Click "Upload Voice" button
- Select an audio file (WAV, MP3, FLAC, OGG)
- The voice will be processed and added to your voice library
- Select your custom voice from the voice grid
Tip: For best results, clean your audio sample before uploading.
curl -X POST "http://localhost:8000/api/generate" \
-d "text=Hello world" \
-d "voice=alba" \
--output output.wavcurl -X POST "http://localhost:8000/api/upload-voice" \
-F "file=@my_voice.wav"curl "http://localhost:8000/api/voices"Connect to ws://localhost:8000/ws/stream and send:
{
"text": "Hello world",
"voice": "alba"
}Edit config.py to customize:
- Server Settings: Host, port
- Audio Parameters: Sample rate, chunk size
- Model Paths: Cache directories
- Performance: Buffer size, max text length
The system includes 8 pre-made voices:
alba- Default voicemariusjavertjeanfantinecosetteeponineazelma
See voice licenses for details.
Typical performance on MacBook Air M4:
- First Chunk Latency: ~200ms
- Generation Speed: ~6x real-time
- CPU Usage: ~2 cores
- Model Size: 100M parameters
├── server.py # FastAPI server with WebSocket support
├── tts_engine.py # TTS engine wrapper with voice caching
├── config.py # Configuration settings
├── requirements.txt # Python dependencies
└── static/
├── index.html # Web interface
├── style.css # Modern UI styling
└── app.js # Client-side streaming logic
The first run will download the Pocket TTS model (~400MB). Ensure you have a stable internet connection.
- Check browser console for errors
- Ensure WebSocket connection is established (green status indicator)
- Try refreshing the page
- Reduce chunk size in
config.pyfor lower latency - Increase chunk size for smoother playback
- Clear voice cache if memory usage is high
uvicorn server:app --reload --host 0.0.0.0 --port 8000from tts_engine import get_engine
engine = get_engine()
engine.export_voice("my_voice.wav", "my_voice.safetensors")- Pocket TTS: Kyutai Labs
- Paper: arXiv:2509.06926
- Tech Report: Kyutai Blog
This implementation is provided as-is. Please refer to the Pocket TTS license for model usage terms.
b7f5be30fa2db3fc17b5ca46183e4709ef1961fe