Document toolboxDocument toolbox

(8.D.1.2) BiquadV2Fract32

Overview

2nd order IIR filter

Discussion

Second order 5 multiply recursive filter with algorithm precision selectable. Precision type 0 uses 24x24 with 56-bit accumulator, 1 uses 32x32 with 32-bit accumulator, 2 uses 32x32 with 64-bit accumulator and 3 uses 24x24 with 24-bit accumulator. The module is designed to operate on multiple channels and applies the same coefficients across all channels. The state array is allocated to contain 4*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 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 _ModuleBiquadV2Fract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 precisionType; // Boolean value that determines whether all channels are summed to form a single output. INT32 updateActive; // Specifies whether the filter coefficients are updating (=1) or fixed (=0). INT32 postShift; // Number of bits to shift INT32 bShift; // Number of bits to shift of Numerator coefficients INT32 currentBShift; // Current post shift of Numerator coefficients INT32 aShift; // Number of bits to shift of Denominator coefficients INT32 currentAShift; // Current post shift of Denominator coefficients FLOAT32* coeffs; // coefficients fract32* coeffsFract32; // coefficients in Fract32 fract32* state; // State variables. 6 per channel. fract32* currentCoeffsFract32; // Current coefficients in Fract32 } ModuleBiquadV2Fract32Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

precisionType

int

const

0

0

Unrestricted

 

updateActive

int

state

0

1

0:1

 

postShift

int

parameter

1

2

Unrestricted

 

bShift

int

derived

1

1

Unrestricted

 

currentBShift

int

state

1

3

Unrestricted

 

aShift

int

derived

1

1

Unrestricted

 

currentAShift

int

state

1

2

Unrestricted

 

coeffs

float*

parameter

0

[5 x 1]

Unrestricted

 

coeffsFract32

fract32*

derived

0

[5 x 1]

Unrestricted

 

state

fract32*

state

1

[6 x 1]

Unrestricted

 

currentCoeffsFract32

fract32*

state

0

[5 x 1]

Unrestricted

 

Pins

Input Pins

Name: in

Description: audio input

Data type: fract32

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: fract32

MATLAB Usage

File Name: biquad_v2_fract32_module.m

M=biquad_v2_fract32_module(NAME, TYPE) Creates a second order IIR filter Fract32 (biquad) for use with the Audio Weaver. Arguments: NAME - name of the module. TYPE - Precision type. 0 - 24x24 with 56-bit Acc 1 - 32x32 with 32-bit Acc 2 - 32x32 with 64-bit Acc 3 - 24x24 with 24-bit Acc

Â