Delay Line
Tier: Primitives | ComponentType: 8 | Params: 2
Circular buffer delay with linear interpolation and soft-clipped feedback.
Overview
DelayLine implements a simple feedback delay using an 88200-sample circular buffer (2 seconds at 44.1 kHz). The delay time is continuously variable with linear interpolation for smooth modulation. Feedback above 1.0 is allowed — a soft clipper (tanh) prevents runaway while enabling controlled expansion and self-oscillation textures.
This is the fundamental building block for echo effects, comb filtering, flanging (short modulated delay), chorus, and feedback networks.
File Locations
| Path | |
|---|---|
| Header | Sources/FolioDSP/include/FolioDSP/Primitives/DelayLine.h |
| Implementation | Sources/FolioDSP/src/Primitives/DelayLine.cpp |
| Tests | Tests/FolioDSPTests/DelayLineTests.swift |
| Bridge | Sources/FolioDSPBridge/src/FolioDSPBridge.mm (DelayLineBridge) |
Parameters
| Index | Name | Description | Min | Max | Default Min | Default Max | Default | Unit |
|---|---|---|---|---|---|---|---|---|
| 0 | Delay Time | Delay length | 0.0 | 2000.0 | 1.0 | 500.0 | 100.0 | ms |
| 1 | Feedback | Feedback amount (>1.0 uses soft clipping for expansion) | 0.0 | 1.2 | 0.0 | 0.9 | 0.3 |
Processing Algorithm
1. Read from Buffer (linear interpolation)
\[d = t_{\text{ms}} \cdot f_s \cdot 0.001\]
\[y = \text{buf}[\text{write} - d] \quad \text{(linearly interpolated)}\]
2. Feedback with Soft Clipping
\[\text{fb}_{\text{sig}} = \begin{cases} y \cdot \text{fb} & \text{fb} \leq 1 \\ \tanh(y \cdot \text{fb}) & \text{fb} > 1 \end{cases}\]
3. Write to Buffer
\[\text{buf}[\text{write}] = x + \text{fb}_{\text{sig}}\]
Core Equations
\[y = \text{buf}[t - d]; \quad \text{buf}[t] = x + \text{fb} \cdot \tanh(y)\]
Snapshot Fields
| Field | Type | Range | Unit | Description |
|---|---|---|---|---|
| Delay Time | Float | 0–2000 | ms | Current delay time |
| Feedback | Float | 0–1.2 | Current feedback amount | |
| Output | Float | -1–1 | Current delayed output |
Implementation Notes
- 88200-sample fixed circular buffer (2 seconds at 44.1 kHz)
- Linear interpolation for sub-sample delay accuracy (smooth modulation)
- Feedback > 1.0 uses
tanh()soft clipping to prevent infinite growth - Returns only the delayed signal — caller handles dry/wet mixing
- Real-time safe: fixed-size buffer, no allocations
Equation Summary
y = buf[t-d]; buf[t] = x + fb·tanh(y)