DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
ZeroLatencyConvolver.h File Reference

Zero-latency non-uniform partitioned convolution (Gardner scheme). More...

#include "AudioBuffer.h"
#include "Convolver.h"
#include "FFT.h"
#include "SimdOps.h"
#include <algorithm>
#include <cstdint>
#include <cstring>
#include <memory>
#include <vector>
Include dependency graph for ZeroLatencyConvolver.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  dspark::ZeroLatencyConvolver< T >
 Gardner-style non-uniform partitioned convolver (zero latency, flat CPU). More...
 

Namespaces

namespace  dspark
 Main namespace for the DSPark framework.
 

Detailed Description

Zero-latency non-uniform partitioned convolution (Gardner scheme).

Convolves arbitrarily long impulse responses with zero input/output delay and flat CPU usage, after W. G. Gardner, "Efficient Convolution without Input-Output Delay", JAES 43(3), 1995. The IR is split into three regions, each handled by the cheapest method that meets its deadline:

[0, 128) direct FIR head (SIMD dot product) – latency 0 [128, 2048) uniform partitioned FFT, block 128 – result lands exactly when needed (offset == its block latency) [2048, end) FFT partitions of 1024, time-distributed: each cycle's work (FFT + per-partition spectral MACs + IFFT + overlap- add) is split into units executed under a per-sample budget across the following 1024 samples, so long IRs never spike a single audio callback

The tail partitions start at twice their block size, which is what creates the full block of scheduling slack the time distribution relies on – the core idea of Gardner's non-uniform scheme.

Compared to the uniform Convolver (latency = block size), the price of zero latency is the direct head (~128 MACs per sample). Use this class for monitoring paths, cabinet simulation and anywhere latency matters; the plain Convolver remains the cheapest choice when block-size latency is acceptable.

Mono engine: one instance convolves one channel (like Convolver).

Dependencies: Convolver.h, FFT.h, SimdOps.h, AudioBuffer.h.

conv.prepare(ir.getChannel(0), irLength);
// In the audio callback -- any block size, even 1 sample:
conv.processInPlace(data, numSamples); // y[0] already includes ir[0]*x[0]
Gardner-style non-uniform partitioned convolver (zero latency, flat CPU).
void prepare(const T *irData, int irLength, int headSize=128)
Prepares the convolver with an impulse response (allocates).
void processInPlace(T *data, int numSamples) noexcept
Convolves in-place.

Definition in file ZeroLatencyConvolver.h.