Text to Speech, Explained

After reading this you will understand how your device turns text into sound, what the rate, pitch and volume controls actually change, and how to pick voices that read numbers, dates and abbreviations the way you expect.

What speech synthesis does

Speech synthesis takes a string of characters and produces an audio waveform that sounds like a person reading it. The Text to Speech Playground uses the voices already installed on your operating system through the browser's Web Speech API. Nothing leaves your device.

Here is the hook. Type Dr. Smith paid $2,500 on 3/4 for 12kg. and press play. A good voice reads "Doctor Smith paid two thousand five hundred dollars on March fourth for twelve kilograms." Every one of those expansions is a decision the synthesizer made: Dr. became "Doctor", $2,500 became a spoken quantity, 3/4 became a date rather than the fraction "three quarters", and 12kg got a unit name. Different voices make different choices. That gap between the characters you typed and the words you hear is the whole subject.

When to use it, and when not

Local text to speech is a good fit for proofreading (your ear catches repeated words and clumsy rhythm that your eye skips), for checking pronunciation of names, for accessibility testing of your own copy, and for quick spoken notes. It costs nothing and works offline.

It is a poor fit when you need broadcast quality narration, precise control over emphasis on a single word, or identical output across machines. System voices vary by device, so the same text can sound different on a phone, a laptop and a tablet. If you need one fixed recording, render it once and save the audio rather than relying on the listener's voices.

Voice availability is not guaranteed. A page that assumes a specific voice name will fall back to the default on machines that lack it. Always design for "any installed voice for this language", not for one named voice.

From text to sound: the pipeline

Most engines run four stages before any audio plays.

Text normalization
Expands non-word tokens into spoken words: numbers, dates, currency, abbreviations, URLs. This is where 3/4 becomes a date or a fraction.
Phonetic analysis
Maps words to phonemes using a dictionary plus letter-to-sound rules for unknown words. "Read" gets one of two pronunciations depending on tense the engine guesses.
Prosody
Assigns pitch, duration and loudness to each phoneme so the sentence has natural rhythm and intonation. Question marks raise the final pitch; commas insert short pauses.
Waveform generation
Turns the phoneme-plus-prosody plan into samples. Modern voices use neural models; older ones concatenate recorded speech fragments.

The three controls you have (rate, pitch, volume) act on the prosody and output stages. They do not change normalization or phoneme choice. If a voice mispronounces a name, no rate or pitch setting will fix it; you must respell the input phonetically.

What the controls actually scale

Rate is a time multiplier. At rate r, every phoneme duration is divided by r, so total playback time scales as:

T(r) = \frac{T_1}{r}

Here T_1 is the duration at rate 1.0 and T(r) is the duration at rate r. Rate 2.0 plays in half the time; rate 0.5 takes twice as long. A good engine changes tempo without changing pitch, so faster speech does not sound like a chipmunk.

Pitch shifts the fundamental frequency of the voice. The Web Speech API pitch value p ranges from 0 to 2 with default 1. Treat it as a multiplier on the base frequency f_0:

f(p) = p \cdot f_0

A male voice near f_0 = 120\ \text{Hz} at pitch 1.5 sits around 180 Hz. In musical terms a factor of 2 is one octave, so pitch 2.0 against pitch 1.0 is a full octave higher. The perceived step follows the logarithm of the ratio, which is why the jump from 1.0 to 1.2 sounds smaller than the jump from 1.6 to 2.0 even though both add 0.4.

Volume is a linear amplitude gain from 0 to 1. Loudness in decibels relative to full scale is:

L = 20 \log_{10}(v)

Volume v = 1.0 gives 0 dB (full scale). Volume 0.5 gives 20 \log_{10}(0.5) \approx -6.02\ \text{dB}. Volume 0.1 gives about -20 dB. Halving the linear value drops the level by roughly 6 dB every time, which matches the rule that -6 dB is half the amplitude.

