Hacker News new | ask | show | jobs
by a-dub 1867 days ago
as mentioned, worth pointing out that most practical digital filters don't have that many taps so unless you have other reasons to go to the frequency domain, time domain filtering can be faster...

but yeah, the implicit boxcar is a sinc.

sometimes it's used for image data as 2d convolutions can be expensive though...

1 comments

Most used digital filters are small this is true. But that is an error caused by legacy solutions which required filters to be exceedingly short beeing inappropriately applied to modern systems and problem. The most egregious examples are from videogames, where several different short classic filters are usually applied in series in order to deal with e.g. aliasing. The problem is twofold, it effectively makes a larger filter, and that larger filter is terrible at its job. The effect of using a single appropriately designed large filter is astonishing.
i'm guessing you're talking about things like og 4 tap biquads and the like.

in the time domain, you're looking at what... for each sample a pointwise multiply for each tap and then a sum, right? i'm guessing for most audio applications at commonly used sample rates, you're rarely going to have more than 24 taps at the very most? (with most only really needed 8 to 16?)

with the fft, unless you're using super exotic multiwindow schemes, you're looking at a pointwise multiply just to do the windowing before the fft. then you're looking at n log n to compute the fft itself, then zeroing or applying an envelope (pointwise multiply), then another n log n back to the frequency domain.

i think with simd you're way faster to just stay in the time domain.

would be interesting to bench for sure though... small ffts and simd may be super fast and not that many instructions.

It's not unusual to use hundreds of taps for a clean linear phase filter with a sharp slope. Discrete convolution reverb would need hundreds of thousands - which is why you use an FFT for that.
interesting. just looked at a datasheet for a modern audio dsp and they set aside memory for ~256 coefficients per 48k channel. i guess big filters are a thing.

still, you're looking at applying a window before the fft in most applications. that's a full pointwise multiply before even stepping into the fft (and back).

reverbs have delay lines, right? what does that look like in the spectral domain? some shift of the phases?