Beginner

How Text-to-Speech Works

Modern TTS systems use a multi-stage pipeline that transforms written text into natural-sounding speech through text analysis, phoneme conversion, acoustic modeling, and neural vocoder synthesis.

The TTS Pipeline

A modern neural TTS system typically follows these stages:

  1. Text Normalization: Convert abbreviations ("Dr." to "Doctor"), numbers ("123" to "one hundred twenty-three"), dates, currencies, and special characters into speakable text.
  2. Linguistic Analysis: Determine sentence boundaries, part-of-speech tags, word stress patterns, and prosodic structure (how the sentence should sound).
  3. Grapheme-to-Phoneme (G2P): Convert text characters into phonemes (speech sounds). English is especially challenging because spelling often does not match pronunciation ("though," "through," "tough").
  4. Acoustic Model: Generate a mel spectrogram (a visual representation of the audio frequencies over time) from the phoneme sequence.
  5. Vocoder: Convert the mel spectrogram into actual audio waveform samples that can be played through speakers.

Key Neural Architectures

Architecture Developer How It Works
WaveNet DeepMind (2016) Autoregressive model that generates audio sample by sample using dilated causal convolutions. Produces extremely natural speech but is slow for real-time use.
Tacotron 2 Google (2017) Sequence-to-sequence model with attention that converts text to mel spectrograms. Paired with WaveNet or WaveRNN vocoder for final audio.
FastSpeech 2 Microsoft (2020) Non-autoregressive model that generates mel spectrograms in parallel, enabling real-time synthesis with explicit duration, pitch, and energy control.
VITS Kakao (2021) End-to-end model combining variational inference, normalizing flows, and adversarial training. Generates audio directly from text in a single step.
Tortoise TTS James Betker (2022) Diffusion-based model that generates highly expressive speech with voice cloning capabilities from small audio samples.
XTTS Coqui (2023) Cross-lingual voice cloning model that reproduces a speaker's voice in multiple languages from just a few seconds of reference audio.

Neural Vocoders

The vocoder converts mel spectrograms into audible waveforms. This is where the final audio quality is determined:

🔈

WaveNet Vocoder

Sample-by-sample generation produces the highest quality audio but is computationally expensive. Used in Google Cloud TTS for premium voices.

HiFi-GAN

GAN-based vocoder that generates high-fidelity audio in real time. Uses multi-scale and multi-period discriminators for natural sound quality.

📈

WaveGlow

Flow-based vocoder from NVIDIA that generates audio in parallel, enabling real-time synthesis on GPUs with quality close to WaveNet.

🛠

Vocos

Lightweight vocoder that operates in the frequency domain rather than generating raw waveform samples, achieving fast synthesis with good quality.

What Makes Speech Sound Natural

The difference between robotic and natural speech comes down to several acoustic properties:

  • Prosody: The rhythm, stress, and intonation patterns of speech. Questions rise in pitch; statements fall. Emphasis communicates meaning.
  • Coarticulation: How adjacent sounds influence each other. The "n" in "ten" sounds different from the "n" in "tenth" because of surrounding sounds.
  • Duration: Natural speech varies word and syllable duration based on meaning, emphasis, and sentence position.
  • Breathing: Natural speakers pause to breathe. Good TTS inserts natural breathing pauses at appropriate points.
  • Emotion: Subtle changes in pitch range, speaking rate, and vocal quality convey emotional content.
The WaveNet Breakthrough: When Google DeepMind published WaveNet in 2016, it reduced the gap between synthetic and natural speech by over 50% in mean opinion score (MOS) evaluations. This single paper launched the modern neural TTS era.

Ready to Go Deeper?

Live instructor-led courses from our partners. Affiliate disclosure.