Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How I Built a 100% Free, Private In-Browser AI Text-to-Speech Tool Using Kokoro-82M & WebGPU

Description and use

A fully client‑side TTS tool built with Kokoro‑82M and WebGPU, offering unlimited speech, zero cost, and full privacy.

Problem

Services demanding $22/month subscriptions, strict 500-character limits, mandatory account signups, and privacy concerns over uploading sensitive text to third-party cloud servers.

Outcome

PureTTS delivers natural, unlimited‑length speech entirely in the browser with zero subscription cost, no character limits, and full client‑side privacy.

Workflow

  • 1. Choose a lightweight neural model (Kokoro‑82M) and compile it to ONNX WebAssembly/WebGPU via kokoro-js.
  • 2. Load the model and perform inference inside a dedicated Web Worker to keep the UI responsive.
  • 3. Chunk long text into ~200‑character sentences using a regex engine.
  • 4. Synthesize each chunk sequentially, reporting progress.
  • 5. Concatenate the resulting Float32Array PCM buffers with a 220 ms natural pause between sentences.
  • 6. Encode the merged PCM stream into a 16‑bit PCM WAV Blob with RIFF headers on the fly.
  • 7. Serve the tool via GitHub Pages, with the model weights cached in IndexedDB for offline use.

Evidence

Services demanding $22/month subscriptions.

Source

I decided to see if modern browser standards (WebGPU, WebAssembly, and Web Workers) could handle state-of-the-art neural speech synthesis completely on the client side — with zero server bills, zero paywalls, and zero limits.

Source

Running neural inference in JavaScript is computationally heavy. On initial prototypes, running the forward pass on the main browser thread caused the entire DOM to lock up... To keep the UI at a buttery 60 FPS, all model loading, phoneme tokenization, and ONNX execution were isolated inside a dedicated Web Worker.

Source

Kokoro-82M has an inherent context window of approximately 512 phonemes (roughly 240 characters or ~29 seconds of speech). If you pass a 2,000-word blog post or book chapter, the model simply truncates it.

Source

No text is ever transmitted across the network. No audio is stored on a server. It works completely offline after the initial model load!

Source

  • Record date: 2026-10-15T01:41:08.079Z