Skip to main content
Skip table of contents

FOFControlFract32

Overview

Time varying 1st order filter controlled using an input pin.

Discussion

This module implements a time-varying 1st order filter. The first input pin specifies the cutoff frequency of the module, in Hz. We only use the first element as the cutoff frequency for the block processing. The second input pin is the audio signal. The audio signal can contain any number of channels and have any blockSize.

Internally, every time the module processes a block of data, it runs a simple design equation to compute the coefficients of the first order filter. Then, filter coeff smoothing is done on the block bases and processing is on a sample-by-sample basis. The .smoothingTime control variable specifies the smoothing time of the coefficient update (in milliseconds). Note, only use this module if you need time varying behavior. The module can be configured as either LPF or HPF.

Type Definition

CODE
typedef struct _ModuleFOFControlFract32
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    FLOAT32 smoothingTime;                        // Time constant of the smoothing process
    INT32 filterType;                             // LPF = 0 and HPF = 1
    INT32 postShift;                              // Number of bits to shift
    fract32 smoothingCoeff;                       // Smoothing coefficient
    fract32 currentA1;                            // Instantaneous a1 filter coefficient
    fract32 targetA1;                             // Instantaneous a1 filter coefficient
    fract32* coeffs;                              // coefficients
    fract32* state;                               // State variables. 4 per channel
} ModuleFOFControlFract32Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

smoothingTime

float

parameter

0

10

0:1000

msec

filterType

int

parameter

0

0

0:1

postShift

int

parameter

0

1

0:1:4

smoothingCoeff

fract32

derived

1

0.06449

Unrestricted

currentA1

fract32

state

1

0

Unrestricted

targetA1

fract32

state

1

0

Unrestricted

coeffs

fract32*

state

1

[5 x 1]

Unrestricted

state

fract32*

state

1

[4 x 1]

Unrestricted

Pins

Input Pins

Name: f

Description: Cutoff frequency (Hz)

Data type: float

Channel range: 1

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

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: fof_control_fract32_module.m

CODE
 M=fof_control_fract32_module(NAME, FILTERTYPE)
 1st order lowpass or highpass filter with a cutoff frequency that can be set using
 a control pin. The module supports an arbitrary number of channels.
 Arguments:
    NAME - name of the module.
    FILTERTYPE - either LPF (default = 0) or HPF = 1.
 The module has an internal design equation which is performed on a block
 by block basis.  Smoothing is also on the block basis.  Use this
 module only if you need dynamic time-varying behavior.

JavaScript errors detected

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

If this problem persists, please contact our support.