You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This tiny example spins up a text-to-speech bot that joins a call and greets participants using the open-weight [Kokoro](https://github.com/hexgrad/kokoro) model.
6
+
7
+
---
8
+
9
+
## Quick start
10
+
11
+
```bash
12
+
# clone and move into the repo (if not already there)
This package integrates the open-weight [Kokoro-82M TTS model](https://github.com/hexgrad/kokoro) with the GetStream audio/video SDK.
4
+
5
+
It provides a drop-in `KokoroTTS` class that implements the common `getstream_common.tts.TTS` interface, allowing you to stream PCM audio generated by Kokoro directly into a WebRTC `AudioStreamTrack`.
6
+
7
+
```py
8
+
from getstream_kokoro import KokoroTTS
9
+
from getstream.video.rtc.audio_track import AudioStreamTrack
10
+
11
+
track = AudioStreamTrack(framerate=24_000)
12
+
13
+
tts = KokoroTTS(lang_code="a", voice="af_heart")
14
+
tts.set_output_track(track)
15
+
16
+
await tts.send("Hello from Kokoro!")
17
+
```
18
+
19
+
## Installation
20
+
21
+
```bash
22
+
pip install getstream-plugins-kokoro
23
+
```
24
+
25
+
This will pull in the required `kokoro`, `numpy` and `getstream[webrtc]` dependencies. You also need `espeak-ng`**at runtime** for pronunciation fallback. On macOS you can install it with Homebrew:
26
+
27
+
```bash
28
+
brew install espeak-ng
29
+
```
30
+
31
+
## Configuration options
32
+
33
+
| Parameter | Default | Description |
34
+
|-----------|---------|-------------|
35
+
|`lang_code`|`"a"`| Language group passed to `KPipeline` (`"a"` = American English, etc.) |
36
+
|`voice`|`"af_heart"`| Kokoro voice preset. See the [model card](https://huggingface.co/NeuML/kokoro-int8-onnx#speaker-reference) for available options. |
37
+
|`speed`|`1.0`| Playback speed multiplier. |
38
+
|`sample_rate`|`24000`| Output sample-rate (fixed by Kokoro). **The attached `AudioStreamTrack` must use the same value.**|
39
+
40
+
## Development
41
+
42
+
Run the unit-tests with:
43
+
44
+
```bash
45
+
pytest -q getstream/plugins/kokoro/tests
46
+
```
47
+
48
+
No network calls are made – the Kokoro SDK is fully mocked.
0 commit comments