Overview
2nd order IIR filter
Discussion
Standard second order 5 multiply recursive filter. 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 values. The frequency response of the module is determined by the values of the 5 coefficients, and the coefficients come directly from the MATLAB second order representation. The leading a0 coefficient is not supplied and is assumed to equal 1.0. The order of the coefficients must be [b0 b1 b2 a1 a2]. The module implements the difference equation: $y[n]=b_0x[n]+b_1x[n-1]+b_2x[n-2]-a_1y[n-1]-a_2y[n-2].$
Type Definition
typedef struct _ModuleBiquad { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 b0; // First numerator coefficient. FLOAT32 b1; // Second numerator coefficient. FLOAT32 b2; // Third numerator coefficient. FLOAT32 a1; // Second denominator coefficient. FLOAT32 a2; // Third denominator coefficient. FLOAT32* state; // State variables. 2 per channel. } ModuleBiquadClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
b0 | float | parameter | 0 | 1 | Unrestricted | |
b1 | float | parameter | 0 | 0 | Unrestricted | |
b2 | float | parameter | 0 | 0 | Unrestricted | |
a1 | float | parameter | 0 | 0 | Unrestricted | |
a2 | float | parameter | 0 | 0 | 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_module.m
M=biquad_module(NAME) Creates a second order IIR filter (biquad) for use with Audio Weaver. Arguments: NAME - name of the module.