Class VoiceActivityDetector
Detects speech regions in audio using the built-in Silero voice-activity-detection model, without running any transcription.
public sealed class VoiceActivityDetector : IDisposable
- Inheritance
-
VoiceActivityDetector
- Implements
- Inherited Members
Examples
using var detector = new VoiceActivityDetector();
detector.Settings.MinSilenceDuration = TimeSpan.FromMilliseconds(400);
using var audio = new WaveFile("meeting.wav");
foreach (VoiceActivityDetector.Segment segment in detector.Detect(audio))
{
Console.WriteLine($"speech {segment.Start:mm\\:ss\\.ff} - {segment.End:mm\\:ss\\.ff}");
}
Remarks
The detector answers one question: where is speech in this recording? It returns the time ranges that contain voice activity, which callers typically use to segment audio before transcription, skip silence in long recordings, or measure how much of a file is actually spoken.
The Silero model ships inside the library and runs on the CPU, so no model download, GPU, or LM instance is required. Detection behavior is governed by Settings, the same VadSettings contract that VadSettings uses.
Each detector owns a private native detection context. Instances are safe to call from multiple threads (calls are serialized internally), and should be disposed to release the native context.
Properties
- Settings
Settings that govern detection: energy threshold, minimum speech and silence durations, maximum segment duration, and padding applied around detected speech.
Methods
- Detect(WaveFile, CancellationToken)
Detects the speech regions of the given audio.
- Dispose()
Releases the native detection context.