Smooth Out Network Chaos
Jitter buffer compensează variațiile în timpul de livrare a pachetelor, asigurând audio continuu și clar pentru voice AI.
What is Jitter?
Packet Arrival Without Jitter
Packets arrive at regular intervals (20ms each)
Packet Arrival With Jitter
Packets arrive at varying intervals, some out of order
Jitter = variation in packet arrival time. Measured in milliseconds. High jitter causes choppy, distorted audio.
How Jitter Buffer Works
Collect Incoming Packets
Store packets as they arrive from network
Reorder by Sequence Number
Put packets in correct order (RTP sequence)
Wait for Late Packets
Hold buffer to allow late arrivals to catch up
Release at Constant Rate
Output smooth, continuous audio stream
Buffer Types
Static (Fixed) Buffer
Fixed delay regardless of network conditions.
Adaptive Buffer (Recommended)
Adjusts size based on measured jitter.
Adaptive Buffer Algorithm
// Adaptive jitter buffer pseudocode
class AdaptiveJitterBuffer {
minBuffer = 20; // ms
maxBuffer = 200; // ms
targetBuffer = 40; // initial
onPacketReceive(packet) {
const jitter = measureJitter(packet);
// Expand buffer if jitter increases
if (jitter > this.targetBuffer * 0.8) {
this.targetBuffer = Math.min(
this.maxBuffer,
jitter * 1.5
);
}
// Shrink buffer if network stabilizes
if (jitter < this.targetBuffer * 0.5) {
this.targetBuffer = Math.max(
this.minBuffer,
this.targetBuffer * 0.9
);
}
this.buffer.add(packet);
}
}Buffer Metrics
Packet Loss Concealment
When packets are lost or arrive too late, PLC generates replacement audio:
Silence Insertion
Insert silence. Simple but noticeable.
Quality: LowPacket Repetition
Repeat last packet. Works for short gaps.
Quality: MediumInterpolation
AI predicts missing audio. Best quality.
Quality: HighConfiguration Guidelines
| Network Quality | Typical Jitter | Recommended Buffer | Mode |
|---|---|---|---|
| Excellent (LAN, Fiber) | <5ms | 20-30ms | Adaptive (aggressive) |
| Good (Broadband) | 5-20ms | 40-60ms | Adaptive (normal) |
| Fair (Mobile 4G) | 20-50ms | 60-100ms | Adaptive (conservative) |
| Poor (Congested/3G) | >50ms | 100-200ms | Fixed (high) |
Voice AI Specific Considerations
STT Input Buffer
Smaller buffer preferred - STT can handle some jitter. Target: 20-40ms to minimize transcription delay.
TTS Output Buffer
Larger buffer acceptable - smooth playback prioritized. Target: 40-60ms for glitch-free AI speech.