Open-source State-of-the-art TTS model which runs on a CPU π»
Python
fixed readme + example
Rohan Joshi0ff11239528d
diff --git a/README.md b/README.mdindex 1a15bd3..ae6e50e 100644--- a/README.md+++ b/README.md@@ -1,94 +1,169 @@-# Kitten TTS π»+# Kitten TTS-<img width="607" height="255" alt="Screenshot 2026-02-18 at 8 33 04β―PM" src="https://github.com/user-attachments/assets/f4646722-ba78-4b25-8a65-81bacee0d4f6" />+<p align="center">+ <img width="607" height="255" alt="Kitten TTS" src="https://github.com/user-attachments/assets/f4646722-ba78-4b25-8a65-81bacee0d4f6" />+</p>+[](https://huggingface.co/spaces/KittenML/KittenTTS-Demo)+[](https://discord.com/invite/VJ86W4SURW)+[](https://kittenml.com)+[](LICENSE)+> **New:** Kitten TTS v0.8 is out -- 15M, 40M, and 80M parameter models now available.-> **π ANNOUNCEMENT:** New version of KittenTTS is now available to download!+Kitten TTS is an open-source, lightweight text-to-speech library built on ONNX. With models ranging from 15M to 80M parameters (25-80 MB on disk), it delivers high-quality voice synthesis on CPU without requiring a GPU.-### [Wanna hear samples? Try the model for free on Hugging Face Spaces by clicking this link](https://huggingface.co/spaces/KittenML/KittenTTS-Demo)+> **Status:** Developer preview -- APIs may change between releases.+**Commercial support is available.** For integration assistance, custom voices, or enterprise licensing, [contact us](https://docs.google.com/forms/d/e/1FAIpQLSc49erSr7jmh3H2yeqH4oZyRRuXm0ROuQdOgWguTzx6SMdUnQ/viewform?usp=preview).+## Table of Contents-Kitten TTS is an open-source realistic text-to-speech model with just 15 million parameters, designed for lightweight deployment and high-quality voice synthesis.+- [Features](#features)+- [Available Models](#available-models)+- [Demo](#demo)+- [Quick Start](#quick-start)+- [API Reference](#api-reference)+- [System Requirements](#system-requirements)+- [Roadmap](#roadmap)+- [Commercial Support](#commercial-support)+- [Community and Support](#community-and-support)+- [License](#license)-*Currently in developer preview*+## Features-[Join our discord](https://discord.com/invite/VJ86W4SURW)+- **Ultra-lightweight** -- Model sizes from 25 MB (int8) to 80 MB, suitable for edge deployment+- **CPU-optimized** -- ONNX-based inference runs efficiently without a GPU+- **8 built-in voices** -- Bella, Jasper, Luna, Bruno, Rosie, Hugo, Kiki, and Leo+- **Adjustable speech speed** -- Control playback rate via the `speed` parameter+- **Text preprocessing** -- Built-in pipeline handles numbers, currencies, units, and more+- **24 kHz output** -- High-quality audio at a standard sample rate-[Our website](https://kittenml.com)+## Available Models-[For custom support - fill this form ](https://docs.google.com/forms/d/e/1FAIpQLSc49erSr7jmh3H2yeqH4oZyRRuXm0ROuQdOgWguTzx6SMdUnQ/viewform?usp=preview)+| Model | Parameters | Size | Download |+|---|---|---|---|+| kitten-tts-mini | 80M | 80 MB | [KittenML/kitten-tts-mini-0.8](https://huggingface.co/KittenML/kitten-tts-mini-0.8) |+| kitten-tts-micro | 40M | 41 MB | [KittenML/kitten-tts-micro-0.8](https://huggingface.co/KittenML/kitten-tts-micro-0.8) |+| kitten-tts-nano | 15M | 56 MB | [KittenML/kitten-tts-nano-0.8](https://huggingface.co/KittenML/kitten-tts-nano-0.8-fp32) |+| kitten-tts-nano (int8) | 15M | 25 MB | [KittenML/kitten-tts-nano-0.8-int8](https://huggingface.co/KittenML/kitten-tts-nano-0.8-int8) |-Email the creators with any questions : [email protected]+> **Note:** Some users have reported issues with the `kitten-tts-nano-0.8-int8` model. If you encounter problems, please [open an issue](https://github.com/KittenML/KittenTTS/issues).+## Demo-## Features+https://github.com/user-attachments/assets/d80120f2-c751-407e-a166-068dd1dd9e8d-- **Ultra-lightweight**: Model size less than 25MB-- **CPU-optimized**: Runs without GPU on any device-- **High-quality voices**: Several premium voice options available-- **Fast inference**: Optimized for real-time speech synthesis+## Quick Start+### Prerequisites-## Models+- Python 3.8 or later+- pip-| Model | Params | Size | Link |-|-------|--------|------|------|-| kitten-tts-mini | 80M | 80MB | π€ [KittenML/kitten-tts-mini-0.8](https://huggingface.co/KittenML/kitten-tts-mini-0.8) |-| kitten-tts-micro | 40M | 41MB | π€ [KittenML/kitten-tts-micro-0.8](https://huggingface.co/KittenML/kitten-tts-micro-0.8) |-| kitten-tts-nano | 15M | 56MB | π€ [KittenML/kitten-tts-nano-0.8](https://huggingface.co/KittenML/kitten-tts-nano-0.8-fp32) |-| kitten-tts-nano-0.8-int8 | 15M | 25MB | π€ [KittenML/kitten-tts-nano-0.8-int8](https://huggingface.co/KittenML/kitten-tts-nano-0.8-int8) |+### Installation-> Some users are facing minor issues with the kitten-tts-nano-int8 model. We are looking into it. Please report to us if you face any issues.+```bash+pip install https://github.com/KittenML/KittenTTS/releases/download/0.8.1/kittentts-0.8.1-py3-none-any.whl+```-## Demo Video+### Basic Usage+```python+from kittentts import KittenTTS-https://github.com/user-attachments/assets/d80120f2-c751-407e-a166-068dd1dd9e8d+model = KittenTTS("KittenML/kitten-tts-mini-0.8")+audio = model.generate("This high-quality TTS model runs without a GPU.", voice="Jasper")+import soundfile as sf+sf.write("output.wav", audio, 24000)+```+### Advanced Usage-## Quick Start+```python+# Adjust speech speed (default: 1.0)+audio = model.generate("Hello, world.", voice="Luna", speed=1.2)-### Installation+# Save directly to a file+model.generate_to_file("Hello, world.", "output.wav", voice="Bruno", speed=0.9)-```-pip install https://github.com/KittenML/KittenTTS/releases/download/0.8.1/kittentts-0.8.1-py3-none-any.whl+# List available voices+print(model.available_voices)+# ['Bella', 'Jasper', 'Luna', 'Bruno', 'Rosie', 'Hugo', 'Kiki', 'Leo']```+## API Reference+### `KittenTTS(model_name, cache_dir=None)`- ### Basic Usage+Load a model from Hugging Face Hub.-```-from kittentts import KittenTTS-m = KittenTTS("KittenML/kitten-tts-mini-0.8")+| Parameter | Type | Default | Description |+|---|---|---|---|+| `model_name` | `str` | `"KittenML/kitten-tts-nano-0.8"` | Hugging Face repository ID |+| `cache_dir` | `str` | `None` | Local directory for caching downloaded model files |-audio = m.generate("This high quality TTS model works without a GPU.", voice='Jasper' )+### `model.generate(text, voice, speed, clean_text)`-# available_voices : ['Bella', 'Jasper', 'Luna', 'Bruno', 'Rosie', 'Hugo', 'Kiki', 'Leo']+Synthesize speech from text, returning a NumPy array of audio samples at 24 kHz.-# Save the audio-import soundfile as sf-sf.write('output.wav', audio, 24000)+| Parameter | Type | Default | Description |+|---|---|---|---|+| `text` | `str` | -- | Input text to synthesize |+| `voice` | `str` | `"expr-voice-5-m"` | Voice name (see available voices) |+| `speed` | `float` | `1.0` | Speech speed multiplier |+| `clean_text` | `bool` | `False` | Preprocess text (expand numbers, currencies, etc.) |-```+### `model.generate_to_file(text, output_path, voice, speed, sample_rate, clean_text)`+Synthesize speech and write directly to an audio file.+| Parameter | Type | Default | Description |+|---|---|---|---|+| `text` | `str` | -- | Input text to synthesize |+| `output_path` | `str` | -- | Path to save the audio file |+| `voice` | `str` | `"expr-voice-5-m"` | Voice name |+| `speed` | `float` | `1.0` | Speech speed multiplier |+| `sample_rate` | `int` | `24000` | Audio sample rate in Hz |+| `clean_text` | `bool` | `True` | Preprocess text (expand numbers, currencies, etc.) |+### `model.available_voices`+Returns a list of available voice names: `['Bella', 'Jasper', 'Luna', 'Bruno', 'Rosie', 'Hugo', 'Kiki', 'Leo']`## System Requirements-Works literally everywhere. Needs python3.12. We recommend using conda.+- **Operating system:** Linux, macOS, or Windows+- **Python:** 3.8 or later+- **Hardware:** Runs on CPU; no GPU required+- **Disk space:** 25-80 MB depending on model variant++A virtual environment (conda, venv, or similar) is recommended to avoid dependency conflicts.++## Roadmap++- [ ] Release optimized inference engine+- [ ] Release mobile SDK+- [ ] Release higher quality TTS models+- [ ] Release multilingual TTS+- [ ] Release KittenASR+- [ ] Need anything else? [Let us know](https://github.com/KittenML/KittenTTS/issues)++## Commercial Support++We offer commercial support for teams integrating Kitten TTS into their products. This includes integration assistance, custom voice development, and enterprise licensing.+[Contact us](https://docs.google.com/forms/d/e/1FAIpQLSc49erSr7jmh3H2yeqH4oZyRRuXm0ROuQdOgWguTzx6SMdUnQ/viewform?usp=preview) or email [email protected] to discuss your requirements.+## Community and Support-## Checklist+- **Discord:** [Join the community](https://discord.com/invite/VJ86W4SURW)+- **Website:** [kittenml.com](https://kittenml.com)+- **Custom support:** [Request form](https://docs.google.com/forms/d/e/1FAIpQLSc49erSr7jmh3H2yeqH4oZyRRuXm0ROuQdOgWguTzx6SMdUnQ/viewform?usp=preview)+- **Email:** [email protected]+- **Issues:** [GitHub Issues](https://github.com/KittenML/KittenTTS/issues)-- [x] Release a preview model-- [ ] Release the fully trained model weights-- [ ] Release mobile SDK-- [ ] Release web version+## License+This project is licensed under the [Apache License 2.0](LICENSE).diff --git a/example.py b/example.pyindex e37474a..ad1e5b4 100644--- a/example.py+++ b/example.py@@ -3,17 +3,15 @@ from kittentts import KittenTTS# it will run blazing fast on any GPU. But this example will run on CPU.# Step 1: Load the model-# m = KittenTTS("KittenML/kitten-tts-mini-0.8") # 80M version (highest quality)-m = KittenTTS("KittenML/kitten-tts-micro-0.8") # 40M version (balances speed and quality )+m = KittenTTS("KittenML/kitten-tts-mini-0.8") # 80M version (highest quality)+# m = KittenTTS("KittenML/kitten-tts-micro-0.8") # 40M version (balances speed and quality )# m = KittenTTS("KittenML/kitten-tts-nano-0.8") # 15M version (tiny and faster )# Step 2: Generate the audio# this is a sample from the TinyStories dataset.-text ="""One day, a little girl named Lily found a needle in her room. She knew it was difficult to play with it because it was sharp. Lily wanted to share the needle with her mom, so she could sew a button on her shirt.-Lily went to her mom and said, "Mom, I found this needle. Can you share it with me and sew my shirt?" Her mom smiled and said, "Yes, Lily, we can share the needle and fix your shirt."-Together, they shared the needle and sewed the button on Lily's shirt. It was not difficult for them because they were sharing and helping each other. After they finished, Lily thanked her mom for sharing the needle and fixing her shirt. They both felt happy because they had shared and worked together."""+text ="""One day, a little girl named Lily found a needle in her room. She knew it was difficult to play with it because it was sharp. """# available_voices : ['Bella', 'Jasper', 'Luna', 'Bruno', 'Rosie', 'Hugo', 'Kiki', 'Leo']