Audio: How to measure dynamic range (in sense of dynamic compression/ "loudness war")

I'm about to calculate some quality measures for audio.

One important of them is the dynamic range (in sense of "loudness war"). By which in this context is not meant the SNR but the (naive said) "variance" of the "occuring energy".

https://en.wikipedia.org/wiki/Loudness_war

http://dr.loudness-war.info/

My idea was to take the average RMS for that and use its standard deviation (relative to the average RMS). But this doesn't separate the good from the bad. If I take TT DR Offline meter it outputs DR11 for a fine (Steven Wilson) remaster, and DR7 for a deadly compressed one from an everyday compilation. But the relative standard deviation of them is nearly the same (about 69% and 65% for L and R, window = 50ms).

Are there any suggestions/ ideas how to measure it better?

One important of them is the dynamic range (in sense of "loudness war"). By which in this context is not meant the SNR but the (naive said) "variance" of the "occuring energy".

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 "loud" 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

1. You record and mix in an unconstrained format (floating point).
2. 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.)
3. During mastering so-called "peak limiting" 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.
4. Repeat this until you have achieved the maximum "tolerable" distortion and you can't make it louder without adding too much crap.

In essence you create a trade off between overall loudness and "acceptable" distortion. "Loudness war" basically means that this trade off has skewed hard to towards "loud" and "lots of distortion". A good example to analyze is Tom Petty's album "Hypnotic Eye" 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 "RMS to Peak", since that's exactly what the peak limiters is trying to reduce. Since these days the "peak" in a file is almost always very close to unity (unless it's "mastered for Itunes"), you can simply take the RMS of the file. Here are some typical examples

1. 0 dB: Square wave
2. -3 dB: Sine wave
3. -7.8 dB: "Maggie's Farm" by Rage Against the Machine
4. -10.8 dB: Averabe of the Billboard 2013 top 100
5. -15 dB: Average of 10000+ "typical" 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 "riding" 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.

• Thank very much you for your detailed explanation! Still there is a little misunderstanding: I'm not about the ready-made masterings from some labels, but from any source (in my case for example a chain of LP to cassette to audio file, with diverse distortion sources inbetween). So the peak won't always be at max. And the peaks may also be only few but due to technical errors. But the overall characteristic of the song (the compression rate) should not depend on that. So if I "simply" take the peak to RMS ratio I may fail deeply...(?) Sep 18, 2020 at 13:27
• Also if you have a look at the descriptions of the "Offline meters" maat.digital/dro2 ... It cannot be simply RMS to peak ratio, can it? Sep 18, 2020 at 13:41
• @nji9 hm, a bit confused now: are you asking about distortion in general, or dynamic compression in particular. Because if the latter, Hilmar's answer reads pretty conclusive. Sep 18, 2020 at 15:09
• Sorry, you need to rephrase your question. The dynamic range compression in the context of loudness war is entirely due to peak limiting. Distortion of the signal chain is an entirely different topic and measured completely. The plug in that you cite also seems to look primarily at pealk limiting and is about the "Crest factor" which is the peak to RMS ratio. Sep 18, 2020 at 17:45
• I'm sorry if I caused confusion with my wording. I'm new to the topic and have only basic knowledge. However I'm not primarily about distorting etc. but just about arbitrary audio sources, which can be distorted in any way. And for them I would like to do a thorough analysis, one of it DR. So I will try and identify a "reference peak" (which is exceeded by "sufficiently enough" samples). And take that for the quotient you propose. Sep 18, 2020 at 19:09