How can I calculate audio dB level?

All the previous answers are correct if you want a technically accurate or scientifically valuable answer. But if you just want a general estimation of comparative loudness, like if you want to check whether the dog is barking or whether a baby is crying and you want to specify the threshold in dB, then it’s a relatively simple calculation.

Many wave-file editors have a vertical scale in decibels. There is no calibration or reference measurements, just a simple calculation:

dB = 20 * log10(amplitude)

The amplitude in this case is expressed as a number between 0 and 1, where 1 represents the maximum amplitude in the sound file. For example, if you have a 16 bit sound file, the amplitude can go as high as 32767. So you just divide the sample by 32767. (We work with absolute values, positive numbers only.) So if you have a wave that peaks at 14731, then:

amplitude = 14731 / 32767
          = 0.44

dB = 20 * log10(0.44)
   = -7.13

But there are very important things to consider, specifically the answers given by the others.

1) As Jörg W Mittag says, dB is a relative measurement. Since we don’t have calibrations and references, this measurement is only relative to itself. And by that I mean that you will be able to see that the sound in the sound file at this point is 3 dB louder than at that point, or that this spike is 5 decibels louder than the background. But you cannot know how loud it is in real life, not without the calibrations that the others are referring to.

2) This was also mentioned by PaulR and user545125: Because you’re evaluating according to a recorded sound, you are only measuring the sound at the specific location where the microphone is, biased to the direction the microphone is pointing, and filtered by the frequency response of your hardware. A few feet away, a human listening with human ears will get a totally different sound level and different frequencies.

3) Without calibrated hardware, you cannot say that the sound is 60dB or 89dB or whatever. All that this calculation can give you is how the peaks in the sound file compares to other peaks in the same sound file.

If this is all you want, then it’s fine, but if you want to do something serious, like determine whether the noise level in a factory is safe for workers, then listen to Paul, user545125 and Jörg.

Leave a Comment