crystal_tts_kokoro_client
tts_kokoro
Crystal shard client for kokoro_api_server. Stateful sentence tokenization and stream buffering. => https://github.com/ieve-rothe/kokoro_api_server Kokoro Api Server
Installation
Add to your shard.yml:
dependencies:
tts_kokoro:
github: ieve-rothe/tts_kokoro
Usage
require "tts_kokoro"
# 1. Initialize client (uses keep-alive automatically)
tts = TtsKokoro::TTS.new(endpoint: "http://127.0.0.1:8888/speak")
# 2. Synchronous block speak
tts.speak_blocking("Hello world!")
# 3. Streaming buffer integration
buffer = TtsKokoro::StreamingTTSBuffer.new(tts, voice_blend: "af_bella", speed: 1.0)
buffer.start
# Push streaming chunks from LLM
buffer.push("This is a ")
buffer.push("sentence. Next ")
buffer.push("sentence starts here.")
# Flush when LLM finishes
buffer.flush
Features
- Stateful
SentenceTokenizerskips splits on decimals (v1.0), initials (U.S.), lists (1. Item), and multiple punctuation (Wait!!!). - Connection health recovery loop with exponential backoff.
- Background fiber exception safety routing to Crystal standard
Log.
Repository
crystal_tts_kokoro_client
Owner
Statistic
- 0
- 0
- 0
- 0
- 0
- about 9 hours ago
- June 28, 2026
License
Links
Synced at
Sun, 28 Jun 2026 22:43:33 GMT
Languages