Class RemoveSilenceBlock
- Assembly
- VisioForge.Core.dll
Audio silence removal block that automatically detects and removes silent sections from audio streams. This block analyzes incoming audio to identify sections where the signal level falls below a specified threshold and either removes these sections entirely or reduces their volume. Essential for cleaning up recordings, podcasts, voice content, and any audio that contains unwanted silent gaps or quiet segments. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class RemoveSilenceBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
RemoveSilenceBlock()
Initializes a new instance of the VisioForge.Core.MediaBlocks.AudioProcessing.RemoveSilenceBlock class with default silence removal settings suitable for general audio processing.
public RemoveSilenceBlock()Properties
Input
Gets the primary input pad for audio silence removal processing.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads for this remove silence block. This block has a single input for audio processing.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the primary output pad providing audio with silence processed.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads for this remove silence block. This block has a single output for processed audio.
public override MediaBlockPad[] Outputs { get; }Property Value
Squash
Gets or sets the squash mode for silence handling. When enabled (true), silent sections are completely removed from the output stream. When disabled (false), silent sections are reduced in level but timing is preserved. Squash mode is useful for speech processing where gaps can be eliminated entirely.
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 (complete silence only) to 1.0 (no silence detection). Lower values are more sensitive to quiet sounds, higher values require louder audio to avoid removal.
public double Threshold { get; set; }Property Value
Type
Gets the type of this media block.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Constructs and initializes the removesilence filter and its associated GStreamer elements. This method creates the filter with the specified silence detection parameters, establishes input and output pads, and prepares the block for processing audio with silence removal capabilities.
public override bool Build()Returns
- bool
-
trueif the filter was successfully built and configured;falseif initialization failed.
CleanUp()
Releases all resources and performs cleanup operations for this remove silence block. This method disposes of the GStreamer elements and resets the build state.
public void CleanUp()Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
GetCore()
Gets the core BaseElement wrapper that provides additional functionality around the GStreamer removesilence filter element.
public BaseElement GetCore()Returns
- BaseElement
-
The BaseElement wrapper instance that encapsulates the GStreamer removesilence filter.
GetElement()
Gets the underlying GStreamer element that performs the silence removal processing.
public Element GetElement()Returns
- Element
-
The GStreamer Element instance representing the removesilence filter.
IsAvailable()
Determines whether this media block is available. Checks if the required GStreamer removesilence plugin is installed and accessible.
public static bool IsAvailable()Returns
- bool
-
trueif the removesilence element is available; otherwise,false.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Associates this remove silence block with a pipeline and initializes its internal context. This method is called internally when the block is added to a pipeline.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The MediaBlocksPipeline instance that will manage this block.