Table of Contents

Class PitchShiftEffect

Namespace
NAudio.Effects
Assembly
NAudio.Core.dll

Pitch shifter (no tempo change) wrapping the Bernsee STFT phase-vocoder (SmbPitchShifter) in the effect framework, one shifter per channel. This is the dependable default; a higher-quality Signalsmith-based tier remains a separate future evaluation. Introduces FFT-frame latency (LatencySamples).

public sealed class PitchShiftEffect : AudioEffect, IAudioEffect, IParameterized
Inheritance
PitchShiftEffect
Implements
Inherited Members

Properties

FftSize

FFT size; a power of two ≤ 4096. Default 4096.

public int FftSize { get; set; }

Property Value

int

LatencySamples

Processing latency the effect introduces, in samples per channel. Zero for effects with no inherent delay; non-zero for look-ahead or block/partitioned designs that need delay compensation in a chain.

public override int LatencySamples { get; }

Property Value

int

Oversampling

STFT oversampling (overlapping windows). Higher is smoother/heavier. Default 4.

public long Oversampling { get; set; }

Property Value

long

Parameters

Generic parameter list (excludes Bypass/Mix, which are on the base).

public IReadOnlyList<EffectParameter> Parameters { get; }

Property Value

IReadOnlyList<EffectParameter>

PitchSemitones

Pitch shift in semitones (±, 0 = no change). Clamped to roughly ±1 octave, the algorithm's usable range.

public float PitchSemitones { get; set; }

Property Value

float

Methods

OnConfigure(WaveFormat)

Called by Configure(WaveFormat) after the format is stored. Derived effects allocate and size their sample-rate-dependent state here.

protected override void OnConfigure(WaveFormat format)

Parameters

format WaveFormat

ProcessBlock(Span<float>)

Transforms buffer in place into the fully-wet signal. The base class handles dry/wet mixing and bypass around this call.

protected override void ProcessBlock(Span<float> buffer)

Parameters

buffer Span<float>

Reset()

Clears internal state (delay lines, envelopes, smoothers) so the next block starts as if from silence.

public override void Reset()