1
$\begingroup$

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.

$\endgroup$

3 Answers 3

1
$\begingroup$

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.

$\endgroup$
0
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$
    – user199059
    Commented Jun 24, 2018 at 16:12
  • $\begingroup$ @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. $\endgroup$
    – user4552
    Commented Jun 25, 2018 at 14:11
0
$\begingroup$

Sound Pressure Level

I think what you're looking for isn't loudness in the technical sense of the word. Loudness is the subjective perception of sound pressure.

What you may want instead is the sound pressure level (SPL): $$ \text{SPL}=20\log_{10}\left(\frac{p_\text{rms}}{p_0}\right) \ \ \ \ \text{or just}\ \ \ \ 10\log_{10}\left(\dfrac{\text{avg}(p^2)}{p_0}\right) $$ Where $p_0$ is your reference, since the decibel $dB$ is a unitless measurement expressing the logarithmic representation of a ratio.
The lower limit of human hearing is typically taken to be $20μPa$ at $1\text{KHz}$.

Actual Loudness

In audio mixing the LUFS unit is typically used. See EBU R128 and it's referenced ITU-R BS.1770 which actually defines the loudness unit.

It first runs the audio through a couple filters to match the human perception of loudness across frequencies, and then it essentially applies the $dB_{SPL}$ formula to it, but instead of being relative to $20μPa$ it's relative to the loudest sound that can be digitally stored in the format you're using. My question about that very unit has more information (I also wrote an answer in which I attempt to document it with more detail).
For a continuous audio file, loudness is measured by keeping a rolling windowed average, gated to exclude sounds either below an absolute $-70$ LUFS or below $-10$ LUFS relative to the current average value (as you're running through the file).

You can use ffmpeg's loudnorm filter to determine this loudness parameter, as well as a few statistically relevant others for any given file. It will output as json.

But as I said, this unit is relative to the loudest sound that can be stored digitally on file, not any real-world reference which I assume is what you're looking for. For that you'd have to record a reference of your own and then use that as an offset to further LUFS measurements.

This is pointless if your recording setup automatically amplifies/attenuates the input signal (like phones trying to keep a constant volume when you're on a call in loudspeaker). Though this is true for the nature of your task so I imagine you've already taken measures to avoid it.

One last note is how the filters used by this LUFS unit are computationally efficient approximations that do not attempt to faithfully reproduce the Equal-Loudness contour to a precise degree. If you need a very accurate solution, you will have to find some other solution with either higher-order filters or an FFT, as well as probably keep a more faithful distribution of the calculated loudness throughout the file (the rolling windowed average is really good but scientific/research work might require more granular information).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.