Overdrive
Tier: Color | ComponentType: 18 | Params: 7
Drive, pre-filter, clipping, tone shaping, and output level with seven clip curves, four pre-filter types, and two signal topologies.
Overview
Overdrive models the gain-staging and nonlinear clipping found in guitar pedals, tube amplifiers, and transistor circuits. The signal chain is: input gain (drive) followed by an optional pre-filter that shapes the frequency content entering the clipper, then one of seven clipping curves that define the distortion character, a post-clip tone filter to tame harsh harmonics, an output level control, and finally a dry/wet mix.
The seven clip curves span the full range of distortion archetypes. Soft Symmetric (tanh) produces the smooth, compressed character of tube overdrive. Asymmetric applies different saturation to positive and negative halves, generating even harmonics like a transistor stage. Hard Clip is aggressive fuzz. Diode has a linear region below a threshold then soft-clips above it, mimicking the TS808 midrange. Full-Wave Rectify folds the negative half upward (octave-up effect). Half-Wave Rectify zeroes out the negative half. Crossover introduces a dead zone around zero then clips, emulating crossover distortion in Class AB amplifiers.
Two topologies are available. In Signal Path mode (default), drive is applied to the input, then filtered, then clipped -- the standard pedal architecture. In Feedback mode, the previous output is subtracted from the input before amplification and clipping, creating a negative feedback loop that compresses dynamics and adds a different harmonic character. The feedback sample is clamped to \([-1, 1]\) to prevent runaway instability.
File Locations
| Path | |
|---|---|
| Header | Sources/FolioDSP/include/FolioDSP/Color/Overdrive.h |
| Implementation | Sources/FolioDSP/src/Color/Overdrive.cpp |
| Tests | Tests/FolioDSPTests/OverdriveTests.swift |
| Bridge | Sources/FolioDSPBridge/src/FolioDSPBridge.mm (OverdriveBridge) |
Parameters
| Index | Name | Description | Min | Max | Default Min | Default Max | Default | Unit |
|---|---|---|---|---|---|---|---|---|
| 0 | Drive | Input gain before clipping | 0 | 80 | 0 | 40 | 20 | dB |
| 1 | Tone | Post-clip one-pole lowpass cutoff | 50 | 20000 | 200 | 8000 | 2000 | Hz |
| 2 | Pre-Filter | Frequency shaping before clipper (0=Flat, 1=MidBoost, 2=BassCut, 3=TrebleBoost) | 0 | 3 | 0 | 3 | 0 | |
| 3 | Clip Curve | Clipping function (0=SoftSym, 1=Asym, 2=Hard, 3=Diode, 4=FullRect, 5=HalfRect, 6=Crossover) | 0 | 6 | 0 | 6 | 0 | |
| 4 | Mix | Dry/wet blend | 0 | 100 | 0 | 100 | 100 | % |
| 5 | Level | Output gain after clipping | -40 | 40 | -20 | 20 | 0 | dB |
| 6 | Topology | Signal routing (0=SignalPath, 1=Feedback) | 0 | 1 | 0 | 1 | 0 |
Processing Algorithm
The process() function executes these steps for each input sample:
1. Drive (Input Gain)
The drive parameter is converted from decibels to a linear gain:
2. Topology Branch
Signal Path Topology (default)
The input is amplified, pre-filtered, then clipped:
Feedback Topology
The previous output is subtracted from the input before amplification:
3. Pre-Filter Types
| Type | Name | Algorithm |
|---|---|---|
| 0 | Flat | Passthrough |
| 1 | MidBoost | HP at 200 Hz added at 50% to input: \(y = x + 0.5 \cdot \text{HP}_{200}(x)\) |
| 2 | BassCut | Subtract LP at 150 Hz: \(y = x - \text{LP}_{150}(x)\) |
| 3 | TrebleBoost | Add 30% of derivative: \(y = x + 0.3 \cdot (x - x_{n-1})\) |
4. Clip Curves
| Curve | Name | Function |
|---|---|---|
| 0 | SoftSymmetric | \(\tanh(x)\) |
| 1 | Asymmetric | \(\tanh(x)\) for \(x \geq 0\), \(\tanh(0.5x)\) for \(x < 0\) |
| 2 | HardClip | \(\text{clamp}(x, -1, 1)\) |
| 3 | Diode | Linear below threshold 0.3, then $t + \tanh(2( |
| 4 | FullWaveRectify | $ |
| 5 | HalfWaveRectify | \(\max(0, x)\) |
| 6 | Crossover | Dead zone at \(\pm 0.15\), then $\text{sgn}(x) \cdot \tanh(3( |
5. DC Blocker
Applied only for rectifier curves (FullWaveRectify, HalfWaveRectify) which generate DC offset:
Where \(\alpha = 1 - e^{-2\pi \cdot 10 / f_s}\).
6. Tone Filter
A one-pole lowpass filter tames harsh upper harmonics from clipping:
7. Output Level
8. Dry/Wet Mix
Where \(m = \text{mix} / 100\).
Core Equations
Snapshot Fields
| Field | Type | Range | Unit | Description |
|---|---|---|---|---|
| Input | Float | 0--1 | Smoothed absolute input level | |
| Output | Float | 0--1 | Smoothed absolute output level | |
| Drive | Float | 0--80 | dB | Current drive setting |
| Clipping | Float | 0--1 | Amount of gain reduction from clipping | |
| Clip Curve | Uint8 | 0--6 | Active clip curve index | |
| Tone | Float | 50--20000 | Hz | Current tone filter frequency |
| Transfer | Float[16] | -1--1 | 16-point transfer curve (input-to-output mapping) | |
| Topology | Uint8 | 0--1 | Active topology (0=SignalPath, 1=Feedback) | |
| Feedback | Float | 0--1 | Absolute value of current feedback sample |
Implementation Notes
- DC blocker uses a one-pole highpass at 10 Hz, only engaged for FullWaveRectify and HalfWaveRectify curves that generate DC offset. The coefficient is: \(\alpha = 1 - e^{-2\pi \cdot 10 / f_s}\).
- Feedback topology clamping: The feedback sample is clamped to \([-1, 1]\) to prevent unbounded positive feedback. Without this, certain curves (especially FullWaveRectify) cause runaway values leading to NaN.
- Transfer curve is computed in the snapshot emission path (not per-sample), sampling 16 evenly spaced points from \(x = -1\) to \(x = 1\) through the current drive and clip curve.
- Clipping amount is tracked as \(1 - |y_{\text{clipped}}| / |x_{\text{driven}}|\), measuring how much the clipper reduced the signal.
- All parameters use
std::atomic<float>for lock-free thread safety. - Snapshot emission is decimated to ~60 fps (every 735 samples at 44.1 kHz).
Equation Summary
y = clip(x·drive) · tone ± feedback