I'm trying to convert musicg Spectrogram output to dBFS.
With 16-bit signed integer PCM audio, and an FFT length of 2048, I'm trying to analyze the spectrogram for an audio file to determine things like "Was a particular frequency notched out by equalization" or "Was the audio high-passed or low-passed" by looking for peaks in the spectrogram.
I'm taking a normalized musicg spectrogram, and converting the magnitude values to dBFS (max value: 0 dBFS) by doing:
dBFS = (20 * Math.log10( 2 * Math.abs(magnitude) / 2048)) - 100
I think this is giving me what I'm looking for, and it correlates closely to what I'm seeing in other tools. And if I decrease the gain on a file by 20db, and then analyze the decreased file, the dBFS data I get back is 20db less than the original.
However, I noticed that when I view the spectrogram in Audacity (using plot spectrum), the dB values in Audacity seem to range between 4db and 9db higher than what I'm getting from musicg and the above equation.
Is there something I'm doing particularly wrong in the way I'm trying to calculate dBFS from the musicg absolute spectrogram data? (or perhaps I'm mistaken and what I'm calculating, and what Audacity is displaying, are not quite the same thing)