resonators 0.1.1

Rust implementation of the Resonate algorithm for low-latency spectral analysis.
Documentation

resonators

A Rust implementation of Alexandre François's Resonate algorithm for low-latency spectral analysis.

See the main repository for details, demos, benchmarks, and attribution.

Install

cargo add resonators

Quickstart

use resonators::ResonatorBank;
use std::f32::consts::PI;

let sample_rate = 44_100.0;
let freqs = [110.0, 220.0, 440.0, 880.0];
let mut bank = ResonatorBank::from_frequencies(&freqs, sample_rate);

let signal: Vec<f32> = (0..sample_rate as usize)
    .map(|i| (2.0 * PI * 440.0 * i as f32 / sample_rate).sin())
    .collect();
let spectrogram = bank.resonate(&signal, 256); // flat Vec<Complex32>, (n_frames, n_bins)

License

Dual-licensed under MIT or Apache-2.0, at your option.