Table of Contents

Class PitchBlock

Namespace
VisioForge.Core.MediaBlocks.AudioProcessing
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, IMediaBlockInternals

Inheritance

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

semitones int

The pitch shift in semitones (-12 to +12).

Properties

Input

Gets the input pad.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets the inputs.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the output.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets the outputs.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

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

float

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

int

Type

Gets the media block type identifier for pitch processing operations.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

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

true if the filter was successfully built and configured; false if 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

disposing bool

true to release both managed and unmanaged resources; false to 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

true if 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

pipeline MediaBlocksPipeline

The MediaBlocksPipeline instance that will manage this block.

See Also