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