A Malay text-to-speech model that is 8.5 MB. One ONNX file, one voice, runs in a browser tab (transformers.js, WebGPU or WASM) or on a single CPU thread in Python, at about 25 times real time.
A newer, more accurate version exists: Kecil-TTS Yati v0.2 (typical error roughly halved; the muffled sound is the same). This page describes v0.1.
This is a first release. It is understandable, but it sounds slightly muffled, and roughly one sentence in ten has a wrong word. Details and numbers are below, so you can judge whether it is good enough for your use.
examples/gradio_app.py (pip install gradio, then python examples/gradio_app.py). A hosted Gradio Space needs a paid Hugging Face plan; the code is ready in hf/space_gradio of the project if you want to host one.| Model file | onnx/model_quantized.onnx, 8.46 MB (int8 weights) |
| Parameters | 7.9 M |
| Output | 24 kHz mono |
| Speed | about 25x real time on one CPU thread (onnxruntime); about 15x in a browser tab on WebGPU (6x on the first call) |
| Language | Bahasa Melayu (Malaysia), with common English words used in Malaysian speech |
| Inputs | input_ids (int64 [1,T], phoneme ids with a 0 at each end, T up to 402) and speed (float32 [1]) |
Tested for this release: Python 3.12 with onnxruntime on CPU (Windows, clean install from this repo's wheel), Node 24 with transformers.js 3.8 (output matches Python sample for sample), and a Chromium browser with both WebGPU and WASM through the web Space. The ONNX file is built to be WebGPU-safe: a double-precision phase accumulator was moved to float32 and 64-bit slice bounds were clamped, because ONNX Runtime Web's WebGPU backend cannot run them. The audio is unchanged by this (measured against the unpatched export, within the sampling noise of the model).
Python (onnxruntime + numpy; no PyTorch):
pip install onnxruntime numpy huggingface_hub soundfile
pip install https://huggingface.co/Suarify/kecil-tts-yati-v0.1/resolve/main/dist/kecil_tts_8m-0.3.0-py3-none-any.whl
import soundfile as sf
from kecil_tts import SAMPLE_RATE, KecilTTS
tts = KecilTTS.from_pretrained("Suarify/kecil-tts-yati-v0.1")
sf.write("hello.wav", tts("Selamat pagi, boleh saya bantu encik hari ini?"), SAMPLE_RATE)
Browser or Node (transformers.js 3.x). The Malay front end (js/) turns text into phonemes; the model is loaded by transformers.js as a StyleTextToSpeech2Model:
import { KecilTTS } from './js/kecil-tts.js'; // see the web Space for a complete page
const tts = await KecilTTS.load({ model: 'Suarify/kecil-tts-yati-v0.1', g2pBase: './js/g2p/' }); // WebGPU if available, else WASM
const { audio, sampleRate } = await tts.speak('Selamat pagi, boleh saya bantu encik hari ini?');
examples/ has runnable Python and Node scripts.
Quality was measured by playing the model's speech to Whisper large-v3 and comparing what it heard with the text (character error rate, CER; lower is better). The recogniser itself misreads 7-9% of the characters of the human-like clips this model was trained to copy, so no model scores 0.
| Sentences the model had not seen | n | Median CER | Share at or under 8% |
|---|---|---|---|
| Call-centre style (appointments, bills, delivery) | 40 | 9.7% | 42% |
| Mixed held-out set, overall | 60 | 17% | 23% |
| of which general text | 17 | 17% | |
| of which numbers and money | 12 | 21% | |
| of which Malay with English words | 6 | 17% |
Listen to samples/ (three sentences it got right, three typical ones; the file samples/sentences.txt lists the text and score of each). Free text outside call-centre style, names, place names and numbers are the weak spots.
confirm, booking, email, ...).kecil_tts/, ported line for line to js/) writes Malay as phonemes that use the 178-symbol vocabulary of Kokoro-82M. It tells the pepet vowel from the taling vowel with a lexicon of 24,000 words, and handles numbers, abbreviations and English loanwords.v0.2 is being trained with phoneme timings taken from letter-level alignment (half of the phoneme boundaries in v0.1's training data were more than one frame off), which should reduce wrong words and the smeared sound. It will be released only if it measures better than v0.1.
Code and weights: Apache-2.0. kecil_tts/lexicon_e.json and js/g2p/lexicon_e.json are derived from Wiktionary data and are CC BY-SA 4.0. See NOTICE for all credits: Paradee-8M (Sahil Mahendrakar), Kokoro-82M (hexgrad), Chatterbox Multilingual (Resemble AI), misaki, WikiPron, g2p-id, Tatoeba and Malay Wikipedia.