resonant
Ergonomic audio DSP for Rust — FFT, filters, analysis in one line of code.
use AudioFile;
let audio = open?;
let bins = audio.with_window_size.fft?;
for bin in &bins
Why resonant?
| Task | raw rustfft | resonant |
|---|---|---|
| Load audio file | 15+ lines (symphonia boilerplate) | AudioFile::open("f.wav")? |
| FFT with window | 8 lines (alloc, convert, plan, execute) | .with_window_size(4096).fft()? |
| Labelled bins | Manual: k * sr / N per bin |
Built-in FrequencyBin { frequency_hz, magnitude, phase } |
| Streaming STFT | Build your own frame loop | .fft_stream()? returns a lazy iterator |
| Domain safety | Nothing — you track it yourself | Compile-time Signal<T, TimeDomain> / FreqDomain |
Quick start
[]
= "0.0.1"
One-shot FFT
use ;
let audio = open?;
let bins: = audio
.with_window_size
.with_db_scale
.fft?;
Streaming STFT
use AudioFile;
let audio = open?;
for frame in audio.with_window_size.with_overlap.fft_stream?
Drop down to lower-level crates
use ;
let signal = from_samples;
let spectrum = signal.fft?;
let magnitudes = spectrum.magnitude;
use ;
let coeffs = butterworth_lowpass.unwrap;
let mut filter = new;
for sample in audio_buf.iter_mut
Feature matrix
| Feature | Crate | no_std |
no_alloc |
|---|---|---|---|
Type-state Signal<T, D> |
resonant-core | yes | yes |
| Window functions | resonant-core | yes | yes |
| Q15/Q31 fixed-point | resonant-core | yes | yes |
| Radix-2 FFT | resonant-fft | yes | yes |
| Arbitrary-size FFT (rustfft) | resonant-fft | no | no |
| STFT (analysis + overlap-add) | resonant-fft | no | no |
| Biquad filter | resonant-filters | yes | yes |
| FIR filter | resonant-filters | yes | no |
| Butterworth design | resonant-filters | yes | yes |
| Integer decimation | resonant-filters | yes | no |
| Audio file decoding | resonant | no | no |
| One-liner FFT with labelled bins | resonant | no | no |
Examples
Examples live in the workspace-level examples/ crate:
See examples/README.md for details and sample output.
Workspace crates
| Crate | Description |
|---|---|
| resonant-core | no_std, zero-allocation DSP foundation |
| resonant-fft | Type-safe FFT, STFT, DCT |
| resonant-filters | FIR/IIR filters and design helpers |
| resonant-stream | Async streaming DSP pipeline (planned) |
| resonant-analysis | Onset, beat, pitch, MFCC analysis (planned) |
| resonant | Ergonomic facade — this crate |
License
Licensed under either of MIT or Apache-2.0 at your option.