Pages: [1]   Go Down
Author Topic: 16-bit FFT Code Tweaking  (Read 1012 times)
0 Members and 1 Guest are viewing this topic.
Manchester, NH
Offline Offline
Full Member
***
Karma: 0
Posts: 116
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm having trouble figuring out how to take 16-bit FFT code work from say 0 - 400 Hz in 64 bins. The default frequency range is around 0 - 4.5KHz (1/2 the 9KHz default sample rate). Not yet sure exactly what I want for upper freq and # bins but would like to know how to use the FFT and interrupts to tailor the freq and # bins.

So a few questions...
What is the sinewave array and how does it relate to FFT size (# of bins)?
How do I use the interrupt timer to change the default 9KHz sample rate to something lower?
Is there a good tutorial that describes tailoring an FFT on the Arduino?
Logged

Offline Offline
Newbie
*
Karma: 5
Posts: 32
Don Bosley (b.1982) is an active composer, guitarist, and music technologist based in New York City.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

First off, based on your questions, I would recommend learning what the FFT actually is and how it works on a fundamental level if you want to try to control it.  Read Appendix C of my master's thesis which is on my website under software, or the appendix of the computer music tutorial by curtis roads.

If you want 64 bins spaced from 0-400, you would need to have a 128 sample window for the FFT, and the sampling rate would have to be 800 Hz.  Remeber, window length needs to always be a power of 2, and your bin spacing is Sampling Rate / Number of Samples per Window. You could also use a higher sampling rate, a longer window, and just use the output of the lower bins where the cutoff is closest to 400Hz.

As far as interrupts, the Interval_Timer library is a pretty good route to write your own interrupt/ADC routine, and then you need to store your samples in blocks of size N for processing by the FFT. If you're clever you can double buffer and overlap your windows so that while one block is being processed, you're still collecting samples for the next block.
Logged

Pages: [1]   Go Up
Jump to: