Skip to main content
Skip table of contents

BiquadSmoothedFract32

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 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 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: [b0, b1, b2, a1, a2] are the "target" coefficients that serve as control variables to the module. 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 controls whether the coefficient smoothing occurs at the start of each block. .updateActive was provided to allow 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

CODE
typedef struct _ModuleBiquadSmoothedFract32
{
    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
    fract32 smoothingCoeff;                       // Smoothing coefficient. This is computed based on the smoothingTime, sample rate, and block size of the module
    INT32 postShift;                              // Number of bits to shift
    INT32 currentPostShift;                       // Current post shift
    FLOAT32* coeffs;                              // Desired coefficients
    fract32* coeffsFract32;                       // Desired coefficients in fract32
    fract32* current_coeffsFract32;               // Instantaneous coefficients
    fract32* state;                               // State variables. 4 per channel.
} ModuleBiquadSmoothedFract32Class;

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

smoothingCoeff

fract32

derived

1

0.06449

Unrestricted

postShift

int

derived

1

1

Unrestricted

currentPostShift

int

state

1

1

Unrestricted

coeffs

float*

parameter

0

[5 x 1]

-10:10

linear

coeffsFract32

fract32*

derived

1

[5 x 1]

Unrestricted

current_coeffsFract32

fract32*

state

0

[5 x 1]

Unrestricted

state

fract32*

state

1

[4 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_smoothed_fract32_module.m

CODE
 M=biquad_smoothed_fract32_module(NAME)
 Creates a second order IIR Fract32 filter (biquad_smoothed) for use with the
 Audio Weaver.  This filter smoothly updates its coefficients on a block
 by block basis.
    NAME - name of the module.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.