IPB

Welcome Guest ( Log In | Register )

FFT Analysis for Dummies
Ethan Winer
post Mar 27 2010, 21:41
Post #1





Group: Members
Posts: 248
Joined: 12-May 09
From: New Milford, CT
Member No.: 69730



Folks,

I'd like to learn more about FFTs. I'm not a math guy, so I imagine I'll never fully understand all the nuances. But I'd like to try anyway. I understand the general concept, that an FFT shows how much energy is present at different frequencies. What I'd like to know is how to set the various parameters such as FFT Size and Overlap, when to use the different types of window smoothing and why, and so forth. Below is a list of settings in the Rightmark FFT analyzer with my associated questions, and hopefully this is a good place to start.

FFT Size: I understand that the higher the number, the better the frequency resolution. So why is this
even adjustable? Why not just use the highest resolution possible automatically?

Zero Padding: This ranges from None through 8x. What does this do?

FFT Overlap: What is this for, and when would you use higher or lower values?

FFT Window: I recognize some of the names, but have no idea when or why one would select these choices.

Kaiser Window beta: I have no idea what this does either.

I noticed that Sound Forge lets you pick the number of slices to show. What are slices and why is more than
one needed to analyze a Wave file?

I realize this is a lot to ask! If anyone knows of a good newbie-level tutorial that explains this in plain English with minimal math, I'd love to see it. Everything I've found through Google starts right in with math that's way over my head.

--Ethan


--------------------
I believe in Truth, Justice, and the Scientific Method
Go to the top of the page
+Quote Post
 
Start new topic
Replies
benski
post Mar 28 2010, 16:53
Post #2


Winamp Developer


Group: Developer
Posts: 670
Joined: 17-July 05
From: Brooklyn, NY
Member No.: 23375



Answering a bit more than your question asks, for anyone else who might be interested in this thread.

A transform is just a different way of representing the same set of data. If we have three samples, 4, 7 and 12, we could use a polynomial transform and use transformed coefficients of 4, 2, 1 and recreate the original samples through the equation a + b * x + c * x^2 by plugging in x for each sample (f(0) = 4, f(1) = 7, f(2) = 12). We havn't stored any less or any more data by using the transform rather than the samples, and we can change between them without loss.

A fourier transform is the same thing, but the equation to recreate the samples is a + b*sin(x) + c*cos(x) + d*sin(2x) + e*cos(2x) + ...
Taking the fourier transform is done by solving a giant system of equations to determine the correct coefficients to recreate the original samples out of this equation.
The fourier transform has the nice property that it it transforms the sample data into a representation that models the human ear (and other physical systems) very well.

When we take the FT (via FFT or DFT) of a large audio file, we are going to get coefficients representing different frequency bands. Unfortunately, this information gives us only the average energy of each frequency band, not the precise occurrence of the frequency within the song. If you had a weird high-pitch noise in some small section of the song, you could see it in the spectrograph, but would have no idea where it occurs. Just as looking at the streaming of audio samples gives you "time" data but no frequency information. The frequency coefficients of a fourier transform give you "frequency" data but no time information.

To work around this issue, we take the FT of sub-sections of the song called windows. A smaller window gives us less frequency bands, but if we see the weird high-pitched noise, at least we've narrowed it down to the current window. In the FT lingo, you can tradeoff "time resolution" and "frequency resolution" by using smaller or larger windows of audio. In Sound Forge, "FFT Size" corresponds to window size. At the extreme smaller end of window sizes, you have something called "Short Time Fourier Transform" which is often doing an FFT with windows of 4 samples. Wavelets are used when time and frequency resolution need to be adjusted more precisely, but that's a conversation for another day smile.gif

When you see a spectrogram (2D spectrograph over time), it is a series of windowed FTs. Each vertical "strip" is one window.

Windowing the audio, however, causes an annoying artifact. If you were to play the sub-section of audio out of your speakers, you'd likely get a 'click' at the beginning and the end since they don't occur at zero crossings. It shows up as noise in the spectrograph just like it shows up as noise on the speakers. And because you can't tell "where" the noise occurs within the window, there's no way to isolate it out. You can see this phenomenon in low bitrate video as "blocking" artifacts - same reason. A windowing function is using to avoid these blocking artifacts. Conceptually, it fades in the start of the window and fades out the end of the window.

But as you can imagine, a windowing function is also destroying out data. This is where overlap comes in. If we let the windows overlap each other - e.g. first window is samples 0 through 1023 and the second window is samples 512 through 1535, we can avoid destroying the data. This is because the audio we "faded out" during the current window becomes part of the "fade in" of the next window. The downside of the windowing function is that the data has "smeared" itself across two windows. Different windowing functions change the amount of smear, allowing a trade-off between blocking artifacts and smear.

