KnowML

Real-Time Voice AI

Follow one question to a voice agent, "What's my balance?", from the moment the caller stops talking to the first sound of the reply. You'll see where the milliseconds go, how the agent decides the caller has finished, and what interruptions and packet loss do to the pipeline.

⏱ 29 min readAssumes: the speech stack (13), time to first token (31)
Start reading

Picture a customer phoning a support line and asking a voice agent, "What's my balance?" The moment they finish the last word, a clock starts. The caller is waiting to hear something back, and every extra tenth of a second makes the pause feel less like a conversation and more like a bad connection. This chapter follows that one turn, from the instant the caller stops speaking to the instant the first sound of the reply reaches their ear, and asks where the time goes.

A voice agent is usually built as three programs in a row, which we'll call a cascade. A speech recogniser (ASR, for automatic speech recognition) turns the caller's audio into text. A language model (LLM) reads that text and writes a reply. A speech synthesiser (TTS, for text-to-speech) turns the reply back into audio. You met the speech pieces in chapter 13 and the model's time to first token in chapter 31. What's new here is that each piece has to run while the others are still working, and that audio has to travel to and from the caller's phone as well.

You might expect the language model to dominate the delay, and most teams optimise it first, since it's the biggest and most expensive part. We'll build a budget for one turn and find that it doesn't. Deciding that the caller has finished speaking takes longer than the model does, and moving audio around takes more than the model does, too. Every setting we can change is also a trade against some other failure: answer sooner and you start interrupting people, shrink one buffer and the recogniser hears glitches, drop the cascade for a single speech model and you lose the written transcript you may have been logging.

We'll start with how long a human pause is, because that's the number everything else gets measured against. Then we'll price each stage of the turn, spend most of our time on the largest stage, and finish with what happens when the caller interrupts and when the network drops packets.

01The clock you are running against

Before we can say a reply is too slow, we need to know how fast people reply to each other. Stivers and colleagues timed the gap between a yes/no question and its answer in ten languages drawn from five continents. Every language gave the same kind of picture, a single hump in the distribution with its peak between 0 and 200 ms. The median across languages was +100 ms, and the language averages ran from +7 ms in Japanese to +469 ms in Danish. People start answering almost as soon as the question ends, and often they've started planning the answer before it does.

