How Text-to-Speech Works

What Is Text-to-Speech?

Text-to-speech (TTS) is the technology that converts written text into spoken audio. It is used in a wide range of applications, from accessibility tools that help visually impaired and low vision users, to navigation systems, virtual assistants, content creation, telephony systems, and interactive voice response (IVR) platforms.

Over the past several decades, TTS technology has evolved dramatically. Early systems used robotic-sounding formant synthesis, which generated speech entirely from mathematical rules. Modern approaches, like the unit selection synthesis that powers Voice Forge, produce remarkably natural speech by using recordings of real human voices.

The Technology Behind Voice Forge

Voice Forge is powered by Cepstral's speech synthesis engine, a technology rooted in pioneering research at Carnegie Mellon University. Cepstral was founded in 2000 by CMU researchers Alan W. Black and Kevin Lenzo, who had been at the forefront of speech synthesis research. Their work led to the development of a high-quality, efficient TTS system that could produce natural-sounding voices with personality and style.

The core of this technology is called unit selection synthesis, a concatenative approach that is widely considered one of the most natural-sounding methods of speech generation. Rather than generating audio from scratch using algorithms, unit selection stitches together small segments of pre-recorded human speech to create new utterances.

This is the approach used by Voice Forge. By maintaining a large database with many instances of each sound recorded in different contexts, the system can select the version that best fits the current sentence. This produces highly natural speech because the output consists almost entirely of real human speech recordings. The speaker's identity, personality, and vocal characteristics are preserved, making each voice distinctive and engaging.

The Voice Database

The quality of a unit selection TTS system depends heavily on the size and diversity of its speech database. Creating a voice requires a professional voice actor to record several hours of carefully scripted speech in a controlled studio environment. The scripts are designed to cover a wide range of phonetic contexts, ensuring the database contains units for virtually every sound combination that could occur in natural speech.

Voice Forge offers 42 unique voices, each with its own distinct personality and character. Every voice was recorded by a different speaker, giving each one a unique timbre, speaking style, and personality. This diversity allows content creators to find the perfect voice for their specific application, whether that is a warm, conversational tone for a podcast, a clear and authoritative delivery for a presentation, or a fun, character-driven voice for creative projects.

How Unit Selection Synthesis Works

Unit selection synthesis works through a multi-stage pipeline that transforms your written text into natural-sounding speech. Here is a step-by-step look at what happens when you type text into Voice Forge and click generate:

Step 1: Text Analysis

The system first analyzes your text to understand its linguistic structure. This involves breaking the text into sentences, words, and phonemes (the individual sounds of speech). It also determines prosodic targets such as pitch, rhythm, stress patterns, and duration for each sound. For example, a question naturally rises in pitch at the end, while emphasis on certain words changes their loudness and duration. This analysis creates a detailed "recipe" for how the final speech should sound.

Step 2: Searching the Voice Database

Each voice in Voice Forge's library is backed by a large database of recorded speech from a real human speaker. These recordings have been carefully segmented into small units, typically individual phonemes or pairs of phonemes called diphones. Each unit is annotated with acoustic information including its pitch, energy, spectral characteristics, and the phonetic context in which it was originally spoken. When you generate speech, the engine searches through thousands of these recorded units to find the best candidates that match what the text analysis stage specified.

Step 3: Optimal Unit Selection

This is the heart of the technology and where "unit selection" gets its name. The system needs to pick the best sequence of units from the database. For each sound, there may be dozens or even hundreds of candidate units recorded in different contexts. The engine evaluates every candidate using two key cost functions:

  • Target Cost – How closely does this unit match the desired pitch, duration, and phonetic context? A unit recorded in a similar context to what is needed will have a lower target cost.
  • Join Cost – How smoothly will this unit connect with the units before and after it? This is measured using mel-frequency cepstral coefficients (MFCCs), which capture the spectral characteristics of speech in a way that closely mirrors human hearing. Units that have similar spectral properties at their boundaries join seamlessly with minimal audible artifacts.

