Forums

Audio filtering

Started by Sreeram December 25, 2004
<sreeram@spymac.com> wrote in message 
news:1104374614.777745.135800@c13g2000cwb.googlegroups.com...
> Thank you, Jon, for your patience. > >> >>>Are you saying, after a bandpass filtering I need to run the same >>>through a low pass and high pass filter to get the correct output? >> >> >> No, I'm saying you might get better results by running the signal > through the >> biquad multiple times, i.e. feed the filtered output back into the > biquad input. >> >> > > Now I have generated coefficients for 1 biquad. I cannot use same > biquad coeffcients for further filtering. right? How I should calculate > further biquad coefficients for further filtering?
Actually, you can. It may not be the optimal filter, but will certainly provide additional filtering. Another thing you could try is to design a filter that is somewhat wider then you have now. Applying that multiple times may give better results. Do you have a way a viewing the frequency response of the biquad filter? Using that is a good way to see what is going on and design the appropriate filters. Matlab or one of it's clones is a good tool. Or I have used Excel, deriving the magnitude response of the filter from the s-domain equations in the cookbook: substitute s = jw, and find the magnitude of the (complex) function. Maybe there are on-line tools as well?
> Also, could you please recomend me some book which describes about > filters in audio programming(with some C/C++ code if it is available)? > It would be better if that book is available in asian countries. Many > good foreign technical books will not get in India. (normally)
Maybe someone else can help with this.
Yes. I am using a spectrum analyzer tool. I have a loopback driver
which can route the sound output to sound input. And using a third
party spectrum analyser tool I am seeing the response.

The main problem I am facing is with lower frequencies. Say, I am doing
a filtering 5000 to 10000Hz, after filtering few times with the same
biquad coefficients the frequencies out side the highband ie;  >10000Hz
(in this case) are filtered out. But in below lowerband edges  ie;
<5000Hz, I am still seeing the signal with the analyser tool.  I tried
lowpass, highpass and bandpass and also with various combinations.

Could you please provide me little more help?

"Another thing you could try is to design a filter that is somewhat
wider then you have now. "

Could you explain the meaning of this? Thanks.
Thank you for your time,
Sreeram.

Yes. I am using a spectrum analyzer tool. I have a loopback driver
which can route the sound output to sound input. And using a third
party spectrum analyser tool I am seeing the response.

The main problem I am facing is with lower frequencies. Say, I am doing
a filtering 5000 to 10000Hz, after filtering few times with the same
biquad coefficients the frequencies out side the highband ie;  >10000Hz
(in this case) are filtered out. But in below lowerband edges  ie;
<5000Hz, I am still seeing the signal with the analyser tool.  I tried
lowpass, highpass and bandpass and also with various combinations.

Could you please provide me little more help?

"Another thing you could try is to design a filter that is somewhat
wider then you have now. "

Could you explain the meaning of this? Thanks.
Thank you for your time,
Sreeram.

