Crates.io | kokoro-tiny |
lib.rs | kokoro-tiny |
version | 0.1.0 |
created_at | 2025-09-18 04:53:02.258529+00 |
updated_at | 2025-09-18 04:53:02.258529+00 |
description | Minimal TTS crate using Kokoro - perfect for embedding in other apps |
homepage | https://github.com/8b-is/kokoro-tiny |
repository | https://github.com/8b-is/kokoro-tiny |
max_upload_size | |
id | 1844246 |
size | 137,181 |
Minimal, blazing-fast TTS (Text-to-Speech) crate powered by the Kokoro model (82M params). Perfect for embedding in applications, system alerts, and smart tools!
🚀 0.5-2s time-to-first-audio | 📦 Single-file implementation | 🎯 Zero-config usage
~/.cache/kokoros
kokoro-speak
for instant TTSAdd to your Cargo.toml
:
[dependencies]
kokoro-tiny = "0.1"
use kokoro_tiny::TtsEngine;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize (downloads model on first run)
let mut tts = TtsEngine::new().await?;
// Generate speech
let audio = tts.synthesize("Hello, world!", Some("af_sky"))?;
// Save to file
tts.save_wav("output.wav", &audio)?;
// Or play directly (with 'playback' feature)
#[cfg(feature = "playback")]
tts.play(&audio, 0.8)?; // 80% volume
Ok(())
}
Create unique voices by blending:
// Mix voices with weights
let audio = tts.synthesize(
"Creative voice mixing!",
Some("af_sky.8+af_bella.2") // 80% Sky + 20% Bella
)?;
Install the CLI:
cargo install kokoro-tiny
Use it instantly:
# Speak text
kokoro-speak say "Hello from kokoro!"
# System alerts
kokoro-speak alert success "Build complete!"
# Pipe input
echo "Processing files..." | kokoro-speak pipe
# Context summaries (perfect for smart-tree!)
kokoro-speak context "Found 5 TypeScript files with 200 lines total"
# Save to file
kokoro-speak say "Save this speech" -o output.wav
# List voices
kokoro-speak --list-voices
50+ voices across accents and styles:
Use --list-voices
to see all options!
Enable additional capabilities:
[dependencies]
kokoro-tiny = { version = "0.1", features = ["all-formats"] }
playback
- Direct audio playback (default)mp3
- MP3 encoding supportopus-format
- OPUS for streaming/VoIPcuda
- GPU accelerationall-formats
- All audio formatsCheck out the examples directory:
# Simple usage
cargo run --example simple
# Test all voices
cargo run --example test_voices
# Audio format comparison
cargo run --features all-formats --example audio_formats
Perfect for:
kokoro-tiny uses the Kokoro-82M model:
Contributions welcome! This project is maintained by Hue & Aye at 8b.is.
For the full Kokoro implementation with advanced features, check out Kokoros.
Apache 2.0 - See LICENSE
Built with 🎉 by the 8b.is team | Powered by the amazing Kokoro model