Correct method for processing FFT in realtime I am attempting to build a 'live' FFT for continuous analysis of an audio signal.  I am relatively new to this, but have attempted the full thing, and then updating the graph at 20Hz refresh rate.  My FFT is working with regards to identifying the correct frequencies, however is very 'jumpy' with regards to the amplitude. Before I analyse my code to see where I have gone wrong, I would like to just confirm the process I have used is correct.


Read audio samples into circular buffer.
Read half of the window size from last half of previously processed array.  (50% because I am trying to achieve 50% overlap).
Read half of the window size from the buffer to give the complete window size. 
Perform Window Function on the window to process.
Zero pad the end of this to achieve a n^2 bit FFT Size. 
Perform FFT on the full array
Save Array to List of arrays to average (add to end, delete first one to always retain x no. of averages).
Average the arrays in List of arrays (treat real and imaginary values as two independent values when averaging).
Obtain the magnitude for each bin in the averaged array by obtaining the square root of the imaginary^2 + real^2. This is then divided by the number of bins, and the entire value multiplied by 2 as we have halved the FFT spectrum to only look at the positive values. This is then multiplied by a window correction factor. 
This thread should then sleep for however long it takes to capture half the window length needed (the next set of audio samples) subtract the computational time to perform this FFT step.  


That is currently the method I am working to.  I know my FFT algorithm is good as I have tested it on known input and output values.  I am sure it is a coding mistake, but as this is my first project I wanted to check that the overall method I am following is sound.  If anyone can see any potential issues, please let me know.  Thanks.
There are numerous ways to do this and you have the general flow except, as noted, complex averaging is only done in special circumstance, which you haven’t mentioned and are in most cases not applicable.

One can average magnitude or magnitude squared. There is a 1975 Bell System Technical Journal article that goes into detail but a simple comparison is good enough for most people.

Zero padding a FFT to a power of 2 is probably unnecessary if you use a modern FFT library like fftw.  A library will also offer an optimized real FFT. The other advantage of not using a zero pad is that you can pick your bin widths more intelligently.  It may be convenient for a user to have something like 1Hz or 5Hz or 10Hz bin widths.

The number of averages should have some reasoning as well. 

Depending on your actual application, some filtering prior to your FFTs might be useful. A seismologist might be interested in frequencies below 10Hz, but a lot of other people don’t. Some degree of pre whitening is often useful. 

One can have a “correct” processing chain , but nevertheless underachieve as an analysis tool. 

There is a lot about how to display this information that hasn’t been touched. Real time usually means real time display. 

When I started doing DSP there were a lot of tricks that you can use to save cycles. You can avoid square roots by taking the max( real, imag) - \alpha min(real, imag) where you set any negatives to positives first.  

Another trick is to complex bandshift filter to use a complex fft without redundancy