Human conversation requires response latencies under 400 milliseconds. Traditional sequential voice setups (record audio -> upload MP3 -> transcribe -> send prompt -> wait for full completion -> synthesize audio) routinely suffer 3 to 5 second pauses, breaking conversational immersion. This blueprint details how to achieve sub-300ms end-to-end voice latency using WebRTC tracks and streaming pipeline pipelining.
1. The 300ms Latency Budget: Deconstructing the Pipeline
Allocating milliseconds across STT, inference, and audio playback
To feel conversational, total round-trip delay must stay under 350ms. We budget: WebRTC network transit (25ms), Streaming VAD & STT (80ms), First-token LLM generation (100ms), and Streaming Audio TTS buffer (95ms).
Total Roundtrip
< 290ms
Human conversational latency threshold
Barge-in Cutoff
< 30ms
Instant client audio track mute on user speech
Concurrent Channels
2,500+
Per single 32-core WebRTC edge server
2. WebRTC Media Server Architecture with Node.js & Mediasoup
Bi-directional audio streaming without HTTP file upload overhead
WebRTC sends continuous Opus-encoded audio packets over UDP, bypassing the TCP handshake and head-of-line blocking that plague WebSocket implementations under high packet loss.
3. Token-Pipelined Text-to-Speech Synthesis
Synthesizing audio on the first clause boundary
Rather than buffering complete sentences, the server streams the initial 5-8 tokens directly to low-latency neural TTS APIs (Cartesia or ElevenLabs Turbo v2.5), playing audio to the user while downstream tokens are still generating.
4. Voice Activity Detection & Zero-Latency Audio Barge-In
Detecting user speech locally to abort active speech queues instantly
When Silero VAD detects user vocalization while the bot is speaking, the client immediately drops the incoming audio buffer and transmits an abort signal over WebRTC DataChannel to cancel active LLM generation.