ringkernel-audio-fft
GPU-accelerated audio FFT processing with direct/ambience signal separation.
Overview
This crate demonstrates RingKernel's actor model by implementing a novel audio processing pipeline where each FFT frequency bin is an independent GPU actor. Actors communicate with neighbors via K2K (kernel-to-kernel) messaging to perform coherence analysis and separate direct sound from room ambience.
Architecture
Audio Input -> FFT -> [Bin Actors with K2K] -> Separation -> Mixer -> IFFT -> Output
| | |
neighbor links
Each frequency bin actor:
- Receives its FFT data (magnitude + phase)
- Exchanges data with left/right neighbors via K2K
- Computes coherence metrics
- Separates into direct and ambient components
Signal Separation Algorithm
The separation is based on inter-bin phase coherence:
- Direct signal: High phase coherence between neighboring bins (transient, localized sounds)
- Ambience: Low phase coherence, diffuse energy distribution (reverb, room tone)
Usage
use *;
async
Components
| Module | Description |
|---|---|
audio_input |
Audio file I/O and device streaming |
bin_actor |
FFT bin actor implementation |
fft |
FFT/IFFT processing with window functions |
separation |
Coherence analysis and signal separation |
mixer |
Dry/wet mixing and gain control |
processor |
High-level processing pipeline |
Processing Parameters
| Parameter | Default | Description |
|---|---|---|
fft_size |
2048 | FFT window size (power of 2) |
hop_size |
512 | Overlap between windows |
sample_rate |
44100 | Audio sample rate |
dry_wet |
0.5 | Mix ratio (0 = direct only, 1 = ambience only) |
Testing
The crate includes 32 tests covering FFT processing, coherence analysis, and signal separation.
License
Apache-2.0