At rate 1.0 a 20-word sentence of about 100 phonemes takes roughly 7 seconds. At rate 2.0 it takes 3.5 seconds; at rate 0.5 it takes 14 seconds. Pitch 1.0 keeps a 120 Hz voice at 120 Hz; pitch 1.5 raises it to 180 Hz; pitch 2.0 raises it to 240 Hz, one octave up.

A worked example with the defaults

Reading one sentence at rate 1.0, pitch 1.0, volume 1.0

Use the demo defaults: rate 1.0, pitch 1.0, volume 1.0, and a sentence of 20 words that runs to about 100 phonemes.

  1. Base duration at rate 1.0: about 7.0 s for 100 phonemes (average speaking pace is 12 to 16 phonemes per second, so 100 / 14 \approx 7.1 seconds).
  2. Change rate to 1.5. New duration: 7.0 / 1.5 \approx 4.67 seconds. The pitch does not move.
  3. Change pitch to 1.5 at rate 1.0. Fundamental rises from 120 Hz to 1.5 \times 120 = 180 Hz. Duration stays at 7.0 s.
  4. Drop volume to 0.5. Level falls by 20 \log_{10}(0.5) \approx -6.0 dB. The sound is half the amplitude but the same speed and pitch.

Each control changed exactly one property. That independence is the point: set the pace with rate, the register with pitch, the loudness with volume, and read the pronunciation problems as input problems.

Reading and interpreting the output

Judge a voice on three things. First, normalization: does it read 1990s as "nineteen nineties" or "one thousand nine hundred and ninety s"? Second, prosody: does the pitch fall at a period and rise at a question mark, or does every sentence sound flat? Third, phoneme accuracy on unusual words and names.

The table below shows how the same tokens can diverge across two hypothetical voices, which is exactly the variation you should expect across real systems.

Two voices reading the same tokens
Input tokenVoice A readsVoice B reads
Dr.DoctorD R
3/4March fourththree fourths
2,500two thousand five hundredtwo five zero zero
kgkilogramsK G
2024twenty twenty-fourtwo thousand twenty-four

None of these is a bug in the strict sense. Each voice applies its own normalization rules. The lesson is that if you need a specific reading, write the words out: type "kilograms" instead of "kg" and "three quarters" instead of "3/4".

Common mistakes

Fighting a mispronunciation with pitch or rate. Those controls never change phonemes. Respell the word instead: "Nguyen" often reads better as "Nwin" or "Win" depending on the voice.

Cranking pitch to extremes. Values near 0 or 2 often sound robotic because the voice was recorded near f_0 and the engine stretches its spectrum to reach the target. Stay within 0.8 to 1.3 for natural speech.

Assuming rate is linear in comfort. Comprehension holds up to roughly 1.5 for most listeners, then drops fast. Duration falls as 1/r, so the time saved from 1.0 to 1.5 is 7.0 - 4.67 = 2.33 seconds, while 1.5 to 2.0 saves only 4.67 - 3.5 = 1.17 seconds for a much larger loss in clarity.

Add punctuation to control pauses. A comma inserts a short break, a period a longer one, and a paragraph break the longest. Splitting a long clause into two sentences often reads better than any rate change.

Related tools

If you are testing your audio path rather than the voice itself, the Tone generator plays a clean sine at a known frequency so you can confirm output and set levels. For timing a spoken script against a fixed pace, the Metronome gives you a steady reference click.

Frequently asked questions

Why do I have fewer voices than someone else?

Voices come from your operating system and browser, not from this page. Most systems ship at least one voice per installed language. You can add more through your OS accessibility or language settings, and they will appear in the voice list after a reload.

Does faster speech raise the pitch?

No, on a modern engine. Rate scales duration as 1/r using time stretching that preserves pitch. Only the pitch control changes frequency.

Is my text sent anywhere?

No. Synthesis runs locally through your browser and system voices. Your text is never uploaded to a server.

Can I save the audio?

The Web Speech API plays audio but does not expose a file directly. To capture a recording, use your operating system's audio recorder while the text plays.

Why does the same text sound different on my phone and laptop?

Different devices ship different voices, each with its own normalization, phonemes and prosody. There is no shared standard for how a given voice must sound, so treat cross-device consistency as something you cannot rely on.