0

I am trying to create a spectral analyzer plugin using C++; After the FFT, I would like to somehow average each bin using RMS. The reason being is because I want the frequency plot to display at a slower rate for better viewing. How can I achieve this? To be a little more specific, I have a FFT with a sample size of 4096 with a sampling frequency of 44,100 HZ. I'm updating the display every 40 ms. Each FFT frame is displaying to fast for the human eye. How can I smooth this out by some type of averaging?

Thanks,

Isaiah Thompson

Isaiah Thompson
  • 85
  • 1
  • 10
  • 1
    Sounds more like filtering out high frequency components to me. Perhaps you really want a low-pass filter that removes them. – duffymo Jul 29 '14 at 19:58
  • Duffymo, Thank you for your response. To be a little more specific, I have a FFT with a sample size of 4096 with a sampling frequency of 44,100 HZ. I'm updating the display every 40 ms. Each FFT frame is displaying to fast for the human eye. How can I smooth this out by some type of averaging? – Isaiah Thompson Jul 29 '14 at 20:03
  • 1
    You can get a decaying average effect with something like bin_value = (old_bin_value * 0.8) + new_bin_value. – ScottMcP-MVP Jul 29 '14 at 20:28
  • Thank you both. Both answers were on the right track. – Isaiah Thompson Jul 29 '14 at 21:01

1 Answers1

0

Your display updates every 40 ms are of course pointless. You have 44.100 samples per second, 4096 samples per FFT so about 11 FFT's per second. That's one every 90 ms, not 40 ms.

Furthermore, the common way to display this is as a spectrogram. Don't use a 4096 bin FFT, that's overkill anyway. Instead, use a 1024 point FFT. You'll now get 44 FFT's per second. Color-code each bin, and plot each FFT on a vertical line. The horizontal axis is the time axis. You can now show half a minute of FFT's on a single screen, and it will horizontally scroll at 44 pixels/second. This is slow enough for the eye to track.

MSalters
  • 173,980
  • 10
  • 155
  • 350
  • Thank, you very much for your reply. Your are right that the refresh rate is too fast, but I believe I do need the 4096 FFT. I'm replicating the spectral analyzer shown here: www.waves.com/plugins/h-eq-hybrid-equalizer. Thank you for your time. – Isaiah Thompson Jul 30 '14 at 20:16
  • @IsaiahThompson: A 7 band equalizer?! You can do that with a 256 point FFT. – MSalters Jul 31 '14 at 07:10
  • If you take a look at the graph, the frequency starts at 10 HZ. With a 256 point FFT, the bins would increase by around 86 HZ, which is a huge jump. – Isaiah Thompson Jul 31 '14 at 15:41
  • It's not like you'd notice if you'd amplify the 9Hz component by 3dB ! (The lowest bin starts at 0 hz, DC) – MSalters Jul 31 '14 at 15:44
  • Thank you for your kind words. The first ten lines increment by ten HZ. The the next ten lines increment by by 100 HZ with multiple points in between, then by 1,000 Hz etc. What FFT size would you suggest for this? – Isaiah Thompson Jul 31 '14 at 15:53
  • @IsaiahThompson: That suggests a non-FFT transform. Wavelets perhaps? – MSalters Jul 31 '14 at 18:51