← All models

text-to-speech · audio · WASM · ~114 MB

MMS-TTS Urdu — end-to-end Urdu speech, one network

This is the Urdu checkpoint of Meta's MMS-TTS family — a distinct model from the English MMS-TTS demo, the Hindi one and the Arabic one: its own native Perso-Arabic (Nastaliq) character vocabulary (58 symbols, is_uroman:false — native Urdu script written right-to-left, not romanised Latin) and its own Urdu-trained VITS weights. Urdu shares the Arabic script family but is a separate checkpoint with letters like ٹ/ڈ/ڑ/ں/ہ and its own pronunciation. 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 Urdu sentence comes out with slightly different rhythm every time.

At a glance

Modelnaklitechie/mms-tts-ur-ONNX — a faithful ONNX export of facebook/mms-tts-urd-script_arabic (its vocab is byte-identical to the canonical checkpoint)
Task / pipelinetext-to-speech — VitsModel, Urdu text tokens → 16 kHz waveform
ArchitectureVITS: conditional VAE + normalizing-flow decoder + monotonic alignment + stochastic duration predictor. End-to-end — no separate vocoder.
Language / scriptUrdu (urd-script_arabic) in native Perso-Arabic (Nastaliq), right-to-left (is_uroman:false) — one of 1000+ MMS languages, each its own checkpoint
OutputA mono Float32Array waveform at sampling_rate 16000
Quantizationfp32 (full precision) ONNX (model.onnx)
BackendWebAssembly (WASM) — runs anywhere; no WebGPU needed
Download~114 MB (fp32), cached after first load
LicenseCC-BY-NC 4.0 (MMS weights) — non-commercial
Web APIsWebAssembly, Web Workers, Web Audio (playback), Blob URLs, Canvas

Run it

Type some Urdu and press بولیں (Speak). The text field is right-to-left. 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.

See inside — the waveform, tokens, and the stochastic duration predictor

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 Urdu text became (native Perso-Arabic characters plus interleaved blank tokens). The interesting part is timing — VITS decides how long each Urdu sound lasts with a stochastic module, so re-running the same text changes the duration.

Speak something to see its waveform and stats.

Why it matters

An Urdu voice that runs entirely on-device: no per-character bill, no text leaving the tab. Urdu is spoken by well over a hundred million people across Pakistan and India and the diaspora; VITS won't out-act a big expressive model, but it's the model you reach for when you need Urdu speech everywhere, offline, privately — with correct right-to-left rendering.

Use cases

Basics

Type an Urdu line, hear it, see its waveform — the core move.

Practical

An Urdu narrator: read a notification, a weather report or an article snippet aloud.

Wild

Stochastic prosody lab — generate the same Urdu text many times and compare the timing.

Multi-model

Type English, translate it to Urdu with M2M100, then have MMS speak the Urdu.

How the API works

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 is byte-identical to canonical facebook/mms-tts-urd-script_arabic
const model = await AutoModel.from_pretrained(
  "naklitechie/mms-tts-ur-ONNX", { model_file_name: "model", subfolder: "", dtype: "fp32" });

// Faithful VitsTokenizer: lowercase, map each in-vocab char, interleave blank (id 0).
// VERIFIED byte-identical to transformers.js's real VitsTokenizer on a control language.
const ids = tokenizeUrdu("ایک ہی نیٹ ورک حروف کو براہِ راست آواز کی لہر میں بدل دیتا ہے۔");
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 was checked byte-for-byte against transformers.js's real VitsTokenizer on a control language (Xenova/mms-tts-hin) — identical token ids — so the Urdu 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.

References