Sax on the Web Forum banner

1 - 8 of 8 Posts

·
Banned
Joined
·
4,313 Posts
Discussion Starter · #1 ·
I have in the past written DSP software that uses the FFT and its inverse to apply filters to audio waveforms. Most of the time I haven't really understood what I was doing because all the formal explanations I read about those formulae assume the reader knows more than I know. The filters I work with are usually open source algorighms—EQ, slow-downers, pitch changers,and so on. I cannot always tell how those algorithms work by reading the code because I don't fully understand the structure of the frequency domain data.

Here's what I know:

  1. Begin with a block of samples from a waveform. The number of samples must be a power of 2. This is, of course, the time domain.
  2. Pass the sample buffer to the FFT algorithm.
  3. Apply the filter to the resulting buffer, which contains the frequency domain.
  4. Pass the filtered buffer to the iFFT algorithm to convert it back to the time domain.
The explanations I read fail to describe the frequency domain buffer sufficiently that I can understand it. Here's what I think I know:

  1. Each bin in the buffer represents a frequency range.
  2. The bins are 0 to some upper limit, which is determined by the number of bins (I think.)
  3. The value in each bin is a complex number. One part is the frequency's volume; the other part is the phase (0-359) the frequency is at when the waveform begins.

Here's what I do not understand:
  1. If a waveform has a frequency occurring more than once but at different phases, how does the frequency domain represent these data? Or does it need to?
  2. Many algorithms operate on the time domain buffer and then save some part of the end of the filtered time domain buffer to combine with the next buffer occuring in time. I hope that makes sense as I explained it because I do not fully understand what is going on there.
Comments? Please converse as much as possible without advanced mathematical references. It's been too long. You'll lose me. Feel free to disagree with the things that I said I do know. Because I don't really know that I know them. If you know what I mean.
 

·
Registered
Joined
·
1,036 Posts
Al Stevens said:
...
Here's what I do not understand:
  1. If a waveform has a frequency occurring more than once but at different phases, how does the frequency domain represent these data? Or does it need to?
  2. Many algorithms operate on the time domain buffer and then save some part of the end of the filtered time domain buffer to combine with the next buffer occuring in time. I hope that makes sense as I explained it because I do not fully understand what is going on there.
....
1. It doesn't need to, a fourier transform takes the incoming wave form and breaks it into separate fequencies, you dont get the same fequency twice.

I am not going to attempt point two - but I'd like to read an explanation if someone else has one - I suspect that a proper worked example will require some maths...
 

·
Registered
Joined
·
402 Posts
Al Stevens said:
Here's what I do not understand:
  1. If a waveform has a frequency occurring more than once but at different phases, how does the frequency domain represent these data? Or does it need to?
  2. Many algorithms operate on the time domain buffer and then save some part of the end of the filtered time domain buffer to combine with the next buffer occuring in time. I hope that makes sense as I explained it because I do not fully understand what is going on there.
The second point there is a technique called windowing. There are several types of windows (Hamming, HaNNing, Square, etc). The purpose of windowing is to create the least amount of discontinuity between samples. This way there's a more natural progression of the frequency spectrum. The different windows basically shape the amplitude of the adjacent frequencies, because since they weren't from the same continuity, they shouldn't "matter" as much.

I've taken signal processing classes, way back in the day (ok ok, so only 4 years ago). My conversing on this topic may be off, and I would welcome anyone to please set me straight. When I get home, I'm pretty tempted to break open that systems/signals book! Whoever thought that this forum would drive me to something like that? :)
 

·
Banned
Joined
·
4,313 Posts
Discussion Starter · #4 ·
DougR said:
1. It doesn't need to, a fourier transform takes the incoming wave form and breaks it into separate fequencies, you dont get the same fequency twice.
Right. But what if the same frequency occurs at different phases in the same waveform? How does the frequency domain represent this second occurrance of the same frequency? That's my question.

For example, picture a waveform with two sine waves, both at the the same frequency, say 2000 hz, but starting at different phases. One starts at zero, for example, and the other starts at, say, 48 degrees. With only one bin in the frequency domain to represent 2000 hz, and, consequently, only one place to represent the phase at which 2000 hz begins, how does the frequency domain represent both sine waves?

I probably should write a program that generates and mixes sine waves and displays the frequency domain data to see what it does.
 

·
Registered
Joined
·
1,036 Posts
Al Stevens said:
....

I probably should write a program that generates and mixes sine waves and displays the frequency domain data to see what it does.
or - for the traditional users out there - either:
1. plot it on graph paper
2. solve as a trig problem.
 

·
Registered
Joined
·
1,036 Posts
OK - you can show what happens in Excel without any fancy maths
Generate two series - one for a sine wave, and one for the same wave shifted by a suitable phase angle.

Sum these to build a third.

Deduce the single y=Asin(x+q) formula where A is the peak value for the sum and q a matching phase discrepency this is series 4.

Build series five from the differences between 3 and 4.....
 

·
Registered
Joined
·
63 Posts
Al,

If you add two sine waves that have the same frequency, but different phases and amplitudes, you'll get a sine wave at the same frequency, but with some other phase and amplitude.

Does that answer Question 1.?

John
 

·
Banned
Joined
·
4,313 Posts
Discussion Starter · #8 ·
Interesting. Thanks for that answer. I'll have to chart that out. I'm having difficulty visualizing it. What if the two have the same amplitude?
 
1 - 8 of 8 Posts
Top