[ RETURN TO ALL ENGINEERING ARTICLES ]
ENGINEERING SPEC // FULL-DUPLEX REAL-TIME VOICE TELEMETRY

Sub-300ms Voice AI Latency
Web Audio Worklets, Silero VAD & Indic Telephony

By Gurdharam Jeet SinghPublished: Sep 202613 Min ReadValidated in TakeMyInterview AI

How we cracked human-grade conversational turn-taking (<300ms latency) without audio crackle or speech overlap. An architectural blueprint covering Web Audio API AudioWorklet processors, client-side Silero ONNX Voice Activity Detection, and token-streamed Indic neural synthesis.

TURN-TAKING SPEED
285 ms

End-to-End Latency

BARGE-IN CUTOFF
< 40 ms

Silero ONNX Worker

AUDIO BUFFER
128 Samples

Zero Main-Thread Junk

INDIC DIALECTS
3 Languages

Punjabi, Hindi, English

// 01. THE ACOUSTIC CONVERSATIONAL THRESHOLD

Why Latency > 500ms Destroys Conversational Credibility

Human conversational psychology has an unforgiving physical limit: between two humans conversing naturally, pause intervals between speaker transitions average 200 to 300 milliseconds. When a caller experiences a delay of 600ms to 1200ms (typical of generic API chaining setups: OpenAI Whisper HTTP → GPT-4 → ElevenLabs), the interaction feels disjointed, awkward, and clearly robotic.

Worse yet, without instant interruption handling (barge-in), the synthetic voice talks over the user when they clarify or correct their sentence, leading to frustrating conversational collisions.

// 02. AUDIOWORKLET & PCM STREAMING ENGINE

Running 16kHz PCM DSP on Dedicated Audio Render Threads

Traditional browser implementations rely on the deprecated ScriptProcessorNode or MediaRecorder slicing chunks every 250ms. This causes severe audio clicks whenever the main JavaScript thread is occupied by React DOM recalculations or CSS animations.

We replaced this with a custom AudioWorkletProcessor running directly inside the Web Audio engine's real-time priority thread:

LOW-LATENCY 16KHZ MONO AUDIOWORKLET PROCESSOR

// pcm-recorder-worklet.js (Runs in Web Audio thread)
class PCMRecorderWorklet extends AudioWorkletProcessor {
  process(inputs, outputs, parameters) {
    const input = inputs[0];
    if (!input || !input[0]) return true;
    
    const float32Data = input[0];
    const int16Buffer = new Int16Array(float32Data.length);
    
    // Fast conversion: Float32 [-1.0, 1.0] to Int16 PCM
    for (let i = 0; i < float32Data.length; i++) {
      const s = Math.max(-1, Math.min(1, float32Data[i]));
      int16Buffer[i] = s < 0 ? s * 0x8000 : s * 0x7FFF;
    }
    
    // Post directly to Web Worker for VAD and network transmission
    this.port.postMessage(int16Buffer.buffer, [int16Buffer.buffer]);
    return true;
  }
}
registerProcessor('pcm-recorder-worklet', PCMRecorderWorklet);
// 03. CLIENT-SIDE BARGE-IN INTERRUPTIONS

Silero ONNX in Web Workers: 35ms Human Interruption Detection

Instead of waiting for cloud servers to detect when the user speaks, we run an optimized 2.4MB ONNX quantized version of Silero VAD directly in a browser Web Worker.

INSTANT BARGE-IN SEQUENCE

  1. User begins speaking → Silero VAD detects probability > 0.82 within 35ms.
  2. Worker immediately halts active speaker playback and clears the local audio buffer queue.
  3. Worker sends binary byte 0xFF [CANCEL] over WebSocket to server, halting cloud TTS synthesis immediately and preserving server GPU compute.

Related Voice AI Services & Architectures

Need Low-Latency Conversational Voice AI?

We build enterprise Voice AI agents, automated receptionists, and telephony callers with human turn-taking speeds.