Hope that helps.

This post has been edited by benski: Mar 28 2010, 17:04
Go to the top of the page
+Quote Post
Ethan Winer
post Mar 29 2010, 18:16
Post #3





Group: Members
Posts: 248
Joined: 12-May 09
From: New Milford, CT
Member No.: 69730



Okay, I have a few quick questions:

In Sound Forge I can select a portion of a Wave file for analysis, but I see no equivalent feature in the Rightmark analyzer. Is there a way to do that? If not, where in the file does Rightmark grab the specified number of samples to analyze?

Let's say I have a long wave file and I load it into Sound Forge and select a 5-second section. I understand that the FFT Size is the number of samples to analyze. But if my highlighted section is 5 seconds long, from where does Sound Forge take those samples? Are they contiguous? Does it skip every third sample so the total number (say, 65,536) starts at the beginning of the highlighted area and ends at the end? I realize the total number of samples dictates the lowest frequency that can be read, so that implies contiguous.

I have other questions, but I won't overload y'all for now. Also, assume that the two reasons I want to use FFT are:

1) To measure the frequency response of something, for example after passing white or pink noise through it.

2) To see the spectral content in a music file, as if I were to try to apply EQ in one audio file to match another as Harbal does. I'm not interested in doing such EQ matching! But I might want to know what frequencies are present in a music file and in what amounts.

--Ethan


--------------------
I believe in Truth, Justice, and the Scientific Method
Go to the top of the page
+Quote Post
Alexey Lukin
post Apr 3 2010, 18:52
Post #4





Group: Members
Posts: 191
Joined: 31-July 08
Member No.: 56508



QUOTE (Ethan Winer @ Mar 29 2010, 13:16) *
In Sound Forge I can select a portion of a Wave file for analysis, but I see no equivalent feature in the Rightmark analyzer. Is there a way to do that? If not, where in the file does Rightmark grab the specified number of samples to analyze?

RMAA always analyzes the whole WAV file that you load and averages spectrum over all FFT blocks.
For more flexible analysis (including spectrograms) I recommend downloading a demo of iZotope RX. It doesn't require authorization to perform analysis. Here's a few screenshots:





QUOTE (Ethan Winer @ Mar 27 2010, 16:41) *
FFT Size: I understand that the higher the number, the better the frequency resolution. So why is this
even adjustable? Why not just use the highest resolution possible automatically?

Because smaller FFT size will allow you to spread more FFT windows throughout the file and get less noise variance due to averaging of spectra.


QUOTE (Ethan Winer @ Mar 27 2010, 16:41) *
Zero Padding: This ranges from None through 8x. What does this do?

This is a frequency interpolation of the resulting spectrum, it will allow you to better see what is happening "between the FFT bins".


QUOTE (Ethan Winer @ Mar 27 2010, 16:41) *
FFT Overlap: What is this for, and when would you use higher or lower values?

It tells how densely FFT windows cover the WAV file, and how "evenly" the file is analyzed. More overlap does better averaging of spectrum (more is typically better for this parameter).


QUOTE (Ethan Winer @ Mar 27 2010, 16:41) *
FFT Window: I recognize some of the names, but have no idea when or why one would select these choices.

It's a subtle moment: they control shape of spectral peaks. "Stronger" windows somewhat widen peaks (which can be compensated by increasing FFT size), but suppress "false" surrounding "skirts" around these peaks. Rectangular is "weakest", Kaiser with high "beta" is "strongest".


QUOTE (Ethan Winer @ Mar 27 2010, 16:41) *
Kaiser Window beta: I have no idea what this does either.

It's the strength of a window's ability to suppress "false" surrounding around spectral peaks (at the expense of slight widening of peaks).


QUOTE (Ethan Winer @ Mar 27 2010, 16:41) *
What are slices and why is more than
one needed to analyze a Wave file?

Averaging spectrum across many slices allows you to reduce noise variance and see white or pink noise more as lines rather than clouds of random data.
Go to the top of the page
+Quote Post
Ethan Winer
post Apr 4 2010, 17:47
Post #5





Group: Members
Posts: 248
Joined: 12-May 09
From: New Milford, CT
Member No.: 69730



Thanks very much Alexey! Lots for me to digest. crying.gif

--Ethan


--------------------
I believe in Truth, Justice, and the Scientific Method
Go to the top of the page
+Quote Post

Posts in this topic
- Ethan Winer   FFT Analysis for Dummies   Mar 27 2010, 21:41
- - lvqcl   QUOTE (Ethan Winer @ Mar 27 2010, 23:41) ...   Mar 27 2010, 22:23
|- - Paulhoff   QUOTE (lvqcl @ Mar 27 2010, 17:23) ...   Mar 27 2010, 22:46
- - AndyH-ha   In most music the frequency changes over time. Ver...   Mar 27 2010, 23:36
- - Woodinville   Ok. An FFT is a discrete-time, finite length line...   Mar 28 2010, 01:00
|- - Gumboot   QUOTE (Woodinville @ Mar 28 2010, 00:00) ...   Jan 15 2012, 00:25
|- - Woodinville   QUOTE (Gumboot @ Jan 14 2012, 15:25) QUOT...   Jan 15 2012, 01:26
- - Notat   I'm not a super math dude but I have been read...   Mar 28 2010, 01:55
|- - Woodinville   QUOTE (Notat @ Mar 27 2010, 17:55) The ba...   Mar 28 2010, 05:23
|- - Notat   QUOTE (Woodinville @ Mar 27 2010, 22:23) ...   Mar 28 2010, 14:45
|- - Ethan Winer   Thanks for the advice and links. I thought to Goog...   Mar 28 2010, 16:59
|- - Canar   QUOTE (Notat @ Mar 28 2010, 09:45) Thanks...   Mar 29 2010, 18:35
|- - Woodinville   QUOTE (Notat @ Mar 28 2010, 06:45) QUOTE ...   Mar 30 2010, 00:10
|- - Notat   QUOTE (Woodinville @ Mar 29 2010, 17:10) ...   Mar 30 2010, 03:15
|- - Woodinville   QUOTE (Notat @ Mar 29 2010, 19:15) QUOTE ...   Mar 30 2010, 21:20
- - hellokeith   I had a very informative conversation about transf...   Mar 28 2010, 04:02
|- - Arnold B. Krueger   QUOTE (hellokeith @ Mar 27 2010, 23:02) A...   Mar 28 2010, 04:26
- - honestguv   Ethan, perhaps the best single resource to answer ...   Mar 28 2010, 10:46
- - benski   Answering a bit more than your question asks, for ...   Mar 28 2010, 16:53
|- - Ethan Winer   Okay, I have a few quick questions: In Sound Forg...   Mar 29 2010, 18:16
|- - Arnold B. Krueger   QUOTE (Ethan Winer @ Mar 29 2010, 13:16) ...   Mar 30 2010, 02:14
||- - Ethan Winer   QUOTE (Arnold B. Krueger @ Mar 29 2010, 21...   Mar 30 2010, 21:02
|- - Alexey Lukin   QUOTE (Ethan Winer @ Mar 29 2010, 13:16) ...   Apr 3 2010, 18:52
|- - Ethan Winer   Thanks very much Alexey! Lots for me to digest...   Apr 4 2010, 17:47
- - Woodinville   Note: I generally point at "Fourier Analysis...   Mar 30 2010, 00:13
- - Canar   I say we start with the Z-transform and express ev...   Mar 30 2010, 21:32
|- - Woodinville   QUOTE (Canar @ Mar 30 2010, 13:32) I say ...   Mar 30 2010, 21:50
- - C.R.Helmrich   Back in the days I learned the discrete Fourier tr...   Apr 4 2010, 18:21
|- - Arnold B. Krueger   QUOTE (C.R.Helmrich @ Apr 4 2010, 13:21) ...   Apr 5 2010, 12:21
|- - SebastianG   QUOTE (Arnold B. Krueger @ Apr 5 2010, 12...   Apr 5 2010, 16:39
- - hypervelocity   Hello guys, I'm working on my undergraduate t...   Apr 26 2011, 14:43
|- - Arnold B. Krueger   QUOTE (hypervelocity @ Apr 26 2011, 09:43...   May 2 2011, 13:42
- - pdq   That would depend on the sampling rate of your dat...   Apr 26 2011, 16:16
- - Natalia   Hi guys! I am trying to sort out samples acco...   Jan 12 2012, 08:49
- - xnor   QUOTE (Natalia @ Jan 12 2012, 09:49) I am...   Jan 12 2012, 18:10
- - Natalia   Well, I guess I should've made it clear from t...   Jan 13 2012, 01:49
|- - Woodinville   The irony of this thread being ressurrected is: h...   Jan 13 2012, 02:08
||- - Ethan Winer   QUOTE (Woodinville @ Jan 12 2012, 20:08) ...   Jan 13 2012, 17:48
|||- - Kees de Visser   QUOTE (Ethan Winer @ Jan 13 2012, 18:48) ...   Jan 13 2012, 19:03
||||- - Woodinville   QUOTE (Kees de Visser @ Jan 13 2012, 10:0...   Jan 14 2012, 23:14
|||- - Canar   QUOTE (Ethan Winer @ Jan 13 2012, 08:48) ...   Jan 15 2012, 01:05
||- - Roseval   QUOTE (Woodinville @ Jan 13 2012, 02:08) ...   Feb 1 2012, 23:56
||- - Woodinville   QUOTE (Roseval @ Feb 1 2012, 14:56) QUOTE...   Feb 2 2012, 11:02
|- - C.R.Helmrich   QUOTE (Natalia @ Jan 13 2012, 02:49) I am...   Jan 14 2012, 23:48
- - Natalia   Wish I could attend   Jan 13 2012, 02:55
- - xnor   Natalie, do these stimuli cause spikes every 68 se...   Jan 13 2012, 11:41
- - xnor   QUOTE (Gumboot @ Jan 15 2012, 01:25) I ta...   Jan 15 2012, 00:40
- - Woodinville   Slide deck and octave scripts are up at www.aes.or...   Jan 27 2012, 02:50
|- - neelX   QUOTE (Woodinville @ Jan 27 2012, 03:50) ...   Jan 27 2012, 11:49
|- - Woodinville   QUOTE (neelX @ Jan 27 2012, 02:49) QUOTE ...   Jan 28 2012, 00:13
- - Woodinville   .zip files still fubar. Webmaster pinged.   Jan 28 2012, 05:19
- - Woodinville   .zip fixed.   Jan 28 2012, 11:56
|- - Ethan Winer   QUOTE (Woodinville @ Jan 28 2012, 05:56) ...   Jan 28 2012, 18:50
|- - xnor   The .m files are scripts for GNU Octave, but you c...   Jan 28 2012, 20:01
|- - Ethan Winer   QUOTE (xnor @ Jan 28 2012, 14:01) The .m ...   Jan 29 2012, 19:09
- - Woodinville   So, Ethan, did you run some of the scripts yet? N...   Jan 30 2012, 02:59
|- - Ethan Winer   QUOTE (Woodinville @ Jan 29 2012, 20:59) ...   Jan 30 2012, 18:45
|- - Woodinville   QUOTE (Ethan Winer @ Jan 30 2012, 09:45) ...   Jan 30 2012, 23:59
|- - Ethan Winer   Hey, I watched an FFT tutorial "webinar...   Feb 1 2012, 23:14
|- - xnor   QUOTE (Ethan Winer @ Feb 2 2012, 00:14) I...   Feb 2 2012, 19:37
||- - C.R.Helmrich   Me too. To many people, such a resource will be mo...   Feb 2 2012, 23:14
||- - Roseval   QUOTE (C.R.Helmrich @ Feb 2 2012, 23:14) ...   Feb 2 2012, 23:36
||- - Woodinville   QUOTE (C.R.Helmrich @ Feb 2 2012, 14:14) ...   Feb 6 2012, 06:17
||- - romor   QUOTE (Woodinville @ Feb 6 2012, 07:17) S...   Feb 8 2012, 09:53
||- - Woodinville   QUOTE (romor @ Feb 8 2012, 00:53) QUOTE (...   Feb 9 2012, 03:52
|- - Ethan Winer   QUOTE (Ethan Winer @ Feb 1 2012, 17:14) H...   Feb 28 2012, 18:38
|- - Woodinville   QUOTE (Ethan Winer @ Feb 28 2012, 09:38) ...   Mar 1 2012, 01:01
||- - romor   QUOTE (Woodinville @ Mar 1 2012, 02:01) N...   Mar 1 2012, 15:25
||- - Ethan Winer   QUOTE (Woodinville @ Feb 29 2012, 19:01) ...   Mar 1 2012, 20:03
|- - Arnold B. Krueger   QUOTE (Ethan Winer @ Feb 28 2012, 12:38) ...   Mar 1 2012, 14:00
- - romor   http://www.aes.org/sections/pnw/scripts/   Feb 2 2012, 02:37
|- - Roseval   Thanks   Feb 2 2012, 10:14
- - Speedskater   Were you able to find anyone to make an audio reco...   Feb 2 2012, 15:31
|- - Woodinville   QUOTE (Speedskater @ Feb 2 2012, 06:31) W...   Feb 4 2012, 02:48
|- - Woodinville   QUOTE (Woodinville @ Feb 3 2012, 17:48) Q...   Feb 4 2012, 07:20
- - Woodinville   http://www.aes.org/sections/pnw/pnwrecaps/2012/jj_...   Feb 6 2012, 05:52
- - icstm   thanks for hosting.   Mar 1 2012, 18:43


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th August 2014 - 19:38