Jon Harris wrote:
> <sreeram@spymac.com> wrote in message > news:1104374614.777745.135800@c13g2000cwb.googlegroups.com... > > Thank you, Jon, for your patience. > > > >> > >>>Are you saying, after a bandpass filtering I need to run the same > >>>through a low pass and high pass filter to get the correct output? > >> > >> > >> No, I'm saying you might get better results by running the signal > > through the > >> biquad multiple times, i.e. feed the filtered output back into the > > biquad input. > >> > >> > > > > Now I have generated coefficients for 1 biquad. I cannot use same > > biquad coeffcients for further filtering. right? How I should
calculate
> > further biquad coefficients for further filtering? > > Actually, you can. It may not be the optimal filter, but will
certainly provide
> additional filtering. Another thing you could try is to design a
filter that is
> somewhat wider then you have now. Applying that multiple times may
give better
> results. > Do you have a way a viewing the frequency response of the biquad
filter? Using
> that is a good way to see what is going on and design the appropriate
filters.
> Matlab or one of it's clones is a good tool. Or I have used Excel,
deriving the
> magnitude response of the filter from the s-domain equations in the
cookbook:
> substitute s = jw, and find the magnitude of the (complex) function.
Maybe
> there are on-line tools as well? > > > Also, could you please recomend me some book which describes about > > filters in audio programming(with some C/C++ code if it is
available)?
> > It would be better if that book is available in asian countries.
Many
> > good foreign technical books will not get in India. (normally) > > Maybe someone else can help with this.
The following book can help you to understand how to write a FIR or IIR filter routine in C++ (real time processing). C++ Algorithms for Digital Signal Processing, By Paul Embree, Damon Danieli. Published by Prentice Hall PTR. good luck gold
<sreeram0425@gmail.com> wrote in message
news:1104389793.368700.234820@c13g2000cwb.googlegroups.com...
> Yes. I am using a spectrum analyzer tool. I have a loopback driver > which can route the sound output to sound input. And using a third > party spectrum analyser tool I am seeing the response.
I was thinking of a software tool to show the magnitude vs. frequency graph of the filter itself, but you probably can use this method too. Put in a white noise signal and look at the output spectrum. I want you to see what a biquad IIR bandpass filter really does and doesn't do to get a better feel for this process.
> The main problem I am facing is with lower frequencies. Say, I am doing > a filtering 5000 to 10000Hz, after filtering few times with the same > biquad coefficients the frequencies out side the highband ie; >10000Hz > (in this case) are filtered out. But in below lowerband edges ie; > <5000Hz, I am still seeing the signal with the analyser tool. I tried > lowpass, highpass and bandpass and also with various combinations.
Is the low-frequency signal attenuated at least somewhat? Compare the input to the output and see how much attenuation it is receiving. Also, knowing how much below 5000Hz this signal is would be important information. A signal at 4000Hz would not be attenuated nearly as much as one at say 40 Hz.
> Could you please provide me little more help? > > "Another thing you could try is to design a filter that is somewhat > wider then you have now. " > > Could you explain the meaning of this? Thanks. > Thank you for your time, > Sreeram.
If your current filter is for example one octave wide, then when you use multiple filters, I have found it useful to make each one be say 1.5 octaves wide. This keeps the pass band more flat. Having a filter design tool that lets you quickly see the effects of this change is very useful.
in article 33ivssF3vnhtlU1@individual.net, Jon Harris at
goldentully@hotmail.com wrote on 12/30/2004 13:32:

> I was thinking of a software tool to show the magnitude vs. frequency graph of > the filter itself, but you probably can use this method too. Put in a white > noise signal and look at the output spectrum. I want you to see what a biquad > IIR bandpass filter really does and doesn't do to get a better feel for this > process.
if what you want is code to display the mag (usually in dB) vs. freq (usually log freq) given the filter parameters or coefficients, that is very doable. i have math/code that can do it for a fixed-point or single-precision floating-point (bad things happen to cos(w) when w gets close to zero, which are many octaves, especially if Fs = 96 kHz or higher) but it ain't public domain. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
> > The following book can help you to understand how to write a FIR or IIR > > filter routine in C++ (real time processing). > > C++ Algorithms for Digital Signal Processing, > By Paul Embree, Damon Danieli. > Published by Prentice Hall PTR. > > good luck > gold >
Do you know this book has an electronic version? Unfortunatly it is not available here, for me to get one. Thank you, Sreeram.
> Do you know this book has an electronic version? Unfortunatly it is
not
> available here, for me to get one. >
I don't think so, it has an electronic version. you can check the following link for C++ implementation of FIR and Biquad (IIR) filters under the section "Selected C++ Implementations" http://www-ccrma.stanford.edu/~jos/filters/Welcome.html and do a reverse engineering to understand and modify for your own requirements. Hope this will be helpful for you gold