Stopping speech the instant the user interrupts
/AI/5 min read
Deciding to stop is only half of barge-in; the audio already on its way keeps playing. A server that pushed 3 s of speech ahead talks over the user for 3.2 s after it decides to stop. Pace the stream and flush the client and it is 280 ms; mute on the device itself and it is about 210.
When a user interrupts a voice agent, two things must happen. The system must decide that it was a real interruption — not a cough, not "mm-hmm", not its own echo. And then the speech must actually stop, at the user's ear, quickly.
The second part is often treated as trivial: stop the TTS, done. In practice the audio the user hears was generated well before they hear it, and it sits in a chain of buffers between the speech engine and the loudspeaker. Stopping the source does nothing about what is already in the pipe.
Where the audio is when you decide to stop
Follow the audio from synthesis to sound:
- TTS engine — generating audio, often faster than real time.
- Server send queue — audio waiting to be written to the network.
- Network in flight — packets travelling to the client.
- Client jitter buffer — a small buffer that smooths out network variation, typically 40–200 ms.
- Client playback buffer — audio handed to the operating system's audio output.
- Loudspeaker.
Every buffer between the decision and the speaker keeps playing unless it is explicitly cleared. The worst offender is usually the server sending audio far ahead of real time. A fast TTS engine can produce a whole sentence in a fraction of a second, and a naive server forwards it immediately, so the client ends up holding several seconds of speech.
Three designs, three stop times
Assume detecting a real interruption takes about 200 ms, and the network is 40 ms each way.
| design | how the stop happens | user hears the agent for |
|---|---|---|
| server stops generating; audio pushed ahead as fast as produced (3 s queued at the client) | only new audio stops | 200 + 3,000 = ~3.2 s |
| server paces audio near real time and sends a "clear" message; client flushes its buffers | detection → server → client | 200 + 40 + 40 = ~280 ms |
| client detects speech locally and mutes immediately; server notified in parallel | on the device | 200 + ~10 = ~210 ms |
Three seconds of the agent talking over someone who has said "stop" feels like being ignored. A quarter of a second feels like being heard.
How to make it fast
Pace the stream. Send audio to the client at roughly real-time speed, keeping only a small lead — a few hundred milliseconds — over what is playing. That bounds how much can ever be in flight. The TTS can still run ahead on the server, where its output can be discarded instantly.
Make "clear" a first-class message. The protocol between server and client needs an explicit instruction to drop all queued audio now, separate from simply sending no more. WebRTC-based and telephony stacks each need their own way of doing this; on a phone line, it may mean the media server cutting the outgoing stream.
Detect on the device where possible. A lightweight voice activity detector running on the client can duck or mute playback the moment the user starts talking, without waiting for a round trip. The server still makes the final decision — resume if it was only a backchannel, stop for good if it was a real interruption — but the user hears the response to their voice immediately.
Duck before you stop. Lowering the volume instantly on possible speech, then stopping or resuming once the classification is confident, gives the responsiveness of immediate action without the cost of stopping for every cough.
Cancel everything upstream. Stop the TTS, cancel the language model's generation, and abort any in-progress tool call that only existed to finish that reply. Leftover work wastes compute and, if not cancelled, can produce audio that leaks out later.
Remember exactly what was said
Once stopped, the agent's record of its own turn must match what the user actually heard. If it generated 120 words and was cut off after 35, the conversation history should contain those 35 — otherwise the model will later refer to things the user never heard.
To do that precisely, the system needs to know which audio reached the speaker. Word-level timestamps from the TTS, combined with the playback position reported by the client at the moment of the stop, let the agent truncate its turn to the last word played. Marking the turn as interrupted helps the model respond naturally to whatever the user said.
Test it end to end
Measure stop latency the way the user experiences it: record both the user's audio and what comes out of the client's speaker, interrupt at random moments, and measure from the start of the user's speech to the agent's silence. Do it on real networks and real devices — speakerphones, Bluetooth headsets and phone lines all add buffering that never shows up on a developer's laptop.
What to take away
Deciding to stop is only half of handling an interruption; the other half is that audio is already in buffers between the TTS and the user's ear. A server that pushes speech ahead as fast as it is produced can keep talking for about 3.2 s after deciding to stop.
Pace audio near real time, send an explicit clear that reaches every buffer, mute or duck on the device itself — bringing the stop to about 280 ms, or about 210 with local detection — cancel all upstream work, and truncate the agent's turn to the words that were actually played.