Crates.io | lowpass-filter |
lib.rs | lowpass-filter |
version | 0.4.1 |
created_at | 2021-03-11 11:39:07.293598+00 |
updated_at | 2025-07-06 12:29:18.222238+00 |
description | Simple first-order digital lowpass filters, compatible with `no_std`. 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 | 85,159 |
Simple first-order digital lowpass filters, compatible with no_std
. You can
use it, for example, to get the low frequencies from a song.
biquad
⚠ TL;DR: biquad
might be a better option in some use-cases.
This crate provides a basic and simple to understand, first order lowpass
filter. The biquad crate offers second order
filters, with higher accuracy. From my testing, a lowpass filter created with
biquad
has higher computational costs as this crate, but offers a
better resolution for actually cutting of signals above the cut-off frequency
while the preserved signal will be less attenuated.
So for production use-cases, please also consider using biquad
. You can run
benchmark and check your data (e.g., by plotting) to make that decision.
You can either use the LowpassFilter
type to integrate the filter in
iterator chains or you can use a convenient function such as
lowpass_filter
and lowpass_filter_f64
. The first approach is more
flexible.
LowpassFilter
typeSee implementation of lowpass_filter
function.
lowpass_filter
functionuse lowpass_filter::lowpass_filter;
// some samples
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);
The MSRV is 1.85.0
.