OnePole
Tier: Primitives | ComponentType: 2 | Params: 2
Single-pole lowpass/highpass filter — the simplest IIR filter topology.
Overview
OnePole implements a one-pole filter with selectable lowpass or highpass response. The lowpass mode uses the standard first-order IIR equation with an exponential coefficient. The highpass mode is derived as the complement: HP = input - LP.
This is the fundamental building block for parameter smoothing, envelope following, DC blocking, and simple tone shaping. Extremely efficient — one multiply and one add per sample.
File Locations
| Path | |
|---|---|
| Header | Sources/FolioDSP/include/FolioDSP/Primitives/OnePole.h |
| Implementation | Sources/FolioDSP/src/Primitives/OnePole.cpp |
| Tests | Tests/FolioDSPTests/OnePoleTests.swift |
| Bridge | Sources/FolioDSPBridge/src/FolioDSPBridge.mm (OnePoleBridge) |
Parameters
| Index | Name | Description | Min | Max | Default Min | Default Max | Default | Unit |
|---|---|---|---|---|---|---|---|---|
| 0 | Frequency | Filter cutoff frequency | 1.0 | 20000.0 | 20.0 | 5000.0 | 1000.0 | Hz |
| 1 | Type | Filter type: 0=lowpass, 1=highpass | 0.0 | 1.0 | 0.0 | 1.0 | 0.0 |
Processing Algorithm
1. Coefficient Calculation
\[c = e^{-2\pi f / f_s}\]
2. Lowpass Filter
\[y_{\text{LP}} = (1 - c) \cdot x + c \cdot y[n-1]\]
3. Highpass (complementary)
\[y_{\text{HP}} = x - y_{\text{LP}}\]
4. Output Selection
Type < 0.5 returns LP; type ≥ 0.5 returns HP.
Core Equations
\[c = e^{-2\pi f / f_s}\]
\[y_{\text{LP}}[n] = (1-c) \cdot x[n] + c \cdot y_{\text{LP}}[n-1]\]
Snapshot Fields
| Field | Type | Range | Unit | Description |
|---|---|---|---|---|
| Frequency | Float | 1–20000 | Hz | Current cutoff |
| Type | Float | 0–1 | Current filter type | |
| Output | Float | -1–1 | Current output sample |
Implementation Notes
- Coefficient recalculated every sample for real-time frequency modulation
- At type = 0.5, output is equal blend of LP and HP (partial cancellation at cutoff)
- No normalization — output may be slightly attenuated at high frequencies (inherent to one-pole topology)
Equation Summary
y = (1-c)·x + c·y[n-1], c = e^(-2πf/sr)