Speech & Audio AI Lab

Interactive labs for speech recognition, speech synthesis, and audio in general: in-browser DSP experiments, algorithms, datasets, and a learning path, without storing any recording.

43experiments

Energy-Based Voice Activity Detection

Energy-based Voice Activity Detection (VAD)

BeginnerSignal Processing

Educational content in the form of a scientific draft that needs expert review before being adopted as an academic reference. No experimental result that was not actually run is shown here.

Definition

A simple method for identifying the frames that contain speech by comparing the energy of each short frame with a threshold derived from the noise floor. It does not need a trained model.

Mathematical Idea

We split the signal into frames (for example 25 ms with a 10 ms hop) and compute $E_m=\sum_n x^2[n]$ and then $E_{dB}=10\log_{10}(E_m+\varepsilon)$. We estimate the noise floor as a low percentile of $E_{dB}$ and set the threshold $T=\text{floor}+\delta$. A frame is active if it exceeds the threshold. Temporal smoothing (hangover) is usually added to avoid fragmentation.

How It Works

  1. We split the signal into short frames.
  2. We compute the energy of each frame.
  3. We convert it to decibels.
  4. We estimate the noise floor (a low percentile).
  5. We set the threshold and classify the frames.
  6. We smooth the decisions and merge adjacent segments.

Stages Diagram

  1. Frames
  2. Energy
  3. dB
  4. Adaptive threshold
  5. Smoothing
  6. Speech segments

Equations

$$E_m=\sum_{n=0}^{L-1} x^2[mH+n]$$

The energy of frame $m$ with length $L$ and hop $H$.

$$\text{active}_m=\big[\,10\log_{10}E_m>\hat E_{floor}+\delta\,\big]$$

$\delta$ is a margin in decibels above the noise floor.

Advantages

  • Very fast and works in real time.
  • Requires no training.
  • Transparent and easy to tune.

Limitations

  • Breaks down with high or variable noise.
  • Cannot distinguish speech from high-energy noise.
  • The threshold needs tuning per recording.

Use Cases

  • Trimming silence before ASR.
  • Segmenting long recordings.
  • Saving computation in audio systems.

Applied Example

A two-second signal containing a one-second active segment: the code counts the active frames × 10 ms, giving about one second (1.02 s in the experiment because of the window width).

Code Example

PythonImplemented and Tested
import numpy as np
rng = np.random.default_rng(0)
sr = 16000
t = np.arange(sr)/sr
x = 0.01*rng.standard_normal(2*sr)                   # background noise
x[sr//2:sr//2+sr] += 0.3*np.sin(2*np.pi*200*t)       # active segment one second long
fl, hop = 400, 160                                   # 25 ms and 10 ms
n = 1 + (len(x) - fl)//hop
E = np.array([np.sum(x[i*hop:i*hop+fl]**2) for i in range(n)])
E_db = 10*np.log10(E + 1e-12)
floor = np.percentile(E_db, 10)                      # noise floor estimate
active = E_db > floor + 10                           # threshold = floor + 10 dB
print("active seconds:", round(active.sum()*hop/sr, 2))

References

  1. Silero Team. Silero VAD (software repository). GitHub. Source
  2. McFee, Raffel, Liang, Ellis, McVicar, Battenberg, et al.. librosa: Audio and Music Signal Analysis in Python. Proceedings of the 14th Python in Science Conference (2015). DOI

Audio processing in the experiments takes place inside your browser. Audio, texts, and conversations are not saved on the server. Privacy Policy