Class VoiceActivityDetector
Energy-based voice activity detector with an adaptive noise floor and hangover. Operates on a mono sample stream in fixed analysis frames: a frame counts as speech when its level rises a configurable margin above the tracked noise floor, and the decision is held for a short hangover so word-final sounds are not clipped. Used to gate noise-estimate updates (noise suppression), freeze AGC during silence, or drive a transmit gate.
public sealed class VoiceActivityDetector
- Inheritance
-
VoiceActivityDetector
- Inherited Members
Constructors
VoiceActivityDetector(int, float)
Creates a detector.
public VoiceActivityDetector(int sampleRate, float frameMilliseconds = 20)
Parameters
sampleRateintSample rate in Hz. Must be positive.
frameMillisecondsfloatAnalysis frame length in ms. Default 20 ms.
Properties
HangoverMs
Hangover time in milliseconds (decision held after speech ends). Default 200 ms.
public float HangoverMs { get; set; }
Property Value
IsVoiceActive
True if the most recent frame (including hangover) is classed as speech.
public bool IsVoiceActive { get; }
Property Value
NoiseFloorDb
The current adaptive noise floor estimate in dBFS.
public float NoiseFloorDb { get; }
Property Value
ThresholdDb
Margin in dB above the noise floor that counts as speech. Default 9 dB.
public float ThresholdDb { get; set; }
Property Value
Methods
Process(float)
Feeds one mono sample and returns the current voice-activity decision.
public bool Process(float sample)
Parameters
samplefloat
Returns
Reset()
Resets the detector to its initial (un-adapted) state.
public void Reset()