kokoro-pi

Kokoro text to speech on a Raspberry Pi 5, about twice as fast on the same CPU. The point of the exercise is that you cannot hear the difference — so here it is to listen to.

github.com/zreecespieces/kokoro-pi

Same text, same voice, three builds

All produced on one Raspberry Pi 5 with the voice af_heart, on held-out text the int8 calibration never saw. Upstream is the published Kokoro ONNX export. Float adds graph rewrites and a native Snake kernel — 1.35×, and identical to 115 dB. int8 adds the fused convolution kernel and is the default build: 1.83× on the vocoder, and what you are listening for is whether it costs anything.

Good evening, Maya.

upstream
float
int8 — default

On Tuesday, the museum opens at nine and closes shortly after sunset.

upstream
float
int8 — default

When the afternoon meeting ended, Elena reviewed every note, corrected the final schedule, and sent a clear summary to the volunteers who would arrive early the following morning.

upstream
float
int8 — default

These are 64 kbit MP3s so the page loads on a phone; the originals are 24 kHz WAVs in samples/. In a blind listen over all six held-out utterances, none of the builds was distinguishable from the float engine, which is why the default is the fastest one. The measured gap is 2.2 dB log-spectral distance against a floor of roughly 1 dB for any change at all — why that is the right measure.

What it costs in time

SetupFirst audioFull passageRealtime factor
Kokoro on PyTorch — a plain pip install10.45 s20.13 s1.54
Kokoro + ONNX Runtime, upstream export12.02 s12.02 s0.98
+ graph rewrites and the Snake kernel10.41 s10.41 s0.85
+ the fused int8 kernel5.47 s5.47 s0.45
+ clause streaming — the default1.59 s5.90 s0.51

One paragraph, about 12 seconds of speech, measured over HTTP so the numbers include everything a client waits for. Realtime factor under 1.0 is faster than speech. Full benchmarks, including a comparison against Piper and Kokoro-FastAPI on the same machine.

Against the alternatives

EnginePhraseSentenceParagraph
kokoro-pi0.490.480.37
Kokoro-FastAPI — the same model, PyTorch1.861.381.39
Piper, en_US-lessac-medium0.120.130.14

Realtime factor on one Raspberry Pi 5, every engine resident, measured the same afternoon. 3.4–3.8× faster than the popular Kokoro server — the difference between not keeping up with speech and running at three times speech. And 2.6–3× slower than Piper, which is a smaller model doing a cheaper job and is excellent at it. Both are now comfortably faster than speech, which is the point: on this hardware the choice stops being about speed and starts being about how the voice sounds. The players above are how you decide.

Running it

curl -fsSL https://raw.githubusercontent.com/zreecespieces/kokoro-pi/main/install.sh | bash

curl -s http://127.0.0.1:8080/v1/tts -H 'Content-Type: application/json' \
  -d '{"text":"Hello from my Raspberry Pi."}' | aplay -q -r 24000 -f S16_LE -c 1 -

It speaks the OpenAI speech API and the Wyoming protocol as well, so Open WebUI and Home Assistant need a URL and nothing else.