Friday 15 July 2016

finite impulse response - How can I design a very narrow filter?


Suppose I've got an audio signal sampled at $48000$ Hz, and I'd like to design a low-pass filter that isolates everything below ~$60$Hz. In the digital world, this is a low-pass filter with the passband at $[-\frac{\pi}{400} , \frac{\pi}{400} ] $. Also, the transition band should be reasonable as well. Building a FIR filter for this can have a lot of taps which in the long run affects precision. An IIR filter is too not ideal because audio suffers for non-linear-phase response in filters, so unless the signal is filtered, then reversed and filtered again, it is not really an option.


Could a wavelet transform be better at this than in-one-go regular filtering?



Answer



If you are optimizing for engineering time and are on a platform that supports large FFTs well (i..e not fixed point), then take hotpaw2's advice and use fast convolution. It will perform much better than a naive FIR implementation and should be relatively easy to implement.


On the other hand, if you have some time to spend on this to get the best implementation or are on a fixed-point platform, you should use a multirate down-filter-up-subtract structure. But it's a bit trickier to get everything right.



I've got access to trusted and highly optimized implementations of both fast convolution and multirate filtering tools. The fast convolution takes about 3x longer to get equivalent signal performance compared to the multirate structure. Furthermore, that is even on a floating point platform. The gap would widen considerably on a fixed point dsp.


In general terms:


Down-conversion:


Use 8 stages of halfband,decimate-by-2 filters to transform your 48kHz signal into a 187.5 Hz signal. The first stage of this downsampling can have a very wide transition band, allowing energy to alias as long as it doesn't alias back into the sub 60 Hz range. As the stages progress, the number of taps needs to increase, but they will be applied at a progressively lower sampling rates, so the overall cost of each stage remains small.


Filtering:


Perform your tight filtering around the 60 Hz bw to keep the energy you will eventually want to subtract. There is a double advantage to doing your tight filtering at the low rate:



  1. 1Hz of transition bandwidth is 256 times larger in terms of digital frequency at the low rate vs. the original rate. So every tap of your filter is 256 times as powerful.

  2. The signal itself is at a lower rate, so the filter only needs to process 1/256 the data.



Up-conversion:


Essentially, this is the reverse of the decimation stages. Each of the 8 interpolator stages doubles the rate by estimating the sample that goes between consecutive input samples. The transition band gets wider as the sample rate gets higher.


Subtract:


Subtract your full-rate low-pass filtered signal from the original signal. If you've adjusted for all the group delays properly, the overall structure will be a highpass filter with a narrow transition bandwidth.


No comments:

Post a Comment

readings - Appending 内 to a company name is read ない or うち?

For example, if I say マイクロソフト内のパートナーシップは強いです, is the 内 here read as うち or ない? Answer 「内」 in the form: 「Proper Noun + 内」 is always read 「ない...