Class PitchBlock
- Assembly
- VisioForge.Core.dll
Audio pitch shifting block that changes the pitch without affecting playback speed. This block provides high-quality pitch shifting using the soundtouch library. Supports pitch adjustment in semitones (-12 to +12) for musical applications. Essential for karaoke, music production, and audio processing applications. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class PitchBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
PitchBlock()
Initializes a new instance of the VisioForge.Core.MediaBlocks.AudioProcessing.PitchBlock class with default pitch settings (no pitch change).
public PitchBlock()PitchBlock(int)
Initializes a new instance of the VisioForge.Core.MediaBlocks.AudioProcessing.PitchBlock class with the specified pitch shift in semitones.
public PitchBlock(int semitones)Parameters
semitonesint-
The pitch shift in semitones (-12 to +12).
Properties
Input
Gets the input pad.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets the inputs.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets the outputs.
public override MediaBlockPad[] Outputs { get; }Property Value
Pitch
Gets or sets the pitch multiplier directly. 1.0 = no change, 2.0 = one octave up, 0.5 = one octave down.
public float Pitch { get; set; }Property Value
Semitones
Gets or sets the pitch shift in semitones. Range: -12 to +12 (one octave down to one octave up).
public int Semitones { get; set; }Property Value
Type
Gets the media block type identifier for pitch processing operations.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Constructs and initializes the pitch filter and its associated GStreamer elements. This method creates the filter with the specified pitch settings, establishes input and output pads, and prepares the block for pitch shifting audio.
public override bool Build()Returns
- bool
-
trueif the filter was successfully built and configured;falseif initialization failed.
CleanUp()
Cleans up all resources associated with the pitch operations.
public void CleanUp()Dispose(bool)
Releases unmanaged and managed resources used by the pitch block.
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 pitch filter element.
public BaseElement GetCore()Returns
- BaseElement
-
The BaseElement wrapper instance that encapsulates the GStreamer pitch filter.
GetElement()
Gets the underlying GStreamer element that performs the pitch processing.
public Element GetElement()Returns
- Element
-
The GStreamer Element instance representing the pitch filter.
IsAvailable()
Determines whether this media block is available. Correct NuGet SDK redist should be included into your project.
public static bool IsAvailable()Returns
- bool
-
trueif this media block is available; otherwise,false.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Associates this pitch 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.