{"course":{"slug":"making-things-with-ai","title":"Making Things with AI","url":"https://addaly.com/learn/making-things-with-ai","level":"beginner","track":"create"},"lesson":{"slug":"how-speech-is-made","title":"From text to a waveform","url":"https://addaly.com/learn/making-things-with-ai/how-speech-is-made","position":50,"of":84,"minutes":8,"answer":"Modern speech synthesis converts text into discrete audio tokens with a language model and turns those tokens back into sound with a neural codec, which is why it now sounds natural and why it hallucinates.","keyIdea":"Modern speech synthesis converts text into discrete audio tokens with a language model and turns those tokens back into sound with a neural codec, which is why it now sounds natural and why it hallucinates."},"body":{"format":"markdown","text":"## The old pipeline, and why it sounded like that\n\nFor decades, text-to-speech had three stages. Convert text to phonemes with pronunciation rules and a dictionary. Predict a spectrogram (a picture of the sound's frequency content over time) from those phonemes. Convert the spectrogram to a waveform with a vocoder.\n\nEach stage was separately engineered, and the joins were audible. Concatenative systems stitched together recorded fragments, which is why announcements at railway stations have that particular seam between words. Parametric systems produced the flat, buzzy voice everyone associates with a computer.\n\nThe quality ceiling came from the middle stage. Predicting a spectrogram from phonemes is an averaging problem: many real deliveries of a sentence are correct, and a model trained to minimise error over all of them produces the average of them, which is the flat one.\n\n## The current pipeline\n\nThe shift that changed everything was to treat audio as a sequence of discrete tokens, exactly as a language model treats text.\n\nA **neural audio codec** (trained to compress audio and reconstruct it) produces a small vocabulary of tokens, typically at something like 50 to 75 tokens per second per codebook, with several codebooks stacked to capture successive levels of detail. A one-second clip becomes a few hundred integers.\n\nNow the problem is familiar: given text, predict a sequence of audio tokens. A transformer does this, and it does it the way language models do: by sampling from a distribution rather than by averaging. That single change removes the flatness, because the model commits to *one* delivery rather than blending all of them.\n\nThe codec's decoder then turns the predicted tokens back into a waveform.\n\n> Figure: From text to a waveform, as it is done now. Steps: 1. Text (Everything about delivery (the stress, the phrasing, where the breath goes) has to be inferred, because none of it is in the words.); 2. A language model over audio tokens (A neural codec gives audio a vocabulary: fifty to seventy-five tokens a second per codebook, several codebooks stacked, so a second of sound is a few hundred integers.); 3. It samples rather than averages (This is what removed the flatness. The model commits to one delivery instead of blending every correct one, and that is also why it can skip a word or invent a noise.); 4. Codec decoder (Tokens back into a waveform.); 5. A person listens to every line (Generate line by line, re-roll the failures, assemble in Audacity. Nobody generates ten minutes in one pass and ships it.). The old pipeline predicted a spectrogram from phonemes, which is an averaging problem: many deliveries of a sentence are correct and the average of them is the flat one. Sampling is the whole difference, and it brings the whole failure family with it.\n\n```\ntext -> (language model) -> audio tokens -> (codec decoder) -> waveform\n```\n\n## What follows from the architecture\n\nThree consequences that explain nearly everything users notice.\n\n**It hallucinates, because it samples.** A generative sequence model can produce tokens that do not correspond to your text. In practice this appears as repeated syllables, a word skipped, an invented noise, or (the most disconcerting failure) the voice trailing off into unrelated babble. This is the same failure family as a language model repeating itself, and it is why any synthetic voice used in production must be listened to, every time, before it ships.\n\n**Temperature and sampling settings exist.** Where a system exposes them, they behave as they do for text: low values give consistent, slightly duller delivery; high values give expressive readings with more failures. There is a genuine trade here, and for long-form narration the low setting plus a re-roll of the bad lines is usually the right one.\n\n**Long inputs degrade.** Attention over a long token sequence is the same constraint as everywhere else in this course. Most systems handle a sentence or a paragraph well and drift over several minutes. Generating line by line and assembling in an editor is the standard practice, and it also gives you the ability to re-roll one bad line rather than a whole chapter.\n\n## The free tools, and what they can do\n\nThis is an area where open tools are competitive, which is not true everywhere in this course.\n\n- **Piper**: small, fast, runs on a Raspberry Pi, dozens of languages, good for narration where perfect naturalness is not required.\n- Several open codec-based systems produce voices close to commercial quality, run on consumer hardware, and support cloning from a short sample.\n- **Audacity** (free) for assembling, trimming and normalising the output, which you will need to do regardless of the generator.\n\nThe practical shape of a narration job is: generate line by line, listen to every line, re-roll the failures, assemble in Audacity, apply gentle compression, export. That is perhaps an hour for a ten-minute script, and most of the hour is listening.\n\n## The limitation worth remembering\n\nThe naturalness of current speech synthesis is real and it makes the failures more dangerous, not less. A flat robotic voice announced itself. A voice that is indistinguishable from a person, that occasionally inserts a word that was not in the script, and that is being used for something consequential (a medical instruction, a legal notice, an emergency announcement) is a different risk profile entirely.\n\nThe control is not technical. It is that synthetic speech in any consequential setting gets listened to by a person against the script before it is used. Every organisation deploying this at scale eventually learns that, usually after an incident."},"check":{"question":"Why does current speech synthesis sound natural where the older spectrogram-prediction approach sounded flat?","options":[{"text":"It samples a single delivery from a distribution over audio tokens rather than predicting the average of all valid deliveries.","correct":true},{"text":"It uses a much higher audio sample rate, which preserves the high-frequency detail that carries vocal expressiveness in human speech recordings.","correct":false,"tempting":"Sample rate affects fidelity and was never the cause of the flatness; older systems at high sample rates still sounded averaged."},{"text":"It applies a separate prosody model after synthesis to add emphasis and intonation to an otherwise flat rendering.","correct":false,"tempting":"Post-hoc prosody adjustment was tried in the older pipelines and is not what changed; the improvement came from the generative objective."},{"text":"It concatenates recorded fragments from a much larger library of human speech, so more natural transitions are available.","correct":false,"tempting":"That describes concatenative synthesis, the older approach whose seams are exactly what people found unnatural."}]},"prev":{"slug":"voice-and-consent","title":"Voice, and the line you do not cross","url":"https://addaly.com/learn/making-things-with-ai/voice-and-consent"},"next":{"slug":"the-voice-print","title":"What a voice print actually is","url":"https://addaly.com/learn/making-things-with-ai/the-voice-print"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Source and assessment review continues. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'From text to a waveform', in Making Things with AI. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/making-things-with-ai/how-speech-is-made (Accessed: 29 November 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"From text to a waveform","courseTitle":"Making Things with AI","module":{"index":6,"slug":"voice-and-speech","title":"Voice and speech"},"answer":null,"keyIdea":"Modern speech synthesis converts text into discrete audio tokens with a language model and turns those tokens back into sound with a neural codec, which is why it now sounds natural and why it hallucinates.","hero":{"kind":"figure","figure":{"t":"figure","label":"Figure","figure":{"caption":"The old pipeline predicted a spectrogram from phonemes, which is an averaging problem: many deliveries of a sentence are correct and the average of them is the flat one. Sampling is the whole difference, and it brings the whole failure family with it.","steps":[{"label":"Text","detail":"Everything about delivery (the stress, the phrasing, where the breath goes) has to be inferred, because none of it is in the words."},{"label":"A language model over audio tokens","detail":"A neural codec gives audio a vocabulary: fifty to seventy-five tokens a second per codebook, several codebooks stacked, so a second of sound is a few hundred integers."},{"label":"It samples rather than averages","detail":"This is what removed the flatness. The model commits to one delivery instead of blending every correct one, and that is also why it can skip a word or invent a noise."},{"label":"Codec decoder","detail":"Tokens back into a waveform."},{"label":"A person listens to every line","detail":"Generate line by line, re-roll the failures, assemble in Audacity. Nobody generates ten minutes in one pass and ships it."}],"title":"From text to a waveform, as it is done now","type":"flow"},"alt":"Figure: From text to a waveform, as it is done now. Steps: 1. Text (Everything about delivery (the stress, the phrasing, where the breath goes) has to be inferred, because none of it is in the words.); 2. A language model over audio tokens (A neural codec gives audio a vocabulary: fifty to seventy-five tokens a second per codebook, several codebooks stacked, so a second of sound is a few hundred integers.); 3. It samples rather than averages (This is what removed the flatness. The model commits to one delivery instead of blending every correct one, and that is also why it can skip a word or invent a noise.); 4. Codec decoder (Tokens back into a waveform.); 5. A person listens to every line (Generate line by line, re-roll the failures, assemble in Audacity. Nobody generates ten minutes in one pass and ships it.). The old pipeline predicted a spectrogram from phonemes, which is an averaging problem: many deliveries of a sentence are correct and the average of them is the flat one. Sampling is the whole difference, and it brings the whole failure family with it."}},"blocks":[{"t":"h2","id":"the-old-pipeline-and-why-it-sounded-like-that","runs":[{"text":"The old pipeline, and why it sounded like that"}]},{"t":"p","runs":[{"text":"For decades, text-to-speech had three stages. Convert text to phonemes with pronunciation rules and a dictionary. Predict a spectrogram (a picture of the sound’s frequency content over time) from those phonemes. Convert the spectrogram to a waveform with a vocoder."}]},{"t":"p","runs":[{"text":"Each stage was separately engineered, and the joins were audible. Concatenative systems stitched together recorded fragments, which is why announcements at railway stations have that particular seam between words. Parametric systems produced the flat, buzzy voice everyone associates with a computer."}]},{"t":"p","runs":[{"text":"The quality ceiling came from the middle stage. Predicting a spectrogram from phonemes is an averaging problem: many real deliveries of a sentence are correct, and a model trained to minimise error over all of them produces the average of them, which is the flat one."}]},{"t":"h2","id":"the-current-pipeline","runs":[{"text":"The current pipeline"}]},{"t":"p","runs":[{"text":"The shift that changed everything was to treat audio as a sequence of discrete tokens, exactly as a language model treats text."}]},{"t":"p","runs":[{"text":"A "},{"text":"neural audio codec","b":true},{"text":" (trained to compress audio and reconstruct it) produces a small vocabulary of tokens, typically at something like 50 to 75 tokens per second per codebook, with several codebooks stacked to capture successive levels of detail. A one-second clip becomes a few hundred integers."}]},{"t":"p","runs":[{"text":"Now the problem is familiar: given text, predict a sequence of audio tokens. A transformer does this, and it does it the way language models do: by sampling from a distribution rather than by averaging. That single change removes the flatness, because the model commits to "},{"text":"one","i":true},{"text":" delivery rather than blending all of them."}]},{"t":"p","runs":[{"text":"The codec’s decoder then turns the predicted tokens back into a waveform."}]},{"t":"code","lang":"","label":"Text","text":"text -> (language model) -> audio tokens -> (codec decoder) -> waveform"},{"t":"h2","id":"what-follows-from-the-architecture","runs":[{"text":"What follows from the architecture"}]},{"t":"p","runs":[{"text":"Three consequences that explain nearly everything users notice."}]},{"t":"p","runs":[{"text":"It hallucinates, because it samples.","b":true},{"text":" A generative sequence model can produce tokens that do not correspond to your text. In practice this appears as repeated syllables, a word skipped, an invented noise, or (the most disconcerting failure) the voice trailing off into unrelated babble. This is the same failure family as a language model repeating itself, and it is why any synthetic voice used in production must be listened to, every time, before it ships."}]},{"t":"p","runs":[{"text":"Temperature and sampling settings exist.","b":true},{"text":" Where a system exposes them, they behave as they do for text: low values give consistent, slightly duller delivery; high values give expressive readings with more failures. There is a genuine trade here, and for long-form narration the low setting plus a re-roll of the bad lines is usually the right one."}]},{"t":"p","runs":[{"text":"Long inputs degrade.","b":true},{"text":" Attention over a long token sequence is the same constraint as everywhere else in this course. Most systems handle a sentence or a paragraph well and drift over several minutes. Generating line by line and assembling in an editor is the standard practice, and it also gives you the ability to re-roll one bad line rather than a whole chapter."}]},{"t":"h2","id":"the-free-tools-and-what-they-can-do","runs":[{"text":"The free tools, and what they can do"}]},{"t":"p","runs":[{"text":"This is an area where open tools are competitive, which is not true everywhere in this course."}]},{"t":"ul","items":[[{"text":"Piper","b":true},{"text":": small, fast, runs on a Raspberry Pi, dozens of languages, good for narration where perfect naturalness is not required."}],[{"text":"Several open codec-based systems produce voices close to commercial quality, run on consumer hardware, and support cloning from a short sample."}],[{"text":"Audacity","b":true},{"text":" (free) for assembling, trimming and normalising the output, which you will need to do regardless of the generator."}]]},{"t":"p","runs":[{"text":"The practical shape of a narration job is: generate line by line, listen to every line, re-roll the failures, assemble in Audacity, apply gentle compression, export. That is perhaps an hour for a ten-minute script, and most of the hour is listening."}]},{"t":"h2","id":"the-limitation-worth-remembering","runs":[{"text":"The limitation worth remembering"}],"role":"limit"},{"t":"p","runs":[{"text":"The naturalness of current speech synthesis is real and it makes the failures more dangerous, not less. A flat robotic voice announced itself. A voice that is indistinguishable from a person, that occasionally inserts a word that was not in the script, and that is being used for something consequential (a medical instruction, a legal notice, an emergency announcement) is a different risk profile entirely."}]},{"t":"p","runs":[{"text":"The control is not technical. It is that synthetic speech in any consequential setting gets listened to by a person against the script before it is used. Every organisation deploying this at scale eventually learns that, usually after an incident."}]}],"check":{"question":[{"text":"Why does current speech synthesis sound natural where the older spectrogram-prediction approach sounded flat?"}],"options":[{"text":[{"text":"It samples a single delivery from a distribution over audio tokens rather than predicting the average of all valid deliveries."}],"correct":true,"tempting":null},{"text":[{"text":"It uses a much higher audio sample rate, which preserves the high-frequency detail that carries vocal expressiveness in human speech recordings."}],"correct":false,"tempting":[{"text":"Sample rate affects fidelity and was never the cause of the flatness; older systems at high sample rates still sounded averaged."}]},{"text":[{"text":"It applies a separate prosody model after synthesis to add emphasis and intonation to an otherwise flat rendering."}],"correct":false,"tempting":[{"text":"Post-hoc prosody adjustment was tried in the older pipelines and is not what changed; the improvement came from the generative objective."}]},{"text":[{"text":"It concatenates recorded fragments from a much larger library of human speech, so more natural transitions are available."}],"correct":false,"tempting":[{"text":"That describes concatenative synthesis, the older approach whose seams are exactly what people found unnatural."}]}],"order":[3,2,0,1],"why":null},"prev":{"slug":"voice-and-consent","title":"Voice, and the line you do not cross","minutes":9},"next":{"slug":"the-voice-print","title":"What a voice print actually is","minutes":8}}}