Skip to content
AgenticAIWiki
  1. Learn
  2. Part 1
  3. 8. Multimodal and voice
  4. 8.2

Lesson 8.2 · 2 of 9 · 4 min read · Reviewed 24 Nov 2026

Speech to text and text to speech

By the end, you can

  • Describe speech-to-text and text-to-speech.
  • Build a simple voice pipeline around a text model.

The cascaded pipeline

microphone --> STT --> text --> language model --> text --> TTS --> speaker
               "Can I move my                "Yes. I've moved it to
                delivery to Friday?"          Friday between 9 and 12."

Speech-to-text

Converts audio to text. Things to handle:

  • Mishearing: names, numbers and ids are error-prone. Confirm important values back (“That’s order 1-0-4-2?”).
  • Punctuation and speakers: some systems add punctuation and label who spoke.
  • Partial results: streamingStreaming: Receiving a response as a series of server-sent events while it is generated, instead of waiting for the whole reply. STT gives early guesses that firm up as the user speaks.

Text-to-speech

Converts text to natural audio. Choose a voice, speed and language. Long or heavily formatted text sounds bad when spoken.

Writing for the ear

Tell the model its reply will be spoken:

Your replies are read aloud. Use short sentences. No lists, tables, markdown
or emoji. Say numbers the way people say them. Confirm key details back.

Latency budget

Each stage adds time: STT, then the model’s first tokensToken: The unit a model reads and writes: a word, part of a word, a space or a symbol, mapped to an integer id., then TTS’s first audio. Streaming every stage keeps the total low enough to feel conversational (8.3).

Key points

  • Speech-to-text (STT) turns audio into text; text-to-speech (TTS) turns text into audio.
  • A cascaded voice assistant chains STT, a language model and TTS.
  • Each stage adds latency and its own errors, so design for mishearing and keep spoken replies short.
Hands-on labOn your own machine

Transcribe audio locally with Whisper

Run an open Whisper-style speech-to-text model on your own machine and measure where it mishears.

You will have: A transcript of three short recordings and a table of every misheard name, number or id.

Steps

  1. Install ffmpeg, then install the open-source Whisper package (or whisper.cpp) in a Python virtual environment.
  2. Record three 20 to 30 second clips on your phone: one plain sentence, one with an order number and a postcode, one with a colleague's name.
  3. Transcribe each clip with a small model, then again with a larger one, and time both runs.
  4. Compare each transcript with what you actually said and list every wrong word, number or name.
  5. Write the read-back confirmation your voice agent should say for the riskiest value.

Done when

  • All three clips have transcripts from two model sizes.
  • Your table lists each error with the model size that made it.
  • You have one read-back sentence for numbers or ids.

Docs: openai/whisper on GitHub · Radford et al., Robust Speech Recognition via Large-Scale Weak Supervision (arXiv)

Quick checkIn a cascaded voice assistant, what does the language model receive from the user?
How sure are you?
Pick an answer and how sure you are