nazdridoy/kokoro-tts
A local Kokoro ONNX CLI for turning documents and piped text into speech
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
Kokoro TTS is a Python CLI, invoked as kokoro-tts or python -m kokoro_tts, with local inference through kokoro-onnx==0.3.9. It reads TXT, EPUB, PDF, or stdin. For structured documents it extracts chapter information, then breaks long text into smaller segments for synthesis, local playback, or file output. The default model and voice assets are separate: kokoro-v1.0.onnx and voices-v1.0.bin.
The dependency stack includes EbookLib and Beautiful Soup 4 for ebook and markup handling, PyMuPDF, pymupdf-layout, and pymupdf4llm on the PDF side, and sounddevice and soundfile on the audio side. The practical integration surface is a subprocess with arguments, stdin, and output files. There is no established plugin contract or network service interface; playback streaming should not be treated as a streaming API.
Key Capabilities & Differentiators
Preset voices cover US and UK English (en-us, en-gb), French (fr-fr), Italian (it), Japanese (ja), and Mandarin (cmn). --lang selects the language, --speed adjusts delivery, and --voice accepts either one preset or a weighted mix such as af_sarah:60,am_adam:40. Blending gives users a way to tune existing voices; it is not evidence of voice cloning from a recording.
EPUB processing preserves chapter titles and structure, while PDF chapter detection works from the table of contents or content. Output can be a single WAV or MP3 file, or chunks organized for chapter assembly with --split-output and --merge-chunks. --stream plays audio locally as it is generated. For troubleshooting, --debug exposes processing details including EPUB NCX parsing and discovered chapter metadata.
Trade-offs & Limitations
Compared with a hosted service such as ElevenLabs, this CLI keeps document handling and inference on the user's machine and is straightforward to script from a shell. In return, the operator manages the Python environment, model files, compute capacity, and any GPU compatibility work. If the requirement is a shared remote endpoint, the CLI is a component to wrap and operate, not a ready-to-deploy service.
Document-aware processing reduces manual chapter splitting, but chapter detection and reading order are still worth spot-checking before converting an entire book, particularly for complex PDFs. Compare voice quality on representative text rather than assuming parity with hosted offerings. The CLI carries an MIT license; deployment and redistribution reviews should separately cover the model, voice assets, dependencies, and rights to the source documents.
Hardware & Deployment Guide
Use Python 3.11 or 3.12; the package excludes Python 3.13 and later. Install from PyPI with uv tool install kokoro-tts or pip install kokoro-tts, or run the cloned kokoro_tts module after installing dependencies. Fetch kokoro-v1.0.onnx and voices-v1.0.bin separately. The default lookup expects both in the working directory; once the dependencies and assets are in place, synthesis runs locally without a hosted TTS endpoint.
v2.3.0 introduced custom model and voice paths and stricter model-file validation. v2.3.2 replaced deprecated fitz API usage for PDF-processing compatibility. Start with CPU inference, then measure end-to-end conversion time, peak RAM, and output size using representative files. GPU support is available, but there is no established VRAM requirement or speedup figure. For parallel batches, check aggregate memory and storage on the intended host.
kokoro-onnx==0.3.9, with separate ONNX model and voice files.-, and pass an explicit --voice for unattended runs.--voice, language selection with --lang, and speech-rate control with --speed.--stream playback, WAV or MP3 export, and --merge-chunks to assemble chunks into chapter files.Readers turning EPUBs or PDFs into chapter-organized audio, and teams that want local text-to-speech in a shell or batch workflow.
You need a ready-made hosted API, remote audio streaming, or voice cloning from recordings.
Quick Start & Installation
# Using uv (recommended) uv tool install kokoro-tts # Using pip pip install kokoro-tts
Comparison vs. Top Voice, Vision & Video Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| kokoro-tts ★ | 2.1k | +22 | Python | MIT | A local Kokoro ONNX CLI for turning documents and piped text into speech |
| voice-pro | 13.5k | +34 | Python | GPL-3.0 | Self-hosted Gradio studio for transcription, translation, and dubbing |
| voicebox | 61.8k | +437 | Python | MIT | Local-first voice studio with multi-engine speech synthesis, dictation and MCP. |
| EmotiVoice | 8.5k | — | Python | Apache-2.0 | Self-hosted PyTorch TTS for prompt-controlled Chinese and English speech |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/nazdridoy/kokoro-tts.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about kokoro-tts
How should I integrate Kokoro TTS into a batch workflow?
kokoro-tts as a subprocess. Pass a file path or use - to pipe text through stdin. Specify --lang, --voice, and the output path explicitly so a batch job does not depend on interactive voice selection. The integration surface is the CLI; --stream plays audio locally rather than serving it over a network API.Do I need a GPU, and how should I size the host?
Can I use it commercially or distribute a self-hosted bundle?
When is this a better fit than ElevenLabs?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy