dsp.rs
dsp.rs copied to clipboard
Add FFT filter
- Convert signal into frequency domain
- Remove given frequencies (make them 0)
- Convert back to time domain
I think an "FFT Filter" would be best realized using an overlap-add FFT convolution filter: http://www.dspguide.com/ch18.htm. It's an O(n logn) convolution operation and typically higher performance than a typical FIR implementation for filters >~128 taps.
I think the best approach here is to use cupy's approach, which is really clever. They have a '_correlate_or_convolve' function with flexible arguments: cupy ndimage. My next task for this repo (hoping to wrap up another project and dedicate more time to this) is to do an FIR filter implementation. I propose I make the FIR filter convolution and FFT overlap-add convolution with the same interface, with a correlation function just calling convolve with reversed filter taps (as in cupy).
Yes it makes sense. In this context I though about doing FFT on the whole signal. This can be useful in some context (like bio signals). But overlap-add FFT sounds good to me too.