The engine uses a Viterbi search algorithm, a form of dynamic programming, to efficiently find the globally optimal path through all possible unit combinations. This ensures the best overall result rather than just picking the best unit at each individual position.

Step 4: Concatenation and Smoothing

Once the optimal sequence of units is selected, they are concatenated (joined end-to-end) to form the complete audio output. Minimal signal processing is applied at the boundaries to smooth any remaining discontinuities in pitch, energy, or spectral content. Because the system uses actual human speech recordings, this post-processing is kept to a minimum, preserving the natural quality, warmth, and personality of the original speaker's voice.

Glossary of Key Terms

Phoneme – The smallest unit of sound in a language. For example, the word "cat" contains three phonemes: /k/, /ae/, and /t/.

Diphone – A speech unit that spans the transition from the middle of one phoneme to the middle of the next. Diphones capture the crucial coarticulation effects that occur between adjacent sounds.

Prosody – The patterns of rhythm, stress, and intonation in speech. Prosody conveys meaning beyond the words themselves, such as whether a sentence is a question or a statement.

MFCC (Mel-Frequency Cepstral Coefficients) – A compact representation of the spectral characteristics of a sound, modeled to approximate human auditory perception. MFCCs are used to measure how smoothly two speech units will join together.

Concatenative Synthesis – Any TTS approach that works by joining together pre-recorded speech segments. Unit selection is the most advanced form of concatenative synthesis.

Viterbi Algorithm – A dynamic programming algorithm used to find the optimal sequence of units from the speech database. It efficiently evaluates all possible combinations to minimize the total cost of the output.

SSML (Speech Synthesis Markup Language) – An XML-based markup language that provides detailed control over speech output, including pronunciation, pauses, emphasis, and audio effects.

Read the standalone How Text-to-Speech Works guide

SSML Tags in Voice Forge

What Is SSML?

Speech Synthesis Markup Language (SSML) is an XML-based standard that gives you fine-grained control over how text-to-speech engines produce audio. Instead of just typing plain text, you can embed special tags to tell the speech engine exactly how to pronounce words, where to pause, what to emphasize, and how fast or slow to speak.

Voice Forge supports a set of SSML tags that you can type directly into the text input area. The tags are included in your 500-character limit, so keep that in mind when composing longer passages with markup.

Supported SSML Tags

Below is a complete reference of the SSML tags you can use in Voice Forge. Type these directly into the text area when generating speech.

<break> – Add a Pause

Inserts a pause in the speech. You can control the length of the pause using the time attribute or the strength attribute.

Welcome to Voice Forge. <break time="500ms"/> Let's get started.

Pauses for 500 milliseconds between the two sentences.

And the winner is <break time="1s"/> Voice Forge!

A dramatic one-second pause before the reveal.

First point. <break strength="strong"/> Second point.

The strength attribute accepts values like "none", "x-weak", "weak", "medium", "strong", and "x-strong".

<emphasis> – Stress a Word or Phrase

Adds emphasis to the enclosed text, changing how strongly the word or phrase is spoken. Use the level attribute to control the degree of emphasis.

This is <emphasis level="strong">very</emphasis> important.

The word "very" is spoken with strong emphasis.

Please do <emphasis level="moderate">not</emphasis> forget.

Accepted levels are "strong", "moderate", and "reduced".

<prosody> – Control Pitch, Rate, and Volume

Adjusts the pitch, speaking rate, or volume of the enclosed text. You can set one or more of these attributes at the same time.

<prosody rate="slow">Take your time reading this.</prosody>

Speaks the text at a slower rate. Accepted rate values include "x-slow", "slow", "medium", "fast", and "x-fast".

<prosody pitch="high">Is that really true?</prosody>

Raises the pitch. Accepted pitch values include "x-low", "low", "medium", "high", and "x-high".

