Text to Speech

Text-to-Speech

Generating audible speech from text through linguistic analysis, an acoustic model, and a waveform generator (Vocoder).

Educational content in the form of a scientific draft that needs expert review before being adopted as an academic reference. No experimental result that was not actually run is shown here.

Overview

Understand the structure of modern TTS systems, the stages of linguistic analysis and synthesis, and the methods of quality evaluation, while recognizing that some metrics need human listeners.

Learning Objectives

  • Describe the stages of a TTS system from text to waveform
  • Explain the role of text normalization and phoneme generation
  • Distinguish between the acoustic model and the waveform generator
  • Understand the role of intonation and rhythm in the naturalness of speech
  • Choose an appropriate metric for quality evaluation and understand its limits

Scientific and Ethical Notes

  • MOS requires human listeners; do not present automatic estimates as MOS.
  • The platform runs synthesis only through the speech interface built into the browser, and does not include a neural model.
  • Cloning a person's voice without their consent is a privacy violation and may be used for fraud.
  • Disclosure that the voice is machine-generated is required in any public-facing application.

Topics

TTS System Architecture TTS Architecture

The system usually consists of a text front end (normalization and conversion to phonemes), an acoustic model that predicts the mel spectrogram, and a waveform generator (Vocoder) that converts it into an audio signal. There are also end-to-end models that merge the last two stages into a single network and generate the waveform directly from text. Separating the stages allows each to be improved and its errors analyzed individually.

Text Normalization Text Normalization

Text normalization converts numbers, dates, abbreviations, and symbols into spoken words, such as converting a number to its verbal form. In Arabic this requires attention to gender agreement in numerals and to case endings, and the absence of diacritics affects correct pronunciation, which calls for rules or models to add diacritics.

Phoneme Generation Phoneme Generation

Converting letters to phonemes (Grapheme-to-Phoneme) determines how a word is pronounced. Languages with regular orthography need simpler rules, whereas undiacritized Arabic lacks short vowels, so context or an automatic diacritizer is needed. Errors in this stage appear directly as pronunciation errors in the output. It can be tested with lists of difficult words that include names, numbers, and foreign vocabulary.

Acoustic Models Acoustic Models

The acoustic model predicts a sequence of spectral frames from phonemes or characters. Tacotron 2 uses autoregressive, incremental attention, while FastSpeech 2 predicts duration, pitch, and energy in parallel without attention, making it faster and more robust against skipped or repeated words. Choosing between them remains a trade-off among quality, speed, and ease of training on the available data.

Vocoders Vocoders

The vocoder converts the spectrogram into a time-domain waveform. Approaches range from analytical algorithms such as Griffin-Lim, to neural networks such as the slow autoregressive WaveNet, the flow-based WaveGlow, and the faster generative adversarial HiFi-GAN. The choice affects quality, speed, and running cost. The quality of the input spectrogram remains a basic requirement for the quality of the resulting waveform.

Neural Speech Synthesis Neural Speech Synthesis

Neural synthesis has replaced concatenative and statistical synthesis. Networks learn the relationship between text and audio from recorded data, producing smoother speech. The resulting voice depends on the quality and diversity of the training data, on the recorded speaker, and on the rights to use that speaker's voice. Therefore, the source and licensing of the recordings must be documented before training any speech model.

Prosody and Rhythm Prosody

Prosody includes variation in pitch, duration, energy, and pauses, and it carries emphasis and sentence type. Without it, speech sounds robotic. Modern models predict prosody and duration explicitly or implicitly, and it is hard to control prosody precisely when contextual information is missing from the input text. It is advisable to analyze the effect of each component separately to understand what the classifier depends on.

Speech Quality Voice Quality

Speech quality includes clarity, naturalness, absence of distortions, and consistency across sentences. It is assessed subjectively with human listeners, and objectively with metrics such as mel-cepstral distortion (MCD). Automatic metrics give only a partial signal and do not replace structured human listening. It is advisable to run a listening test with a sufficient number of sentences and listeners before drawing conclusions.

Experiments

Speech Synthesis

Text-to-Speech

An interface for generating speech through the SpeechSynthesis API: text, language, voice, rate, and pitch. The voices are those available on your system or browser, not…

Runs via Browser / Optional Provider

Audio Spectrum Explorer

Spectrogram Explorer

Computes a real STFT with control over window size, hop length, and window type (Hann/Hamming), and shows the Spectrogram and Mel Spectrogram side by side.

Runs in the Browser

Pitch and Energy

Pitch & Energy

Extracts the pitch contour F0 with the YIN algorithm and the energy contour (RMS) from your recording and displays the statistics (mean, range, deviation). These are aco…

Runs in the Browser

Model Comparison

Model Benchmark

A table in which you enter the results of your actual experiments (WER, CER, Accuracy, F1, Latency, model size, and memory) for different models and compare them. They a…

Runs in the Browser

Neural Speech Synthesis

Neural Speech Synthesis

Run models such as VITS or FastSpeech 2 with HiFi-GAN to generate speech and compare quality; requires PyTorch and possibly a GPU.

