Skip to content

How it's builtGenerative AI

Voice Studio

Kokoro, an open text-to-speech model with 82 million parameters, reads your script aloud in your browser, sentence by sentence, in a choice of natural voices. The clip downloads as a WAV file.

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

  1. 01
    Split

    The script becomes pieces of about one sentence, each with the pause that follows it.

  2. 02
    Phonemise

    eSpeak NG turns each piece into phonemes, in American or British English to match the voice.

  3. 03
    Speak

    Kokoro turns the phonemes into 24 kHz audio in a worker, one piece at a time.

  4. 04
    Tidy

    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.

  5. 05
    Play

    Each piece is queued on the Web Audio clock as soon as it arrives, so playback starts after the first sentence.

  6. 06
    Draw

    The waveform is drawn from the samples on a canvas, with a playhead you can drag or move with the keys.

  7. 07
    Save

    The pieces and pauses are joined and written as a 16-bit mono WAV file, on the page.

Results

Voices
28
20 American, 8 British
Speed on the graphics chip
1.4 to 2.4× real time
17.6 s of speech; first sound after 1.6 to 2.2 s
Speed on the processor
0.2× real time
17.6 s of speech; first sound after 14.0 to 16.4 s
WAV size
48 kB a second
a 20-second clip is about 960 kB

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

PartWhat it does hereLicence
Kokoro 82MThe voice model, in ONNX formatApache 2.0
kokoro-jsRuns Kokoro in the browser, from text to audioApache 2.0
phonemizer.js and eSpeak NGText to phonemes, compiled to WebAssemblyApache 2.0; eSpeak NG is GPL 3.0
Transformers.jsLoads the model and its files, with cachingApache 2.0
ONNX Runtime WebRuns the model on WebGPU or WebAssemblyMIT
My audio codeSentence splitting, the streaming player, the waveform and the WAV writer, in TypeScript with unit testsMine
PreactThe interactive demoMIT
AstroThe page, built as static HTMLMIT

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.