The problem
Clinics, shops and creators need short voice clips all the time: a phone greeting, a voice-over for a product video, an announcement in the store. Booking a voice artist for every change is slow and costly, and robotic text to speech makes a business sound cheap.
A small open model makes a natural-sounding clip in seconds, as often as the script changes, with no fee per word and nothing sent to a server.
The data
The voices come with the model: 28 English voices, 20 American and 8 British, each graded in Kokoro's voice notes by how much clean audio it learnt from. I list them all, best first, with the grade beside each name.
The three templates are mine, for made-up businesses: a phone greeting for Lotus Dental Care, a 20-second voice-over for Brew Box and an announcement for Meadow Mart. They become four, four and four pieces to speak.
Kokoro also has Hindi voices, but they need a Hindi phonemiser and the one that ships with kokoro-js knows only English, so it rejects them. I left them out rather than offer voices that cannot speak.
The model
Kokoro 82M turns phonemes into a waveform at 24,000 samples a second. kokoro-js first turns the text into phonemes with eSpeak NG, compiled to WebAssembly, then the model speaks them in the chosen voice, at the chosen speed.
One sentence at a time. I split the script into sentences, join a very short one to its neighbour (Kokoro's notes say short lines sound weaker) and cut a very long one at its commas. A worker makes each piece and sends it back at once; the page queues the pieces back to back on the Web Audio clock, so the first sentence plays while the rest are still being made.
Graphics chip or processor. kokoro-js recommends full precision on WebGPU and the 8-bit model on the processor. The 8-bit file is far smaller (about 90 MB against 330 MB), but on the processor this site gets one thread, and in my tests that was several times slower than speech. So the demo uses the graphics chip where the browser offers one and lets you choose the smaller download.
The pipeline
- 01Split
The script becomes pieces of about one sentence, each with the pause that follows it.
- 02Phonemise
eSpeak NG turns each piece into phonemes, in American or British English to match the voice.
- 03Speak
Kokoro turns the phonemes into 24 kHz audio in a worker, one piece at a time.
- 04Tidy
Isolated clicks, which Kokoro puts near the start of each piece on a graphics chip, are removed, and quiet speech is lifted to a steady level, with one gain for the whole clip.
- 05Play
Each piece is queued on the Web Audio clock as soon as it arrives, so playback starts after the first sentence.
- 06Draw
The waveform is drawn from the samples on a canvas, with a playhead you can drag or move with the keys.
- 07Save
The pieces and pauses are joined and written as a 16-bit mono WAV file, on the page.
Results
The speeds are from the demo in Edge on Windows on 2026-11-23, making the 20-second product voice-over in Heart's voice twice on each, the slower run while the machine was busy with other work; the page works them out from those timings when it is built. They depend on the device: a newer graphics chip is faster, and a phone is slower.
For a client
For a client I would fix one or two voices as the brand's voice and keep a pronunciation list for names and products, so ‘Lotus’ and ‘kurta’ come out right every time.
Phone systems want their own formats, often 8 kHz audio, so I would render clips on a server or when the site is built and keep them with the script, ready to change in a minute.
For Indian languages I would use a model trained on them; Kokoro's English voices read Indian names with an English stress.
Stack
| Part | What it does here | Licence |
|---|---|---|
| Kokoro 82M | The voice model, in ONNX format | Apache 2.0 |
| kokoro-js | Runs Kokoro in the browser, from text to audio | Apache 2.0 |
| phonemizer.js and eSpeak NG | Text to phonemes, compiled to WebAssembly | Apache 2.0; eSpeak NG is GPL 3.0 |
| Transformers.js | Loads the model and its files, with caching | Apache 2.0 |
| ONNX Runtime Web | Runs the model on WebGPU or WebAssembly | MIT |
| My audio code | Sentence splitting, the streaming player, the waveform and the WAV writer, in TypeScript with unit tests | Mine |
| Preact | The interactive demo | MIT |
| Astro | The page, built as static HTML | MIT |
Privacy
Your script and the audio never leave your browser. The model downloads once from Hugging Face and then loads from the browser's cache; each voice is a small extra file fetched the first time you use it.
The WAV file is made on the page, so nothing is stored anywhere but your own downloads.
Limits
- English only, in American and British accents. Indian names can come out with an odd stress; spelling a name the way it sounds usually fixes it.
- Some voices are much better than others. The grades in the picker are Kokoro's own, and the best ones are at the top.
- Kokoro's text rules know dollars and pounds but not rupees, so I write prices out in words.
- Without a graphics chip a clip takes longer to make than to play, so playback pauses between sentences while the next one is made.