# Designing a Notch filter for Digital Audio to be able to work with all audio sampling frequencies

I am currently designing an FIR notch filter using Matlab Filter Design & Analysis tool. I created a notch filter at desired notch frequency (lets say f0) with sampling frequency of 44.1kHz. But I found that the same notch filter is not able to filter-out/attenuate the desired frequency in other audio signals with different sampling rates.

Is it possible to design a single notch filter that works for all audio sampling frequencies.

FYI, I have tried with designing a notch filter with highest sampling frequency, but it is not working for audio with sampling rate other than what it is designed for?

Can somebody help me/provide me a lead in designing such a notch filter?

• Can you please clarify what does this "it doesn't work at different sample rates" means? If its centre frequency appears to "shift" with a varying sampling frequency then that is expected. – A_A Sep 20 '16 at 11:18

## 2 Answers

What you want is impossible. The notch frequency is always relative to the sampling frequency, so you design a notch filter with a given ratio $f_{notch}/f_s$. What you need to do is design different notch filters for different sampling frequencies. The same is of course true for cut-off frequencies of frequency selective filters, center frequencies, etc.

By the way, considering computational complexity, IIR filters are usually better for implementing notch filters than FIR filters.

• Also, is there a mathematical way to maintain specified attenuation at the designed notch frequency. As I told before, I have created a notch filter with fs=44100 Hz. When I applied this filter on a 44.1kHz audio file, the attenuation is less than expected from the filter's frequency response. In fact, when I created another notch filter with fs=88.2kHz and applied on corresponding audio file, attenuation is much less than expected. How is it explained? What should be done in such cases? – Oldman Sep 21 '16 at 12:13
• @Oldman: You should add this to your question together with links to relevant plots, so we can see what's going on. Do you filter the audio signal in matlab? – Matt L. Sep 21 '16 at 17:56

You can design the impulse response of a sample-rate-independant notch filter, but this impulse response will have to be (re)sampled for the sample rate at which it is to be used to scale it to the appropriate frequency range.