The Best Free Text-to-Speech Model for Commercial Use
In a groundbreaking development for text-to-speech (TTS) technology, the Kokoro TTS model has emerged as the number one free and commercially available TTS solution. Built on top of the widely popular open-source StyleTTS framework, Kokoro TTS offers unmatched flexibility and functionality for a variety of use cases. Let’s explore what makes this model stand out, its features, and how you can make the most of it.
What is TTS?
TTS, or text-to-speech, is a technology that converts written text into spoken words. It is widely used for applications like:
- Interacting with language models (LLMs).
- Narrating audiobooks.
- Transforming written content into podcasts.
TTS models have significant real-world applications, enhancing accessibility and improving user experiences.
Why is Kokoro TTS a Game-Changer?
Kokoro TTS stands out as the leading free and open-source TTS model for commercial use. Here’s why:
- Open Source and License-Friendly Kokoro TTS is licensed under Apache 2.0, allowing unrestricted use for commercial purposes. This makes it a truly open-source solution.
- Hugging Face Leaderboard Kokoro TTS ranks third on the Hugging Face TTS Arena leaderboard. While other models like Play.HT, ElevenLabs may rank higher, they are not commercially available, giving Kokoro TTS the edge.
3. Top Features
- Unique Voice Packs: Offers diverse voice options, including male and female voices.
- Multilingual Support: Supports languages such as US and UK English, French, Japanese, Korean, and Chinese.
- ONNX Version: Provides a lightweight, GPU-independent deployment option ideal for real-time use cases.
Key Advantages for Developers
Kokoro TTS is a powerful tool for developers looking to integrate TTS functionality into their applications. Its ONNX compatibility allows for:
- Seamless Self-Hosting: Deploy on personal servers or cloud environments.
- Real-Time Applications: Ideal for web-based real-time communication systems.
- Scalable Use Cases: Handle large-scale production without relying heavily on GPUs.
How to Get Started with Kokoro TTS
The model weights are readily available for download.
## 1️⃣ Install dependencies silently
!git lfs install
!git clone https://huggingface.co/hexgrad/Kokoro-82M
%cd Kokoro-82M
!apt-get -qq -y install espeak-ng > /dev/null 2>&1
!pip install -q phonemizer torch transformers scipy munch
## 2️⃣ Build the model and load the default voicepack
from models import build_model
import torch
device = 'cuda' if torch.cuda.is_available() else 'cpu'
MODEL = build_model('kokoro-v0_19.pth', device)
VOICE_NAME = [
'af', # Default voice is a 50-50 mix of Bella & Sarah
'af_bella', 'af_sarah', 'am_adam', 'am_michael',
'bf_emma', 'bf_isabella', 'bm_george', 'bm_lewis',
'af_nicole', 'af_sky',
][0]
VOICEPACK = torch.load(f'voices/{VOICE_NAME}.pt', weights_only=True).to(device)
print(f'Loaded voice: {VOICE_NAME}')
## 3️⃣ Call generate, which returns 24khz audio and the phonemes used
from kokoro import generate
text = "How could I know? It's an unanswerable question. Like asking an unborn child if they'll lead a good life. They haven't even been born."
audio, out_ps = generate(MODEL, text, VOICEPACK, lang=VOICE_NAME[0])
## Language is determined by the first letter of the VOICE_NAME:
## 🇺🇸 'a' => American English => en-us
## 🇬🇧 'b' => British English => en-gb
## 4️⃣ Display the 24khz audio and print the output phonemes
from IPython.display import display, Audio
display(Audio(data=audio, rate=24000, autoplay=True))
print(out_ps)
Final Thoughts
Kokoro TTS is a revolutionary step forward for the TTS community. With its open-source license, diverse voice options, and impressive performance, it’s a solid choice for developers and businesses alike. Whether you’re narrating audiobooks, creating podcasts, or enhancing accessibility in your applications, Kokoro TTS offers a reliable, scalable, and cost-effective solution.
Try Kokoro TTS today and experience the future of text-to-speech technology. Let us know your thoughts, especially if you’ve tested the model in different languages. The possibilities are endless with this exceptional tool. Happy prompting!