(8.D.2.7) BiquadSmoothed
Overview
2nd order smoothly updating IIR filter
Discussion
Smoothly varying 5 coefficient biquad 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 is similar to the unsmoothed Biquad module, except that the filter coefficients are smoothed on a block-by-block basis. The module contains two sets of filter coefficients. The coeffcients [b0, b1, b2, a1, a2] are the "target" coefficients that serve as control variables to the module, and the coefficients [current_b0, current_b1, current_b2, current_a1, current_a2] are the instantaneous coefficients that are updated on a block by block basis using exponential smoothing. The current coefficients exponentially approach the control coefficients. The instance variable .updateActive is a Boolean and it controls whether the coefficient smoothing occurs at the start of each block. The variable .updateActive allows the coefficient smoothing to be halted and the target coefficients updated atomically.
The rate of smoothing is controlled by the .smoothingTime instance variable.
Type Definition
typedef struct _ModuleBiquadSmoothed
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 updateActive; // Specifies whether the filter coefficients are updating (=1) or fixed (=0).
FLOAT32 smoothingTime; // Time constant of the smoothing process.
FLOAT32 b0; // Desired first numerator coefficient.
FLOAT32 b1; // Desired second numerator coefficient.
FLOAT32 b2; // Desired third numerator coefficient.
FLOAT32 a1; // Desired second denominator coefficient.
FLOAT32 a2; // Desired third denominator coefficient.
FLOAT32 current_b0; // Instantaneous first numerator coefficient.
FLOAT32 current_b1; // Instantaneous second numerator coefficient.
FLOAT32 current_b2; // Instantaneous third numerator coefficient.
FLOAT32 current_a1; // Instantaneous second denominator coefficient.
FLOAT32 current_a2; // Instantaneous third denominator coefficient.
FLOAT32 smoothingCoeff; // Smoothing coefficient. This is computed based on the smoothingTime, sample rate, and block size of the module.
FLOAT32* state; // State variables. 2 per channel.
} ModuleBiquadSmoothedClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
updateActive | int | parameter | 0 | 1 | 0:1 | Â |
smoothingTime | float | parameter | 0 | 10 | 0:1000 | msec |
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 | Â |
current_b0 | float | state | 1 | 1 | Unrestricted | Â |
current_b1 | float | state | 1 | 0 | Unrestricted | Â |
current_b2 | float | state | 1 | 0 | Unrestricted | Â |
current_a1 | float | state | 1 | 0 | Unrestricted | Â |
current_a2 | float | state | 1 | 0 | Unrestricted | Â |
smoothingCoeff | float | derived | 1 | 0.06449 | 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_smoothed_module.m
M=biquad_smoothed_module(NAME)
Creates a second order IIR filter (biquad_smoothed) for use with
Audio Weaver. This filter smoothly updates its coefficients on a block-
by-block basis.
Arguments:
NAME - name of the module.
Â