# How to average the loudness of a audio file from its amplitude?

I would like to average the loudness of different sounds so that their means could be used as a dependent variable in a statistical regression, but I have some troubles to understand how loudness works.

Assume that I have large number of different audio files that are all recorded in the exact same conditions, so that a same original sound would have the exact same frequency and amplitude in each file.

I saw that the loudness of a sound is proportional to the square of its amplitude, but also that $\mathrm{dB} = 10\log_{10}(\mathrm{Amp})$. Therefore I do not know which formula to use, and neither if I should first average the amplitude and then apply the formula, or apply the formula first and then average the dB.

If somebody has some answers or some literature to get me on the right track it would be very helpful.

In general, you would first ensure the signals you are using have no DC component (likely the don't have a DC component), and more specifically, you could choose to band limit the signals to a frequency range of interest; but this may not be necessary. You will also need to ensure that if you are using different signal sources, they are normalized somehow. For loudness specifically (i.e. not just signal energy), it might be necessary to 'A-weight' the signal (i.e. pass through a filter with characteristics that emulate human hearing)

Then you would square the signal (not absolute value) and average over the duration of interest. Human perception of loudness depends on the frequency and other characteristics, so there may not be a direct correlation between the numerical value you obtain and the perception of loudness.

I don't think there's a generic physics answer to your question. It depends on what you're trying to accomplish in this analysis. You haven't said whether it's a psychology experiment, or a study of the effect of sound waves on materials, or something else. The reason we often use the dB scale for sounds is that the ear-brain system perceives loudnesses in terms of ratios, and the logarithm converts ratios to differences. "Loudness" is not a physics term. If it's going to have a formal mathematical definition, that would be psychoacoustics, not physics.

so that their means could be used as a dependent variable in a statistical regression

Both a mean and a linear regression are linear things. Whether it makes sense to do these linear operations on a variable depends on whether the variable is naturally structured in a linear way. For example, it makes sense to average celsius temperatures, but it doesn't necessarily make sense to average star ratings on rottentomatoes.

• I would like to do an economic analysis. The files are records of the noise produced by an audience in an amphitheatre (people whispering/talking to each other while a speaker is doing a speach). In addition to these soundtracks, I have for each speach the gender of the speaker. I would like to compute the mean "loudness" of the audience for each speach in order to see if this is correlated or not with the gender of the speaker. Thus, I'm not really interested in having a measure of what would have perceived a human ear, but rather in having comparable values of how "loud" the audience was.
– user199059
Jun 24, 2018 at 16:12
• @louis: I don't think this is really a physics question, then, unless you can spell out how the thing you're trying to measure connects to some physical quantity.
– user4552
Jun 25, 2018 at 14:11