I need advice about how to make an audio frequency analyzer I just need some clarification of some very basic aspects of creating a frequency analyzer.  I am writing a c++ program, so far it is just a media player, with a custom explorer.  You can make playlists, shuffle, repeat etc.  

But my goal is to continue to add functionality.  So far, I just have a signal level meter, and I am now trying to add a frequency analyzer.  

I am using fftReal.  So I am at the stage where I have the output, and I am scaling to dbfs like so which I think is correct, but not exactly sure.

for (int i=0; i &lt; fftsize/2; ++i)
    db[i]=20*log(sqrt(imaginary[i]*imaginary[i]+real[i]*real[i]));


So I know I should apply a window function somewhere, and I'm trying to understand how to do that.  But I am wondering this as well.  If I want to display the data as rectangles popping up and down rather than plotting points and connecting with lines, and I want to limit the amount of rectangles to about 50 or so.  Do I take the average db of a range.  

I notice that in many applications, the frequency scale is skewed, where the higher frequency, the small distance between units.  What kind of scale is used, and how can I break up the spectrum so that I have a nice visual?

I'm sorry if this has all been discussed before, I have been googling for a while now, and overall I am overwhelmed with information, but there are a just a few key thing which I need to understand first.  

Thanks
This really depends on how fancy you want to get. A "good" analyzer will typically do the following things.


Split the input into frames. The frames typically overlap and are windowed. Good choices are an overlap of 50% and a Hanning window.
Do an FFT
Select the center frequencies of bands. For audio good choices are octaves or third octaves (see http://www.engineeringtoolbox.com/octave-bands-frequency-limits-d_1602.html)
For each integrate the FFT energy around the center frequency. There are different choices for the integration windows. Good choices are trapezoids or butterworth windows. A really good window choice will make sure that all the energy is accounted for, i.e. that the sum of the band energies equals the sum of all FFT bins.


If the number of frequency bands is relatively small, it is more efficient and easier to simply use a bank of parallel bandpass filters and an RMS detector. This also allows to dial in the temporal behavior of the display nicely.