Hello, here is another example if one tries to explain something, the closer to the reality, the complicated the stuff. A have a comment to the text below: On Tue, 31 Aug 1999, Steve Thackery wrote: > I'll have another go at summarising FFT for beginners (of which I count as > one). As I mentioned, please ignore the previous attempt! Here goes: > > The highest frequency you can extract is half the sampling > frequency. In other words, if you sample at 10kHz then the highest > frequency you can pull out is 5kHz (this is known as the Nyquist frequency). > > The lowest frequency you can extract is 1 / duration of sound bite. So, if > your soundbite is 100ms long, then the lowest frequency you can extract is > 10Hz. With a 2 second long soundbite your lowest extractable frequency is > 0.5Hz, and so on. > > The rest of the steps in the FFT output are multiples (harmonics) of that > lowest frequency. So, with our 100ms soundbite the first item in the FFT > output represents 10Hz, the next represents 20Hz, and so on up to the > Nyquist frequency. (This is just a better way of explaining what I said in > my previous attempt). > > Most FFT engines require you to present them with a soundbite which is > exactly a power of 2 samples long. In other words, the soundbite must > consist of 4, 8, 16, ........ 256, 512, 1024, 2048, etc samples. If your > soundbite isn't the right length, you can either truncate it down to the > previous power of 2, or you can pad it with zeroes up to the next power of > two. For example, if your soundbite is (say) 700 samples long you must > either chop it back to 512, or pad it to 1024. Generally padding is the > better bet if you can spare the processing time. Both can cause > complications if you are using a "window" (which is too heavy to go into > now). Stress the word *Most* above. There are another engines not suffering under this requirement but they are too complicated to do it with a PIC in real time, I guess (they use prime factorization). Do not forget, that padding as described above introduces some distorsion into the results, e.g. because of the length of the soundbite and such way the spectral resolution also changes. > > The industry standard sampling rates we tend to use (e.g. 11025Hz, 22050Hz, > etc), combined with the need to adjust the length of the soundbite to be a > power of 2, means that the frequencies in the FFT output are usually > fractional numbers rather than integers. For example, a soundbite of 1024 > samples, which was recorded at 11025Hz, gives us a bottom frequency of > 10.766Hz, the next frequency is 21.533Hz, and so on up to 5512.5Hz. Did not know, but sounds convincing. (E. g. older sound cards with the famous 44.1 kHz sampling freq) > > Finally, to repeat: filter out everything above the Nyquist frequency > *before* you do the sampling. In other words, the filtering needs to be > done in the analogue domain. For example, with a 11025Hz sampling > frequency, you would filter out everything above 5.5kHz. The reason for > this is that frequencies above the Nyquist frequency get "mirrored" back > into the 0 to 5kHz range and give you misleading results. More exactly, they - together with the sampling process - produce components which really do not exist. They are called "aliasing" and the filter described above is the so-called anti-aliasing filter as referred in the most textbook. > > Steve Thackery > Suffolk, England. > Web Site: http://www.btinternet.com/~stevethack/ > > Regards, Imre