HN
Today

Local, CPU-Friendly, High-Quality TTS (Text-to-Speech) with Kokoro

A new article spotlights Kokoro, a remarkably CPU-friendly, high-quality Text-to-Speech (TTS) model that runs entirely locally, sidestepping the need for GPUs. It achieves impressive results with a compact 82M parameter model, offering privacy-conscious local audio generation that even older CPUs can handle. This allows for powerful local applications, integrating seamlessly with existing OpenAI API workflows and opening doors for new LLM interactions.

116
Score
23
Comments
#1
Highest Rank
23h
on Front Page
First Seen
Jul 7, 7:00 PM
Last Seen
Jul 8, 5:00 PM
Rank Over Time
7221122267879910913151820242729

The Lowdown

The article introduces Kokoro, a cutting-edge Text-to-Speech (TTS) model celebrated for its ability to deliver high-quality, realistic speech generation locally and efficiently on CPU-only systems. This marks a significant leap from just a few years ago when such performance seemed unimaginable without dedicated, powerful GPUs, emphasizing privacy as a core benefit.

  • Model Overview: Kokoro is a compact 82-million parameter model capable of generating realistic speech in multiple languages, including English, Mandarin, and Hindi, with approximately 50 distinct English voices.
  • Easy Setup: It offers straightforward deployment via a Docker/Podman container image, Kokoro-FastAPI, which bundles pre-downloaded voice models (resulting in a 5 GB image size).
  • API Compatibility: The service provides a simple web UI for testing and, more importantly, a TTS interface compatible with the OpenAI speech API, allowing easy integration into existing applications using JavaScript or Python.
  • Performance: Benchmarks demonstrate impressive CPU performance, with generation times ranging from 4.7 seconds on a 12-year-old Intel Core i7-4770K to 1.5 seconds on a modern AMD Ryzen 7 8745HS for a test paragraph.
  • Alternative: The article also briefly mentions Speaches, another OpenAI-compatible containerized TTS service that includes Whisper (STT) but requires separate voice weight downloads.
  • Use Cases: The author suggests combining local TTS with local LLMs to enable users to listen to AI-generated answers instead of reading them.

In essence, Kokoro represents a powerful, accessible, and privacy-preserving solution for integrating advanced speech synthesis directly into local applications, democratizing high-quality TTS capabilities.

The Gossip

Kokoro's Capabilities and Quirks

Commenters generally laud Kokoro's quality and CPU-friendly nature, sharing positive experiences using it for accessibility products, browser games, and intercom systems. However, a common drawback noted is its struggle with very short utterances (e.g., a single word), often introducing extraneous sounds. Users have found clever workarounds, such as embedding single words in longer sentences and then cropping the audio based on word timestamps, albeit with a slight loss of natural intonation. This limitation is attributed to the model's small parameter size.

Performance Prowess & Platform Porting

Many users are impressed by Kokoro's performance on CPUs, with some suggesting even faster inference could be achieved by leveraging integrated GPUs (like those on Apple M2 Pro or AMD Ryzen APUs). There's also active discussion and sharing of efforts to optimize Kokoro further for various platforms and runtimes, including reducing 'expensive layers' and converting it to formats like MNN for 3x speedups on phones, or porting it to CoreML and iPhone's ANE for real-time natural TTS with reduced battery drain and thermals.

Competitive Comparisons & Quality Queries

The discussion includes comparisons of Kokoro's quality against other leading TTS solutions. While many find Kokoro "surprisingly great at nuance" and "very good" for its local and CPU-friendly nature, questions arise about how it stacks up against cloud-based services like Eleven Labs, and other local models such as Pocket TTS. Some argue Pocket TTS, especially its ONNX version, might offer better quality, while others find the PyTorch version of Pocket TTS performs better on CPU inference, highlighting varied experiences and optimization paths.