Audio: How to measure dynamic range (in sense of dynamic compression/ "loudness war")
One important of them is the dynamic range (in sense of &quot;loudness war&quot;). By which in this context is not meant the SNR but the (naive said) &quot;variance&quot; of the &quot;occuring energy&quot;.

Loudness War is neither dynamic range nor SNR nor variance of occuring engery (although it's related). It's mostly about peak limiting.
For better or for worse, there is a strong desire in the industry to make sure that your song is percieved louder when being played back to back with somone else's song on the radio, a streaming service or a record company executive review meeting.
The song is delivered as a fixed point audio file and this format has a maximum sample amplitude that it can represent. To make it &quot;loud&quot; you need to shove as much energy as possible into the file without any one sample exceeding the the allowable max amplitude. In practice this is done the following way

You record and mix in an unconstrained format (floating point).
The last step is mastering, where the mix session is turned into a fixed point file with whatever format is required (sample rate, bit depth, labelling, streaming constraint, etc.)
During mastering so-called &quot;peak limiting&quot; is applied. You raise the overal level of the song and then shave off the few samples that exceed the maximum allowable amplitude. This generates distortion.
Repeat this until you have achieved the maximum &quot;tolerable&quot; distortion and you can't make it louder without adding too much crap.

In essence you create a trade off between overall loudness and &quot;acceptable&quot; distortion. &quot;Loudness war&quot; basically means that this trade off has skewed hard to towards &quot;loud&quot; and &quot;lots of distortion&quot;. A good example to analyze is Tom Petty's album &quot;Hypnotic Eye&quot; the CD version is peak limited, but the high res version is not, so you can actually compare directly what damage the peak limiter has done.
This is quite painful to listen to especially since it's mostly unneccessary. The original version is not as loud, but I can simply adjust the volume to compensate. However, the distortion in the peak limited version is always there.
Back to the original question: you want to look at the &quot;RMS to Peak&quot;, since that's exactly what the peak limiters is trying to reduce.  Since these days the &quot;peak&quot; in a file is almost always very close to unity (unless it's &quot;mastered for Itunes&quot;), you can simply take the RMS of the file. Here are some typical examples

0 dB: Square wave
-3 dB: Sine wave
-7.8 dB: &quot;Maggie's Farm&quot; by Rage Against the Machine
-10.8 dB: Averabe of the Billboard 2013 top 100
-15 dB: Average of 10000+ &quot;typical&quot; songs including a wide mix of genre's and release years

Many streaming services don't like this variability since it requires the customer to keep &quot;riding&quot; the volume control and therefore prescribe mastering levels (example -14 dB LUFS which is based on an ITU norm). They may remaster the content or ask the labels to do it which the labels may or may not do. As a result, the same song when played from Spotify may be mastered differently than the same one played from Apple Music.