text-to-speech · audio · WebGPU (WASM fallback) · ~180 MB
SpeechT5 is a speaker-conditioned text-to-speech model. Unlike a model with a fixed set of named voices, its voice is set by a 512-number speaker embedding (an "x-vector"). Feed it a different x-vector and the same sentence is spoken by a different person — voice-cloning-adjacent, entirely in your browser. A HiFi-GAN vocoder turns the model's mel-spectrogram into the waveform you hear.
| Model | Xenova/speecht5_tts + vocoder Xenova/speecht5_hifigan |
|---|---|
| Task / pipeline | text-to-speech (encoder–decoder + HiFi-GAN vocoder) |
| Architecture | SpeechT5 — a shared encoder–decoder for speech & text, conditioned on a 512-dim speaker x-vector → mel-spectrogram → vocoder → 16 kHz waveform |
| Speaker embeddings | Real CMU-Arctic x-vectors (6 bundled, ~2 KB each) |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebGPU when available, honest WebAssembly fallback |
| Download | ~180 MB (encoder + decoder + vocoder), cached after first load |
| License | MIT (model) · x-vectors from CMU-Arctic |
| Web APIs | WebGPU / WebAssembly, Web Workers, Web Audio (playback), Blob URLs |
Type something, pick a speaker, and hit Speak. Synthesis runs in a Web Worker; the audio, waveform, spectrogram, and speaker fingerprint below are the real output for this device. SpeechT5 is trained on short utterances, so it sounds best on a sentence or two at a time.
SpeechT5's voice lives in a vector. Below is the exact 512-dim speaker x-vector that conditioned this synthesis (each bar is one dimension of the "voice fingerprint"), the real spectrogram of the audio the model produced, and the final waveform (it fills as it plays). Change the speaker and watch the fingerprint — and the sound — change while the text stays identical.
Speaker x-vector (512 dims) — the "who":
Spectrogram of the generated speech — the "what it sounds like":
Waveform (fills as it plays):
SpeechT5 decouples what is said from who says it. Because the voice is just a vector, you can store, swap, blend, or derive voices at runtime — no per-voice model, no cloud TTS bill, and no text ever leaving the tab. It's a different design point from a fixed-voice model like Kokoro: more knobs, a smaller download, and a built-in path toward personalized voices.
Type a line, pick a speaker x-vector, hear it — the core move.
Read-aloud: paste an article, choose a voice, and listen sentence by sentence.
Voice swap: speak one line through every x-vector and compare the same words in each voice.
Translate → speak: M2M100 translates your text, then SpeechT5 reads the translation aloud.
One pipeline call. The voice is the speaker_embeddings argument — a 512-dim vector:
import { pipeline } from "@huggingface/transformers";
const tts = await pipeline(
"text-to-speech",
"Xenova/speecht5_tts",
{ dtype: "q8" }, // WASM fallback when WebGPU is absent; the HiFi-GAN vocoder auto-loads
);
// A 512-float x-vector — from a file, a URL, or one you derived yourself.
const speaker_embeddings = new Float32Array(await (await fetch(xvectorUrl)).arrayBuffer());
const out = await tts("Hello from your browser.", { speaker_embeddings });
// out.audio → Float32Array waveform
// out.sampling_rate → 16000
This page runs the pipeline inside a Web Worker so synthesis never blocks the interface, encodes the
returned Float32 samples to a WAV blob for the <audio> element, and draws the real
x-vector, spectrogram, and waveform under "See inside". The six speakers are real CMU-Arctic x-vectors
bundled next to this page — nothing hard-coded about the audio.