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.
Voice Activity Detection
Voice Activity Detection
Implement a voice activity detector based on frame energy and an adaptive threshold, and evaluate it on a synthetic signal with known boundaries.
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.
Prerequisites
- Python with numpy
- A clip containing speech and silence, or a synthetic signal
Tools
- voice-activity-detection
- pitch-energy
- audio-visualizer
Implementation Steps
- Slice the signal into short frames
- Compute the energy of each frame
- Estimate the noise level from the first frames
- Set a relative threshold above the noise
- Smooth the decision by keeping the frame active for a short period (hangover)
- Compare the decisions with manual labeling
- Compute precision and recall
Code
import numpy as np
sr = 8000
rng = np.random.default_rng(1)
t = np.arange(3 * sr) / sr
x = 0.02 * rng.standard_normal(len(t))
x[sr:2 * sr] += 0.5 * np.sin(2 * np.pi * 300 * t[sr:2 * sr])
n = 200
frames = x[:len(x) // n * n].reshape(-1, n)
e = (frames ** 2).mean(axis=1)
thr = 4 * e[:5].mean()
vad = e > thr
truth = np.zeros(len(e), bool); truth[sr // n:2 * sr // n] = True
tp = (vad & truth).sum()
print('precision', tp / vad.sum(), 'recall', tp / truth.sum())Expected Results
The detector is expected to find the audio segment clearly at low noise, and its accuracy to degrade as noise increases.
These are educational expectations and not experimental results actually measured.
Project Tests
- Raise the noise level and monitor precision and recall
- Test threshold tuning and its effect on clipping word onsets
- Compare with a neural detector such as Silero VAD if available
Datasets
Experiments
References
- Silero Team. Silero VAD (software repository). GitHub. Source
Audio processing in the experiments takes place inside your browser. Audio, texts, and conversations are not saved on the server. Privacy Policy
