Switchboard Audio SDK
Open navigation menu

Voice Activity Detection: How VAD Works and How to Integrate It

A misconfigured VAD clips the beginning of every utterance or starves your speech-to-text engine with silence. This guide covers how VAD works and how to integrate it correctly in real-time voice applications on mobile and web.

What Is Voice Activity Detection?

Voice activity detection (VAD) is an algorithm that classifies short audio segments as speech or silence, updated continuously as audio arrives.

STT/ASR engines use VAD to gate transcription; without it, they run continuously and waste compute, or miss speech entirely because they weren't listening. Push-to-talk systems use it to close transmissions automatically, while recording applications use it to strip silence from stored audio. Voice AI assistants run it before everything else in the pipeline: before wake word detection, before speech recognition. In bandwidth-limited deployments, VAD suppresses transmission during silence entirely.

A voice activity detector answers exactly one question: is there a human voice in this audio frame?

How VAD Works: From Energy Thresholds to Neural Networks

Three generations of VAD algorithms are in active use today. Understanding the tradeoffs explains why Silero VAD has become the default choice for production voice applications.

Energy-Based VAD

The simplest VAD approach measures the short-time energy of the audio frame and compares it to a threshold. If the signal power exceeds the threshold, the frame is classified as speech.

Energy-based VAD is fast and has near-zero compute overhead. It works well in quiet, controlled environments. It fails in noisy ones: background noise can exceed the threshold consistently, or a soft-spoken user's voice can fall below it. The threshold must be manually tuned per environment.

Energy-based VAD measures signal loudness.

Spectral Feature VAD

A refinement of energy-based VAD incorporates spectral features: the distribution of energy across frequency bands. Human speech concentrates energy in particular frequency ranges (roughly 300 Hz to 3 kHz for fundamental frequency and formants), and a spectral VAD can use these signatures to distinguish voice from broadband noise.

WebRTC's legacy VAD module uses a Gaussian mixture model over spectral features. This is more robust than pure energy detection and handles a wider range of noise environments, but it still struggles with music and any noise spectrum that overlaps with speech frequencies.

ML-Based VAD: Silero

Silero VAD is a neural network trained to classify audio frames as speech or non-speech. It uses a recurrent architecture (LSTM) that models temporal context: the current frame and how the recent audio sequence has evolved together inform the classification. This temporal awareness dramatically reduces false positives from transient noise that briefly resembles speech energy.

Silero VAD achieves high accuracy across a wide range of acoustic environments and device types. The silero-vad ONNX model runs in a few megabytes and requires minimal CPU on mobile and embedded devices. It runs entirely on-device with no network dependency, which matters for offline-capable voice apps.

The tradeoff is frame-level latency: the model processes 512 samples at 16 kHz (32 ms) at a time. For most applications this is acceptable; for sub-20 ms push-to-talk systems it may require tuning.

VAD in Real-Time Voice Pipelines

How VAD is wired into your audio graph matters as much as which algorithm you use.

STT/ASR Pipeline Integration

The most common use case is triggering an automatic speech recognition (ASR) or speech-to-text (STT) engine. The pattern works like this:

  1. VAD continuously monitors the microphone stream.

  2. On a start event, begin buffering audio to the ASR engine (or begin streaming if the STT API supports it).

  3. On an end event, flush the buffer and trigger transcription.

Two timing issues consistently cause problems here. First, the start of speech is frequently clipped: VAD takes one or more frames to activate after speech begins, cutting off the first phoneme or syllable. The speechPadMs parameter adds padding before and after each detected segment; the before-padding recovers audio lost during VAD's activation delay. Set it to at least 100–200 ms for conversational speech.

Second, a minSilenceDurationMs that is too short triggers the end event during brief pauses mid-utterance. A value that is too long delays transcription feedback. Conversational speech typically has inter-word pauses in the 200–500 ms range; 300 ms is a reasonable starting point.

Wake Word Pre-filter

VAD is commonly used upstream of a wake word detector to gate its activation. Wake word models run continuously and consume battery. By only passing audio to the wake word model when VAD detects speech, you can reduce unnecessary inference by 80–90% in a typical indoor environment.

Push-to-Talk

For push-to-talk interfaces where the user cannot hold a physical button, VAD replaces the hardware signal. The implementation is identical to the STT/ASR pipeline integration above. The key tuning difference is that the system should be more aggressive about ending the segment: a shorter minSilenceDurationMs feels more responsive. The tradeoff is more frequent false utterance boundaries during natural speech pauses.

Recording and Segmentation

Long-form recording applications use VAD to segment continuous audio into speech-only chunks, reducing storage and speeding up downstream processing. Each start/end event pair produces one segment. Gap handling within continuous speech is controlled by minSilenceDurationMs.

Integrating VAD with Switchboard

The Switchboard SDK provides Silero VAD as an extension node. The VAD node is a sink: it consumes audio and emits events rather than passing audio downstream. In a typical audio graph, you route microphone output through a BusSplitter, sending one branch to the VAD node and the other to your output or STT/ASR node.

The end event provides both start and end timestamps (in seconds) for the completed speech segment, which simplifies buffer management when segmenting recorded audio.

For a working example of the full graph wiring, see the VAD example in the SDK documentation. For implementation details, see the SileroVAD extension reference.