| name | text-to-speech |
| description | Generate speech audio from text. Use when a user asks to generate speech, read text aloud, create audio from text, or do text-to-speech / TTS. |
Text-to-Speech
Generate natural-sounding speech from text using Kokoro TTS running locally on CPU. No external API keys required.
Bundled Scripts
tts.py — Generate speech from text
uv run scripts/tts.py "Hello, world!" -o output.ogg
echo "Hello world" | uv run scripts/tts.py - -o output.ogg
uv run scripts/tts.py --file input.txt -o output.ogg
uv run scripts/tts.py "Hello!" -o output.ogg --voice am_adam
uv run scripts/tts.py "Good day!" -o output.ogg --voice bf_emma
uv run scripts/tts.py "Hello!" -o output.wav
uv run scripts/tts.py "Hello!" -o output.ogg --speed 1.2
uv run scripts/tts.py --list-voices
Setup
Dependencies (kokoro-onnx, soundfile) are declared inline via PEP 723 and handled automatically by uv run. Model files (~336 MB total) are downloaded on first use and cached in ~/.cache/kokoro-tts/.
First run is slower due to dependency resolution and model download. Subsequent runs take a few seconds for short texts.
Voices
Default voice is af_heart (US English, female). Use --list-voices to see all 30+ voices across English (US/GB), French, Italian, Japanese, and Mandarin. Language is auto-detected from the voice name prefix; override with --lang if needed.
Output Formats
- OGG Vorbis (default) — compact, good quality for voice (~6x smaller than WAV)
- WAV — uncompressed, use when lossless quality is needed
Format is auto-detected from the output file extension, or can be set explicitly with --format.
Notes
- Runs entirely on CPU — no GPU required.
- OGG Vorbis at 24 kHz mono produces very compact files suitable for sharing in chat.
- For long texts, generation may take proportionally longer. Short messages (a few sentences) take just a few seconds.