# Bandpass with large group delay

I read that a simple delay filter that delays all frequencies requires at least $$\frac {N-1} {2f_s}$$ taps. In my case this would result in way too many taps (20000).

Can I achieve this with significantly fewer taps (maybe around 1000, smaller by factor 20) if I either:

• only want to distortionless-free delay a bandwidth of $$f_s/100$$ and don't care about the filter response outside of that band

• or is there a way to have the center 18000 taps zero (only 1000 taps on the left and right have coefficients)?

Do you have any tips or could point me to the correction literature for this very specific case? Or are there even python functions that allow me to specifiy these requirements?

• What do you mean by using the terms "simple delay" and "bandpass" together? What is N? What is the $f_s$ you're using? What are you really trying to do?, because design a filter is only part of it. – Andy Walls Oct 15 '20 at 12:19
• I have 1000 samples of a signal (sum of sinusoids) sampled at fs=100e6 and I want to predict one single sample that is 10.000 sample-steps in the future, assuming that the sinusoid parameters stay the same. I also have 1000 samples that are an additional 10.000 sample-steps in the future, which would allow me to do this estimation backwards – filternoobie2020 Oct 15 '20 at 12:30

This depends a lot on whether your constraints on the number of taps is computation or memory.

If you have a enough memory, you can simply use an FIR with all taps zero except for the last one (Which is $$1$$). That's equivalent to using a ring buffer and no filter at all.

If you don't have enough memeory, things are more tricky. YOu can get delays that are constant with frequency with parallel/cascaded alpass filters and you can use "schroeder allpass" filters to crank up the group delay effificently. The best way to do this depends a lot on your specific constraints: how much memory do you have, how wide is your frequency range and how "constant" does that delay needs to be.

You can have all the taps be zero except for the last tap and the filter will delay the signal by that number of taps (as an all-pass). This doesn't do any filtering, and it is the actual filtering requirement that would drive the number of taps needed in the filter. For that requirement alone a dual port memory is a good solution for very long delays.

The delay for any filter is proportional to the transition bandwidth of that filter, sharper transitions in frequency require more memory (think moving averages and how the noise of a 10 day moving average of stock prices compares to a 90 day moving average). The sharpest possible transition in Hz achievable for a FIR filter is done with the moving average filter and would be the inverse of the time duration of the filter in seconds, as illustrated by the frequency response of a rectangular window (which that FIR filter would be). So for the time duration given in samples as $$N$$, and the transition bandwidth normalized the sampling rate $$f_s$$, the transition would be $$1/N$$ cycles/sample, or in radian frequency as in the plot below $$2\pi/N$$ radians/sample. For a bandpass equivalent of this we simply heterodyne the coefficients using $$e^{j\omega n}$$ to be rotating at the center frequency of interest. This filter, as a Sinc response suffers from signficant sidelobes, so is further improved by windowing which reduces the sidelobes but increases the transition width further (by a typical factor between 2 and 5 depending on window chosen). Any other FIR filter design techniques (least squares etc) would have the same result--so the rectangular case tells us the best that can be achieved (with an FIR filter). For much tighter transitions with less coefficients-- which then means much longer delay for less coefficients, an IIR filter can be used.

Bottom line for the delay associated with any filtering:

Tight transition bandwidth = Long Delay. The least delay that can be achieved with an FIR for a given transition bandwidth is the case of a simple moving average, where the number of taps $$N$$ required is the inverse of the transition bandwidth, and the associated delay is $$N/2$$. Any practical FIR filters are likely to have a factor 2 to 5 times larger than this.

Given this:

I want to distortionless-free delay a bandwidth of fs/100 and don't care about the filter response outside of that band

The $$fs/100$$ bandwidth requirement specifies that the FIR filter needs to be at least 100 taps, longer by a factor of 2-5 depending on actual passband and stopband requirements. Beyond that zeros can be used to shift the time with no other consequence.