12
$\begingroup$

I've come across RMS in a variety of fields. I've come across dB units in a variety of fields.

Right now I'm looking at an algorithm for determining the perceived loudness of an audio track (EBU R128's referenced ITU-R BS.1770 for anyone who might be interested).

But they measure in this weird way.. First they take the mean of the squares:

$$ z_i = \frac{1}{T} \int_0^T y_i^2 \mathrm{d}t $$

($y_i$ is the signal on one channel, which would be a recording of sound pressure over time, and T is time).

Then they define loudness as such:

$$ \mathrm{Loudness, L_K} =-0.691 + 10 \log_{10} \sum_i G_i \cdot z_i $$ (the constant has to do with previously applied filters, $G_i$ can be ignored, and for simplicity purposes the summation can just be replaced with $z_i$, as the rest is multichannel-specific).

This is essentially the definition for the LUFS unit (LKFS as defined in this document) that is apparently used in all kinds of audio applications.


As I understand, the mean of the squares most often lacks any particular meaning on it's own, being in many fields squared to create the RMS (root mean square) which will represent something tangible. In electronics for instance the RMS value of an oscillating voltage can be used (with other variables) to calculate things like power as if you were working with direct (non-oscillating) current. I imagine the same would be true for sound in some sense, since sound works in similar oscillating fashion.

And I understand that $10 \log_{10}(x)$ is also how you get dB from a sound power level ratio for instance.

The spec seems very intelligently designed so I imagine there's a logical explanation for this. But so far I haven't been able to find it. What does it mean?

$\endgroup$
3
  • 3
    $\begingroup$ Concerning "The mean of the squares most often lacks any particular meaning on its own": For electronics, the average power dissipated in a simple resistive element is proportional to the mean of the squared voltage:$$\bar{P} = \frac{1}{T} \int_0^T \frac{V^2(t)}{R} \, dt.$$So in the context of power measurements it's the mean square that's most relevant, not the root mean square. $\endgroup$ Commented Mar 18 at 12:30
  • $\begingroup$ @MichaelSeifert That makes a lot of sense. I always just thought of it as ohm's law for current $I = V/R$ replaced into the power equation $P = V \cdot I$, never stopped to appreciate the square. I suppose even if you had already taken the RMS measurement of voltage it'd still work since $\sqrt{\text{avg}(V^2)}^2$ is just $\text{avg}(V^2)$. That's actually an excellent and intuitive analogy too. $\endgroup$
    – TrisT
    Commented Mar 18 at 23:28
  • $\begingroup$ Note, regarding loudness: en.wikipedia.org/wiki/Sone and en.wikipedia.org/wiki/Phon $\endgroup$ Commented Mar 19 at 0:38

2 Answers 2

16
$\begingroup$

Short Answer: Using the mean of the square (or the square of the RMS) represents the energy in the acoustical signal.

Longer Answer:

Sound waves that you hear are made of vibrations in the air. There are many effects that coincide with this vibration, but lets focus on two: the air moves and has a velocity, and the air pressure changes.

