Class SilenceDetectionEventArgs
- Namespace
- VisioForge.Core.Types.Events
- Assembly
- VisioForge.Core.dll
Event arguments for silence detection events that are raised when silence starts or ends in an audio stream. Provides detailed information about the timing and characteristics of the detected silence period, enabling applications to respond to audio level changes in real-time for recording, streaming, or analysis purposes.
public class SilenceDetectionEventArgs : EventArgsInheritance
Inherited Members
Constructors
SilenceDetectionEventArgs(TimeSpan?, bool, double, double, SilencePeriod)
Initializes a new instance of the VisioForge.Core.Types.Events.SilenceDetectionEventArgs class for a silence start or end event.
public SilenceDetectionEventArgs(TimeSpan? timestamp, bool isSilenceStart, double levelDb, double thresholdDb, SilencePeriod period = null)Parameters
timestampTimeSpan?-
The timestamp of the event, or
nullwhen unknown. isSilenceStartbool-
True if this is a silence start event, false for silence end.
levelDbdouble-
The audio level in decibels at the time of the event.
thresholdDbdouble-
The silence detection threshold in decibels.
periodSilencePeriod-
The completed silence period (for silence end events only), or null.
Properties
IsSilenceStart
Gets a value indicating whether this event represents the start of a silence period. True for silence start events, false for silence end events.
public bool IsSilenceStart { get; }Property Value
LevelDb
Gets the audio level in decibels (dB) at the time of this event.
This is the RMS level that triggered the silence state change - or, on an event raised by
FinalizeSilencePeriods, the last level the detector measured, since that call
measures nothing itself.
public double LevelDb { get; }Property Value
Period
Gets the complete silence period information when silence ends.
This property is populated for silence end events and contains the start time, end time
and duration of the completed silence period. It is null for silence start events, and
for any end event whose period could not be formed: one end not on the timeline, or the
two ends out of order. On an event raised by FinalizeSilencePeriods the
VisioForge.Core.Types.Events.SilenceDetectionEventArgs.Timestamp is always the end time the caller passed, so it is not null there
even when this is - a non-null timestamp does not imply a non-null period.
public SilencePeriod Period { get; }Property Value
ThresholdDb
Gets the configured silence detection threshold in decibels (dB). Audio levels below this threshold are considered silence.
public double ThresholdDb { get; }Property Value
Timestamp
Gets the timestamp of the silence detection event in the audio stream, or null when the position is unknown. For silence start events, this is when audio level dropped below threshold. For silence end events, this is when audio level rose above threshold. A null does not make the crossing itself doubtful - the level did cross the threshold - but VisioForge.Core.Types.Events.SilenceDetectionEventArgs.Period is null alongside it, because a period needs both of its ends on the timeline.
public TimeSpan? Timestamp { get; }