Class RemoveSilenceAudioEffect
- Namespace
- VisioForge.Core.Types.X.AudioEffects
- Assembly
- VisioForge.Core.dll
Audio effect for automatic silence detection and removal. This effect analyzes audio streams to identify sections where the signal level falls below a specified threshold and drops them from the stream. Useful for cleaning up recordings, podcasts, and voice content by eliminating unwanted silent gaps. Implements the VisioForge.Core.Types.X.AudioEffects.BaseAudioEffect.
public class RemoveSilenceAudioEffect : BaseAudioEffect, ISharedAudioEffectXInheritance
Implements
Inherited Members
Constructors
RemoveSilenceAudioEffect(string)
Initializes a new instance of the VisioForge.Core.Types.X.AudioEffects.RemoveSilenceAudioEffect class.
public RemoveSilenceAudioEffect(string name)Parameters
namestring-
The unique name for this audio effect instance.
RemoveSilenceAudioEffect(string, double, bool)
Initializes a new instance of the VisioForge.Core.Types.X.AudioEffects.RemoveSilenceAudioEffect class with custom threshold and squash settings.
public RemoveSilenceAudioEffect(string name, double threshold, bool squash)Parameters
namestring-
The unique name for this audio effect instance.
thresholddouble-
The silence detection threshold (0.0 to 1.0).
squashbool-
Whether to pull the surviving buffers back to close the gap (true) or keep their original timestamps (false). Silence is dropped either way.
Exceptions
- ArgumentOutOfRangeException
-
Thrown when
thresholdis not between 0.0 and 1.0.
Properties
Squash
Gets or sets the squash mode. Silent sections are always dropped; squash controls what happens to the timeline afterwards. When enabled (true), the timestamps of the surviving buffers are pulled back by the dropped duration, so the output is shorter and gapless - which also means the audio no longer lines up with the video of the same recording. When disabled (false), the gap is left in place and the surviving buffers keep their original timestamps, which keeps A/V sync.
public bool Squash { get; set; }Property Value
Threshold
Gets or sets the silence detection threshold. Audio levels below this threshold will be considered as silence. Values range from 0.0 (clamped to the element's -70 dB floor - only near-digital silence is removed) to 1.0 (full scale - every sample counts as silence). Lower values are more permissive; higher values remove more audio.
public double Threshold { get; set; }Property Value
Remarks
Converted to the dB scale the underlying removesilence element uses
(20 * log10(value), clamped to the element's -70..70 dB range), so the default 0.001
reaches the element as -60 dB - the same threshold the element itself defaults to. The
element then keeps whole decades of it, truncating toward zero - so anything in (-70, -60]
is applied as -60 dB. Over the negative range that rounds up: a threshold asked for as
-65 dB removes as much audio as -60 dB, never as little as -70 dB.
Two limits of the element are worth knowing before it is put in a graph, because neither is
reachable from here. Its pads are S16LE, mono only, and this block inserts no
converter, so a stereo stream is downmixed for everything downstream of it - the graph links
at all only because UniversalSourceBlock carries its own converter. And its detector
ANDs the level test with a zero-crossing test - a buffer counts as speech only when it is
both loud enough and low-frequency enough - so noise-like or high-frequency content is
treated as silence at every threshold, including the -70 dB floor.
Exceptions
- ArgumentOutOfRangeException
-
Thrown when the value is not between 0.0 and 1.0.