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:
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?
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: