DSPRelated.com
Forums

DFT and bandpass filters

Started by Michel Rouzic June 2, 2005
Michel Rouzic wrote:
> I've a program that does a bandpass filtering using DFT.
...
> Can someone tell me how to make a correct bandpass filter?
I suppose that you don't need to FFT/IFFT to make a band-pass filter. With an overlap method, that amounts to a convolution in the time domain. It's a good way for high-performance filters, but direct convolution is simpler, and IIR filters take less computer time. You don't seem to care about phase. Read appropriate chapters from the free book available on line at http://www.dspguide.com. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
in article lImdnU7z7ur4XD3fRVn-sw@comcast.com, Frunobulax at
jlawrence@comcast.net wrote on 06/03/2005 16:45:

> I realize that, I am just giving the simplest thing to do. Seems to me if > you add the transfer functions in the s-domain for the two filters you will > arrive at a bandpass filter with a second order polynomial in the > denominator, something like Bs/(s^2+Bs+w^2), where B is quality factor and w > is bandpass center frequency.
the transfer function for an analog BPF might better be expressed as H(s) = Bs/(s^2 + Bws + w^2) (note the linear term in denom) where where B is the *reciprocal* of the quality factor and w is bandpass center frequency. check out the cookbook (it's now at the music-dsp site) for a simple "recipe" to do a BPF in the digital domain. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Jerry Avins wrote:

   ...

> I suppose that you don't need to FFT/IFFT to make a band-pass filter.
Fah! I meant "I suppose you know that you don't need to FFT/IFFT to make a band-pass filter. �������� Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Thank you, you are right, I was going from fuzzy memory.

"robert bristow-johnson" <rbj@audioimagination.com> wrote in message 
news:BEC63D62.7EF2%rbj@audioimagination.com...
> in article lImdnU7z7ur4XD3fRVn-sw@comcast.com, Frunobulax at > jlawrence@comcast.net wrote on 06/03/2005 16:45: > >> I realize that, I am just giving the simplest thing to do. Seems to me if >> you add the transfer functions in the s-domain for the two filters you >> will >> arrive at a bandpass filter with a second order polynomial in the >> denominator, something like Bs/(s^2+Bs+w^2), where B is quality factor >> and w >> is bandpass center frequency. > > the transfer function for an analog BPF might better be expressed as > > H(s) = Bs/(s^2 + Bws + w^2) (note the linear term in denom) > > where where B is the *reciprocal* of the quality factor and w is bandpass > center frequency. > > check out the cookbook (it's now at the music-dsp site) for a simple > "recipe" to do a BPF in the digital domain. > > -- > > r b-j rbj@audioimagination.com > > "Imagination is more important than knowledge." > >
http://www.musicdsp.org/  is the link for that music dsp site by the way.

"Frunobulax" <jlawrence@comcast.net> wrote in message 
news:gsednTjJs-X8QT3fRVn-2A@comcast.com...
> Thank you, you are right, I was going from fuzzy memory. > > "robert bristow-johnson" <rbj@audioimagination.com> wrote in message > news:BEC63D62.7EF2%rbj@audioimagination.com... >> in article lImdnU7z7ur4XD3fRVn-sw@comcast.com, Frunobulax at >> jlawrence@comcast.net wrote on 06/03/2005 16:45: >> >>> I realize that, I am just giving the simplest thing to do. Seems to me >>> if >>> you add the transfer functions in the s-domain for the two filters you >>> will >>> arrive at a bandpass filter with a second order polynomial in the >>> denominator, something like Bs/(s^2+Bs+w^2), where B is quality factor >>> and w >>> is bandpass center frequency. >> >> the transfer function for an analog BPF might better be expressed as >> >> H(s) = Bs/(s^2 + Bws + w^2) (note the linear term in denom) >> >> where where B is the *reciprocal* of the quality factor and w is bandpass >> center frequency. >> >> check out the cookbook (it's now at the music-dsp site) for a simple >> "recipe" to do a BPF in the digital domain. >> >> -- >> >> r b-j rbj@audioimagination.com >> >> "Imagination is more important than knowledge." >> >> > >

Andor wrote:
> Michael: > > > my plan is to do bandpasses to > > build a spectrogram > > Can't you just take the output of the DFT for your spectrogram? Why > convert the signal back to time domain?
um... because i want to make it based on the envelope of a filtered band (basically i want to make a spectrogram that's logarithmic base 2 on the frequency scale, so i gotta do a bandpass filter on specific frequencies, something i could hardly do right if i took like 256 time samples and DFTed it)

Jerry Avins wrote:
> Michel Rouzic wrote: > > I've a program that does a bandpass filtering using DFT. > > ... > > > Can someone tell me how to make a correct bandpass filter? > > I suppose that you don't need to FFT/IFFT to make a band-pass filter. > With an overlap method, that amounts to a convolution in the time > domain. It's a good way for high-performance filters, but direct > convolution is simpler, and IIR filters take less computer time. You > don't seem to care about phase. > > Read appropriate chapters from the free book available on line at > http://www.dspguide.com. > > Jerry > -- > Engineering is the art of making what you want from things you can get. > =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=
=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF um... i need help : i read all the definitions of convolution on google but i still dont understand what it does when it comes to DSP. yeah i guess that doing a FFT and a IFFT for each band i wanna pass is not the most efficient way, but i wouldnt know how to deal with FIR/IIR, and since i understand FFT i like to stick to what i know. and yeah I dont think i care for phase to much
Michel Rouzic wrote:
> > Jerry Avins wrote: > >>Michel Rouzic wrote: >> >>>I've a program that does a bandpass filtering using DFT. >> >> ... >> >> >>>Can someone tell me how to make a correct bandpass filter? >> >>I suppose that you don't need to FFT/IFFT to make a band-pass filter. >>With an overlap method, that amounts to a convolution in the time >>domain. It's a good way for high-performance filters, but direct >>convolution is simpler, and IIR filters take less computer time. You >>don't seem to care about phase. >> >>Read appropriate chapters from the free book available on line at >>http://www.dspguide.com. >> >>Jerry >>-- >>Engineering is the art of making what you want from things you can get. >>&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295; > > > um... i need help : i read all the definitions of convolution on google > but i still dont understand what it does when it comes to DSP. > > yeah i guess that doing a FFT and a IFFT for each band i wanna pass is > not the most efficient way, but i wouldnt know how to deal with > FIR/IIR, and since i understand FFT i like to stick to what i know. and > yeah I dont think i care for phase to much >
I once had to construct a phonocardiogram system. I went the FFT/IFFT route because I needed to have a precise time alignment between outputs of the different bands, hence FIR filters of equal length for each band. It wasn't that bad because you only need one forward FFT which you share for all the bands.
Michel Rouzic wrote:
> > Andor wrote: > >>Michael: >> >> >>>my plan is to do bandpasses to >>>build a spectrogram >> >>Can't you just take the output of the DFT for your spectrogram? Why >>convert the signal back to time domain? > > > um... because i want to make it based on the envelope of a filtered > band (basically i want to make a spectrogram that's logarithmic base 2 > on the frequency scale, so i gotta do a bandpass filter on specific > frequencies, something i could hardly do right if i took like 256 time > samples and DFTed it)
If course you can do that. The output of the overall DFT consists of many bins, each the same range of frequencies, covering (say) the audio band. First, convert Re and Im to amplitude. (I don't think you need the phase: right? Amplitude squared is easier, and just as good for converting to dB.) Sum the amplitudes of all the bins that lie in the range of one display bar. Going by octaves for example, 15 to 30 Hz, 30-60, 60-120, 120-240, 240-480, 480-960, 960-1920, 1920-3840, .... Those sums are your logarithmically-spaced spectral energies. There may be a better way than mine -- I haven't thought about it much or looked to see what's usually done, but my way gets the same results as yours with much less processing, hence less latency. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Michel Rouzic wrote:
> Andor wrote: > > Michael: > > > > > my plan is to do bandpasses to > > > build a spectrogram > > > > Can't you just take the output of the DFT for your spectrogram? Why > > convert the signal back to time domain? > > um... because i want to make it based on the envelope of a filtered > band (basically i want to make a spectrogram that's logarithmic base 2 > on the frequency scale, so i gotta do a bandpass filter on specific > frequencies, something i could hardly do right if i took like 256 time > samples and DFTed it)
The simplest thing would be to take a large FFT (say 4N or 8N, where N is the number of points of the logarithmic spectrogram) and interpolate in the low frequency band and average in the high frequency bands. The point is that even a large FFT is computationally much more efficient (and also simpler to program) than a number of logarithmically spaced bandpass filters (implemented using fast convolution filtering). By the way, for very efficient bandpass filters, you might want to have a look at frequency sampled FIR filter architecture (discussed in Lyons'or O & S books). Regards, Andor