Skip to main content
Skip table of contents

FOFControl

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 _ModuleFOFControl
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    FLOAT32 smoothingTime;                        // Time constant of the smoothing process
    INT32 filterType;                             // LPF = 0 and HPF = 1
    FLOAT32 smoothingCoeff;                       // Smoothing coefficient
    FLOAT32 currentA1;                            // Instantaneous a1 filter coefficient
    FLOAT32* coeffs;                              // coefficients
    FLOAT32* state;                               // State variables. 4 per channel
} ModuleFOFControlClass;

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

smoothingCoeff

float

derived

1

0.06449

Unrestricted

currentA1

float

state

1

0

Unrestricted

coeffs

float*

state

1

[5 x 1]

Unrestricted

state

float*

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

CODE
 M=fof_control_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.