Crates.io | lowpass-filter |
lib.rs | lowpass-filter |
version | 0.3.2 |
source | src |
created_at | 2021-03-11 11:39:07.293598 |
updated_at | 2021-11-15 09:03:38.660256 |
description | This is a `no_std` Rust library for simple digital low pass filters. You can use it for example to get the low frequencies from a song. |
homepage | https://github.com/phip1611/lowpass-filter |
repository | https://github.com/phip1611/lowpass-filter |
max_upload_size | |
id | 367263 |
size | 76,883 |
no_std
digital low pass filter libraryThis is a no_std
Rust library for simple digital low pass filters. You can use it for example to
get the low frequencies from a song.
I'm not an expert on digital signal processing. Code contributions are highly welcome! :)
biquad
⚠ TL;DR: Prefer crate biquad
and use this crate only for educational purposes.
This crate provides a basic and simple to understand, first order lowpass filter. The biquad
crate offers second order filters, with higher accuracy. Due to my testing, a lowpass filter with biquad
has the same
computational costs as my crate, but offers a better resolution for actually cutting of signals above the
cut-off frequency while the preserved signal will be less attenuated, compared to my filter implementation.
For production, please use biquad
.
use lowpass_filter::lowpass_filter;
/// Minimal example how to use this crate/how to apply low pass filter.
fn main() {
// read this from MP3 for example
let mut mono_audio_data = [0.0, 1.0, -5.0, 1551.0, 141.0, 24.0];
// mutates the input buffer
lowpass_filter(&mut mono_audio_data, 44100.0, 120.0);
}