Air that moves has kinetic energy, or energy stored up in motion. The velocity of the air is actually very complicated due to the fact that it is made up of many molecules bouncing around, but when analyzing sound waves it is usually fine to "smooth out" the air by treating it like a continuous fluid. Then, one can think of looking at just a little patch of the air and measuring how fast it moves. This is called the particle velocity (technically in a Lagrangian sense, but don't worry about that). The kinetic energy, as you may know, is related to the mass of an item times its velocity squared. The mass of this little packet of air is just the density of the air times the volume of the packet. We are imagining a very small chunk of air that doesn't have a specific volume, so we will just divide the kinetic energy by the volume to get rid of it and say we are looking at the kinetic energy density instead. Thus, we may write the kinetic energy density as $$ E_k = \frac{1}{2}\rho v^2, $$ where $\rho$ is the mass density and $v$ is the particle velocity.

There is another form of energy that is important for acoustics, which is potential energy. Think of a spring: if you pull it, it stores energy that can be returned once the spring is released. Air acts like a spring as well. If you pull it apart the pressure of the air around it pushes it back to its original state. Potential energy for a spring takes the standard form $$ E_s = \frac{1}{2}k x^2, $$ where $k$ is a spring constant and $x$ is the distance that you move the spring. However, since the force of a spring $F$ is $F=-kx$ and can be rearranged to give $x=-F/k$, the potential energy could just as easily be written as $$ E_s = \frac{1}{2k} F^2. $$ The force on air is the pressure (times the area), and the spring constant is related to the stiffness of the air, or the bulk modulus $\rho c^2$, where $c$ is the speed of sound. Thus, without actually proving it, we may write the potential energy density for sound in air as $$ E_p = \frac{1}{2}\frac{p^2}{\rho c^2}, $$ where $p$ is the acoustic pressure. The total energy density may then be written as $$ E_T = \frac{1}{2}\rho v^2 + \frac{1}{2}\frac{p^2}{\rho c^2}. $$

From these equations you can see that the square of the pressure and particle velocity are associated with the energy of the wave. But, we can explain further. Without proving it, I know that for a sound wave that is just propagating in one direction (no echoes or spreading) we may write $$ v = \frac{p}{\rho c}. $$ (This relation is called the impedance relationship.) For this rather common case we may then eliminate velocity from the total energy density and obtain $$ E_T = \frac{p^2}{\rho c^2}. $$ Now, the acoustic pressure oscillates, as you said. That means that the total energy density of the air at a point also oscillates, bouncing from zero to values proportional to the sound amplitude over time. Perhaps it would be most helpful if we were to average out the energy. Since the oscillations happen so fast anyway, this is kind of like smoothing out the sound, just like we smoothed out the air molecules into a fluid. We may then write the time averaged total energy density as $$ \langle E_T\rangle = \lim_{T\rightarrow\infty}\frac{1}{T}\int_0^T \frac{p^2}{\rho c^2}. $$ Since $\rho$ and $c$ are constants (to the level of approximation for sound waves, anyway), this just leads to $$ \langle E_T\rangle = \frac{1}{\rho c^2}\langle p^2\rangle = \frac{p_{\text{rms}}^2}{\rho c^2}. $$ Thus, we may see that the time averaged total energy density of the sound wave is proportional to the mean squared pressure. We could also have written it as being proportional to the mean squared particle velocity, acoustic density, or acoustic temperature. In the end, for sound (and many other physical systems) the energy is related to the square of some oscillating quantity, and so we average over that and wind up with RMS quantities.

To just round out the discussion, I will comment on the use of decibels. People noticed that humans respond to sound roughly logarithmically compared to the amplitude, and so they started to take the logarithm of the energy. However, decibels are a relative measure, and so they had to pick some reference value. For air, they chose an amplitude (or RMS value) of 20 $\mu$Pa. Thus, the sound pressure level (SPL; not the loudness) is defined as $$ \text{SPL} = 10\log_{10}\left(\frac{p_\text{rms}^2}{(20~\mu\text{Pa})^2}\right). $$ From the properties of logarithms, we can bring the square down and we obtain an expression familiar to just about every acoustician: $$ \text{SPL} = 20\log_{10}\left(\frac{p_\text{rms}}{20~\mu\text{Pa}}\right). $$ Loudness depends on the specifics of how humans hear different frequencies, and so you get more complicated expressions for loudness, but they are based on the SPL formulation as well.

$\endgroup$
5
$\begingroup$

Michael's answer is fantastic, but since someone might find this through specifically searching for loudness units, I thought it worth writing an additional answer more specific to the LUFS unit.

As Michael mentions in the end of his answer: $$\text{SPL} = 20\log_{10}\left(\frac{p_\text{rms}}{20~\mu\text{Pa}}\right)$$

The LUFS unit is very similar in concept, except as it's name (Loudness Units Relative to Full Scale) suggests, it is relative to the maximum amplitude the audio file can store.


Let's say in an audio file, sound pressure is stored in a value between $-1.0$ and $1.0$. Then a full scale wave is one that oscillates from one end of that range to the other (as opposed to between $-0.5$ and $0.5$, for instance).
This means that if we square any of these samples, we get a value between $0.0$ and $1.0$.

That then means "Relative to Full Scale" is essentially "Relative to $1.0$". So our $p_0$ becomes $1.0$ as opposed to SPL's $20μPa$. And since $\log_{10}(x)=\frac12\log_{10}(x^2)$, as Michael pointed out, we now have:
$$ 20\log_{10}\left(\dfrac{p_{\text{rms}}}{1.0}\right) = 20\cdot\frac12\cdot \log_{10}\left({p_{\text{rms}}}^2\right) = 10\log_{10}\left({p_{\text{rms}}}^2\right) $$

So then I think it becomes pretty clear, with $p_{\text{rms}} = \sqrt{\text{avg}(p^2)}$, we get ${p_{\text{rms}}}^2 = \text{avg}(p^2)$ and therefore: $$10\log_{10}\left(\text{avg}(p^2)\right)$$ Which is what we see in the algorithm.

So essentially it's $dB_{SPL}$, but relative to the loudest-possible wave that can be held in a file, as opposed to the $20μPa$ reference that's normally used. This is also why the value is always negative, with people often mixing to a preferred max of $-8$ LUFS.


Some notes:

One other thing that is inherent to LUFS is the filters that come before the steps discussed. LUFS measurements start with two filters that approximately compensate for the loudness differences we perceive across different frequencies. See Equal-Loudness contour or Fletcher-Munson curves. That's why that $-0.691$ is present, because the second filter can actually amplify higher frequencies beyond $1.0$ and the subtraction brings it back down.
So it's not just that LUFS is a dB unit relative to the loudest possible sound that can be stored, it's also implicitly applied to the audio only after it's weighed across different frequencies to match the human perception of loudness.

Sound pressure is not stored in values between $-1.0$ and $1.0$.
Audio files will store samples in discrete "boxes" that may be 16-bit, 24-bit, 32-bit, etc.. Some of them may encode it differently for the sake of filesize (like mp3, aac, opus, etc..), but it will ultimately get decoded to that for reproduction.
In a 16-bit sample the sound pressure value is an integer that can vary from -32768 to +32767 (the full range split at the middle between positive and negative numbers, $2^{15}$ towards each side with $0$ counting as positive) - but for audio processing purposes, this range is thought of as "normalized" to [-1.0, 1.0].

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.