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.
Sound event detection
Audio Event Detection
Detect audio events over time by tracking frame energy and determining their onset and offset, then compare with an external event model.
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
- Synthetic signals or licensed clips
Tools
- audio-classification
- voice-activity-detection
- spectrogram-explorer
Implementation Steps
- Slice the signal into frames
- Compute the energy or a spectral feature for each frame
- Apply a threshold and a median filter to smooth the decision
- Extract event intervals (onset and offset)
- Compare the intervals with manual labeling
- Compute precision and recall with a time tolerance
- Compare with a trained event model if available
Code
import numpy as np
from scipy.signal import medfilt
sr = 8000
rng = np.random.default_rng(2)
x = 0.02 * rng.standard_normal(4 * sr)
for a, b in ((sr, sr + 2000), (3 * sr, 3 * sr + 4000)):
x[a:b] += 0.6 * rng.standard_normal(b - a)
n = 200
e = (x[:len(x) // n * n].reshape(-1, n) ** 2).mean(axis=1)
d = medfilt((e > 5 * np.median(e)).astype(float), 5) > 0
edges = np.flatnonzero(np.diff(np.r_[0, d, 0]))
print([(float(s * n / sr), float(t * n / sr)) for s, t in zip(edges[::2], edges[1::2])])Expected Results
The two synthetic event intervals are expected to be extracted to within frame-boundary approximation, with accuracy declining at higher noise.
These are educational expectations and not experimental results actually measured.
Project Tests
- Compare the extracted boundaries with the known boundaries
- Change the median filter size and observe its effect
- Test overlapping events and monitor the errors
Datasets
Algorithms
References
Audio processing in the experiments takes place inside your browser. Audio, texts, and conversations are not saved on the server. Privacy Policy
