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.