Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I calculate audio dB level?

I want to calculate room noise level with the computer's microphone. I record noise as an audio file, but how can I calculate the noise dB level?

I don't know how to start!

like image 831
oBlank Avatar asked Mar 15 '10 08:03

oBlank


People also ask

What is the 3dB rule?

Common RF Terms. 3 dB rule: A 3 dB gain means twice (x2) the power. A 3 dB loss means half the power. For example, a system with 40 watts of input power and a 6 dB insertion loss will only have 10 watts of output power. dB: Decibel, a logarithm (equal to 10 times) ratio of the difference between two values.

What is dB in audio levels?

It is measured in decibels (dB). The decibel scale is logarithmic, which means that loudness is not directly proportional to sound intensity. Instead, the intensity of a sound grows very fast. This means that a sound at 20 dB is 10 times more intense than a sound at 10 dB.

How loud is 60 decibels?

How Loud Is 60 Decibels? 60 decibels is as loud as a normal conversation between two people sitting at a distance of about one meter (3 ¼ feet). It is the average sound level of a restaurant or an office.


1 Answers

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.

like image 111
RobertT Avatar answered Oct 13 '22 10:10

RobertT