Crates.io | simper-filter |
lib.rs | simper-filter |
version | 0.1.0 |
source | src |
created_at | 2023-10-19 07:27:40.783706 |
updated_at | 2023-10-19 07:27:40.783706 |
description | State Variable Filters for real-time audio in pure Rust |
homepage | https://neodsp.com/ |
repository | https://github.com/neodsp/simper-filter/ |
max_upload_size | |
id | 1007539 |
size | 22,058 |
State Variable IIR Filters for real-time audio in pure Rust. Based on the filter design by Andrew Simper (Cytomic).
use simper_filter::Svf;
// initialize filter with parameters
let mut filter = Svf::new(FilterType::Lowpass, 44100.0, 400.0, 0.771, 0.0);
// update filter with new parameters
filter.set(FilterType::Lowpass, 44100.0, 400.0, 0.771, 0.0);
// get response for specific frequency as complex number
let response = filter.get_response(400.0);
// process a whole buffer
let input = vec![0.0; 100];
let mut output = vec![0.0; 100];
filter.process(&input, &mut output);
// or process on sample basis
for sample in output.iter_mut() {
*sample = filter.tick(*sample);
}