#digital #low-pass #filter #digital-signal-processing #signal-processing #audio #dsp

no-std lowpass-filter

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.

11 releases

0.3.2 Nov 15, 2021
0.3.1 Nov 15, 2021
0.2.5 Sep 14, 2021
0.2.4 Mar 30, 2021
0.1.2 Mar 12, 2021

#126 in Multimedia

Download history 36/week @ 2024-06-16 41/week @ 2024-06-23 64/week @ 2024-06-30 15/week @ 2024-07-07 9/week @ 2024-07-14 10/week @ 2024-07-21 47/week @ 2024-07-28 2/week @ 2024-08-04 6/week @ 2024-08-11 9/week @ 2024-08-18 18/week @ 2024-08-25 2/week @ 2024-09-01 20/week @ 2024-09-08 11/week @ 2024-09-15 46/week @ 2024-09-22 15/week @ 2024-09-29

92 downloads per month
Used in 2 crates

MIT license

22KB
175 lines

Rust: no_std digital low pass filter library

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.

I'm not an expert on digital signal processing. Code contributions are highly welcome! :)

Difference to 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.

How to use

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);
}

Visual Examples

#1: Original Waveform of a short sample

Example 1: Original Waveform of a short sample

#1: Lowpassed Waveform

Example 1: Lowpassed Waveform of a short sample

#2: Original Waveform of a song

Example 1: Original Waveform of a song

#2: Lowpassed Waveform

Example 1: Lowpassed Waveform of a song

#2: 3x Lowpassed Waveform

Example 1: Lowpassed Waveform of a song 3x

No runtime deps