# comb filters and fourier transforms for splitting sound into frequencies

Started by April 20, 2005
```hello,

here's the goal: split sound, interval by interval, into frequency
"bins".

here's two alternative possible methods i know of to achieve that:

1. comb filters: look for series of spikes seperated by equally sized
gaps.

2. fourier transforms: i'm sure you know much more about those than me.

how do you think the two method's results will compare? do (or can)
they amount to the same thing or not (just regarding stated goal that
is)? will both be able to get similar results (imagining a good
implementation of both methods) or not? if not, how will they differ?

any thoughts or comments on the possible differences or similarities
between those two different methods (regarding only splitting sound
into its frequencies) would be much appreciated.

thanks, ben.
```
```Ben,

I hate to sound repetative, but a Fourier transform will give you
exactly what you want.  It will seperate the spectum into "bins", but
it will be a continuous bin system, because it's no longer in the time
domain.   A comb filter is good, if you know what frequencies you're
looking for, and what you want to filter out.  A fourier transform is
not a filter, it's just a tool in a mathmatician and engineers back
pocket that can give a better understanding of what "bins" you're
working with, and which "bins" to filter.

To compare the two methods:  Well, if you use DFTs or FFTs to get the
frequency spectrum, you're going to be far better off when trying to
filter your signal.  You will have to use a filter either way, however,
but knowing what you're filtering beforehand, or dynamically is what
you should consider.

Can they amount to the same thing:  If you're lucky, and you know what
you're doing.  Honestly, I really don't, and I'm just getting into some
of these things myself...you should check out Matlab analysis before
modelling whatever you want to build, or try it out!

How will they differ: If you don't use DFTs or FFTs, you're goign to
get some frequencies that you didn't know were in your signal...in your
signal.  If you use DFT or FFT in conjunction, you will find where the
frequency components are, and do whatever  necessary with them you'd
like.

```
```In article <1114018758.620162.325100@l41g2000cwc.googlegroups.com>,
Benry <henrybg@gmail.com> wrote:

> Ben,
>
> I hate to sound repetative, but a Fourier transform will give you
> exactly what you want.  It will seperate the spectum into "bins", but
> it will be a continuous bin system, because it's no longer in the time
> domain.

yup i see.

> A comb filter is good, if you know what frequencies you're
> looking for, and what you want to filter out.  A fourier transform is
> not a filter, it's just a tool in a mathmatician and engineers back
> pocket that can give a better understanding of what "bins" you're
> working with, and which "bins" to filter.
>
> To compare the two methods:  Well, if you use DFTs or FFTs to get the
> frequency spectrum, you're going to be far better off when trying to
> filter your signal.  You will have to use a filter either way, however,
> but knowing what you're filtering beforehand, or dynamically is what
> you should consider.
>
> Can they amount to the same thing:  If you're lucky, and you know what
> you're doing.

right, excellent (if you're right that is) -- that's what i was trying
to get at. in theory, the two methods (fourier transfroms and comb
filters) both _can_ (in the right conditions) give the same
type/level/quality of results -- from an end results point of view one
method's not fundamentally restricted or incapable or different
compared with the other (apart from the practicalities you mention).
their results (if both methods are carried out well or/and with luck)
aren't necessarily bound to be inherently different to each other in
some way. they _can_ give much the same results.

> Honestly, I really don't, and I'm just getting into some
> of these things myself...you should check out Matlab analysis before
> modelling whatever you want to build, or try it out!
>
> How will they differ: If you don't use DFTs or FFTs, you're goign to
> get some frequencies that you didn't know were in your signal...in your
> signal.  If you use DFT or FFT in conjunction, you will find where the
> frequency components are, and do whatever  necessary with them you'd
> like.

yes, i understand. most helpful --thanks very much.

ben.
```
```On Wed, 20 Apr 2005 16:07:29 GMT, ben <x@x.x> wrote:

>hello,
>
>here's the goal: split sound, interval by interval, into frequency
>"bins".

Hello,

I'll take a few minutes to help.

Ben, no one knows for sure what the words
"split sound" means.  They can guess what it
means, but they cannot be sure what *you*
mean.  No one knows for sure what the words
"interval by interval" means.  They can guess
what it means, but they cannot be sure what *you*
mean.

concise, unambiguous words.

Good luck,
[-Rick-]

```
```Benry wrote:
> Ben,
>
> I hate to sound repetative, but a Fourier transform will give you
> exactly what you want.  It will seperate the spectum into "bins", but
> it will be a continuous bin system, because it's no longer in the time
> domain.   A comb filter is good, if you know what frequencies you're
> looking for, and what you want to filter out.  A fourier transform is
> not a filter, it's just a tool in a mathmatician and engineers back
> pocket that can give a better understanding of what "bins" you're
> working with, and which "bins" to filter.

Beg to differ, but it has been shown in the literature that the DFT is
indeed a special case of a multirate filter bank.

>
> To compare the two methods:  Well, if you use DFTs or FFTs to get the
> frequency spectrum, you're going to be far better off when trying to
> filter your signal.  You will have to use a filter either way, however,
> but knowing what you're filtering beforehand, or dynamically is what
> you should consider.
>
> Can they amount to the same thing:  If you're lucky, and you know what
> you're doing.  Honestly, I really don't, and I'm just getting into some
> of these things myself...you should check out Matlab analysis before
> modelling whatever you want to build, or try it out!
>
> How will they differ: If you don't use DFTs or FFTs, you're goign to
> get some frequencies that you didn't know were in your signal...in your
> signal.  If you use DFT or FFT in conjunction, you will find where the
> frequency components are, and do whatever  necessary with them you'd
> like.
>
```
```In article <42671ef4.221922109@news.sf.sbcglobal.net>, Rick Lyons
<R.Lyons@_BOGUS_ieee.org> wrote:

> On Wed, 20 Apr 2005 16:07:29 GMT, ben <x@x.x> wrote:
>
> >here's the goal: split sound, interval by interval, into frequency
> >"bins".
>
> Ben, no one knows for sure what the words
> "split sound" means.

"split sound,... , into frequency bins" that is. each bin corresponding
to different smaller (than the full range of frequencies in the sound)
continuous ranges of frequencies.

prorgramatically be aware of which frequencies are occuring in a sound.

a sound recording contains multiple frequencies and those frequencies
are overlapping and intermixed together in a single stream of data.
instead of having only one stream i'd like to have multiple
streams/bands, each stream for a particular range of frequencies. split
a sound recording into its frequencies. give my computer code the
ability to distinguish what frequencies of sound are occuring at a
particular moment, because without splitting the sound into frequencies
all my code can say is that there is or isn't sound occuring at a given
moment, not what frequencies are occuring.

> No one knows for sure what the words
> "interval by interval" means.

rather than treat the whole sound (say 5 minutes of it) in one go treat
it in much smaller intervals of time -- so, be aware of when the sounds
are occuring.

hope that's clearer now. if not please let me know in what way it's not
clear and i'll try, if i can, to clarify it.

thanks very much, ben.
```
```ben wrote:
> In article <42671ef4.221922109@news.sf.sbcglobal.net>, Rick Lyons
> <R.Lyons@_BOGUS_ieee.org> wrote:
>
>
>>On Wed, 20 Apr 2005 16:07:29 GMT, ben <x@x.x> wrote:
>>
>>
>>>here's the goal: split sound, interval by interval, into frequency
>>>"bins".
>>
>>Ben, no one knows for sure what the words
>>"split sound" means.
>
>
> "split sound,... , into frequency bins" that is. each bin corresponding
> to different smaller (than the full range of frequencies in the sound)
> continuous ranges of frequencies.
>
> prorgramatically be aware of which frequencies are occuring in a sound.
>
> a sound recording contains multiple frequencies and those frequencies
> are overlapping and intermixed together in a single stream of data.
> instead of having only one stream i'd like to have multiple
> streams/bands, each stream for a particular range of frequencies. split
> a sound recording into its frequencies.

A crossover network used to feed different reproducers different
frequency ranges is an example of this. An extended version of this is a
filter bank. You might want to look at the inner workings of a "light
organ".

>                                                 give my computer code the
> ability to distinguish what frequencies of sound are occuring at a
> particular moment, because without splitting the sound into frequencies
> all my code can say is that there is or isn't sound occuring at a given
> moment, not what frequencies are occuring.
>
>
>>No one knows for sure what the words
>>"interval by interval" means.
>
>
> rather than treat the whole sound (say 5 minutes of it) in one go treat
> it in much smaller intervals of time -- so, be aware of when the sounds
> are occuring.

You have a problem here. The longer the section of sound you analyze,
the more finely you can discriminate between frequencies close together.
The shorter the time allowed for analysis, the fewer "bins" you can
meaningfully have, and the fuzzier the boundaries between them. The
situation is analogous to Heisenberg's Uncertainty Principle of quantum
mechanics: if you know the momentum of a particle precisely, you can
have no idea of where it is. Conversely, if you know its location
precisely, you can have no idea how fast it moves. The analogy is
deeper: The product of the momentum and location uncertainties is fixed,
just as, with sound analysis, the product of the frequency and time
uncertainties is fixed.

> hope that's clearer now. if not please let me know in what way it's not
> clear and i'll try, if i can, to clarify it.

Let's stick with it.

> thanks very much, ben.

You're welcome.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```ben wrote:
> "split sound,... , into frequency bins" that is. each bin corresponding
> to different smaller (than the full range of frequencies in the sound)
> continuous ranges of frequencies.
>
> prorgramatically be aware of which frequencies are occuring in a sound.
>
> a sound recording contains multiple frequencies and those frequencies
> are overlapping and intermixed together in a single stream of data.
> instead of having only one stream i'd like to have multiple
> streams/bands, each stream for a particular range of frequencies.

I hope this does not offend you, but...

You do realize that the FFT does NOT produce a stream of data for every
frequency bin, don't you?  Rather, it produces a single complex number
for each bin.  The real portion of that number can be interpretted as
the amplitude of a cosine wave whose frequency equals the "bin"
frequency.  The imaginary part represents the amplitude of a sine wave
of that frequency.  A rectangular to polar conversion of this number
will give you tha amplitude and phase of a sinusoid of that frequency.

The output of a filter OTOH /is/ a stream of data.

--
Jim Thomas            Principal Applications Engineer  Bittware, Inc
jthomas@bittware.com  http://www.bittware.com    (603) 226-0404 x536
Things could be a lot better around here, but worse is more likely - Calvin
```
```A representation of what the Bins contain is all that is needed,
correct?  The amplitude and frequency is what is needed.  I know that
the bins are...well, the full FFT spectrum is just the additions of
infinite sinc() functions...at least...well it's friday, so don't
murder me for being ignorant.

```
```Benry wrote:
> A representation of what the Bins contain is all that is needed,
> correct?  The amplitude and frequency is what is needed.  I know that
> the bins are...well, the full FFT spectrum is just the additions of
> infinite sinc() functions...at least...well it's friday, so don't
> murder me for being ignorant.

It's not a question of ignorance, but of getting what you want.

The bins of an FFT are spaced equally in frequency

The number of FFT bins is determined by the number of samples used in
the FFT.

The finer the bin spacing, the longer it takes to collect enough samples
for the FFT.

For each bin, you get one sample per FFT.

Conclusion: the finer your frequency information, the less frequently
you get it.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```