Now put our agent on that scale. If a turn takes 859 ms (the total we'll build in the next section), it sits at roughly eight times the cross-linguistic median and nearly double the slowest language average that was measured. Even the slow end of human conversation was 469 ms.

Telephone engineers reached a compatible number from the other direction. ITU-T Recommendation G.114 says that below 150 ms of one-way mouth-to-ear delay most applications feel almost transparent, and that above 400 ms the delay is unacceptable for general network planning. A conversation is a round trip, so we can take two one-way trips at that unacceptable limit and get 800 ms. Human gaps almost all fall below 500 ms. Somewhere around 800 ms of turn latency, a reply stops landing anywhere a conversational gap has ever been observed to land, and that's the working line for this chapter.

How close do real systems get? OpenAI's GPT-4o system card reports audio responses in as little as 232 ms with an average of 320 ms, and positions that as human-comparable. Kyutai's Moshi paper gives a theoretical 160 ms, made of an 80 ms Mimi frame plus 80 ms of acoustic delay, and about 200 ms in practice on an L4 GPU. Both are native speech models, a design we'll compare with the cascade in section 07. A 2026 tutorial that built a careful self-hosted cascade, with streaming ASR, vLLM (an LLM serving engine) and streaming synthesis, measured 755 ms to first audio, with a best case of 729 ms. That gap between 320 and 755 is what the rest of the chapter is about, so the next job is to see where a cascade spends its time.

02Where the milliseconds go

Let's follow our caller's question through the system and write down every wait along the way. We measure from the user's last phoneme (the last individual speech sound they make) to the first sample of the reply reaching their ear. Nine stages sit in that interval. The picture below draws them to scale, so a bar twice as wide is twice as long, and it's worth reading the long bar first.

One turn, drawn to scale. Bar widths are proportional to milliseconds.
200 ms: a human has already answered 859 ms total capture + Opus encode 25 network, up 30 jitter buffer 80 endpointing 295 ASR final transcript 24 LLM first token 220 TTS first audio 75 network, down 30 playout buffer 80 0 200 400 600 800
Bars start at their cumulative offset, so the right edge of the last bar is the turn latency. The scale is 458 drawing units for 859 ms, applied to every segment, so a bar twice as wide is twice as long. Note where the green line falls: by the time a human would have finished answering, this pipeline is still waiting to be sure the user has stopped.

Here's each stage in order, with what it is and where its number came from. The caller's voice is first captured and compressed with the Opus audio codec, which works on 20 ms frames of sound. It crosses the network and lands in a jitter buffer, a short queue that holds audio back so uneven packet arrival doesn't make it stutter. An endpointer then decides the caller has stopped talking, the ASR finalises its transcript, and the LLM produces its first token. The TTS produces the first sample of audio, then crosses the network again and waits in a playout buffer on the caller's device. Notice that the jitter buffer and the playout buffer are the same mechanism at either end, so both are 80 ms.

StagemsWhere the number comes from
Capture + Opus encode25One 20 ms frame plus the 5 ms of look-ahead RFC 6716 says the SILK layer needs for noise shaping.
Network, up30One direction of a 60 ms round trip, inside the 20 to 200 ms range ElevenLabs' latency docs quote.
Jitter buffer80NetEq's starting target delay in the WebRTC source, before it adapts to the measured arrival spread.
Endpointing295LiveKit Turn Detector v1's mean latency at a 10% false-cutoff operating point on eot-bench.
ASR final transcript24NVIDIA's reported median time to final transcription for cache-aware streaming Nemotron ASR.
LLM first token220Assumed. This one you must measure yourself. Page 31 is about what sets it.
TTS first audio75ElevenLabs' stated Flash model inference time for short inputs, excluding network and player buffering.
Network, down30Symmetric with the uplink.
Playout buffer80The same jitter mechanism on the return path.

The budget rests on one assumed figure (the LLM row, which you have to measure on your own system) and eight sourced ones, and it totals 859 ms. What matters is the shape more than the exact sum, so let's push on it. Below, the code puts the nine numbers in an array, prints the four biggest rows and the total spent moving audio instead of thinking, and then prices three changes. The edit helper copies the array, replaces one stage with a new value and returns the new total, so each change is measured against the same baseline. Both of the last two changes touch only the endpointer's row: moving it to a 5% false-cutoff operating point (543 ms, a figure from section 03), and replacing it with a plain 800 ms silence timer.

Try it Price three optimisations against the same budget
import numpy as np

# One turn, end of the user's speech to first agent audio.
# Every row is sourced or flagged as an assumption on the page.
stage = ["capture + Opus encode", "network up", "jitter buffer",
         "endpointing", "ASR final transcript", "LLM first token",
         "TTS first audio", "network down", "playout buffer"]
ms = np.array([25, 30, 80, 295, 24, 220, 75, 30, 80], float)
total = ms.sum()

print(f"budget {total:.0f} ms")
for i in np.argsort(-ms)[:4]:
    print(f"  {stage[i]:<21} {ms[i]:5.0f} ms   {ms[i]/total:5.1%}")

moved = ms[[0, 1, 2, 7, 8]].sum()
print(f"\naudio moving, not thinking   {moved:.0f} ms")
print(f"LLM first token              {ms[5]:.0f} ms")

def edit(i, v):
    x = ms.copy(); x[i] = v; return x.sum()

print(f"\nhalve the LLM            {edit(5, 110):.0f} ms")
print(f"endpointer at 5% cutoff  {edit(3, 543):.0f} ms")
print(f"fixed 800 ms silence     {edit(3, 800):.0f} ms")
Endpointing is the biggest row at 295 ms, about a third of the turn, with the LLM second at 220 ms. Five rows only move audio around (capture, both network hops and both buffers) add up to 245 ms, more than the model. Halving the language model, the hardest and most expensive change on the list, moves 859 ms to 749. Loosening the endpointer from a 10% to a 5% false-cutoff rate moves it to 1107, and that erases the win three times over. A plain 800 ms silence timer lands at 1364. The turn-taking policy has more leverage than the model, and it is a config value.

Why does the endpointer cost more than the model?

Because it isn't computing anything slow. It's waiting. A model can't be sure the caller has finished until it has heard some silence, and every millisecond of that doubt is added to every turn. We'll spend the whole next section on it. Before that, one caution about the table: it describes a typical turn, and the complaints come from the unusual ones. A tool call in the middle of a turn, say the agent looking up the balance, inserts a second full model round trip, and nothing about the first one streams across it. One HTTP retry on any hop costs more than the entire budget above. Both are invisible at the median (p50) and dominate the 95th percentile (p95), so latency here is a distribution, and the complaints come from its tail.

03Endpointing: deciding that you stopped

The largest single item in the budget is a decision, and it comes in two parts that are easy to confuse. One part is cheap. Voice activity detection (VAD) answers whether a slice of audio contains speech. Silero VAD processes a 30 ms chunk in under a millisecond on one CPU thread, from a model of about two megabytes, so that question is close to free.

The second part is hard, and it's called endpointing: has this person finished, or are they thinking? Suppose our caller says "My account number is four two" and then goes quiet for 300 ms while they read the next digits off a card. That same 300 ms of silence also follows "What's my balance?" The audio is identical in both cases, and the right action is opposite.

Fixed thresholds, and why they cannot win

The simplest policy is a silence timer. Wait milliseconds of non-speech, then commit the turn and hand the transcript to the model. It can go wrong in exactly two ways. A false cut-off happens when a mid-sentence hesitation lasts longer than , so the agent starts talking over a caller who wasn't done. They have to start over, and recovering costs several seconds. Dead air is the other failure: the caller finished, and we pay milliseconds of silence before anything happens. Every turn pays it.

Why not just pick a shorter timer?

Because the two failures pull against each other with nothing to adjust. Raising reduces cut-offs and raises dead air by exactly the same amount, since dead air is . A shorter timer means more interruptions, a longer one means a slower agent, and no value of escapes that. To do better we need information the silence timer doesn't have.

Semantic endpointing moves the curve

The extra information is what was said. "My account number is four two" is unfinished even after 400 ms of silence, and "That's all, thanks" is finished after 150 ms. A small language model reading the partial transcript can tell those apart, so the agent can commit early when the words sound complete and wait longer when they don't. This is called semantic endpointing.

LiveKit's Turn Detector v1, released in June 2026, distils a Qwen2.5-7B teacher into a 0.5B student that runs on a CPU, and reports results on an open benchmark called eot-bench. Here's the false cut-off rate each system reaches when it's allowed a given latency budget.

Latency budgetLiveKit v1Deepgram FluxOther reported
300 ms9.9% false cut-off12.9%ultraVAD 27.7%
600 ms4.5% false cut-off9.9%Soniox 5.5%

Read that as a curve and not a ranking. That post also gives the inverse view: a 10% false-cutoff target costs 295 ms of mean latency, and a 5% target costs 543 ms. Halving your interruption rate costs 248 ms on every turn. That's the exchange rate you're buying. (That 295 is the endpointing row in our budget, and the 543 is the number we used in the last section's code.)

To see why a semantic endpointer helps, we can simulate it. In the code below, half of 60,000 simulated turns are real endings, and the other half are mid-turn hesitations whose length follows a lognormal distribution centred near 240 ms. The fixed(T) function counts how often a silence timer of length T cuts off a hesitation. Our semantic endpointer gets a noisy confidence score for each turn (higher for real endings), and it commits at 120 ms whenever the score clears a threshold c. We then sweep the threshold, and for each result find the silence timer with the same false cut-off rate so the two policies can be compared like for like. Since we invented the separation between scores, only the shape of the curve carries over.

Try it The endpointing trade, at matched error rates
import numpy as np
rng = np.random.default_rng(0)

N = 60000
is_end = rng.random(N) < 0.5          # the user really has finished
# Mid-turn hesitations in ms. A real turn end never resumes.
pause = np.where(is_end, np.inf,
                 rng.lognormal(np.log(240), 0.6, N))
hes = ~is_end

def fixed(T):
    """Wait T ms of silence, then commit. Dead air is always T."""
    return (hes & (pause > T)).sum() / hes.sum()

# A semantic endpointer reads the partial transcript at 120 ms and
# commits early when confident. The separation below is invented;
# only the shape of the curve is the point.
score = rng.normal(np.where(is_end, 1.7, 0.0), 1.0)

def semantic(c, T=800.0):
    early = score > c
    bad = (hes & early & (pause > 120)) | (hes & ~early & (pause > T))
    wait = np.where(early, 120.0, T)
    return bad.sum() / hes.sum(), wait[is_end].mean()

grid = np.arange(50, 3000, 5.0)
rates = np.array([fixed(t) for t in grid])

print(" false cut | fixed silence | semantic | saved")
for c in (0.4, 1.0, 1.6, 2.2):
    r, wait = semantic(c)
    t_match = grid[np.argmin(np.abs(rates - r))]   # same error rate
    print(f"   {r:6.2%}  |   {t_match:6.0f} ms   | {wait:5.0f} ms |"
          f" {t_match - wait:5.0f} ms")
Look first at the last column. At every matched error rate the semantic policy waits less, by 125 to 146 ms across the four rows, because it can commit before the silence has elapsed. Then look down the columns: going from 16.16% to 7.22% false cut-offs costs 148 ms of extra dead air. Neither policy escapes that. You are choosing a point on a curve, and no setting is correct.

So a better endpointer buys a better curve, and we still have to choose where on it to sit. There's one more trick that changes the arithmetic. Start generating a reply on the partial transcript while the endpointer is still undecided, and cancel if the caller keeps talking. We pay for model turns that get thrown away, and in exchange the LLM's 220 ms runs alongside the endpointer's 295 ms instead of after it. That only works if cancellation is cheap and complete. A cancelled turn that still emits audio, or still writes to the conversation state, is worse than the latency it saved. Cancellation is the central problem of the next section, where the caller interrupts the agent.

04Barge-in, and the state it corrupts

So far the caller has been the only one talking. Now let the agent be halfway through "Your balance is forty-two dollars and..." when the caller says "wait, which account?" Letting the caller cut in like this is called barge-in. It's usually specified as "stop the audio", but that hides three separate problems, and the third is where the bugs live.

Hearing the user through your own voice

The first problem is that the caller's microphone picks up their loudspeaker. Without any correction, the agent's own voice is the loudest thing in the input, so the VAD fires on the agent and the agent interrupts itself. Acoustic echo cancellation (AEC) solves this by subtracting a filtered copy of what was just played from what the microphone heard. That's why the playback path has to hand its samples to the AEC as a reference. RFC 7874 says WebRTC endpoints SHOULD include an AEC and deliberately mandates no particular algorithm.

The hard case is double-talk, where both parties speak at once, and that's exactly what barge-in is. Its adaptive filter has to learn the echo path from a signal that now also contains the caller's voice, and it must not diverge while it does. The ICASSP 2022 AEC Challenge scored entries on subjective quality across single-talk and double-talk conditions, plus a speech recognition word acceptance rate. That's the right pairing, because residual echo that a human tolerates can still wreck a transcript.

Audio you cannot take back

Suppose the echo is handled and we've decided to stop. Some of the agent's speech has already left. Frames handed to the playout buffer are out of our control, and with the 80 ms buffer from section 02 plus a 20 ms frame, up to about 100 ms of speech can reach the ear after we cancel. That sounds small, and its consequence is large: the agent said a word we believe it didn't say.

Here's how that goes wrong in nearly every cascade. On barge-in, the naive implementation stops playback and then writes the full generated response into the conversation history. Now the model believes it delivered "forty-two dollars" when the caller heard only "Your balance is", so it never repeats the number and carries on as if the information landed. To fix it, truncate the assistant turn at the point where audio stopped. That needs an alignment between generated text and emitted audio. For that reason a streaming synthesiser should return timing marks as well as bytes. Without them you're guessing where to cut.

Deciding it was an interruption at all

The third problem is that not everything the caller says is an interruption. "Mhm", "right" and "yeah" are backchannels: they mean "keep going". A VAD classifies them as speech and stops the agent. Over-eager barge-in therefore feels as broken as none at all. Energy alone can't separate a backchannel from a real interruption, so we need the words, and that lands us on the same kind of model that does semantic endpointing. In a cascade, the barge-in decision therefore depends on the ASR having already produced a partial transcript for an utterance only 200 ms long.

Finally, cancellation has to reach every component. If we stop the synthesiser while the language model keeps generating, we leave an orphaned response that arrives after the caller's next question and answers the previous one. That distributed cancel is part of what the cascade costs, and we'll come back to it in section 07. First, though, we should look at the ASR stage we've been treating as a 24 ms box.

05Streaming ASR: what a chunk costs

A batch recogniser looks at the whole utterance before it writes anything. A voice agent can't wait for that. A streaming recogniser has to commit to words while audio is still arriving, using everything before the current moment plus a short window after it. That window goes by several names: lookahead, right context, emission delay or chunk latency. More lookahead means the recogniser has more of the next sound to go on, so it should make fewer mistakes, and that's the price of arriving early.

NVIDIA published a clean version of the exchange rate for its cache-aware streaming Nemotron models in January 2026. Raising the chunk latency from 0.16 s to 0.56 s drops the word error rate (WER, the fraction of words the recogniser gets wrong) from 7.84% to 7.22%. Working it out, 400 ms of extra delay buys 0.62 WER points, about 0.16 points per 100 ms. That's an unusually mild trade.

Why does lookahead cost so little turn latency?

Because the delay is spent while the caller is still speaking. It overlaps the utterance and doesn't get added to the end of it. Only the last chunk's delay lands after the final word, and even that mostly overlaps the endpointer's wait. That's why the ASR row in our budget is 24 ms and not 160. So the useful question is how much of the lookahead is still unpaid when the endpointer fires, and usually the answer is none of it.

Why you cannot just chunk an offline model

If streaming is just windows of audio, why not slice the input and run an ordinary batch model on each window? It looks like streaming but isn't, and chapters 13 and 34 cover why the accuracy degrades. Compute is the cost that matters here. Sliding windows overlap, so the encoder repeatedly re-processes audio it has already seen, and recomputes attention over context it already had. A cache-aware streaming encoder keeps those activations instead and processes each frame once.

NVIDIA reports the size of that difference as concurrency: at a 320 ms chunk on an H100, 560 simultaneous streams against a 180-stream baseline, roughly three times. For a voice product, the number of conversations one GPU can hold is the unit cost of a conversation, so this is a pricing decision as much as an architecture one.

The third knob is the one nobody sets

Lookahead looks forward, and the other two knobs are the chunk size and the left context, which looks back. A streaming encoder that keeps unbounded history grows its state for every stream, and memory per stream is what caps concurrency. Bounding it costs a little accuracy on long turns and is frequently the difference between one GPU and four. With the listening side priced, the next stage to look at is the one that produces the sound.

06Streaming TTS: only the first chunk matters

When the model has written "Your balance is forty-two dollars", the synthesiser has to turn it into sound. Once playback starts, generation only has to keep up with real time: a real-time factor below 1.0 means the synthesiser produces audio faster than it plays, so the buffer never drains. Total synthesis time hardly matters. What the caller feels is time to first audio, and that splits into more parts than most teams look at.

ElevenLabs' own latency documentation is candid about this. Flash model inference is around 75 ms for short inputs. Network round trips are 20 to 200 ms. A 500 ms player buffer is common. Of those terms the model is the smallest, and the largest term of all probably sits upstream of the synthesiser.

The chunking decision that costs half a second

The synthesiser can't start until it has text, and the text arrives from the LLM token by token. What we choose to wait for is a latency decision made before the TTS ever runs. Take the arithmetic: at 40 tokens per second, one token is 25 ms. Waiting for a complete 20-token sentence costs 500 ms after time to first token. Cutting at the first clause boundary, maybe 6 tokens in, costs 150 ms.

That 350 ms difference comes from a text-splitting rule, and it's larger than anything we'd win by changing the synthesiser. It's also why "we stream the TTS" is an ambiguous claim worth interrogating. Streaming audio out while buffering text in to a sentence boundary gives you the latency of a non-streaming system.

Why not cut as early as possible, then?

Because prosody, the rise and fall of pitch and rhythm, is planned over a phrase. Synthesise "I can help with that" and "if you give me the account number" as independent chunks and you get two falling intonations glued together, which sounds like two sentences. A usable compromise is a short first chunk for speed and longer chunks after, since the first one buys the time for everything behind it. We trade the naturalness of one phrase for the responsiveness of every turn.

Where the vocoder sits in this

The last stage inside the synthesiser is the vocoder, which turns the model's frames into audio samples, and it can't start from a single frame. Convolutional vocoders need enough frames to fill their receptive field, plus some lookahead, before the first sample exists. Chunks are also spliced with an overlap from the previous chunk so the seam isn't audible.

Whether that stage is your bottleneck depends on where you run it. A 2025 comparison of low-latency neural vocoders found that on CPU-only systems the per-chunk streaming overhead, meaning data movement and parameter loading, dominates raw arithmetic at low latencies. That same work reports that a single frame of lookahead recovers nearly all of the quality of a non-causal model. On a server GPU the picture inverts: the autoregressive token generation in front of the vocoder is the slow part, and the vocoder is a rounding error. Claiming one universal bottleneck is how teams end up optimising the wrong stage. Having priced every stage of the cascade, we can now ask whether the cascade is the right shape at all.

07Cascade or speech-to-speech

Look at what we've been building. Two of the cascade's three stages exist only to convert between audio and text, and each conversion costs time and throws something away. A native speech model (also called speech-to-speech) skips both: it consumes audio and emits audio, with no text in the loop. Chapter 34 has the model-by-model view, and this section covers the engineering consequences. This trade is real, and in 2026 it's far from settled, because each option gives up something specific.

CascadeSpeech to speech
Reported turnaround755 ms measured in a 2026 self-hosted buildMoshi 200 ms on an L4; GPT-4o 320 ms average
Intermediate stateA readable transcript at every hopActivations. No transcript unless you add an ASR pass
Swapping a componentIndependent, one at a timeAll or nothing
Prosody, emotion, overlapDiscarded at the transcriptPreserved end to end
Barge-inA distributed cancel across three servicesNative, because it never had a turn state
Guardrails and toolsText-level, mature, easy to constrainHarder to constrain mid-stream

Start with what the cascade loses, because "information loss" undersells it. A transcript destroys hesitation, sarcasm, emphasis and emotional state, and it also destroys timing. Overlapped speech becomes either one sequence or two, and which one is a decision your diarizer (the component that labels who spoke when) made. A cascade also serialises three separate warm-up latencies, and gives you three services that can each rate-limit, retry or go down in the middle of a turn.

What speech-to-speech loses is mostly observability. You can't log what you never rendered, so transcripts, retrieval keys, quality evals, compliance review and text guardrails all need a parallel ASR pass, the very step you were trying to avoid running.

The 2026 tutorial cited in section 01 is useful because it tried both. Its cascade of streaming ASR, vLLM and streaming synthesis measured 755 ms. An end-to-end Qwen3-Omni reached 702 ms through a hosted API, and 146 seconds run locally. That last figure is the real state of play: native speech models are faster when somebody else operates them at scale, and mostly aren't self-hostable yet at conversational speed. Regulated and self-hosted deployments choose the cascade for reasons that are only partly about the model. Whichever shape we pick, the audio still has to reach the caller, and that part runs over a connection we don't control.

08Transport: why WebRTC, and what loss does

In our budget, 245 ms is audio in transit or sitting in a buffer, so the protocol underneath matters as much as any model. What surprises newcomers is why live voice doesn't just use HTTP, or a WebSocket, to send audio.

Why not HTTP

HTTP and WebSockets run on TCP, which guarantees ordered delivery. If one segment is lost, TCP retransmits it, and every later segment waits behind it. This is head-of-line blocking, and it's the wrong guarantee for a live conversation. Audio that arrives 200 ms late is worthless, because its moment has passed, so it's better to conceal 20 ms of missing sound than to stall the next 200 ms waiting for it. WebRTC carries audio over SRTP (an encrypted form of the real-time transport protocol) on UDP, which doesn't retransmit, so a lost packet leaves a hole and doesn't stall the stream.

So is a WebSocket never the right choice?

It's fine in two places. WebSockets over TCP remain a good fit for the control plane, and for server-to-server hops on a reliable network. They're the wrong choice for the last mile to a phone on a train, where loss is routine.

Opus, and the 25 ms you pay before sending anything

RFC 7874 makes Opus and G.711 mandatory for WebRTC endpoints, and requires decoders to support all Opus modes, so Opus is the floor here and not a matter of preference. RFC 6716 describes how it's built. The SILK layer handles 10 to 60 ms frames and needs 5 ms of extra look-ahead for noise shaping. The CELT layer handles 2.5 to 20 ms frames with 2.5 ms of overlap look-ahead. A 20 ms frame plus SILK's 5 ms is the 25 ms in the budget table, spent before a single packet is on the wire.

Opus also carries in-band forward error correction: a low-bitrate copy of the previous frame rides inside the next packet, so one isolated loss is recovered without a retransmission and without a round trip. It covers exactly one frame back, so a burst of four defeats it. Mozilla's 2016 experiments found the effect subtle at low loss rates and very noticeable at high ones.

The jitter buffer is a latency knob

Packets sent every 20 ms don't arrive every 20 ms, because each takes a slightly different time across the network. That variation in arrival time is called jitter. A buffer absorbs it by holding audio back, so a packet that comes a little late still arrives before its turn to play, and that's why the buffer appears twice in the budget. A packet that misses its deadline is treated as lost and concealed: the decoder fills the gap with audio it makes up.

WebRTC's NetEq pulls 10 ms of audio at a time and adapts continuously. Its delay manager keeps a histogram of packet inter-arrival times in 20 ms buckets and targets roughly the 97th percentile, starting from 80 ms. When the buffer runs long or short it time-stretches the audio, accelerating or expanding it, and it doesn't drop or stall. Why the 97th percentile? The simulation below shows it. It sends 400,000 packets with a 30 ms minimum delay and a long-tailed jitter (most packets are early, a few are very late), and for each buffer depth counts the fraction that miss their deadline and would be concealed. Packet i's deadline is its send time plus the 30 ms floor plus the buffer depth.

Try it Buffer depth against concealed packets, and where the knee is
import numpy as np
rng = np.random.default_rng(1)

# 20 ms Opus packets. One-way delay is a 30 ms floor plus a heavy
# right tail: most packets are early, a few are very late.
n = 400000
sent = np.arange(n) * 20.0
jitter = rng.gamma(2.0, 7.0, n)          # ms
arrive = sent + 30.0 + jitter

print("buffer   concealed   added delay")
for depth in (0, 20, 40, 60, 80, 120):
    deadline = sent + 30.0 + depth
    late = (arrive > deadline).mean()
    print(f"{depth:4} ms   {late:8.3%}   {depth:8} ms")

q97 = np.quantile(jitter, 0.97)
print(f"\n97th percentile of the jitter: {q97:.0f} ms")
print("NetEq sets its target near that quantile, then adapts.")
The concealment rate falls off a cliff, and the cliff sits at the 97th percentile of the jitter. Going from 20 ms to 40 ms of buffer takes concealment from 22.020% to 2.187%. Another 40 ms takes it to 0.013%, for the same 40 ms of delay. The 97th percentile of this jitter distribution is 37 ms, right where the collapse happens. So NetEq tracks a high quantile of measured arrivals and doesn't use a constant: a fixed buffer is either wasting delay or shredding audio, and which one depends on a network you don't control.

What concealment does to the recogniser

A concealed packet isn't silence. Instead the decoder invents plausible audio to bridge the gap, tuned to sound acceptable to a human ear, and your ASR was never trained on it. A 2022 study over G.722 telephony found the damage is a knee and not a slope: a clean-trained recogniser held up to about 10% packet loss and then degraded roughly in proportion, while a model trained on network-distorted speech pushed that knee out to about 15%. Training on the distortion you'll see moves the cliff.

There's a cheaper version of the same idea. Dissen and colleagues showed at Interspeech 2024 that a front-end adaptation network in front of a frozen Whisper, trained against the recogniser's own loss, recovers much of the loss-induced error without retraining the ASR. All of this points at a gap in how we measure. Published word error rates come from audio files, but your audio came through a codec, a jitter buffer, a concealment algorithm and possibly a transcode at a carrier boundary down to 8 kHz. If you've never measured your own WER on audio captured at the far end of your own transport, you don't know your recognition accuracy, only somebody else's. Measuring that, and the latency budget from section 02 on your own system, is where the next section starts.

09Summary

  1. Human turn-taking sets the clock. The median gap between a question and its answer is about 100 ms across ten languages, and a reply that arrives around 800 ms lands outside anything measured.
  2. A turn is a nine-stage budget, from the user's last phoneme to the first reply sample at their ear. In the worked example it totals 859 ms, with one assumed row (the LLM) and eight sourced ones.
  3. The model isn't the biggest item. Endpointing costs 295 ms, the LLM 220 ms, and moving audio around 245 ms, so the turn-taking policy has more leverage than the model.
  4. Endpointing is a decision, not a computation. A silence timer trades false cut-offs against dead air one for one, and semantic endpointing shifts the whole curve by reading the transcript, saving roughly 125 to 146 ms at matched error rates in the simulation.
  5. Speculative generation hides the LLM behind the endpointer, but only if cancelling a thrown-away turn is cheap and complete.
  6. Barge-in is three problems: echo cancellation so the agent doesn't hear itself, truncating the conversation history at the point where audio stopped, and telling backchannels from real interruptions. The cancel must also reach every component.
  7. Streaming ASR lookahead is cheap in turn latency, because the delay overlaps the user's speech. What it costs is compute, and cache-aware encoders hold about three times the concurrent streams of a sliding-window baseline.
  8. For TTS, only time to first audio matters. Where you cut the LLM's text into chunks can cost 350 ms, more than any synthesiser change, though cutting too early hurts prosody.
  9. Cascade and speech-to-speech each give something up. The cascade loses prosody and timing and needs a distributed cancel, and speech-to-speech loses the transcript. Native models are fast when hosted and mostly not self-hostable at conversational speed yet.
  10. Voice transport runs on UDP through WebRTC, not TCP, because a late packet is worthless and head-of-line blocking stalls everything behind it. The jitter buffer is a latency knob, and NetEq sets it near the 97th percentile of measured arrivals.
  11. Packet loss reaches your word error rate, because concealed audio isn't what your ASR trained on. Measure WER on audio captured at the far end of your own transport.

10Build this

The budget in section 02 is a worked example with one assumed row. Yours will look different, and the difference is the only thing worth acting on.

Project Instrument one turn, then move exactly one number ~4 hours · any voice stack you already have

You are not building an agent. You are building the measurement that tells you which stage to work on, and then checking whether the arithmetic predicted what happened.

  1. Put a monotonic timestamp at nine points on every turn: last speech frame in, endpoint decision, final transcript, first LLM token, first TTS byte, first byte on the wire, first sample played. Ship them with the turn id.
  2. Collect 200 real turns, and avoid staff turns. Plot p50 and p95 per stage as a stacked bar, widths proportional to milliseconds, the same way the diagram above is drawn.
  3. Find the gap between p50 and p95 for each stage. One stage will own nearly all of it. That stage is your actual problem, and it is usually not the one that is largest at p50.
  4. Log every pause with its duration and whether the user resumed. You now have a labelled endpointing dataset for free.
  5. Sweep the silence threshold over that logged data offline and plot false cut-offs against dead air. Pick a false-cutoff target first, then read off the threshold.
  6. Deploy that one change and re-measure, then compare the movement in total latency against what step five predicted.
You'll know it worked when the measured total moves by close to what the sweep predicted. If it does not, one of your nine timestamps is measuring something other than what its name says, and finding which one is worth more than the latency win.
The stretch that changes your mind. Add a second series for turns where the user was interrupted by the agent. Their total time to a successful exchange includes the recovery: the user restarting, the agent re-answering. Priced that way, a false cut-off often costs three to five seconds. Plot the expected time per successful turn against the threshold, rather than the latency, and the optimum usually moves toward waiting longer than felt right.

11What breaks

Almost none of these are model failures, and almost all of them show up as "it feels laggy".

  • p50 is fine and p95 is three seconds. One slow hop, a cold start or a retry. Users remember the tail, and a mean hides it completely.
  • The endpointer was tuned in an office. Staff speak in fluent complete sentences to a demo. Customers hesitate, read numbers aloud and pause to find documents.
  • Barge-in stops the audio but not the model. The orphaned generation arrives later and answers the previous question.
  • The transcript records what was generated and not what was heard. After every interruption the model believes it delivered a sentence that was cut off mid-word.
  • The synthesiser buffers to a sentence boundary. Streaming audio out while blocking on text in gives you non-streaming latency behind a streaming API.
  • The jitter buffer is a constant. Tuned on a wired desk connection, then deployed to mobile networks, where it is now too shallow.
  • Echo cancellation fails on a speakerphone. The agent hears itself, the VAD fires, and it interrupts itself in a loop.
  • The first tool call doubles the turn. Nothing streams across a function call, so the user gets the full budget twice with no audio in between.
  • Backchannels stop the agent. Someone says "mhm" and the agent goes quiet, which reads as being ignored.
  • WER was measured on clean files. The production path adds a codec, concealment and possibly an 8 kHz transcode that no benchmark includes.

12Where you meet this in the wild

Same budget, very different constraints on which lines you can touch.

Phone and contact centre

8 kHz narrowband, a carrier path you cannot instrument, and echo control happening somewhere you do not own. The transport lines of the budget are fixed, so endpointing and the model turn are all you can move.

Semantic endpointing, aggressive speculative generation, and WER measured on your own recordings.

Browser widget

WebRTC end to end, so you control the codec, the buffer and the AEC. The catch is that you also own the AEC, and laptop speakerphones in open-plan offices are the worst case for double-talk.

Tune the jitter buffer per session, ship timing marks with synthesised audio.

On-device and in-car

Network latency goes to zero, which removes about 220 ms. In exchange the vocoder and the recogniser now share one CPU, and concurrency stops mattering while single-stream latency starts to.

Small streaming ASR, short lookahead, a vocoder chosen for per-chunk overhead.

Not a place to assume a server-class bottleneck profile.

Drive-through and kiosk

Constant background noise, multiple speakers, and people who change their order mid-sentence. Endpointing carries the product, because a false cut-off is a wrong order and not just a slow reply.

Long thresholds, target speaker extraction, explicit confirmation.

13Interview questions

BeginnerWhy is 800 ms the wrong number for a voice agent?

Because human conversation does not work at that speed. Stivers and colleagues measured the gap between a question and its answer across ten languages and found a unimodal distribution in every one, with modes between 0 and 200 ms and a cross-linguistic median of about 100 ms. Even the slowest language mean, Danish at 469 ms, is far below 800.

Telephony reaches a compatible conclusion from the other side. ITU-T G.114 treats one-way mouth-to-ear delay under 150 ms as essentially transparent and over 400 ms as unacceptable for planning.

A turn that takes 800 ms is therefore not slightly slow. It is outside the range in which conversational gaps have been observed, which is why it reads as a machine rather than as hesitation.

BeginnerWhat is endpointing and why is it not the same as voice activity detection?

Voice activity detection answers whether a frame of audio contains speech. It is cheap, essentially solved, and runs in well under a millisecond per chunk on a CPU.

Endpointing answers a different and much harder question: has this person finished their turn, or are they pausing mid-thought. The acoustic evidence for those two cases is identical, because both are silence.

A fixed silence threshold is the naive policy, and it has exactly two behaviours: cutting people off when a hesitation runs long, and adding its full value as dead air to every completed turn. Semantic endpointing improves on it by reading the partial transcript, since the words distinguish an unfinished account number where the silence cannot.

IntermediateYour agent takes 900 ms per turn. The LLM's time to first token is 200 ms. Where do you look, and in what order?

At endpointing first, because it is usually the largest single item and it is invisible in any model metric. Published operating points put a semantic endpointer at roughly 295 ms of mean latency for a 10% false-cutoff rate and 543 ms for 5%, so the difference between two reasonable settings exceeds the entire model turn.

Second, at whether text is buffered to a sentence boundary before synthesis starts. At 40 tokens per second that silently adds around 500 ms for a 20-token sentence.

Third, at transport. Two network legs plus two jitter buffers is commonly 200 ms or more, and nobody looks at it.

Only then at the recogniser, and specifically at whether its chunk delay genuinely overlaps the user's speech rather than being paid after the last word. The general rule: the terms nobody measures are larger than the term everybody optimises.

IntermediateWhy can a streaming ASR model afford lookahead almost for free in a voice agent?

Because chunk delay overlaps the utterance instead of appending to it. A recogniser emitting with 160 ms of right context is 160 ms behind the audio at every instant, but the user is still talking, so that lag costs no turn latency at all.

Only the final chunk's delay lands after the last word, and even that runs concurrently with the endpointer deciding whether the turn is over.

NVIDIA's cache-aware streaming numbers show the accuracy side is also mild: moving chunk latency from 0.16 s to 0.56 s improved word error rate only from 7.84% to 7.22%, about 0.16 points per 100 ms.

So lookahead is the wrong knob to fight over. The right question is how much of it is still unpaid at the moment the endpointer commits.

IntermediateWhy does a voice agent use WebRTC rather than a WebSocket?

Because TCP's ordering guarantee is the wrong guarantee for live audio. A lost segment is retransmitted and every later segment queues behind it, so a single loss stalls the stream by at least a round trip.

Audio that arrives 200 ms late has missed its playout slot and is useless, so concealing 20 ms of missing sound is strictly better than waiting. WebRTC carries media over SRTP on UDP, which turns a loss into a hole rather than a stall, and pairs it with an adaptive jitter buffer that time-stretches audio to absorb arrival spread.

It also brings the rest of the real-time stack. RFC 7874 makes Opus mandatory and says endpoints should include acoustic echo cancellation, which you need for barge-in. WebSockets remain reasonable for control messages and for server-to-server hops on a reliable network.

DeepWalk through implementing barge-in properly. What breaks in the naive version?

Three problems, and the third is the one that ships broken. First, you must hear the user through your own output, which requires acoustic echo cancellation with the playback signal as reference. The hard condition is double-talk, both parties speaking at once, which is precisely what barge-in is, and what the ICASSP AEC challenges exist to measure.

Second, you must stop, and stopping is not instantaneous. Frames already handed to the playout buffer will be heard. With an 80 ms buffer and 20 ms frames, assume roughly 100 ms of speech reaches the ear after you cancel.

Third, and most often wrong, you must repair conversation state. The naive implementation writes the full generated response into history, so the model believes it delivered a sentence the user never heard and will not repeat the information.

The fix is to truncate the assistant turn at the point where audio stopped, which requires the synthesiser to return timing marks aligning text to emitted samples. Cancellation must also reach the language model, or an orphaned generation arrives later and answers the previous question.

Finally, backchannels like "mhm" should not trigger any of this, and telling them apart needs the words rather than the energy.

DeepYou are choosing between a cascade and a speech-to-speech model in 2026. Argue both sides with specifics.

The cascade's case is operational. Every intermediate is a string, so you can log it, filter it, apply mature text guardrails, constrain tool calls, run evals and hand transcripts to compliance. Each component swaps independently, which matters in a field where the best recogniser and the best synthesiser come from different labs.

Its costs are concrete: three serial models, three services that can each fail mid-turn, and a transcript that destroys prosody, emotion and the timing of overlapped speech. A careful 2026 self-hosted build of exactly this shape measured 755 ms to first audio.

The speech-to-speech case is latency and fidelity. Moshi reports 160 ms theoretical, an 80 ms frame plus 80 ms of acoustic delay, and about 200 ms in practice on an L4. GPT-4o's system card claims a 320 ms average. Interruption is close to native because a full-duplex model never maintained a turn state to unwind.

Its cost is observability. There is no transcript unless you run a parallel recogniser, which reintroduces the component you removed, and constraining generation mid-stream is harder.

The practical tiebreaker is deployment. The same 2026 comparison found an end-to-end model at 702 ms through a hosted API and 146 seconds run locally, so self-hosted and regulated deployments still mostly pick the cascade.

DeepHow does packet loss reach your word error rate, and what would you do about it?

It reaches it through concealment rather than through silence. When a packet is lost the decoder synthesises plausible audio to bridge the gap, tuned to be inoffensive to a human ear, and your recogniser was trained on neither the artefact nor the discontinuity.

The damage is a knee rather than a slope. A study over G.722 telephony found a clean-trained recogniser holding up to around 10% loss before degrading roughly in proportion, while a model trained on network-distorted speech pushed that knee to about 15%.

The mitigations stack. At the transport layer, enable Opus in-band forward error correction, which carries a low-bitrate copy of the previous frame in the next packet and recovers isolated losses with no retransmission and no round trip. It covers only one frame back, so bursts defeat it.

Size the jitter buffer from measured arrival statistics rather than a constant, since a shallow buffer converts jitter into loss.

At the model layer, either fine-tune on audio degraded the way your production path degrades it, or put a front-end adaptation network ahead of a frozen recogniser, as Dissen and colleagues did with Whisper at Interspeech 2024.

Above all, measure word error rate on audio captured at the far end of your own transport. A benchmark number from clean files describes a system you are not running.

14Go deeper

📄
Paper
Universals and cultural variation in turn-taking in conversation
Stivers et al., PNAS 2009. Ten languages, a cross-linguistic median gap of +100 ms. The clock in section 01.
📄
Standard
ITU-T G.114: One-way transmission time
The 150 ms and 400 ms mouth-to-ear thresholds that fifty years of telephony planning is built on.
🔧
Engineering
Solving end-of-turn detection: LiveKit Turn Detector v1.0
June 2026. False-cutoff rates against latency budgets, and the 295 ms versus 543 ms operating points in section 03.
🔧
Tool
eot-bench
The open end-of-turn benchmark behind those numbers. Run your own endpointer against it before believing any vendor curve.
🔧
Tool
Silero VAD
MIT, about two megabytes, a 30 ms chunk in under a millisecond on one CPU thread. The default first stage.
🔧
Engineering
Scaling Real-Time Voice Agents with Cache-Aware Streaming ASR
NVIDIA, January 2026. Chunk latency against WER, and why sliding windows cost you concurrency.
📄
Standard
RFC 6716: Definition of the Opus Audio Codec
Frame sizes, the SILK and CELT layers, and the look-ahead each needs. Where the 25 ms in the budget comes from.
📄
Standard
RFC 7874: WebRTC Audio Codec and Processing Requirements
Opus and G.711 are mandatory, and endpoints SHOULD include echo control. Short, and worth reading in full.
🔧
Source
NetEq design notes
The adaptive jitter buffer inside WebRTC: 10 ms pulls, target delay from arrival statistics, accelerate and expand.
📄
Paper
Moshi: a speech-text foundation model for real-time dialogue
Défossez et al., 2024. 160 ms theoretical latency decomposed, and the full-duplex design that gets there. arXiv:2410.00037
📄
Report
GPT-4o System Card
OpenAI, 2024. The source of the 232 ms minimum and 320 ms average audio response figures in section 01. arXiv:2410.21276
📄
Paper
Building Enterprise Realtime Voice Agents from Scratch
Qiu et al., March 2026. A measured 755 ms cascade against an end-to-end alternative, self-hosted. arXiv:2603.05413
📄
Paper
ICASSP 2022 Acoustic Echo Cancellation Challenge
Double-talk as the hard case, scored on subjective quality and on speech recognition word acceptance. arXiv:2202.13290
📄
Paper
Enhanced ASR Robustness to Packet Loss with a Front-End Adaptation Network
Dissen et al., Interspeech 2024. Repair the input to a frozen recogniser instead of retraining it. arXiv:2406.18928
📄
Paper
ASR performance on integrated noise-network distorted speech
Where the packet-loss knee sits for a clean-trained recogniser, and how far training on distortion moves it.
📄
Paper
Fast and High-Fidelity Neural Vocoders for Low-Latency Streaming Synthesis
Chunk size against real-time factor on constrained hardware, and how little lookahead a vocoder needs. arXiv:2506.03554
🔧
Docs
Understanding latency (ElevenLabs)
A vendor decomposing time to first audio into inference, network and player buffering, and admitting which term is small.

●Now write it yourself

Reading the derivation and being able to produce it are different skills. These are Deep-ML problems that exercise what this page covers — each one is checked against real test cases, not multiple choice.

Matched to this page from Deep-ML's catalogue of 1,380 problems. More at deep-ml.com, and Where to practise covers the other platforms and what each one trains.