rickso234:

Would like to have 32 bins, about 312 Hz spaced, for a music to light project. THinking that less bins will run faster on a little Nano. Also would like response up to 10kHz since there’s a lot of music between 5kHz and 10kHz. Default sample rate is 9kHz but read that can be increased and would need a rate near 20kHz.

Is this possible to do or will I be chasing ghosts? What parameters determine the number of bins and will they be wide bins or sharp with no response between bins?

The number of bins is determined purely but the order of the FFT. The resolution is (at best) the reciprocal of the period over which you collect the data. In your case with 10 KHz sample rate and 32 bins the resolution is, as you say, 10000/32 i.e. 312 Hz. The Nyquist criteria means that you only get useful information up to half the sample rate so a 10,000 KHz sample rate only gives you 5 KHz bandwidth. Since you only have 312 Hz resolution you will lose most of the bass.

The FFT assumes the data is periodic and this results in a discontinuity at the end points which spreads information from one bin to neighboring bins. One normally uses a Window to help with the discontinuity and, depending on the window being used, this ‘worsens’ the resolution by about 40% (all standard windows have a similar effect). In your case a window would result in about 430 Hz resolution but with values still at 312 Hz separation.

I have just tested a C implementation the Stanford FFT of order 32 and this takes about 15 ms on a Mega2560. This is not an optimized FFT implementation since it does not pre-compute the twiddle factors but since you will have to do other processing as well as do the FFT it is probably about the best you can expect overall. Overall I would be surprised if you can do much better than about 20 frames per second (50 ms per frame). If you want to get much faster than this you will need to find a fixed point block floating point implementation. I wrote one many many years ago for a PDP8e and it is not for the faint hearted.

If you want to get 10 KHz resolution then your sample rate will have to be at least 20 KHz. Most music I have is sampled at 44 KHz.