<prosody volume="loud">Attention everyone!</prosody>

Speaks louder. Accepted volume values include "silent", "x-soft", "soft", "medium", "loud", and "x-loud".

<prosody rate="fast" pitch="low">Breaking news just in.</prosody>

You can combine multiple attributes in a single prosody tag.

<phoneme> – Specify Exact Pronunciation

Provides an explicit phonetic pronunciation for a word, overriding the engine's default pronunciation. Useful for proper nouns, technical terms, or words that the engine might mispronounce. Voice Forge uses Cepstral's phoneme set.

You say <phoneme ph='t ah0 m ey1 t ow0'>tomato</phoneme>, I say <phoneme ph='t ah0 m aa1 t ow0'>tomato</phoneme>

Pronounces "tomato" two different ways by specifying different phoneme sequences.

For a complete list of all available phonemes, see the Cepstral Phoneme Table.

<sub> – Substitute Pronunciation

Replaces the enclosed text with a different spoken form. The written text is preserved but the engine speaks the substitute instead. Great for abbreviations and acronyms.

<sub alias="World Wide Web Consortium">W3C</sub> sets web standards.

Displays "W3C" in text but speaks "World Wide Web Consortium".

<sub alias="doctor">Dr.</sub> Smith will see you now.

Ensures "Dr." is spoken as "doctor" rather than being interpreted differently.

<p> and <s> – Paragraphs and Sentences

Mark paragraph and sentence boundaries explicitly. This helps the engine apply natural pauses and intonation patterns at the correct points in your text.

<p><s>This is the first sentence.</s> <s>This is the second.</s></p>

Wrapping text in paragraph and sentence tags gives the engine clearer structural cues for natural-sounding delivery.

Combining Multiple Tags

You can nest and combine SSML tags to create more sophisticated speech output. Here are some practical examples:

Dramatic Announcement

<prosody rate="slow" volume="loud"><emphasis level="strong">Breaking news!</emphasis></prosody> <break time="800ms"/> The event has been postponed.

Combines slow rate, loud volume, and strong emphasis for a dramatic effect, followed by a pause before the details.

Technical Narration

The <sub alias="application programming interface">API</sub> returns a <sub alias="JavaScript Object Notation">JSON</sub> response.

Speaks both "API" and "JSON" as their full forms using substitution tags.

Character Limits

Voice Forge has a 500-character limit per text input. SSML tags count toward this limit, so keep your markup concise. For example, a simple <break time="500ms"/> tag uses 21 characters of your 500-character allowance.

To maximize your available text space when using SSML, use shorter attribute values where possible. For instance, "500ms" is shorter than "0.5s", and <break/> with no attributes inserts a default short pause using minimal characters.

Tips for Using SSML Effectively

  • Start simple – Try adding a single <break> or <emphasis> tag first to hear how it affects the output before layering on more tags.
  • Close your tags – SSML uses XML syntax, so every opening tag needs a matching closing tag. For example, <emphasis>text</emphasis>. Self-closing tags like <break/> end with a slash before the closing bracket.
  • Preview before downloading – Use the built-in audio player to listen to how your SSML tags affect the speech before downloading. Small adjustments to pause lengths or emphasis levels can make a big difference.
  • Use sub for abbreviations – If the engine mispronounces an acronym or abbreviation, wrap it in a <sub> tag with the full spoken form in the alias attribute.
  • Budget your characters – SSML tags consume characters from your 500-character limit. Plan your text and markup together so you do not run out of space for the actual content you want spoken.

Quick Reference

TagPurposeKey Attributes
<break>Insert a pausetime, strength
<emphasis>Stress a word or phraselevel
<prosody>Change pitch, rate, or volumepitch, rate, volume
<phoneme>Specify exact pronunciationalphabet, ph
<sub>Substitute spoken textalias
<p>Mark a paragraph–
<s>Mark a sentence–

Read the standalone SSML Tags in Voice Forge guide