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
sampleRateintThe sample rate of the audio engine in Hz.
Fields
CurrentInitialFc
Current cutoff frequency in absolute cents.
public int CurrentInitialFc
Field Value
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
Initialized
Used for tracking if the filter has been initialized.
public bool Initialized
Field Value
LastTargetCutoff
For tracking the last cutoff frequency in the apply method, absolute cents. Set to infinity to force recalculation.
public float LastTargetCutoff
Field Value
ResonanceCb
Resonance in centibels.
public int ResonanceCb
Field Value
a0
Filter coefficient 1.
public float a0
Field Value
a1
Filter coefficient 2.
public float a1
Field Value
a2
Filter coefficient 3.
public float a2
Field Value
a3
Filter coefficient 4.
public float a3
Field Value
a4
Filter coefficient 5.
public float a4
Field Value
x1
Input history 1.
public float x1
Field Value
x2
Input history 2.
public float x2
Field Value
y1
Output history 1.
public float y1
Field Value
y2
Output history 2.
public float y2
Field Value
Methods
CalculateCoefficients(int)
Calculates the filter coefficients based on the current resonance and cutoff frequency and caches them.
public void CalculateCoefficients(int cutoffCents)
Parameters
cutoffCentsintThe cutoff frequency in cents.
Init()
public void Init()