Overview
Cascade of second order Biquad filters with high precision implementation
Discussion
A cascade of second order recursive filters that are implemented using a high precision filter structure. The module is designed to operate on multiple channels and applies the same coefficients across all channels. The state array is allocated to contain 2*numChannels*numStages values. Filter coefficients should be mapped from SOS to Biquad representation [b0; b1; b2; a1; a2] and given in .coeffs. The leading a0 coefficient is not supplied and is assumed to equal 1.0. In the set function the coefficients will be mapped from Biquad form to High Precision representation [Fb; Gaa; Gab; K; Fa].
The filter coefficients are stored in the matrix .coeffs. This matrix is of dimension 5 x numStages and each column of the matrix corresponds to an individual 2nd order Biquad stage. Within each column, the coefficients are ordered as: [b0; b1; b2; a1; a2].
Type Definition
typedef struct _ModuleBiquadCascadeHP { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 numStages; // Number of stages in the filter. The filter order = 2*numStages. FLOAT32* coeffs; // Matrix of filter coefficients. The size of the matrix is 5 x numStages. Each column contains the variables for a biquad arranged as [b0; b1; b2; a1; a2]. FLOAT32* targetCoeffs; // Matrix of filter coefficients in the High Precision format. The size of the matrix is 5 x numStages. Each column contains the variables for a biquad arranged as [Fb; Gaa; Gab; K; Fa]. FLOAT32* state; // State variables. 2 per channel. } ModuleBiquadCascadeHPClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
numStages | int | const | 0 | 1 | 1:1:32 | |
coeffs | float* | parameter | 0 | [5 x 1] | Unrestricted | |
targetCoeffs | float* | derived | 0 | [5 x 1] | Unrestricted | |
state | float* | state | 1 | [2 x 1] | Unrestricted |
Pins
Input Pins
Name: in
Description: audio input
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: float
MATLAB Usage
File Name: biquad_cascadeHP_module.m
M=biquad_cascadeHP_module(NAME, NUMSTAGES) Creates a module that implements a cascade of second order Biquad stages. This module can be used to implement high order IIR filters. The module operates on multiple channels and uses the same set of coefficients across channels. This version uses a high precision implementation Arguments: NAME - name of the module. NUMSTAGES - number of biquad stages. The overall filter order is 2*NUMSTAGES.