keepcalculator

06 Numbers and Powers

Voice AI Streaming Latency Controls for Unreliable Links

Card No. 06·64247 · Updated · Standard formula, shown below

Effective latency 403 ms
Loss penalty
3 ms
Result
Target latency
300 ms
You entered
Jitter buffer
100 ms
You entered
You enter
Target latency, Jitter buffer, Packet loss
You get
Effective latency, Loss penalty
Rounding
0 dp

Voice AI streaming latency controls for unreliable links are buffering, jitter management, and adaptive bitrate techniques that keep real-time conversation intelligible when network conditions fluctuate. You configure these controls in your voice AI client or server SDK to trade a small amount of added delay for far fewer dropouts and garbled audio. This article explains the main controls, how they interact, and how to tune them for your specific link quality.

Formula

Effective latency = target latency + jitter buffer + (packet loss % / 100) × 60 ms.

  • Target latency (t) – the base one-way delay you want, in milliseconds. This is your network round-trip time divided by 2, plus processing time.
  • Jitter buffer (j) – extra time added to smooth out variation in packet arrival, in milliseconds.
  • Packet loss (p) – percentage of audio packets lost or discarded.
  • Loss penalty – an estimate of the extra delay caused by retransmission or concealment, using 60 ms per lost packet as a typical value.

The result is the effective one-way latency your user perceives, including all buffering and loss compensation.

Worked Example

Using the defaults: target latency = 300 ms, jitter buffer = 100 ms, packet loss = 5%.

  1. Loss penalty = (5 / 100) × 60 = 3 ms.
  2. Effective latency = 300 + 100 + 3 = 403 ms.

The calculator shows 403 ms, which is within the acceptable range for most voice assistants (under 500 ms).

Why Latency Matters More on Unreliable Links

Voice AI systems like speech-to-text, LLM response generation, and text-to-speech each add their own delay. On a stable connection, you can keep total latency under 300 ms. But on a mobile network with packet loss or jitter, audio can arrive late or out of order, causing the recognizer to mishear words or the synthesizer to stutter. The solution is not to eliminate latency—that is impossible—but to control it intelligently.

There are three main sources of variable delay: network jitter, packet loss, and clock drift between sender and receiver. Jitter buffers handle the first, retransmission or concealment handles the second, and adaptive playout handles the third. Each control has a trade-off: more buffering means more latency, but less buffering means more dropouts.

Jitter Buffer: The Primary Control

A jitter buffer holds incoming audio packets for a short time before playing them out, so that a delayed packet can still be used. Two types exist:

  • Static jitter buffer – fixed delay, simple, but wastes time on good links and under-buffers on bad ones.
  • Adaptive jitter buffer – adjusts its delay based on recent network measurements. It grows when jitter increases and shrinks when the link stabilizes.

Most modern voice AI SDKs use adaptive jitter buffers. You can usually set a minimum and maximum delay, and sometimes a target quality level. On a link with 50 ms jitter, a 100 ms buffer is safe; on a satellite link with 200 ms jitter, you need 400 ms or more.

Packet Loss Concealment and Retransmission

When packets are lost, you have two choices: hide the gap or ask for a retransmission. For real-time voice, retransmission is rarely viable because it adds at least one round-trip time. Instead, most systems use Packet Loss Concealment (PLC) – the decoder estimates the missing audio from surrounding samples. Opus, the most common codec for voice AI, has built-in PLC that works well for loss rates up to 10%.

If you are using a codec without PLC, you can implement your own by repeating the last packet or using a simple interpolation. The trade-off is quality: at 5% loss, PLC sounds almost transparent; at 20%, it becomes robotic. Your latency control should therefore also consider the codec’s loss tolerance.

Adaptive Bitrate and Redundancy

Another control is to reduce the bitrate when the link degrades. Lower bitrate means smaller packets, which are less likely to be dropped and take less time to transmit. Opus supports bitrates from 6 kbps to 510 kbps; for voice, 16–32 kbps is typical. On a very poor link, you can drop to 8 kbps and still have intelligible speech.

Forward Error Correction (FEC) is a complementary technique: you send redundant information that allows the receiver to reconstruct lost packets without retransmission. Opus has in-band FEC that adds about 10–20% overhead but can recover from up to 20% loss. The cost is higher bitrate and slightly higher latency. You can enable FEC only when packet loss exceeds a threshold, say 3%.

Choosing the Right Controls for Your Link

Start by measuring your network’s jitter and loss over a few minutes. Tools like ping with timestamp options or WebRTC statistics can give you these numbers. Then follow this rough guide:

  • Jitter under 30 ms, loss under 1% – use a static buffer of 50–80 ms, no FEC.
  • Jitter 30–100 ms, loss 1–5% – adaptive buffer with min 80 ms, max 200 ms, enable FEC at 2% loss.
  • Jitter over 100 ms, loss over 5% – adaptive buffer with min 150 ms, max 400 ms, always FEC, consider bitrate reduction.

Remember that your voice AI pipeline itself adds latency: speech-to-text typically 50–200 ms, LLM response 200–1000 ms, text-to-speech 50–150 ms. Your network buffer should be tuned to keep total under 500 ms for conversational feel, or under 800 ms if the user is dictating and doesn’t need immediate feedback.

Common Misconception: Lower Latency Is Always Better

Many developers set jitter buffers to the minimum to reduce delay, only to see high dropout rates. On an unreliable link, a 50 ms reduction in latency is worthless if 10% of words are lost. The user perceives a dropout as a much bigger problem than a slight delay. In practice, a 400 ms effective latency with zero dropouts is far better than 200 ms with 5% loss.

Another misconception is that you can rely solely on TCP. Voice AI often uses WebRTC over UDP, which does not guarantee delivery. If you switch to TCP, you get retransmission but also head-of-line blocking – a lost packet delays all subsequent packets. For real-time voice, UDP with PLC and FEC is the standard choice.

Frequently Asked Questions

What is a good target latency for voice AI?

For conversational use, aim for under 500 ms total one-way latency. Over 800 ms feels laggy. Your network buffer should be the smallest value that keeps dropout rate below 2%.

How do I measure jitter on my link?

Use ping -i 0.2 (Linux/macOS) or ping -t (Windows) for a few minutes and look at the variation in round-trip times. Jitter is the average deviation from the mean. WebRTC stats APIs also report jitter in milliseconds.

Should I use FEC always?

No. FEC adds overhead and a few milliseconds of latency. Enable it only when packet loss exceeds 2–3%, and disable it when the link is stable to save bandwidth.

Does the codec affect latency control?

Yes. Opus has a frame size of 2.5 to 60 ms; smaller frames reduce latency but increase overhead. For unreliable links, a 20 ms frame with FEC is a good balance. G.711 has no built-in PLC, so you need external concealment.

Can I use a fixed buffer and still handle loss?

Yes, if loss is low and jitter is stable. A fixed buffer of 100 ms handles up to 50 ms of jitter. But on links with variable jitter, an adaptive buffer is safer because it adjusts without manual intervention.

What happens if I set the jitter buffer too high?

You add unnecessary latency, which can make the conversation feel unnatural. The user might start talking over you because they think you paused. Keep the buffer as low as possible while maintaining intelligibility.

Related

Formula used
in t | Target latency | ms | 300 | 50 | 2000
in j | Jitter buffer | ms | 100 | 0 | 1000
in p | Packet loss | % | 5 | 0 | 100
out eff | Effective latency | ms | t + j + (p / 100) * 60 | 0
out loss_penalty | Loss penalty | ms | (p / 100) * 60 | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →