AlgoViz

Real-time voice interview architecture

hard 6 min

A voice interaction has several clocks.

Video lesson · Chapter 1 of 4

The interviewer is interrupted mid-question

0:00 / 3:31

Theory

Read or listen first. About 2 min.

What it is

A voice interaction has several clocks. The microphone captures samples, turn detection estimates when a person has finished, the model produces a response, and the device plays audio after buffering. These events can overlap. An interview transcript used as memory must account for what the candidate actually heard. The last generated token can be far ahead of the speaker.

Why it exists

In a cascaded pipeline, speech recognition supplies text to a language model and a synthesizer voices the reply. Individual stages are inspectable and replaceable, though recognition errors and latency propagate. A native speech-to-speech system can model overlapping speech and prosody more directly. Both approaches still need an explicit turn policy, playback accounting, interruption and an accessible text alternative.

Interrupt the interviewer halfway through a question

Microphone stream → Turn controller (speech onset). Turn controller → Playback buffer (stop playout). Playback buffer → Session history (played offset). Session history → Turn controller (repaired turn)
Microphone stream → Turn controller (speech onset). Turn controller → Playback buffer (stop playout). Playback buffer → Session history (played offset). Session history → Turn controller (repaired turn)

Inside this chapter

Chapter sources
Turn detection
Acoustic silence is evidence of a boundary, not always the end of an answer. A candidate thinking aloud can pause mid-sentence. Balance responsiveness against premature interruption using real conversations and separate noisy-room and quiet-room measurements.

Voice activity detection only knows whether someone is making sound. Interview answers are full of thinking pauses, so a short silence threshold interrupts people and a long one makes the interviewer feel sluggish. Many systems add a semantic or prosodic signal, such as whether the transcript so far forms a complete thought or whether pitch falls at the end. Tune on real recorded interviews, separately for noisy and quiet rooms.

Example. With a 400 ms pause inside “I would ... shard by tenant,” an aggressive end detector can start the next question early.

Another example. In a quiet room, a 700 ms threshold rarely interrupts. On a laptop in a café, background chatter keeps the detector from ever seeing silence, so the system needs a different end-of-turn signal or noise suppression.

Is this pause the end of the answer?

Combining a silence timer with a completeness signal reduces cutting candidates off mid-thought.
Audio playout and barge-in
When new speech arrives during playback, distinguish canceling future generation from flushing audio already queued. Track the played offset so the next turn can reconcile model-side history with the listener’s experience.

Barge-in means the user starts speaking while the system is talking. Two separate things must stop: generation and synthesis upstream (to save cost), and playback of audio already buffered on the device (so the user hears silence quickly). The device then reports how far playback got, and the dialogue history is trimmed to that point, because the model must not assume the candidate heard words that were flushed.

Example. The server generated two seconds of speech, but the speaker played 0.8 seconds. The remaining 1.2 seconds contain a question the candidate has never heard.

Another example. A voice banking assistant was reading out three account options when the caller said "the second one". Only the first two had played, so "second" is resolved against what was heard, not against the full generated list.

Generated versus heard

QuantityValueFate
Audio generated by server2.0 scomplete question
Audio actually played0.8 scandidate heard this prefix
Queued tail1.2 sflushed, never heard
History records0.8 s prefix plus interruptionbasis for the next turn
Figures from the example.
Voice service objectives
Time from the end of actual user speech to the first audible response includes detection, inference, network and client buffering. Measure interruption-to-silence separately. Evaluate transcription and task quality by accent and noise, using consented recordings.

Measure from the moment the user actually stopped speaking to the moment the first word of the reply is audible on their device. That end-to-end number includes stages owned by different teams, so a local optimisation can be cancelled out elsewhere. Track interruption-to-silence separately, and evaluate recognition and task quality across accents and noise conditions using consented recordings.

Example. Faster synthesis saves 80 ms while a larger jitter buffer adds 120 ms. The candidate hears the first word 40 ms later.

