| Crates.io | fft-convolver |
| lib.rs | fft-convolver |
| version | 0.3.0 |
| created_at | 2022-12-03 14:30:15.875333+00 |
| updated_at | 2025-11-25 23:49:15.756734+00 |
| description | Audio convolution algorithm in pure Rust for real time audio processing |
| homepage | https://neodsp.com/ |
| repository | https://github.com/neodsp/fft-convolver |
| max_upload_size | |
| id | 729128 |
| size | 55,872 |
Fast, real-time safe FFT-based convolution for audio processing in Rust.
Port of HiFi-LoFi/FFTConvolver to pure Rust.
f32 and f64 floating-point typesPerfect for real-time audio applications like convolution reverbs, cabinet simulators, and other impulse response-based effects.
The convolver uses a partitioned FFT convolution algorithm that divides the impulse response into uniform blocks. This approach provides:
All memory allocation happens during initialization (init()), making subsequent processing (process()) completely allocation-free and suitable for real-time audio threads.
use fft_convolver::FFTConvolver;
// Create an impulse response (e.g., a simple delay)
let mut impulse_response = vec![0.0_f32; 100];
impulse_response[0] = 0.8; // Direct sound
impulse_response[50] = 0.3; // Echo
// Initialize the convolver
let mut convolver = FFTConvolver::default();
convolver.init(128, &impulse_response).unwrap();
// Process audio in any buffer size
let input = vec![1.0_f32; 256];
let mut output = vec![0.0_f32; 256];
convolver.process(&input, &mut output).unwrap();
use fft_convolver::FFTConvolver;
let mut convolver = FFTConvolver::<f32>::default();
let ir1 = vec![0.5, 0.3, 0.2, 0.1];
convolver.init(128, &ir1).unwrap();
// Update to a different impulse response (must be ≤ original length)
let ir2 = vec![0.8, 0.6, 0.4];
convolver.set_response(&ir2).unwrap();
use fft_convolver::FFTConvolver;
let mut convolver = FFTConvolver::<f32>::default();
let ir = vec![0.5, 0.3, 0.2];
convolver.init(128, &ir).unwrap();
// Process some audio...
let input = vec![1.0; 256];
let mut output = vec![0.0; 256];
convolver.process(&input, &mut output).unwrap();
// Clear state when seeking or handling playback discontinuities
convolver.reset();
// Continue processing with clean state
convolver.process(&input, &mut output).unwrap();
The following operations are real-time safe (no allocations):
process() - Audio processingset_response() - Updating impulse responsereset() - Clearing internal stateThe following operations are NOT real-time safe (perform allocations):
init() - Initial setupLicensed under the MIT license.