A talking Malay avatar that lives entirely in your browser tab
No server, no API key, no backend process of mine. Chrome’s built-in Gemini Nano writes the replies, a Piper voice speaks them in Bahasa Melayu, and a PNGTuber avatar lip-syncs to the audio. I recorded a demo: AI Avatar Offline Dalam Chrome (https://www.youtube.com/watch?v=IPhh5gjQXuE).
2026-08-08
Why browser-only
Everything runs in the tab: the conversation, the speech synthesis, the lip-sync. Typed messages never leave the device. The conversation history and the avatar's long-term memories live in localStorage and IndexedDB. After the first load, a service worker keeps the whole thing working offline. The honest fine print: voice input uses Chrome's Web Speech API, which sends your audio to Google, and the models themselves download once from Google and Hugging Face. Private does not mean cloud-free. It means nobody middlemans the conversation.
It also means zero serving cost for me. The app is static files, the voice models stream from Hugging Face to the visitor, and the language model ships inside the visitor's own Chrome.
Making Node software run in a browser tab
The speech part runs Piper through WASM, and the phonemizer I needed was compiled for Node.js. Node-specific glue does not survive a browser, so at build time I rewrite Emscripten's generated loader with five patches: a shim for require, a fake Worker class, a hand-written path-module polyfill, and keeping the in-memory filesystem instead of raw filesystem access. At runtime the page fetches 355 espeak-ng data files, nineteen megabytes, and writes them into that virtual filesystem before the first phoneme is made.
The bug I am proudest of finding: Hugging Face's exported Piper configs shipped an empty phoneme id map, which maps every phoneme to nothing and produces pure silence. Sixty megabytes of model weights, working fine, saying exactly nothing. The fix was to commit the four-kilobyte config files myself while streaming only the weights.
Teaching it Malaysian
The voices are Revolab's, sarah and paan, and they came with in-house conventions I ported: the normalizer expands RM50 to lima puluh ringgit, 50% to lima puluh peratus, and identity-card conventions like a/l to anak lelaki, text most normalizers never meet. The persona prompt bans Indonesian: bisa, kamu, coba are out, nak, tak, je, kot are in. The chat logs have receipts. At 6:31 one morning the avatar kept slipping into Indonesian and the user typed waduh waduh kenapa bahasa indon, complaining about Indonesian in Indonesian slang. The on-device model answered, in Malay, sorry, saya sedang belajar lagi. The persona word list was tightened that same day.
What it takes to run
Desktop Chrome 138 or newer, two flags enabled for the on-device model, sixteen gigabytes of memory, and a one-time Gemini Nano download. Mobile and other browsers get a setup guide instead. Two honest caveats: this is a lean rework of the open chrome-on-aituber project, my part is the Malay voices, the structured memory, and the offline packaging. And the voice models on Hugging Face are currently gated, so first-time visitors hear chat but not speech until I re-host them. The architecture is the part I wanted to prove: a talking, remembering, Malay-speaking avatar, entirely inside a tab.