SVF
Overview
State Variable Filter with coefficients derived from input pins
Discussion
This module is a State Variable Filter (short "SVF") module using the standard Chamberlin algorithm which implements a number of standard filter types. The filter operates on multiple interleaved channels, with all channels being processed by the same set of coefficients.
After specifying filterType, adjust the filter parameters by setting the fields, gain, frequency and quality. Frequency, gain and quality can be controlled either through respective input control pin or from the module inspector. Some filter parameters are not applicable to all filter types. The variable, frequency controls the center frequency of the filter, gain determines the boost or cut in dB, and quality determines how sharp the filter is. Low quality values lead to broad filters and high quality values lead to narrow filters.
The following table discusses the various filter types and which variables are active in each case.
filterType=0, Simple pass through with unity gain.
filterType=1, high pass filter. [frequency].
filterType=2, low pass filter. [frequency].
filterType=3, all pass filter. [frequency].
filterType=4, high pass filter 2. [frequency, quality].
filterType=5, low pass filter 2. [frequency, quality].
filterType=6, all pass filter 2. [frequency, quality].
filterType=7, bandpass filter. It has unity gain at the specified frequency and falls off in both directions. The bandwidth of the filter is determined by quality. [frequency, quality, gain].
filterType=8, bandpass filter normalized. It has unity gain at the specified frequency and falls off in both directions. The bandwidth of the filter is determined by quality. [frequency, quality, gain].
filterType=9, notch filter. It has unity gain except around the specified frequency. At the specified frequency, the filter has a true notch with -inf dB gain. [frequency, quality].
filterType=10, peak (bell) filter. [frequency, quality, gain].
filterType=11, peak (bell) filter with variable quality. [frequency, quality, gain].
filterType=12, asymmetrical low shelf. [frequency, quality, gain].
filterType=13, asymmetrical hi shelf. [frequency, quality, gain].
filterType=14, tilt filter [frequency, quality, gain].
When the parameters frequency, gain or quality are controlled through the input pin, then the default behaviour of the module is to calculate coefficients in the Set function. User can change the behaviour through the parameter setBehavior to calculate coefficients in the Process function itself.
Module Pack
awe-mod-dspc-snd
ClassID
classID = 41804
Type Definition
typedef struct _ModuleSVF
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 filterType; // Selects the type of filter that is implemented by the module.
INT32 setBehavior; // Controls the Set function calling behavior of the module. 0 = OnChangeDeferredSet, 1 = OnChangeInstantSet
FLOAT32 frequency; // Cutoff frequency of the filter, in Hz.
FLOAT32 gain; // Amount of boost or cut to apply, in dB if applicable.
FLOAT32 quality; // Specifies the Q of the filter, if applicable.
FLOAT32 g; // g coefficient
FLOAT32 g1; // g1 coefficient
FLOAT32 h; // h coefficient
FLOAT32 cLp; // LP factor
FLOAT32 cBp; // BP factor
FLOAT32 cHp; // HP factor
INT32 updateActive; // Specifies whether the filter coefficients are updating (=1) or fixed (=0).
FLOAT32 current_g; // Instantaneous g coefficient.
FLOAT32 current_g1; // Instantaneous g1 coefficient.
FLOAT32 current_h; // Instantaneous h coefficient.
FLOAT32 current_cLp; // Instantaneous cLp coefficient.
FLOAT32 current_cBp; // Instantaneous cBp coefficient.
FLOAT32 current_cHp; // Instantaneous cHp coefficient.
UINT32 pinID; // Specifies which control pins are available.
FLOAT32* state; // State variables. 2*numChannels per section.
} ModuleSVFClass;
Variables
Properties
| Name | Type | Usage | isHidden | Default Value | Range | Units |
|---|---|---|---|---|---|---|
| filterType | int | parameter | 0 | 0 | 0:14 | |
| setBehavior | int | parameter | 0 | 0 | 0:1 | |
| frequency | float | state | 0 | 250 | 10:23990 | Hz |
| gain | float | state | 0 | 0 | -24:24 | dB |
| quality | float | state | 0 | 0.7071 | 0.05:20 | |
| g | float | derived | 0 | 1 | Unrestricted | |
| g1 | float | derived | 0 | 0 | Unrestricted | |
| h | float | derived | 0 | 0 | Unrestricted | |
| cLp | float | derived | 0 | 0 | Unrestricted | |
| cBp | float | derived | 0 | 0 | Unrestricted | |
| cHp | float | derived | 0 | 0 | Unrestricted | |
| updateActive | int | parameter | 1 | 0 | 0:1 | |
| current_g | float | state | 1 | 0 | Unrestricted | |
| current_g1 | float | state | 1 | 0 | Unrestricted | |
| current_h | float | state | 1 | 0 | Unrestricted | |
| current_cLp | float | state | 1 | 0 | Unrestricted | |
| current_cBp | float | state | 1 | 0 | Unrestricted | |
| current_cHp | float | state | 1 | 0 | Unrestricted | |
| pinID | uint | const | 1 | 7 | Unrestricted | |
| state | float* | state | 1 | [2 x 1] | Unrestricted |
Pins
Input Pins
| Name | freqPin |
| Description | Cutoff frequency of the filter |
| Data type | float |
| Channel range | 1 |
| Block size range | Unrestricted |
| Sample rate range | Unrestricted |
| Complex support | Real |
| Name | gainPin |
| Description | Gain of the filter |
| Data type | float |
| Channel range | 1 |
| Block size range | Unrestricted |
| Sample rate range | Unrestricted |
| Complex support | Real |
| Name | qPin |
| Description | Q of the filter |
| Data type | float |
| Channel range | 1 |
| Block size range | Unrestricted |
| Sample rate range | Unrestricted |
| Complex support | Real |
| Name | in |
| Description | Input signal |
| Data type | float |
| Channel range | Unrestricted |
| Block size range | Unrestricted |
| Sample rate range | Unrestricted |
| Complex support | Real |
Output Pins
| Name | out |
| Description | Output signal |
| Data Type | float |
Matlab Usage
File Name: svf_module.m
Copyright (c) 2026 DSP Concepts, Inc.