• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

FFT on audio... some problems

Not open for further replies.


New Member
Hi all,

I'm trying to perform an FFT on music to extract beats and do light post-processing on them and, finally, pipe it back out to headphones.

As such, since we're working with music, the frequency spectrum ranges from 20Hz - 20kHz, roughly.

According to here, for FFTs in general:
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.
So, in theory, if I want to perform an FFT on a music clip in the audible frequency spectrum, this means I need 50ms sample (because of the lowest frequency being 20Hz).

Then, still in theory, if I want to process frequencies to the upper range of 20kHz, according to ol' Nyquist, this means I'll have to sample at 40kHz (lets go with 44.1kHz to stick to standard).

This equates to... 2205 samples!!!! (.000022675737 sec/sample and .05 second sample duration). And performing an FFT on 2205 samples is a massive computational task too expensive to perform in series with real time signal acquisition and processing (only 256 samples takes 0.0006 sec with the C30 compiler).

I feel like I'm doing something wrong.

So, I'm left wondering:
a.) Am I getting this all right?
b.) What is the best way to do this? dsPICs can be used for spectrum analyzers so certainly this is possible, no?

Perhaps a bandpass filter for a few different frequencies is optimal here? Or a narrower FFT frequency range? What would the best solution be for this application? Anyone?
Last edited:


New Member
I don't know much about the subject but am interested to see where this goes, so I think it deserves a bump.

in my limited knowledge, your idea for splitting the frequencies up with a filter might work... could you run several dsPICs in parallel, one for each filter output? then each of them would have fewer samples to work on. then your nyquist freq. for each dsPIC would only be twice the highest frequency of that particular band, and the sample duration would only have to be as long as the lowest frequency in that band.

so for bass band youd have long samples, but way lower nyquist freq
midband medium sample length and medium sample freq
high frequencies would have short sample length but a high nyquist

you could split it up further if necessary.

however, I really know nothing about the subject, I'm just working on what you have written here.


Well-Known Member
Most Helpful Member
Doing real time FFTs of audio does require a lot of processing power. That's why you may have to use a dedicated high speed DSP such as from TI or Analog Devices for such full bandwidth analysis.

But to reduce the required processing you might reduce the upper and lower frequency limits of the signal you analyze. There is not a lot of music information above 5KHz and certainly very little above 10KHz. Also there is not a lot of bass information below 100Hz and very little below 50Hz. So reducing the analysis bandwidth can significantly reduce your processing requirements and perhaps not significantly affect the extraction of the information you are looking for.

For example a BW of 100Hz to 10KHz would require only 200 samples.

Remember, to minimize alias sampling effects, you need to have a good active-filter in front of the A/D converter to roll-off any frequencies above the highest you are analyzing.


New Member
The points of FFT for digital audio applications depends on the resolution of interest in frequency domain. If you really need to deal with the frequency component with 20Hz resolution (it is different idea from the lowest frequency of interest), you indeed need large number of points in each frame. But such kind application is really few, even in professional audio processes.

A lot of DSProcessors running at +200MHz can handle 1K, 2K points FFT, particularly the one with multi-MAC architecture.

Sounds like your app needs huge MIPs, you need IFFT as well as windowing also.
Not open for further replies.

Latest threads

EE World Online Articles