Another example. Moving speech recognition to a larger model improves word accuracy for regional accents but adds 150 ms. The team keeps it for the interview product, where accuracy matters more, and not for quick voice commands.

Illustrative latency budget to first audible word

StageBeforeAfter change
End-of-turn detection300 ms300 ms
Model to first token300 ms300 ms
Synthesis to first audio200 ms120 ms
Network and jitter buffer150 ms270 ms
Total heard latency950 ms990 ms
Made-up budget. Saving 80 ms in synthesis while adding 120 ms of buffer makes the reply 40 ms later.
Cascaded versus speech-to-speech
A cascaded design chains speech recognition, a text language model and a synthesiser. A speech-to-speech model takes audio in and produces audio out directly. The first is easier to inspect and swap; the second can respond faster and handle tone and overlapping speech more naturally.

Whichever you choose, the system still needs explicit turn-taking rules, playback accounting, interruption handling and a text alternative. Evaluation also differs: a cascade can be graded stage by stage, while a speech-to-speech model is mostly graded end to end.

Example. An interview platform starts cascaded so transcripts and model prompts can be audited per stage, and keeps a text transcript for accessibility either way.

Cascaded pipeline

  • Each stage observable and replaceable
  • Text transcript available at every step
  • Recognition errors and stage latencies add up

Speech-to-speech model

  • Fewer handoffs, potentially lower latency
  • Can use tone, emphasis and overlap
  • Harder to inspect and to swap one part
Echo cancellation and self-interruption
When the interviewer's voice comes out of a laptop speaker, the microphone picks it up again. Without acoustic echo cancellation the system can mistake its own audio for the candidate speaking and interrupt itself.

Browsers and mobile platforms provide echo cancellation, but its quality varies by device. Test barge-in with speakers as well as headphones, and log false-interrupt rates per device type.

Example. On speakers without headphones, the interviewer keeps stopping mid-question. Enabling echo cancellation on the client removes the false barge-ins.

How self-interruption happens
  1. 1Interviewer audio playsthrough laptop speaker
  2. 2Microphone hears itmixed with room noise
  3. 3No echo cancellationlooks like user speech
  4. 4False barge-inplayback flushed
  5. 5Fixsubtract known playback signal

Echo cancellation uses the known outgoing audio to remove it from the microphone signal.

How it works

Step through the idea, or press Play.

Step 1 of 4

Microphone stream. Candidate begins speaking again

Understand it

Worked example

Interrupt the interviewer halfway through a question

  1. 1

    Candidate begins speaking again

    The input stream continues during playback. Track turn identity and the device clock so the new speech can be associated with an interruption.

  2. 2

    Interrupt response seventeen

    The controller detects the candidate taking the floor and requests cancellation of outstanding synthesis or generation.

  3. 3

    800 ms of audio actually played

    Flush the queued tail and report the played offset. Receiving a network packet is insufficient evidence that the candidate heard it.

  4. 4

    Record the audible prefix

    The history reconciles the interruption before asking the next question. The interviewer can repeat the unheard portion if it remains relevant.

Follow the handoffs

In a cascaded pipeline, speech recognition supplies text to a language model and a synthesizer voices the reply. Individual stages are inspectable and replaceable, though recognition errors and latency propagate. A native speech-to-speech system can model overlapping speech and prosody more directly. Both approaches still need an explicit turn policy, playback accounting, interruption and an accessible text alternative.

Interruption reconciled into history

The played offset, not the packet log, decides what counts as heard.

Turn 17 lifecycle

Only Completed marks the whole question as heard.

Summary

The whole topic in one minute.

Playback is the user-visible boundary. Continuing from an unheard question makes the interview incoherent.

In a cascaded pipeline, speech recognition supplies text to a language model and a synthesizer voices the reply. Individual stages are inspectable and replaceable, though recognition errors and latency propagate. A native speech-to-speech system can model overlapping speech and prosody more directly. Both approaches still need an explicit turn policy, playback accounting, interruption and an accessible text alternative.

Sources