Spectrum analysis : how to represent FFT results I'm trying to program a spectrum analyser in C++ but I'm faced with a conceptual problem : how to map the results of the FFT to an image ?

Let me detail : 
I'm doing all this in a dynamic way.


I have chunks of audio data as float [-1;1] arriving to my class.
I put them in a circular buffer which has the same size as my FFT window
I apply a Hann(ing) windowing function
I apply an FFT to the result. 


This part works great. 

Now the result of my FFT is a two dimensional array (my library automatically does the sqrt(re^2 + im^2) part) with bin indexes and amplitudes. 

My goal is to draw this result from time to time into a window. The problem is, the window has way less pixels than there are bins (if my buffer size is 65536, I have 32768 bins), so I have to do some kind of "averaging". 
I could do a mean, a root square mean, take the maximum, etc etc ... I have no idea what is the best method to use ? The application of this will be music, more specifically, detect frequency masking by plotting several semi-transparent sepectrums on the top of each other. 

Any advice on a good way to do that would be much appreciated
Actually, what do the squared magnitude FFT result represent? They represent the total energy in a given frequency bin. So to downscale your results to less bands, you can sum them. It's not even necessary to average the results - however it would have the same effect, as you map the results to an image, thus rescaling them.

However, note that if you need to rescale by something else than an power of two, you'll need to do it using supersampling, as the results won't map directly to your new bins.