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 Block |
---|
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)
...
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
...