text-to-speech · audio · WASM · ~109 MB
This is the Punjabi checkpoint of Meta's MMS-TTS family — a distinct model from the
English MMS-TTS demo, the Hindi one and the
Gujarati one: its own native Gurmukhi character
vocabulary (59 symbols, is_uroman:false — native Punjabi, not romanised Latin, and the
Gurmukhi script is distinct from Devanagari, Tamil and Gujarati) and its own Punjabi-trained VITS
weights, so it speaks Punjabi orthography — vowels ਅ/ਆ/ਇ, consonants ਕ/ਖ/ਗ, the tippi (ਂ), addak (ੱ)
and vowel signs — that the other checkpoints cannot. VITS is a conditional VAE with normalizing
flows and a stochastic duration predictor: one end-to-end network from text
straight to a waveform, no separate vocoder, and the same Punjabi sentence comes out with slightly
different rhythm every time.
| Model | naklitechie/mms-tts-pa-ONNX — an ONNX export of facebook/mms-tts-pan (its vocab matches the canonical checkpoint) |
|---|---|
| Task / pipeline | text-to-speech — VitsModel, Punjabi text tokens → 16 kHz waveform |
| Architecture | VITS: conditional VAE + normalizing-flow decoder + monotonic alignment + stochastic duration predictor. End-to-end — no separate vocoder. |
| Language / script | Punjabi (pan) in native Gurmukhi script (is_uroman:false) — one of 1000+ MMS languages, each its own checkpoint |
| Output | A mono Float32Array waveform at sampling_rate 16000 |
| Quantization | fp32 (full precision) ONNX (model.onnx) |
| Backend | WebAssembly (WASM) — runs anywhere; no WebGPU needed |
| Download | ~109 MB (fp32), cached after first load |
| License | CC-BY-NC 4.0 (MMS weights) — non-commercial |
| Web APIs | WebAssembly, Web Workers, Web Audio (playback), Blob URLs, Canvas |
Type some Punjabi and press ਬੋਲੋ (Speak). Synthesis runs in a Web Worker; the audio and waveform below are the real output for this device. Press Speak again to hear how the stochastic duration predictor re-times the very same words.
There is no spectrogram-then-vocoder hop here: VITS predicts the waveform itself. Below is the actual 16 kHz waveform (the bar fills as it plays). The tokens readout shows how many VITS input ids your Punjabi text became (native Gurmukhi characters plus interleaved blank tokens). The interesting part is timing — VITS decides how long each Punjabi sound lasts with a stochastic module, so re-running the same text changes the duration.
A Punjabi voice that runs entirely on-device: no per-character bill, no text leaving the tab. Punjabi is spoken by well over 100 million people across Punjab (India and Pakistan) and a large global diaspora; VITS won't out-act a big expressive model, but it's the model you reach for when you need Punjabi speech everywhere, offline, privately.
Type a Punjabi line, hear it, see its waveform — the core move.
A Punjabi narrator: read a notification, a weather report or an article snippet aloud.
Stochastic prosody lab — generate the same Punjabi text many times and compare the timing.
Type English, translate it to Punjabi with M2M100, then have MMS speak the Punjabi.
MMS-TTS is normally a one-liner with the text-to-speech pipeline. This ONNX export ships
model.onnx at the repo root and omits a tokenizer.json, so instead of the
high-level pipeline the worker loads the real VitsModel and reproduces the tokeniser
exactly — safe here because this checkpoint is is_uroman:false, so its VitsTokenizer is a
deterministic character tokeniser (no uroman romanisation):
import { AutoModel, Tensor } from "@huggingface/transformers";
// vocab.json matches canonical facebook/mms-tts-pan
const model = await AutoModel.from_pretrained(
"naklitechie/mms-tts-pa-ONNX", { model_file_name: "model", subfolder: "", dtype: "fp32" });
// Faithful VitsTokenizer: lowercase, map each in-vocab char, interleave blank (id 0).
// Same algorithm proven byte-identical to transformers.js's real VitsTokenizer in the Tamil demo.
const ids = tokenizePunjabi("ਇਹ ਆਵਾਜ਼ ਪੂਰੀ ਤਰ੍ਹਾਂ ਤੁਹਾਡੇ ਬ੍ਰਾਊਜ਼ਰ ਵਿੱਚ ਬਣਦੀ ਹੈ।");
const input_ids = new Tensor("int64", BigInt64Array.from(ids.map(BigInt)), [1, ids.length]);
const { waveform } = await model({ input_ids, attention_mask });
// waveform.data → Float32Array (mono), 16 kHz. Run again → slightly different (stochastic duration).
The manual tokeniser uses the same deterministic algorithm that was checked byte-for-byte against
transformers.js's real VitsTokenizer on a control language
(Xenova/mms-tts-hin: realLen 27 == manualLen 27, identical id sequence) — so the Punjabi
tokenisation is faithful, and the waveform is genuine VitsModel output. The
Hindi demo uses the plain pipeline() because its export
ships the full tokenizer files.