Pocket TTS German — int4 ONNX, runs in a browser
Text to speech for German that runs entirely on a CPU — in a web page, with no server, no GPU and no API key. The whole pack is 106 MB.
Made by Prasad Vittaldev. If this is useful to you, follow me on LinkedIn — I post each new model as it lands: https://in.linkedin.com/in/prasadvittaldev
Try it in your browser right now: https://prasadtts.vercel.app
Why this exists
Kyutai's Pocket TTS is a genuinely small, genuinely good TTS model — a 6-layer flow-matching language model (89.4M parameters) over the Mimi neural codec at 24 kHz. The weights are published openly under CC-BY-4.0.
Getting it into a browser is a separate problem from getting it small. This pack solves the parts that are not obvious:
- int4, in one file. The language model is quantized to 4-bit MatMulNBits,
302.7 MB → 40.8 MB. Crucially it is saved as a single
.onnx— ONNX Runtime Web cannot read an external.onnx.datacompanion and fails at session creation withModule.MountedFiles is not available. Most ONNX exports of models this size split by default. - The text conditioner stays float32. Quantizing it to int8 saves 40 bytes (it is nearly all embedding lookups) while putting pronunciation at risk.
- Precomputed voice state. A voice prompt is a KV-cache prefix. Shipping it
precomputed means the browser never has to load the Mimi encoder at all.
One caveat learned the hard way: that state carries a per-layer
stepthat must equal the cache length. Set it to zero and the model silently ignores the voice and emits near-silence — measured at rms 0.0026 versus 0.176 correct.
Contents
| file | size | what it is |
|---|---|---|
flow_lm_main_int4.onnx | 38.9 MB | language model, int4 (MatMulNBits, block 128, symmetric) |
flow_lm_flow_int8.onnx | 9.5 MB | flow head, int8 dynamic |
mimi_decoder_int8.onnx | 21.6 MB | Mimi codec decoder, int8 dynamic |
mimi_encoder_int8.onnx | 19.8 MB | Mimi codec encoder, int8 (only needed to clone a new voice) |
text_conditioner.onnx | 15.6 MB | text conditioner, float32 -- it is almost entirely embedding lookups, so int8 saves nothing and only adds risk |
Plus bundle.json (graph/state manifest), tokenizer.model (SentencePiece), and
bos_before_voice.npy. Voice embeddings are under voices/.
Voices and samples
Every voice below is a real audio file in this repo — click and listen.
| voice | measured F0 | sample |
|---|---|---|
charles | 92 Hz | sample_charles.wav |
azelma | 123 Hz | sample_azelma.wav |
alba | 125 Hz | sample_alba.wav |
vera | 161 Hz | sample_vera.wav |
Use it
In a browser, the easiest path is https://prasadtts.vercel.app — pick German, and the model downloads once and is cached locally.
With ONNX Runtime in Python:
pip install onnxruntime numpy huggingface_hub soundfile
huggingface-cli download prasadvittaldev/pocket-tts-german-onnx-int4 --local-dir ./german
Then run it with the reference ONNX runtime from
KevinAHM/pocket-tts-onnx-export
(MIT), pointing --models_dir at the folder you just downloaded and
--precision int4.
Credits
- Kyutai — the Pocket TTS model and the Mimi codec. All the speech quality here is theirs; this pack changes only the numeric format. Licensed CC-BY-4.0, and this derivative keeps that licence.
- KevinAHM/pocket-tts-onnx-export (MIT) — the ONNX export scripts these graphs were produced with.
- Quantization, single-file packing, browser runtime and the web app by Prasad Vittaldev — https://in.linkedin.com/in/prasadvittaldev
If you build something with this, I would like to hear about it.