Deeper Explanation:
An FFT of 512 samples is taken using BlackmanHarris. The range of frequencies in most music is 22050hz. So 22050hz / 512 samples works out at 43hz per sample. Calculating the average of a “Band of samples” is done by Looping through the amount of bands to create i.e. 64. Then loop through the amount of samples
if count = 0, 2 to the power of 0 = 1, 1 * 2 = 2. So would be in the first frequency band. 0-2 = 86hz.
On the last loop you would need to add the 2 back on to loop through the full 512 samples.
Calculate the average by adding the samples multiplied by the count + 1. Add 1 to the count and at the end of the of the band loop then divide the average by the count.
These frequency bands produce a useable range of values which can be used for endless possibilities.