Skip to content

IR Convolver

Tier: Primitives | ComponentType: 14 | Params: 2

FFT-based overlap-add convolution for cabinet simulation and convolution reverb.

Overview

IRConvolver performs frequency-domain convolution using a 1024-sample block size with FFT-based overlap-add processing. An impulse response (IR) is loaded, pre-transformed to the frequency domain, and applied to incoming audio blocks via complex multiplication.

Used for cabinet/speaker simulation, convolution reverb with short IRs, and room simulation. The IR length is limited to 1024 samples (~23 ms at 44.1 kHz) in the current non-partitioned implementation.

File Locations

Path
Header Sources/FolioDSP/include/FolioDSP/Primitives/IRConvolver.h
Implementation Sources/FolioDSP/src/Primitives/IRConvolver.cpp
Tests Tests/FolioDSPTests/IRConvolverTests.swift
Bridge Sources/FolioDSPBridge/src/FolioDSPBridge.mm (IRConvolverBridge)

Parameters

Index Name Description Min Max Default Min Default Max Default Unit
0 Dry/Wet Balance between original and convolved signal 0.0 100.0 0.0 100.0 50.0 %
1 IR Gain Level adjustment for the impulse response -40.0 40.0 -20.0 20.0 0.0 dB

Processing Algorithm

1. IR Loading (non-realtime)

The IR is zero-padded to 2048 samples and forward-FFT'd:

\[H[k] = \text{FFT}(h[n])\]

A 32-point log-spaced magnitude spectrum is computed for visualization.

2. Block Accumulation

Input samples are accumulated into a 1024-sample buffer.

3. Block Processing (every 1024 samples)

\[X[k] = \text{FFT}(\text{zeroPad}(x[n], 2048))\]
\[Y[k] = X[k] \cdot H[k]\]
\[y[n] = \text{IFFT}(Y[k])\]

4. Overlap-Add

\[\text{output}[0..1023] = y[0..1023] + \text{overlap}[0..1023]\]
\[\text{overlap}[0..1023] = y[1024..2047]\]

5. Dry/Wet Mix

\[y = x \cdot (1 - w) + y_{\text{wet}} \cdot g_{\text{IR}} \cdot w\]

where \(w = \text{mix}/100\) and \(g_{\text{IR}} = 10^{G_{\text{dB}}/20}\).

Snapshot Fields

Field Type Range Unit Description
Input Float 0–1 Input level
Output Float 0–1 Output level
Dry/Wet Float 0–100 % Current mix
IR Length Float 0–10000 ms Loaded IR duration
IR Spectrum Float[32] 0–1 Log-spaced magnitude response

Implementation Notes

  • Non-partitioned: single 1024-sample block, max IR length 1024 samples
  • Latency: 1024 samples = 23.2 ms at 44.1 kHz
  • IR loading is non-blocking: called from UI thread, atomic flag swap on audio thread
  • Complex multiplication: \((a+bi)(c+di) = (ac-bd) + (ad+bc)i\)
  • 32-point visualization spectrum uses log-spaced bin selection

Equation Summary

Y = IFFT(FFT(x) · FFT(ir))