#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

#561 in Math

Download history 128/week @ 2024-08-06 3/week @ 2024-08-13 1/week @ 2024-09-17 4/week @ 2024-09-24 2/week @ 2024-10-01 183/week @ 2024-10-08 149/week @ 2024-10-15 76/week @ 2024-10-22 107/week @ 2024-10-29 222/week @ 2024-11-05 159/week @ 2024-11-12

580 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