State Variable Filter
Tier: Primitives | ComponentType: 7 | Params: 3
Chamberlin state variable filter with 2x oversampling and simultaneous LP/HP/BP/Notch outputs.
Overview
The State Variable Filter (SVF) uses the Chamberlin topology with 2x oversampling for improved stability at high resonance. Unlike the Biquad which offers one output type at a time, the SVF computes all four filter outputs (lowpass, highpass, bandpass, notch) simultaneously from the same integrator state. The output selector chooses which response to emit.
Resonance approaching 1.0 drives the filter toward self-oscillation, producing a singing tone at the cutoff frequency. The 2x oversampling prevents instability that would occur in a naive single-pass implementation at high frequencies and resonance.
File Locations
| Path | |
|---|---|
| Header | Sources/FolioDSP/include/FolioDSP/Primitives/StateVariableFilter.h |
| Implementation | Sources/FolioDSP/src/Primitives/StateVariableFilter.cpp |
| Tests | Tests/FolioDSPTests/StateVariableFilterTests.swift |
| Bridge | Sources/FolioDSPBridge/src/FolioDSPBridge.mm (StateVariableFilterBridge) |
Parameters
| Index | Name | Description | Min | Max | Default Min | Default Max | Default | Unit |
|---|---|---|---|---|---|---|---|---|
| 0 | Frequency | Filter cutoff frequency | 20.0 | 20000.0 | 200.0 | 8000.0 | 1000.0 | Hz |
| 1 | Resonance | Resonance amount (0.999 approaches self-oscillation) | 0.0 | 0.999 | 0.0 | 0.8 | 0.0 | |
| 2 | Output | Output type: 0=LP, 1=HP, 2=BP, 3=Notch | 0.0 | 3.0 | 0.0 | 3.0 | 0.0 |
Processing Algorithm
1. Coefficient Calculation
2. Chamberlin SVF (2x oversampled, run twice per sample)
3. Notch Output
Core Equations
Snapshot Fields
| Field | Type | Range | Unit | Description |
|---|---|---|---|---|
| Frequency | Float | 20–20000 | Hz | Current cutoff |
| Resonance | Float | 0–1 | Current resonance | |
| Output | Float | 0–3 | Selected output type | |
| LP | Float | -1–1 | Lowpass output | |
| HP | Float | -1–1 | Highpass output | |
| BP | Float | -1–1 | Bandpass output |
Implementation Notes
- 2x oversampling: two SVF iterations per input sample for stability at high resonance
- All four outputs computed internally; only one is selected for return, but all are in the snapshot
- Resonance maps inversely to damping: q = 1 - resonance
- No DC blocker — SVF structure is inherently AC-coupled for BP and Notch; LP passes DC normally
Equation Summary
hp = x-lp-q·bp; bp += f·hp; lp += f·bp