# Speech, Voice Agents and Realtime Audio

> Transcribe speech, synthesize voices and build low-latency voice assistants with speech-to-text, text-to-speech and realtime APIs. Free notes, key concepts,...

Canonical: https://www.internhack.in/roadmaps/tracks/ai-engineer/speech-voice
Last updated: 2026-11-28

Transcribe speech, synthesize voices and build low-latency voice assistants with speech-to-text, text-to-speech and realtime APIs.

Intermediate · about 5 hours · difficulty 3/5

Learn first: [Streaming Responses](https://www.internhack.in/roadmaps/tracks/ai-engineer/streaming-responses), [Tool and Function Calling](https://www.internhack.in/roadmaps/tracks/ai-engineer/tool-calling)

Voice interfaces add two conversions around your text pipeline, or replace them with a single **speech-to-speech** model.

### Building blocks

- **Speech-to-text (STT)**: Whisper (open weights) and hosted transcription APIs convert audio to text, with timestamps and speaker labels on some services.
- **Text-to-speech (TTS)**: hosted voices from model providers and specialist vendors turn replies into natural audio, often streaming.
- **Realtime / speech-to-speech APIs**: a single model hears audio and speaks back over a WebSocket or WebRTC connection, with lower latency and more natural turn-taking.

### Two architectures

- **Cascade (STT then LLM then TTS)**: flexible, easy to debug, any text model and tools work, but latency adds up.
- **Native realtime**: faster and more expressive, with less control and higher cost.

### What makes voice hard

- **Latency budget**: people notice pauses above roughly a second. Stream everything and start speaking before the full reply is ready.
- **Turn detection and interruptions**: voice activity detection decides when the user has finished, and the agent must stop talking when interrupted.
- **Audio quality**: noise, accents and phone-line audio reduce accuracy.
- **Consent and misuse**: disclose AI voices and never clone a voice without permission.

### Good enough to move on

You can build a voice assistant that transcribes speech, answers with a tool-using model and speaks back with streaming TTS, and you can measure its end-to-end latency.

## Key concepts

- **Speech-to-text and Whisper**
- **Text-to-speech voices**
- **Cascade voice pipelines**
- **Realtime speech-to-speech APIs**
- **Turn detection and interruptions**
- **Latency budgeting**
- **Voice consent and disclosure**

## Mini project

Build a browser voice assistant for a restaurant that takes spoken orders, calls a menu lookup tool, confirms the order aloud, and logs latency for each stage of the pipeline.

## Check yourself

Where does the latency go in a cascade voice pipeline, and which stage would you stream first?

## Free resources

- [OpenAI docs: speech to text](https://platform.openai.com/docs/guides/speech-to-text) (OpenAI)
- [OpenAI docs: realtime API](https://platform.openai.com/docs/guides/realtime) (OpenAI)
- [Gemini API: Live API](https://ai.google.dev/gemini-api/docs/live) (Google)
- [Hugging Face Audio Course](https://huggingface.co/learn/audio-course) (Hugging Face)

Previous: [Vision and Document Understanding](https://www.internhack.in/roadmaps/tracks/ai-engineer/vision-inputs) · Next: [Image and Media Generation](https://www.internhack.in/roadmaps/tracks/ai-engineer/image-generation)

## More in Multimodal AI

- [Vision and Document Understanding](https://www.internhack.in/roadmaps/tracks/ai-engineer/vision-inputs)
- [Speech, Voice Agents and Realtime Audio](https://www.internhack.in/roadmaps/tracks/ai-engineer/speech-voice)
- [Image and Media Generation](https://www.internhack.in/roadmaps/tracks/ai-engineer/image-generation)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [AI Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/ai-engineer)
