Struct LowpassFilter

Namespace
SpessaSharp.Synthesizer.Engine.Voice
Assembly
SpessaSharp.dll

Applies a low pass filter to a voice note to self: a lot of tricks and come from fluidsynth. They are the real smart guys. Shoutout to them! Give their repo a star over at: https://github.com/FluidSynth/fluidsynth

public struct LowpassFilter
Inherited Members

Constructors

LowpassFilter(int)

Initializes a new instance of the filter.

public LowpassFilter(int sampleRate)

Parameters

sampleRate int

The sample rate of the audio engine in Hz.

Fields

CurrentInitialFc

Current cutoff frequency in absolute cents.

public int CurrentInitialFc

Field Value

int

FILTER_SMOOTHING_FACTOR

Latest test: 06-12-2025 for the 9600 cent cc74 change (XG accurate). Lowered from 0.1 to 0.03

public const float FILTER_SMOOTHING_FACTOR = 0.03

Field Value

float

Initialized

Used for tracking if the filter has been initialized.

public bool Initialized

Field Value

bool

LastTargetCutoff

For tracking the last cutoff frequency in the apply method, absolute cents. Set to infinity to force recalculation.

public float LastTargetCutoff

Field Value

float

ResonanceCb

Resonance in centibels.

public int ResonanceCb

Field Value

int

a0

Filter coefficient 1.

public float a0

Field Value

float

a1

Filter coefficient 2.

public float a1

Field Value

float

a2

Filter coefficient 3.

public float a2

Field Value

float

a3

Filter coefficient 4.

public float a3

Field Value

float

a4

Filter coefficient 5.

public float a4

Field Value

float

x1

Input history 1.

public float x1

Field Value

float

x2

Input history 2.

public float x2

Field Value

float

y1

Output history 1.

public float y1

Field Value

float

y2

Output history 2.

public float y2

Field Value

float

Methods

CalculateCoefficients(int)

Calculates the filter coefficients based on the current resonance and cutoff frequency and caches them.

public void CalculateCoefficients(int cutoffCents)

Parameters

cutoffCents int

The cutoff frequency in cents.

Init()

public void Init()