Transcription, synthesis and turn-taking in voice agents
Explain transcription, synthesis, streaming and turn detection, and run a transcript-first or push-to-talk exercise that handles silence and interruptions.
By Invicly Tech, , in n8n, AI Automation and Voice Agents. About 6 minutes to read.
In short
Transcription turns audio into text, and synthesis turns text into audio. Both work best when streamed in small chunks so the caller does not wait for a full sentence. Turn detection decides when the caller has finished, and it must cope with silence and interruptions.
Think of it like this: Turn detection is like knowing when a friend has finished a sentence, without cutting in too early or leaving an awkward gap.
Explained simply
Transcription means turning speech into text. Synthesis means turning text into speech. A voice agent uses one or both, depending on how it is built.
Streaming means sending small pieces as soon as they exist. If the agent waited to finish a whole sentence before speaking, the caller would sit in silence. By streaming audio out in chunks, the first words come quickly.
The hard part is knowing when someone has finished talking. Software looks for a pause, and some systems also look at meaning. Too eager, and it cuts people off. Too slow, and there is an awkward gap.
Callers also interrupt. When they do, the agent should stop talking and listen. And when the line goes quiet, the agent should check in once, gently, rather than talk forever.
Press Play on a diagram to walk through it one step at a time.
- 1Listen
Audio streams in while the caller speaks.
- 2Detect end of turn
Pause or meaning signals they are done.
- 3Think
Transcript goes to the model and tools.
- 4Speak
Reply audio streams out in chunks.
- 5Watch for barge-in
If the caller talks, stop speaking.
- Back to step 1
- Agent to Voice gateway: Start streaming reply audio1Start streaming reply audio
- Voice gateway to Caller: Play first words2Play first words
- Caller to Voice gateway: Caller starts speaking3Caller starts speaking
- Voice gateway to Agent: Barge-in: cancel reply4Barge-in: cancel reply
- 5Clear queued audioVoice gateway to Voice gateway: Clear queued audio
- Caller to Agent: New caller turn arrives6New caller turn arrives
In depth
Streaming in both directions
Audio flows in as the caller speaks, so the transcript can start forming before the turn ends. Audio also flows out as the reply is made, so playback can begin early. The important idea is that nothing waits for the whole message. The cost is more moving parts: chunks arrive out of step, and a late chunk can be useless if the caller already interrupted.
- Inbound audio chunks feed transcription
- Outbound audio chunks feed playback
- Late chunks after an interruption should be dropped
Detecting the end of a turn
Voice activity detection checks whether sound is speech. A simple rule says the turn ended after a set number of milliseconds of silence. Better systems also judge whether the sentence sounds complete, so a pause in the middle of an address does not end the turn. You normally tune a threshold: shorter feels quick but risks cutting in, longer feels polite but slow. Test with real pauses, such as reading out a phone number.
- Fast replies
- Cuts off slow speakers
- More false turn ends
- Patient with pauses
- Feels slow
- Callers may repeat themselves
Silence and interruptions
For silence, set a first prompt after a few seconds, a second shorter prompt, then end politely or offer a person. For interruptions, stop playback at once, discard queued audio and treat the new speech as the next turn. Also remember what was already said, because the caller only heard part of the reply. If your system tracks that, it can avoid repeating or skipping facts.
Practising without live audio
You can test the logic without a microphone. In a transcript-first exercise you feed typed turns, including empty ones for silence and overlapping ones for interruptions, and check the agent's replies. In a push-to-talk exercise, a person holds a key while speaking, which removes turn detection as a variable.
Learn it in 5 short steps
About 35m each. Track them with a timer in your plan.
- 1Transcribe and synthesise speech~35m
- 2Stream audio in both directions~35m
- 3Detect the end of a turn~35m
- 4Handle silence and interruptions~35m
- 5Run a push-to-talk exercise~35m
Key points
- Stream audio in both directions so speech starts before the whole reply is ready.
- Voice activity detection (VAD) finds speech and silence. Some systems also use meaning to judge the end of a turn.
- A barge-in is the caller interrupting. Stop playback and listen.
- Handle long silence with a gentle prompt, then a polite exit.
- Practise with push-to-talk or a transcript-first test before using live audio.
Key terms
Tap a card to flip it. 0/5 known
Examples
A push-to-talk exercise
Prerequisites: a laptop, a microphone and a speech-to-text provider or a free local tool. Steps: hold a key, speak a booking request, release, and print the transcript. Evidence: the transcript matches what you said. Cleanup: delete any recorded audio files from the test folder.
A transcript-first silence test
Feed the agent typed turns where one is empty. The agent should prompt once, then offer a person on the second empty turn.
turns = ["I need an appointment", "", ""]
for i, t in enumerate(turns):
if t.strip():
reply = agent(t)
elif i == 1:
reply = "Are you still there?"
else:
reply = "I will connect you to a person."
print(reply)Quick reference
- Transcription: speech to text. Synthesis: text to speech.
- Stream audio in chunks so replies start early.
- VAD detects speech versus silence.
- Shorter silence threshold is quicker but cuts people off.
- On barge-in, stop playback and clear queued audio.
- Prompt once on silence, then offer a person.
Common mistakes
- Setting the silence threshold so short that the assistant cuts callers off mid-thought.
- Not clearing queued audio on barge-in, so the assistant keeps talking over the caller.
- Testing only with clean, quiet recordings.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Write down the five steps of one conversation turn.
- Exercise 2medium
Write transcript-first test cases for silence and interruption.
- Exercise 3hard
Design a policy table for end-of-turn thresholds for names, dates and phone numbers.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- What is barge-in?
- It is when the caller speaks over the assistant. The assistant should stop and listen.
- Is a longer silence threshold always safer?
- No. It avoids cutting people off but makes the agent feel slow. Tune it with real calls.
- Can I test without a microphone?
- Yes. Use typed turns, including empty ones for silence, then try push-to-talk before live audio.