#dsp #convolution #fft #signal #intended #filter #applications

convolution-dsp

1-dimensional convolution library intended for use in DSP applications

3 releases (breaking)

0.3.0 Oct 12, 2024
0.2.0 Aug 7, 2024
0.1.0 Jul 10, 2024

#534 in Math

Download history 5/week @ 2024-09-21 14/week @ 2024-10-05 299/week @ 2024-10-12 66/week @ 2024-10-19 105/week @ 2024-10-26 239/week @ 2024-11-02 152/week @ 2024-11-09 192/week @ 2024-11-16 225/week @ 2024-11-23 289/week @ 2024-11-30

917 downloads per month

MIT license

490KB
209 lines

convolution-dsp

1-dimensional convolution library for Rust intended for use in DSP applications. Uses the overlap-add FFT method.

Planned features

  • Input signal
    • ☑ Complex32 signals
    • ☐ f32 signals
  • Filter kernels
    • ☑ f32 filter kernels
    • ☐ Complex32 filter kernels
  • ☐ Use realfft when signal and kernel are both f32
  • ☑ f64 support
  • ☐ Fallbacks to non-fft convolution when it is faster
  • ☑ Full or same length output mode, similar to numpy/scipy
  • ☐ Threading
  • ☐ Minimize memory allocations
  • ☐ Faster than numpy/scipy
  • ☐ Re-export num_complex?

References

Stephen W. Smith, Ph.D., The Scientist and Engineer's Guide to Digital Signal Processing, Chapter 18.


lib.rs:

use convolution_dsp::{ConvMode, Conv1dPlanner};
use num_complex::Complex32;

let filter = vec![0., 0., 0., 1., 0., 0., 0.];

let planner = Conv1dPlanner::new();
let mut conv = planner.plan_conv1d(&filter, ConvMode::Same);

let signal = vec![Complex32::ONE; 1_000_000];

let output = conv.process(signal);

assert_eq!(output.len(), 1_000_000);

Dependencies

~3MB
~57K SLoC