I’m looking to use an FFT to generate a frequency spectrum in 1/3 octave bands. After reading many posts on this site as well as others, I believe the appropriate approach is set out below. I’ve dry-run the calculations in Excel and the results look reasonable, but reasonable is not necessarily correct.
To ask a specific question, is the method I’m using valid? In particular, I question if the method applied in Step 2 is correct.
Background. I’m sampling the electric signal on the output of a pre-amp and my goal is a frequency spectrum in dB. My reference (denominator in the dB calc) is arbitrary and chosen to set an appropriate scale for the spectrum output display. I’m not attempting to take measurements from the output and don’t need to calibrate it against an objective reference. My project will be implemented in C++.
Step 1. Start with a 1024 sample FFT at 48,000 Hz (513 bins at 46.9 Hz each). Result is the DFT, Fn for n = 0 – 512. Units are in V.
Note, normally, I’d normalize the FFT output by multiplying each bin by 2/N (N is number of samples, i.e. 1024). However, because we eventually plot the spectra in dB relative to an arbitrary amplitude, any normalizing I do here will be washed away when I compute the results in dB so I don’t bother with it in my project.
Step 2. Convert the DFT into 1/3 octave bands.
I obtained the following formulas from here: https://www.ap.com/technical-library/deriving-fractional-octave-spectra-from-the-fft-with-apx/
The amplitude in V for each 1/3 octave band is:
Where Lb is the amplitude for each 1/3 octave band in V, for b = 1 to 32, and gn,b is the gain multiplier for FFT bin n and 1/3 octave band b:
Where fn is the frequency of bin n and fb is the center frequency of band b. k is the octave bandwidth designator, 1 for full octave and 3 for 1/3 octave.
Result is Lb for b = 1 to 32 in V.
Step 3. Disregard lower bands.
Below about 250 Hz, for an FFT of length 1024, there are not enough FFT bins within each band to make the results meaningful. Therefore, we disregard the lower bands and keep only the 1/3 octave bands starting with b13 = 251 Hz.
Step 4. Convert the amplitude data in each band to dB.
For this computation, I’m computing the dB value relative to the approximate maximum amplitude likely to appear in any frequency band. This will be Lref.
Final value in dB for each 1/3 octave frequency band above 250 Hz is:
Below is a sample of individual gn,b terms (FFT bins down the left, 1/3 octave bands across the top):
Assistance, input, corrections and comments appreciated. Thanks!