Instructions to use litert-community/tiny-voca with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/tiny-voca with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
# No code snippets available yet for this library.
# To use this model, check the repository files and the library's documentation.
# Want to help? PRs adding snippets are welcome at:
# https://github.com/huggingface/huggingface.jstiny-voca for LiteRT
This repository holds n4ze3m/tiny-voca, an English text-to-speech model with 4.5 million parameters, two voices and 24 kHz audio, as three LiteRT .tflite files for the CPU, tested on two Android phones and a Mac. One call of tiny-voca_fp32.tflite speaks one utterance of up to 16.4 s. Two smaller files of the same model speak shorter utterances in one call, up to 9.6 s (tiny-voca_fp32_128.tflite) and 6.8 s (tiny-voca_fp32_64.tflite), and are faster. On a Snapdragon Galaxy S26 with 8 threads, one call of each took 148.4, 64.7 and 40.0 ms; on a Pixel 11 Pro with 1 thread, 464.2, 204.4 and 127.2 ms (measured on 2026-11-30).
On the 32 test utterances, and on the 30 and 16 of them with at most 128 and 64 phoneme ids, each file's audio on both phones matches the publisher's PyTorch model given the same noise input: every phoneme has the same duration, and the signal-to-noise ratio against the publisher's audio is at least 50.8 dB (Accuracy).
With Python, speak_tiny_voca.py turns English text into a WAV file with one command, after the downloads and installs in Use it (we ran it on a Mac). In an Android app, call a file with the inputs and outputs listed under How it works. The text-to-phoneme step (dizione, a Python package) is not in the files. For the phone runs, the phoneme ids were made beforehand on a Mac. With LiteRT 2.3.0, the GPU did not run tiny-voca_fp32.tflite on either phone: creating the CompiledModel with LiteRT's GPU accelerator failed (Notes). The smaller files were not tried on the GPU. Run the files on the CPU.
Files
| file | bytes | what |
|---|---|---|
tiny-voca_fp32.tflite |
23,375,628 | the whole model, waveform generator included, as one float32 graph with builtin LiteRT operators only |
tiny-voca_fp32_128.tflite |
22,547,396 | the same model and weights at 128 phoneme ids and 896 frames: one call speaks up to 9.6 s |
tiny-voca_fp32_64.tflite |
22,213,832 | the same model and weights at 64 phoneme ids and 640 frames: one call speaks up to 6.8 s |
speak_tiny_voca.py |
8,273 | speaks English text to a WAV file with Python: dizione makes the phoneme ids, then the graph runs once per utterance with ai-edge-litert |
LICENSE |
11,358 | the publisher's license file (Apache License 2.0), unchanged |
How it works
English text → sentences → dizione: phoneme ids and stress → a .tflite file, one call per utterance → 24 kHz audio, joined → WAV
- Front end (on the host, outside the
.tflitefiles). dizione, the publisher's English front end, turns a sentence into phoneme ids, with start and end tokens, and one stress value per id. The ids are the values ofvocabin the publisher'sconfig.json. dizione reads its data from the folder that theDIZIONE_DATAvariable names: the publisher'sphonemizer/folder. - Graph (signature
serving_default). Each call oftiny-voca_fp32.tflitetakes one utterance at fixed sizes: 256 phoneme ids and 1,536 frames of 256 samples.tiny-voca_fp32_128.tfliteandtiny-voca_fp32_64.tflitetake 128 ids and 896 frames, and 64 ids and 640 frames: in the tables, [1, 256] becomes [1, 128] or [1, 64], [1, 393216] becomes [1, 229376] or [1, 163840], and 1,536 becomes 896 or 640.
| input | type | size | meaning |
|---|---|---|---|
tokens |
int32 | [1, 256] | phoneme ids, start and end tokens included, then 0 |
stress |
int32 | [1, 256] | 0 none, 1 primary, 2 secondary; 0 after the ids |
voice |
int32 | [1] | 0 = F2 (female), 1 = M2 (male) |
speed |
float32 | [1] | 1.0 as predicted; larger is faster |
pitch_shift |
float32 | [1] | added to log F0; 0.058 is about one semitone |
pitch_range |
float32 | [1] | scales the movement of log F0 around its mean over the utterance's voiced frames |
noise |
float32 | [1, 393216] | standard-normal noise for the waveform generator |
| output | type | size | meaning |
|---|---|---|---|
audio |
float32 | [1, 393216] | 24 kHz waveform: when total_frames is at most 1,536, the first total_frames × 256 samples are the utterance and the rest is 0 |
durations |
int32 | [1, 256] | frames per phoneme id; 0 after the ids |
total_frames |
int32 | [1] | the sum of durations; above 1,536, the utterance did not fit in the call |
- Longer text.
speak_tiny_voca.pyreads text the way the publisher'sspeak_textdoes: it splits the text into sentences and speaks each sentence in one call when it fits. A sentence of more than the file's phoneme ids minus 12 (244, 116 or 52 ids, as the publisher's code takes 12 from its own 512), or one longer than the file's 1,536, 896 or 640 frames, is split at each comma, semicolon, colon or dash (—) that a space follows, else into two halves by words, and each part is read the same way; a single word that is still too long stops the script with an error. The publisher's code allows 500 ids and 3,000 frames (32 s) per call, so this script can split a sentence that the publisher's code speaks in one call. - Noise and peak. The script draws the noise with NumPy (
numpy.random.default_rng(seed).standard_normal), with seed + n for utterance n, counting from 0. It joins the utterances and, as the publisher's code does, scales the audio down to a peak of 0.99 if it goes above that.
Use it
1. Download
pip install -U huggingface_hub
hf download litert-community/tiny-voca --local-dir tiny-voca
hf download n4ze3m/tiny-voca --revision 5fe06641d0afecb3c04bc9faca2cf64d9b2b1600 --include "phonemizer/*" --local-dir tiny-voca
cd tiny-voca
The second hf download adds dizione's data files from the publisher's repository, in phonemizer/.
2. Install
pip install ai-edge-litert==2.3.0 numpy soundfile git+https://github.com/n4ze3m/dizione@8cd889e4de7be6bd1dd2e6891344a0729fa14dd4
3. Speak
DIZIONE_DATA=phonemizer python speak_tiny_voca.py --model tiny-voca_fp32.tflite --voice F2 --text "Hello! This is tiny voca." --output hello.wav
The script writes hello.wav (mono, 24 kHz, 32-bit float samples) and prints one JSON line with the output file, the voice, the sample rate, the number of samples, the peak before and after scaling, and each utterance's text, durations and number of samples. --voice M2 picks the male voice, --text-file reads the text from a file, and --speed, --pitch-shift and --pitch-range set the graph inputs speed, pitch_shift and pitch_range. --seed (0 by default) sets the noise.
Run as written on 2026-11-30 on a Mac (Apple silicon, macOS 27.0), in a new Python 3.12.13 venv (pip installed huggingface_hub 2.5.0, numpy 2.5.5 and soundfile 0.14.0): it wrote hello.wav, 56,320 samples (2.35 s) of mono 24 kHz 32-bit float audio, and printed the JSON line for its two utterances.
4. Pick a file
When a sentence does not fit in one call of the file (the limits are under How it works), speak_tiny_voca.py splits it into parts and speaks each part as its own utterance, one call each. Pick the smallest file that speaks your longest sentence in one call. For three of the test texts, the script made these calls:
| text | phoneme ids | audio from one call of tiny-voca_fp32.tflite |
tiny-voca_fp32.tflite |
tiny-voca_fp32_128.tflite |
tiny-voca_fp32_64.tflite |
|---|---|---|---|---|---|
| "Did you really think I would forget your birthday?" | 40 | 2.4 s | 1 call | 1 call | 1 call |
| "She had never seen the sea before, and for a long while she stood at the edge of the water without saying a word." | 90 | 5.8 s | 1 call | 1 call | 3 calls |
| "After a long and difficult journey across the mountains, the travellers finally reached the small village, where they were welcomed with warm food, a place to sleep and many questions about the road behind them." | 169 | 10.9 s | 1 call | 4 calls | 5 calls |
The phoneme-id limit can split a sentence shorter than the file's seconds: the second text is 5.8 s of audio and takes 3 calls of tiny-voca_fp32_64.tflite.
DIZIONE_DATA=phonemizer python speak_tiny_voca.py --model tiny-voca_fp32_64.tflite --text "Did you really think I would forget your birthday?" --output birthday.wav
On a Mac, the same command with --model tiny-voca_fp32.tflite wrote the same samples for this text. The JSON line lists each utterance with its text, so it shows whether a sentence was split.
Accuracy
The reference is the publisher's model: tiny-voca.pt in float32 on a Mac's CPU (PyTorch 2.13.0, the model's own synthesize call), with the graph's noise input fed to its waveform generator. The 32 test utterances are the four sample texts of the publisher's card and the ten texts of the publisher's js/test/sentences.json, each in both voices, and four more runs of the first card text in F2: at speed 1.3 and 0.8, and at pitch shift 0.058 and −0.058. The two smaller files ran every test utterance of at most 128 or 64 phoneme ids (the size of the file's tokens input): 30 of the 32 for tiny-voca_fp32_128.tflite and 16 for tiny-voca_fp32_64.tflite.
| file | where it ran | same durations as the reference | lowest SNR against the reference |
|---|---|---|---|
tiny-voca_fp32.tflite |
Mac CPU (ai-edge-litert 2.3.0) | 32 of 32 utterances | 53.14 dB |
tiny-voca_fp32.tflite |
Snapdragon Galaxy S26 CPU, 4 threads | 32 of 32 utterances | 51.86 dB |
tiny-voca_fp32.tflite |
Pixel 11 Pro CPU, 4 threads | 32 of 32 utterances | 50.81 dB |
tiny-voca_fp32_128.tflite |
Mac CPU (ai-edge-litert 2.3.0) | 30 of 30 utterances | 53.14 dB |
tiny-voca_fp32_128.tflite |
Snapdragon Galaxy S26 CPU, 8 threads | 30 of 30 utterances | 51.86 dB |
tiny-voca_fp32_128.tflite |
Pixel 11 Pro CPU, 1 thread | 30 of 30 utterances | 50.81 dB |
tiny-voca_fp32_64.tflite |
Mac CPU (ai-edge-litert 2.3.0) | 16 of 16 utterances | 56.68 dB |
tiny-voca_fp32_64.tflite |
Snapdragon Galaxy S26 CPU, 8 threads | 16 of 16 utterances | 55.62 dB |
tiny-voca_fp32_64.tflite |
Pixel 11 Pro CPU, 1 thread | 16 of 16 utterances | 54.85 dB |
SNR = 20 · log10(‖reference‖ / ‖the file's audio − reference‖), over the utterance's samples (total_frames × 256). Before the phone runs we set the bar: the same durations and at least 40 dB on every utterance.
Speed
One call of each file on the CPU. A call computes all of the file's frames, so its time does not depend on how long the utterance is.
| file | one call speaks up to | Snapdragon Galaxy S26, 8 threads | Pixel 11 Pro, 1 thread |
|---|---|---|---|
tiny-voca_fp32.tflite |
16.4 s | 148.4 ms (147.1–149.0) | 464.2 ms (461.7–465.3) |
tiny-voca_fp32_128.tflite |
9.6 s | 64.7 ms (64.4–67.6) | 204.4 ms (202.8–205.1) |
tiny-voca_fp32_64.tflite |
6.8 s | 40.0 ms (39.9–43.4) | 127.2 ms (125.9–128.2) |
- One call: writing the inputs, running the graph and reading back the audio output. Each file ran in three processes on each phone, the files taking turns within three minutes; each process made three calls that are not counted, then three timed calls. Each number is the median of the three processes' medians, with the lowest and the highest of them in brackets.
- Threads. On
tiny-voca_fp32.tflite, 8 threads were the fastest of 1, 4, 6 and 8 on the Snapdragon Galaxy S26, and 1 thread the fastest of 1, 4 and 5 on the Pixel 11 Pro; the smaller files ran only at these counts. - Clocks. Each timed process started at Android thermal status 0 with no CPU clock ceiling lowered and the screen on, and no reading during a process found a ceiling lowered. Right after 8 of the 9 processes on the Snapdragon Galaxy S26, the ceiling of its fastest CPU cores was at 91–98 % of its maximum. On the Pixel 11 Pro, an earlier 1-thread process of
tiny-voca_fp32.tflitetook 447.9 ms; the phone was cooler at its start, and the cause of the difference was not found. - Memory. In the 32-utterance runs of
tiny-voca_fp32.tflite(4 threads), the highest peak resident memory (VmHWM) read during the process was 316 MB on the Snapdragon Galaxy S26 and 274 MB on the Pixel 11 Pro (308,356 and 267,416 kB; MB = kB × 1024 / 10⁶). The lowest available memory (MemAvailable) read during those runs was 7.74 GB on the Snapdragon Galaxy S26 and 9.45 GB on the Pixel 11 Pro. - Galaxy S26 (Snapdragon, SM8850; model SM-S942Q, Android 16) and Pixel 11 Pro (Tensor G6, Android 17); LiteRT 2.3.0 (
com.google.ai.edge.litert:litert:2.3.0, Google Maven) through its C API; 2026-11-30.
Notes
- GPU. On a Pixel 11 Pro (PowerVR GPU; four processes) and a Snapdragon Galaxy S26 (Adreno GPU; one process), LiteRT 2.3.0's GPU accelerator at its default precision listed
BROADCAST_TO(Operation is not supported.) andCONCATENATION(Tensor dimensions must be less than 5.) among the operations it does not support (the log cuts the list off after these two), took 248 of the 1,804 operations oftiny-voca_fp32.tflitein 3 partitions, and thenLiteRtCreateCompiledModelreturned status 504. The log does not name the operation behind the 504. - How the files were made. The graphs are built on the publisher's ONNX export module (
src/tiny_voca/export.py), with fixed sizes, padding masks and a reworked phase for the pulse oscillator. They were exported in float32 with litert-torch 0.9.4 and PyTorch 2.13.0 from the publisher'stiny-voca.ptat commit 5fe06641 of n4ze3m/tiny-voca.
License
The model files are under the Apache License 2.0, as n4ze3m/tiny-voca is, and the publisher's LICENSE is included unchanged. speak_tiny_voca.py is under the same license; its header names the publisher's code it adapts (src/tiny_voca/infer.py at commit b4603fc4). The phonemizer/ files that the download step fetches from n4ze3m/tiny-voca come with two license files: phonemizer/LICENSE.cmudict, Carnegie Mellon University's license for the CMU Pronouncing Dictionary, and phonemizer/LICENSE.homograph-data, the same Apache License 2.0 text as LICENSE.
- Downloads last month
- 2
Model tree for litert-community/tiny-voca
Base model
n4ze3m/tiny-voca