Overview
2nd order filter with coefficients derived from input pins
Discussion
This module implements a general purpose second order filter that is capable of realizing many different filter types. The module performs internal smoothing allowing the filters to be updated without introducing clicks. In all cases, the module implements an underlying second order filter. First order filters are realized by setting some of the second order coefficients to zero.
...
filterType=22, 2nd order Butterworth high pass filter with variable Q. [freq, Q].
Type Definition
Code Block |
---|
typedef struct _ModuleSOFControlFract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 filterType; // Selects the type of filter that is implemented by the module: Bypass=0, Gain=1, Butter1stLPF=2, Butter2ndLPF=3, Butter1stHPF=4, Butter2ndHPF=5, Allpass1st=6, Allpass2nd=7, Shelf2ndLow=8, Shelf2ndLowQ=9, Shelf2ndHigh=10, Shelf2ndHighQ=11, PeakEQ=12, Notch=13, Bandpass=14, Bessel1stLPF=15, Bessel1stHPF=16, AsymShelf1stLow=17, AsymShelf1stHigh=18, SymShelf1stLow=19, SymShelf1stHigh=20, VariableQLPF=21, VariableQHPF=22. FLOAT32 freq; // Cutoff frequency of the filter, in Hz. FLOAT32 gain; // Amount of boost or cut to apply, in dB if applicable. FLOAT32 Q; // Specifies the Q of the filter, if applicable. FLOAT32 smoothingTime; // Time constant of the smoothing process. INT32 postShift; // Number of bits to shift FLOAT32 coeffGain; // Scale coefficients based on postShift. INT32 updateActive; // Specifies whether the filter coefficients are updating (=1) or fixed (=0). fract32 smoothingCoeff; // Smoothing coefficient. This is computed based on the smoothingTime, sample rate, and block size of the module. UINT32 pinID; // Specifies which control pins are available. FLOAT32* coeffs; // Desired coefficients fract32* coeffsFract32; // Desired coefficients in fract32 fract32* current_coeffsFract32; // Instantaneous coefficients fract32* state; // State variables. 4 per channel. } ModuleSOFControlFract32Class; |
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
filterType | int | parameter | 0 | 0 | 0:22 | |
freq | float | state | 0 | 250 | 10:20000 | Hz |
gain | float | state | 0 | 0 | -24:24 | dB |
Q | float | state | 0 | 1 | 0:0.1:20 | |
smoothingTime | float | parameter | 0 | 10 | 0:1000 | msec |
postShift | int | parameter | 0 | 4 | 0:1:24 | |
coeffGain | float | derived | 0 | 0.0625 | Unrestricted | |
updateActive | int | parameter | 1 | 1 | 0:1 | |
smoothingCoeff | fract32 | derived | 1 | 0.06449 | Unrestricted | |
pinID | uint | const | 1 | 7 | Unrestricted | |
coeffs | float* | derived | 0 | [5 x 1] | -10:10 | linear |
coeffsFract32 | fract32* | derived | 0 | [5 x 1] | Unrestricted | |
current_coeffsFract32 | fract32* | state | 0 | [5 x 1] | Unrestricted | |
state | fract32* | state | 0 | [4 x 1] | Unrestricted |
Pins
Input Pins
Name: freqPin
Description: Cutoff frequency of the filter
...
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: fract32
MATLAB Usage
File Name: sof_control_fract32_module.m
...