Table of Contents

Class Oversampler

Namespace
NAudio.Dsp
Assembly
NAudio.Core.dll

Integer-factor (1×, 2× or 4×) oversampler for a single channel. Zero-stuffs and low-pass filters on the way up, low-pass filters and decimates on the way down, so a non-linear stage (saturation, clipping) can run at a higher rate where the alias products it generates fall above the original Nyquist and are filtered out. A factor of 1 is a transparent pass-through.

public sealed class Oversampler
Inheritance
Oversampler
Inherited Members

Constructors

Oversampler(int, int)

Creates an oversampler.

public Oversampler(int factor, int sampleRate)

Parameters

factor int

Oversampling factor: 1, 2 or 4.

sampleRate int

The (base) sample rate in Hz.

Properties

Factor

The oversampling factor.

public int Factor { get; }

Property Value

int

Methods

Downsample(ReadOnlySpan<float>)

Low-pass filters the high-rate samples and returns the single decimated output sample. source must be exactly Factor long.

public float Downsample(ReadOnlySpan<float> source)

Parameters

source ReadOnlySpan<float>

Returns

float

Reset()

Clears the anti-alias filter state.

public void Reset()

Upsample(float, Span<float>)

Upsamples one input sample into destination, which must be at least Factor long.

public void Upsample(float input, Span<float> destination)

Parameters

input float
destination Span<float>