tiny-voca is a 4.5M-parameter text-to-speech model with two stock voices, F2 and M2. Build your own voice for it here and save it as a file to use in your own pages and scripts. Everything runs in this page, from an 11 MB download, and the model speaks about 16× faster than real time on one WebAssembly (CPU) thread.
Once it has loaded, pick a preset and press Speak, then drag a slider: each release plays the text again in the new voice. Switch to Sing to hear the same voice sing lyrics to notes you write.
A voice file (.voice.json, about 4 KB) contains the two embeddings and
the six controls that the model reads. Play it in your own page or script:
<script src="https://austegard.com/experiments/tiny-voca-voices/web/tinyvoca.js"></script>
<script type="module">
const tts = await TinyVoca.load();
const voice = await (await fetch("my-voice.voice.json")).json();
const audio = await tts.speak("Hello there.", voice); // Float32Array, 24 kHz
const wavBlob = TinyVoca.wav(audio);
</script>
# Python: pip install onnxruntime numpy soundfile git+https://github.com/n4ze3m/dizione python speak.py my-voice.voice.json "Hello there." hello.wav
Ready-made files for every preset are in voices/, e.g.
voices/F2-adult.voice.json. A link can set the text too:
?text=Hello on this page, or example.html?text=…&voice=voices/M2-baritone.voice.json.
With Chorus above 1, your voice leads and the others are drawn the way "Surprise me" draws them, all on the lead's timing, each slightly detuned and placed left to right. "New chorus" draws another set; the link keeps the set.
Hyphenate words into syllables (A-maz-ing), one phrase per line. Write one note per
syllable, in order, as NOTE/BEATS: D4/1, F#4/.5. Join notes with
~ to stretch one syllable over several (B4/.5~G4/.5); a rest is r/1.
The default is the first verse of "Amazing Grace" (John Newton, 1779) to "New Britain" (1829) as E. O. Excell
set it in 1900, all public domain. A song can have any number of lines; one line can last up to about 30 s. Male voices sound best an octave down: Transpose −12.
Voice embedding. For each voice the model learned two 192-number vectors, one at the phoneme level and one at the frame level. The first slider walks between F2 (0) and M2 (1) and past them. The four axes point away from that line in fixed random directions; 1.0 is as far as F2 is from M2. Each hint says what that axis did at +1 on F2 in tests. Whether words stay clear depends on the axes' combined distance off the line, shown under the axes. Every random voice up to 1.13 stayed clear, one axis at a time at ±1 lost a word once in 32 tries, and past about 1.15, 6 of 8 random voices garbled a word. "Surprise me" stays within 0.9.
Vocal tract and texture. The waveform comes from a pulse train and noise, each shaped by a filter that the network predicts every 10.7 ms. Formant scale resamples that filter along frequency: below 1, the speaker sounds larger and older. Brightness tilts the voiced filter, and Breath raises or lowers the noise filter.
Whisper, a speech recognizer, transcribed every preset exactly. It did the same with each of the other sliders set to
either end, except speed ×2, which slurred one word. Method and measurements:
experiments/tiny-voca-voices.
Build .