Requires an External Model

Listening Test (MOS)

Listening Test (MOS)

MOS is a subjective measure that requires human listeners and a methodology (ITU-T P.800); it cannot be computed automatically and the plugin does not claim to measure i…

Educational Reference Only

Algorithms

Tacotron 2

Tacotron 2

A sequence-to-sequence speech synthesis model that produces a mel spectrogram from text by autoregressive decoding with attention, and then converts the spectrogram to a…

AdvancedSpeech Synthesis

FastSpeech 2

FastSpeech 2

A non-autoregressive speech synthesis model that predicts all mel spectrogram frames at once. It adds a variance adaptor that predicts duration, pitch, and energy instea…

AdvancedSpeech Synthesis

VITS

VITS

An end-to-end speech synthesis model that combines a conditional variational autoencoder (cVAE), normalizing flows, and adversarial training in a single model that produ…

AdvancedSpeech Synthesis

HiFi-GAN

HiFi-GAN

A generative adversarial neural vocoder (GAN) that converts the mel spectrogram to a waveform with fast generation, using a convolutional generator and two discriminator…

AdvancedSpeech Synthesis

WaveNet

WaveNet

An autoregressive model that generates the waveform sample by sample using dilated causal convolutions, modeling the conditional distribution of each sample over fine qu…

AdvancedSpeech Synthesis

WaveGlow

WaveGlow

A vocoder based on generative flows (Flow-based) that transforms Gaussian noise into a waveform through invertible transformations conditioned on the mel spectrogram, an…

AdvancedSpeech Synthesis

Attention

Attention

A mechanism that computes, for each output, a weighted average of a set of values, where the weights are computed from the degree of match between a query and the keys.…

IntermediateDeep Learning

Transformer

Transformer

An architecture based on self-attention instead of recurrence, so it processes all positions of the sequence in parallel and links any two positions directly. It has bec…

AdvancedDeep Learning

Mel Spectrogram

Mel Spectrogram

A spectrogram in which frequency bins are grouped by triangular filters spaced on the perceptual mel scale. It reduces dimensionality and emphasizes detail at low freque…

IntermediateSignal Processing

Lessons

Datasets

LJSpeech

LJSpeech

Speech from a single English female speaker reading passages from non-fiction books, widely used for training TTS.

Open

LibriTTS

LibriTTS

A 24 kHz version of LibriVox books prepared for training TTS models, with normalized text.

Open

Models

Tacotron 2

Tacotron 2

Sequence-to-sequence model with attention that generates a Mel spectrogram from text, which a vocoder then converts.

Educational Reference Only

FastSpeech 2

FastSpeech 2

Generates the Mel spectrogram in parallel while predicting duration, pitch and energy.

Educational Reference Only

VITS

VITS

End-to-end generative model combining a variational autoencoder (VAE), flows and a GAN to generate a waveform from text.

Educational Reference Only

SpeechT5

SpeechT5

Unified encoder-decoder model for speech and text tasks with pre-training.

Educational Reference Only

HiFi-GAN

HiFi-GAN

GAN that converts a Mel spectrogram to a waveform at high speed.

Educational Reference Only

WaveNet

WaveNet

Autoregressive sequence model with dilated convolution for generating audio samples.

Educational Reference Only

WaveGlow

WaveGlow

Flow-based network for generating audio from a Mel spectrogram.

Educational Reference Only

Evaluation Metrics

MOSThe mean of listeners' opinion scores on a five-point scale; it requires human listeners and a controlled test design, and cannot be computed automatically.
MCDThe spectral distortion distance between the mel coefficients of generated and reference speech after time alignment; a lower value means closer similarity.
NaturalnessThe naturalness of speech as perceived by the listener, usually assessed by human rating or by preference tests between two systems.
IntelligibilityHow well the listener understands the generated speech, measured by listeners transcribing it or by an ASR system followed by computing WER, noting that ASR adds its own bias.

References

  1. Shen et al.. Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions. arXiv (2017). DOI
  2. Ren et al.. FastSpeech 2: Fast and High-Quality End-to-End Text to Speech. arXiv (2020). DOI
  3. Kim et al.. Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech. arXiv (2021). DOI
  4. Kong et al.. HiFi-GAN: Generative Adversarial Networks for Efficient and High Fidelity Speech Synthesis. arXiv (2020). DOI
  5. van den Oord et al.. WaveNet: A Generative Model for Raw Audio. arXiv (2016). DOI
  6. Prenger et al.. WaveGlow: A Flow-based Generative Network for Speech Synthesis. arXiv (2018). DOI
  7. Ao et al.. SpeechT5: Unified-Modal Encoder-Decoder Pre-Training for Spoken Language Processing. arXiv (2021). DOI
  8. Griffin, Lim. Signal estimation from modified short-time Fourier transform. IEEE Trans. ASSP 32(2):236-243 (1984). DOI

Audio processing in the experiments takes place inside your browser. Audio, texts, and conversations are not saved on the server. Privacy Policy