The agent's voice. Modern TTS can stream audio in real-time, sound nearly human, and even clone specific voices. Here's your toolkit.
Run text-to-speech entirely on your machine — no cloud, no API keys, no audio leaving your network. These tools let you synthesize speech from text, compare voice quality across engines, and even clone voices locally.
ONNX-based neural TTS that runs on minimal hardware — even a Raspberry Pi. Pre-installed and available system-wide. Fast synthesis but limited to sentence-level streaming.
# Piper is pre-installed and available system-wide # Wrapper at /usr/local/bin/piper → /opt/piper/speak.py # Basic text-to-speech echo "Hello, this is Piper text to speech." \ | piper --model /opt/piper/models/en_US-lessac-medium.onnx --output_raw \ | aplay -r 22050 -f S16_LE # Save to a file instead of playing echo "Save this to a file." \ | piper --model /opt/piper/models/en_US-lessac-medium.onnx --output_file output.wav
82M parameter TTS model with excellent quality and natural prosody. ONNX-based, runs on CPU. Higher quality than Piper but slightly slower. Streaming server available via Kokoro-FastAPI.
# Kokoro is pre-installed and available system-wide # Wrapper at /usr/local/bin/kokoro → /opt/kokoro/speak.py # Basic text-to-speech echo "Hello, this is Kokoro text to speech." \ | kokoro \ | aplay -r 24000 -f S16_LE # Kokoro-FastAPI streaming server (if running) # Web UI at http://localhost:8880/web time curl -s http://localhost:8880/v1/audio/speech \ -H "Content-Type: application/json" \ -d '{"input": "Hello from Kokoro streaming server.", "voice": "af_heart", "response_format": "wav"}' \ -o output.wav && aplay output.wav
Zero-shot voice cloning and TTS — clone a voice from just 6 seconds of audio. Requires more compute than Piper or Kokoro. We use the original TTS package, not the community coqui-tts fork.
# Coqui TTS is pre-installed and available system-wide # Wrapper at /usr/local/bin/coqui-tts → /opt/coqui-tts/.venv/bin/tts # Basic text-to-speech coqui-tts --text "Hello, this is Coqui TTS." --out_path output.wav aplay output.wav # List available models coqui-tts --list_models # Voice cloning with XTTS v2 (provide a reference audio clip) coqui-tts --model_name tts_models/multilingual/multi-dataset/xtts_v2 \ --text "Hello, this is a cloned voice." \ --speaker_wav reference_voice.wav \ --language_idx en \ --out_path cloned_output.wav
Have a suggestion for a TTS service to include here? Email us at [email protected]
The right TTS depends on your use case — speed, quality, privacy, and budget all factor in.
| Scenario | Recommended TTS | Why |
|---|---|---|
| Quick local demo | Piper | Fastest on CPU, minimal setup |
| High-quality local demo | Kokoro | Best quality for local, runs on CPU |
| Voice cloning attack sim | Coqui XTTS | Local cloning + generation in one |
| Edge / IoT deployment | Piper | Runs on minimal hardware |
| Production voice agent | ElevenLabs / Cartesia | Best quality + streaming + low latency |