Overview
Sparse Biquad cascade filters with most of the coefficients as bypass
Discussion
This module implements a custom biquad filter that is capable of realizing many different filter types along with additional raw coefficients. The module performs internal smoothing allowing the filters to be updated without introducing clicks. In all cases, the module implements an underlying cascade second order filters. First order filters are realized by setting some of the second order coefficients to zero.
...
Any stage that is set to "bypass" will result in a true bypass. As there is no processing happens if a biquad coefficients are bypassed, IIR Accelerators maybe expensive if the module usage is with majority of biquad stages as bypassed. Please use the BiquadSparseV3 module in that case.
Type Definition
Code Block |
---|
typedef struct _ModuleBiquadSparseV6 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 numStages; // Number of cascaded stages of the second order filter. FLOAT32 smoothingTime; // Time constant of the smoothing process. INT32 enableHWAccel; // Enables or Disables Hardware accelerators for compatible targets INT32 updateActive; // Specifies whether the filter coefficients are updating (=1) or fixed (=0). FLOAT32 smoothingCoeff; // Smoothing coefficient. This is computed based on the smoothingTime, sample rate, and block size of the module. INT32 bulkParamsUpdate; // State variable to handle bulk changes in filter parameters. INT32 rawCoeffsIndex; // Raw coefficient filter type index. INT32 biquadForm; // Flag indicates which direct form implementation to use, DF-2, TDF-2 or DF-1. Default is DF-2. 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, Resonant=23, RawCoeffs=24. 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* rawCoeffs; // Matrix of filter raw coefficients. The size of the matrix is 5 x numStages x numChannels. Each column contains the variables for a biquad arranged as [b0; b1; b2; a1; a2]. FLOAT32* sofCoeffs; // Matrix of filter sof coefficients. The size of the matrix is 5 x numStages x numChannels. Each column contains the variables for a biquad arranged as [b0; b1; b2; a1; a2]. FLOAT32* currentCoeffs; // Matrix of filter current coefficients. The size of the matrix is 5 x numStages x numChannels. Each column contains the variables for a biquad arranged as [b0; b1; b2; a1; a2]. FLOAT32* state; // State variables. 2*numChannels if DF2 and 4*numChannels if DF1 per section. INT32* bypass; // State buffer used internally to store coeffs bypass status. INT32* currentBypass; // State buffer used internally to store coeffs bypass status. void * hardware_specific_struct_pointer; // This is the internal array used for ADI IIR accelerator. Size is determined internally } ModuleBiquadSparseV6Class; |
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
numStages | int | const | 0 | 2 | 1:1:100 | |
smoothingTime | float | parameter | 0 | 10 | 0:1:1000 | msec |
enableHWAccel | int | parameter | 1 | 0 | 0:1 | |
updateActive | int | parameter | 1 | 1 | 0:1 | |
smoothingCoeff | float | derived | 1 | 0.06449 | Unrestricted | |
bulkParamsUpdate | int | state | 1 | 0 | Unrestricted | |
rawCoeffsIndex | int | state | 1 | 24 | Unrestricted | |
biquadForm | int | const | 1 | 0 | 0:2 | |
filterType | int* | parameter | 0 | [2 x 1] | 0:24 | |
freq | float* | parameter | 0 | [2 x 1] | 10:0.1:23990 | Hz |
gain | float* | parameter | 0 | [2 x 1] | -24:0.1:24 | dB |
Q | float* | parameter | 0 | [2 x 1] | 0:0.1:20 | |
rawCoeffs | float* | parameter | 0 | [10 x 1] | Unrestricted | |
sofCoeffs | float* | derived | 0 | [10 x 1] | Unrestricted | |
currentCoeffs | float* | state | 1 | [10 x 1] | Unrestricted | |
state | float* | state | 1 | [4 x 1] | Unrestricted | |
bypass | int* | state | 1 | [1 x 1] | Unrestricted | |
currentBypass | int* | state | 1 | [1 x 1] | Unrestricted | |
hardware_specific_struct_pointer | void * | state | 1 | Unrestricted |
Pins
Input Pins
Name: in
Description: audio input
...
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: float
MATLAB Usage
File Name: biquad_sparse_v6_module.m
...