How Text-to-Speech Architecture Turns Text into Voice
A text-to-speech system turns written words into spoken audio in four stages: a text frontend, an acoustic model, a vocoder and playback. How each stage works.
On this page
Short answer
A text-to-speech architecture is the pipeline that turns written text into spoken audio: a text frontend cleans the text and works out pronunciation, an acoustic model predicts the sound features, a vocoder turns those features into a waveform, and a playback layer streams or saves the audio. Each stage can be tuned separately for voice quality, speed and cost.
What is a text-to-speech architecture?
Text-to-speech architecture is the design of the system that turns written text into spoken audio: a text frontend prepares the sentence, an acoustic model predicts the sound features, a vocoder turns those features into a waveform, and a playback layer delivers the audio to the listener.
The four stages form a pipeline. Each stage takes the output of the one before it, and each can be changed or tuned without rebuilding the whole system. That separation is what makes the architecture useful: a team can improve pronunciation without touching the voice, or swap the vocoder for a faster one without retraining the acoustic model.
| Stage | Job | Example |
|---|---|---|
| Text frontend | Clean text, work out pronunciation | Expand "Dr" to "Doctor" |
| Acoustic model | Predict sound features | Mel-spectrogram frames |
| Vocoder | Turn features into a waveform | Neural vocoder output |
| Playback | Stream or save the audio | Play, pause, speed controls |
Most teams do not build every stage themselves. They combine a cloud service, an open model or an on-device engine, and write the code around it: choosing text, caching audio and adding controls. The design decisions are the same either way, which is what this article covers. The text-to-speech guide explains what the technology does for users.
How does the text frontend prepare a sentence?
The text frontend prepares a sentence for synthesis by cleaning the text and working out how each word should sound. It is the first stage in the pipeline, and most pronunciation mistakes start here, not in the voice model.
Text normalisation comes first. Numbers, dates, times, currency and abbreviations are expanded into words that can be spoken, so "Dr Smith, 3.30 pm" becomes "Doctor Smith, three thirty pm" and "$45" becomes "forty-five dollars". A shared list of pronunciations for product names, place names and codes keeps the expansion consistent across the whole product.
Next, the frontend splits the text into sounds. Grapheme-to-phoneme conversion turns letters into phonemes, the small sound units of a language, and marks stress and pauses from punctuation and sentence structure. Prosody prediction then decides rhythm, pitch movement and emphasis, so a question rises at the end and a list item pauses between entries.
Good frontend design keeps the rules in one place. When a new name appears, the team adds one pronunciation rule and every page benefits, instead of fixing the same misreading in many places.
How does the acoustic model turn text into sound features?
The acoustic model turns the prepared text into sound features, usually a mel-spectrogram: a picture of how sound energy changes across frequencies over time. It predicts what the voice should sound like at each moment, before any audio exists.
Modern acoustic models are neural networks trained on hours of recorded speech. Given phonemes and prosody marks, the model predicts the spectrogram frame by frame, including how long each sound lasts and how pitch rises and falls. Older systems built speech by joining recorded fragments; neural models predict new audio directly, which is why they handle rhythm and emphasis far more naturally.
Three things decide the quality of this stage. The training data must cover the voices, languages and speaking styles the product needs. The model must predict duration well, because timing errors make speech sound rushed or flat. And the output must stay stable on unusual input, such as long sentences or rare words, instead of mumbling or skipping.
The acoustic model is also where voice choice lives. A different voice means a different trained model, or a model conditioned on a speaker identity, while the rest of the pipeline stays the same.
How does the vocoder turn sound features into audio?
The vocoder turns sound features into an audio waveform: the actual samples a speaker plays. It is the last synthesis stage, and it decides much of the final sound quality, including whether the voice sounds clean or buzzy.
Vocoders come in two broad kinds. Signal-processing vocoders rebuild audio with fixed rules and run fast on modest hardware, but they can sound flat or metallic. Neural vocoders learn the mapping from features to waveform from recorded speech and sound far more natural, at the cost of more compute. The choice is a trade-off between quality and the hardware budget.
| Vocoder type | How it works | Best for |
|---|---|---|
| Signal processing | Fixed rules rebuild the waveform | Low-power devices, simple prompts |
| Neural vocoder | Learned model predicts samples | Natural voices, long passages |
| Streaming vocoder | Generates audio in small chunks | Live conversation, low latency |
Streaming vocoders deserve attention in live products. A vocoder that waits for the full spectrogram before starting adds a delay the user feels; one that generates in small chunks can start playing while the rest of the sentence is still being predicted.
How do streaming and batch synthesis differ?
Streaming synthesis generates and plays audio while the sentence is still being processed, while batch synthesis waits for the whole passage and returns a complete file. The difference is latency: streaming starts speaking in well under a second, batch can take several seconds on a long article.
Streaming works by cutting the text into small chunks, usually a sentence or a clause, and running each chunk through the pipeline as soon as it is ready. Playback starts on the first chunk while later chunks are still being synthesised. The chunks must join cleanly, so the frontend splits at natural pauses and the acoustic model keeps prosody consistent across chunk boundaries.
Batch synthesis is simpler and often sounds slightly better, because the model sees the whole passage and can plan phrasing across sentences. It suits audiobooks, pre-recorded prompts and help-centre audio, where the listener waits for a file rather than a conversation.
| Mode | First audio | Best for |
|---|---|---|
| Streaming | Under a second | Voice assistants, live replies |
| Batch | After the full passage | Audiobooks, pre-recorded audio |
Many products use both: streaming for live replies and batch for content that is generated once and cached.
Where should the system run: cloud, device or hybrid?
A text-to-speech system can run in the cloud, on the device, or as a hybrid of the two. The choice decides latency, cost, privacy and which voices are available, so it is worth deciding before the rest of the design.
Cloud synthesis sends text to a service and streams audio back. It offers the widest choice of voices and languages, and the vendor carries the compute, but every request costs money and needs a network connection. It suits apps where the text changes constantly, such as articles, messages and notifications.
On-device synthesis runs the whole pipeline on the phone or computer. It works offline, costs nothing per request and keeps the text private, but the voice choice is limited to what fits on the device and quality varies by hardware. It suits navigation prompts, accessibility features and offline use.
| Where it runs | Strength | Watch out for |
|---|---|---|
| Cloud | Most voices, always current | Per-request cost, needs network |
| On device | Offline, private, no per-use cost | Fewer voices, varies by hardware |
| Hybrid | Cloud voice, device fallback | Two systems to keep in step |
Hybrid designs use the cloud voice when online and fall back to the device voice when offline. They are the most work to build, because the two voices sound different and the switch must not surprise the listener.
How do you build a text-to-speech architecture in 6 steps?
You build a text-to-speech architecture by deciding the pipeline, the deployment and the quality controls in that order, because each decision shapes the ones after it. The steps below fit a first version that can be tested with real listeners.
- List the text you will read. Write down every screen, message and notification that gets a listen option. Cut anything decorative, because every extra word costs money and listening time.
- Pick the deployment. Choose cloud, on-device or hybrid from the latency, cost and privacy needs, not from the voice demo.
- Choose the pipeline stages. Decide the frontend rules, the acoustic model and the vocoder, and how audio is cached by text and voice settings.
- Set the pronunciation list. Record how product names, places and abbreviations should sound, and keep the list in one shared file.
- Add playback controls. Give listeners play, pause, skip and speed controls, and highlight the sentence being read.
- Test with real listeners. Play full passages to the people who will listen every day, fix the misread names, then widen the rollout.
Cache audio from day one. Every paragraph should be generated once and stored under a key made from the text and the voice settings, so repeat listens cost nothing. The implementation guide walks through these steps in product terms.
Example (hypothetical): a help centre adds live voice replies
Example (hypothetical): a software company adds live voice replies to its support chat. The chat already answers in text; the team wants customers to hear the answer as well, without waiting for a whole article to be generated.
The team picks a streaming cloud design. The text frontend splits each reply at sentence boundaries, the acoustic model predicts sound features for one sentence at a time, and a streaming vocoder starts playing the first sentence while the second is still being synthesised. The first audio reaches the customer in about 0.8 seconds.
The numbers are simple. A typical reply is 90 words, and the system speaks about 150 words per minute, so a reply takes about 36 seconds to hear. The team caches the 200 most common replies, which cover about half of all chats, so half of all voice replies cost nothing to generate again. The remaining replies are generated once per customer and cached under the text and voice settings.
After a month, the team checks the results. Listeners finish replies more often than readers do, and the support team spends less time re-explaining answers. The main fix is pronunciation: the team adds 12 product names to the shared list after hearing them misread in the first week.
What are the common mistakes?
The most common text-to-speech architecture mistakes are choosing the voice before the deployment, skipping the cache, and treating the frontend as an afterthought. Each one is avoidable with the design order in this article.
- Voice first, deployment later. A voice that sounds good in a demo may be unusable offline or too costly per request. Decide where the system runs first.
- No caching. Generating the same paragraph on every listen is the fastest way to a large bill. Cache by text and voice settings from day one.
- Ignoring the frontend. Most misread names come from missing normalisation rules, not from a bad voice model. Keep one pronunciation list.
- One chunk for everything. Long passages synthesised as a single chunk delay the first audio and hide errors until the end. Split at natural pauses.
- No fallback. If the service is down or the network drops, the product should fall back to a device voice or plain text, not silence.
Start with one voice, one language and a small set of pages. Measure how many listeners finish, fix the names they hear misread, and only then add more voices. The best-practices guide covers the testing routine in more detail.
Key takeaways
- A text-to-speech pipeline has four stages: frontend, acoustic model, vocoder and playback
- The frontend decides pronunciation; most misread names start there, not in the voice
- Streaming synthesis starts speaking in under a second; batch suits pre-recorded audio
- Cloud offers the most voices, on-device works offline and costs nothing per request
- Cache audio by text and voice settings from day one to keep costs down
Frequently asked questions
What is the difference between an acoustic model and a vocoder?
The acoustic model predicts sound features, usually a mel-spectrogram, from the prepared text. The vocoder turns those features into an audio waveform that a speaker can play. The two stages are tuned separately: the acoustic model decides timing and tone, while the vocoder decides how clean the final sound is.
Why does text to speech need a text frontend?
Written text is full of shortcuts that cannot be read aloud as written, such as numbers, dates, abbreviations and symbols. The frontend expands them into speakable words, splits words into sounds and predicts rhythm and emphasis. Without it, the voice would misread names, dates and prices on almost every page.
Is on-device text to speech as good as cloud?
It depends on the device. Modern phones carry capable on-device voices, but the choice is smaller and quality varies by hardware. Cloud services offer more voices and languages and stay current without app updates, at the cost of a network connection and a per-request fee.
What is first-audio latency?
First-audio latency is the time between the system receiving text and the listener hearing the first sound. Streaming systems keep it under a second by synthesising in small chunks, while batch systems wait for the whole passage. It matters most in live conversation, where a long pause feels broken.
Can one system speak many languages?
Yes, if the frontend, acoustic model and vocoder all support the language. Each language needs its own pronunciation rules and usually its own trained voice, so adding a language is a real project, not a setting. Test each language with native listeners before launch.
How much does it cost to add text to speech?
Cloud vendors usually charge per character or per minute of audio, so the cost depends on how much text you read and how often it changes. Caching generated audio and reading only the content users came for keeps the bill small. Check the vendor site for current pricing before budgeting.