Foobar's dynamic range meter
post-15843556
Thread Starter
Post #1 of 9

VNandor

100+ Head-Fier
Joined
Oct 17, 2014
Messages
454
Reaction score
150
Joined
Oct 17, 2014
Posts
454
Likes
150
I've just checked the "dynamic range" of a 1 minute long 0dBFS 1kHz sine wave. I was expecting the meter to report a -3dB RMS and probably 0dB dynamic range. Instead, I got a 0dB RMS and 0 dynamic range. Am I wrong to expect a -3dB RMS reading from this "test"? If so, why is that? Does anyone know what the program actually reports as RMS?
 
     Share This Post       
post-15843614
Post #2 of 9

castleofargh

Sound Science Forum Moderator
Joined
Jul 2, 2011
Messages
9,079
Reaction score
4,416
Joined
Jul 2, 2011
Posts
9,079
Likes
4,416
Not sure I understand this right. Your signal remains at the same level(0dBFS but that doesn't matter), so if you look at a meter, you'll constantly read the same RMS level. But that's not what you're reading here. You're reading a measure of the dynamic range! which in this case seems to be some measure of variation in the RMS levels. That level does not change over time with that particular test signal, so the dynamic range is zero.

does this clear the confusion?
 
     Share This Post       
post-15843622
Post #3 of 9

VNandor

100+ Head-Fier
Joined
Oct 17, 2014
Messages
454
Reaction score
150
Joined
Oct 17, 2014
Posts
454
Likes
150
drm.jpg


Im expecting the dynamic range to be 0, the peak to be 0 and the RMS of the signal to be at -3dB because that is the RMS of a sine wave.
 
     Share This Post       
post-15843760
Post #4 of 9

danadam

Head-Fier
Joined
Jan 2, 2017
Messages
74
Reaction score
52
Joined
Jan 2, 2017
Posts
74
Likes
52
Because the "RMS" calculated in the algorithm is not a real RMS but:
the square root of the double sum over all input samples squared, divided by the block size in samples
(emphasis mine)

Why? My guess:
  • they wanted DR value of pure sine to be 0,
  • the DR value in the algorithm is calculated as a difference between the peak and that pseudo RMS,
  • so if they used an actual RMS the difference wouldn't be 0.
 
     Share This Post       
post-15843808
Post #5 of 9

gimmeheadroom

Headphoneus Supremus
Joined
Feb 8, 2018
Messages
3,561
Reaction score
1,940
Location
Czech Republic
Joined
Feb 8, 2018
Location
Czech Republic
Posts
3,561
Likes
1,940
Website
www.head-fi.org
A sine wave has peaks and values. That's why the RMS value has to square it and then divide. What you want is the average (RMS = Root Mean Squared) not the peak.:)
 
     Share This Post       
post-15843852
Post #6 of 9

VNandor

100+ Head-Fier
Joined
Oct 17, 2014
Messages
454
Reaction score
150
Joined
Oct 17, 2014
Posts
454
Likes
150
Because the "RMS" calculated in the algorithm is not a real RMS but:

(emphasis mine)

Why? My guess:
  • they wanted DR value of pure sine to be 0,
  • the DR value in the algorithm is calculated as a difference between the peak and that pseudo RMS,
  • so if they used an actual RMS the difference wouldn't be 0.
Ah, thank you. So if I understand the calculations correctly, subtracting 3dB from what the program reports should give the actual RMS most of the time, is that right? Because the multiplication of sqrt(2) of the samples has the same effect as adding ~3dB to the end result I think.

The only time this wouldn't work is if the signal's actual RMS is already more than -3dB RMS. I mean a square wave with an amplitude of 0.8 has a ~ -2dB RMS while an amplitude of 0.9 would give ~ -0.9dB RMS. Both of these signals are reported as 0dB RMS by foobar.

The reason I came across this is because I used this RMS value to volume match while testing and with some of the music I could still hear some volume difference. At least now I know it doesn't work properly with some of the (extremely loud) music I have.
 
     Share This Post       
post-15843863
Post #7 of 9

VNandor

100+ Head-Fier
Joined
Oct 17, 2014
Messages
454
Reaction score
150
Joined
Oct 17, 2014
Posts
454
Likes
150
A sine wave has peaks and values. That's why the RMS value has to square it and then divide. What you want is the average (RMS = Root Mean Squared) not the peak.:)
Yes, I'm aware of the definition of RMS. The reason foobar confused me is because it doesn't use the standard definition of RMS.
 
     Share This Post       
post-15846454
Post #8 of 9

danadam

Head-Fier
Joined
Jan 2, 2017
Messages
74
Reaction score
52
Joined
Jan 2, 2017
Posts
74
Likes
52
Ah, thank you. So if I understand the calculations correctly, subtracting 3dB from what the program reports should give the actual RMS most of the time, is that right? Because the multiplication of sqrt(2) of the samples has the same effect as adding ~3dB to the end result I think.

The only time this wouldn't work is if the signal's actual RMS is already more than -3dB RMS. I mean a square wave with an amplitude of 0.8 has a ~ -2dB RMS while an amplitude of 0.9 would give ~ -0.9dB RMS. Both of these signals are reported as 0dB RMS by foobar.
Yes, I think so.

I wasn't sure if that displayed value is for the whole track or for the 20% of the loudest 3-second blocks (that's what is actually used to calculate the DR value), but it looks like it is for the whole track.

The reason I came across this is because I used this RMS value to volume match while testing and with some of the music I could still hear some volume difference. At least now I know it doesn't work properly with some of the (extremely loud) music I have.
I use either SoX:
Code:
]$ sox sine.wav -n stats
             Overall     Left      Right
DC offset   0.000000  0.000000 -0.000000
Min level  -0.999908 -0.999908 -0.999908
Max level   0.999908  0.999908  0.999908
Pk lev dB      -0.00     -0.00     -0.00
RMS lev dB     -3.01     -3.01     -3.01
RMS Pk dB      -3.00     -3.00     -3.00
RMS Tr dB      -3.06     -3.06     -3.06
Crest factor       -      1.41      1.41
Flat factor     0.00      0.00      0.00
Pk count        11.5        10        13
Bit-depth      16/16     16/16     16/16
Num samples    22.0k
Length s       0.500
Scale max   1.000000
Window s       0.050
or Audacity (its Measure RMS tool has to be enabled manually):
MeasureRMS.png
 
     Share This Post       
  • Like
Reactions: VNandor
post-15853812
Post #9 of 9

playmusic

New Head-Fier
Joined
Aug 13, 2020
Messages
36
Reaction score
6
Location
Europe
Joined
Aug 13, 2020
Location
Europe
Posts
36
Likes
6
Because the "RMS" calculated in the algorithm is not a real RMS
Im expecting [...] the RMS of the signal to be at -3dB because that is the RMS of a sine wave.
Yes, I'm aware of the definition of RMS. The reason foobar confused me is because it doesn't use the standard definition of RMS.
It might surprise you, but the above discussed rms calculation in foobar (precisely the Dynamic Range component for foobar) for a sine wave is correct if you look at it in a quite plausible context.

The "dB" is always about a relative measure.
The full scale signal level is defined in the standard AES-17 as relative to a full-scale sine wave.
The standard even mentions explicitly that a square wave can read as much as +3.01 dB FS.
So, in the context of AES standards, the algorithm in foobar is correct about the rms of a sine wave.

At the same time, there seems to be for signals with a positive dB FS rms a bug in the software implementation of foobar's algorithm.
To me this bug is not relevant for music listening because a song with a positive dB FS rms (according to AES definition) is rather unappealing, I think, since it is something between a FS sine [edited: "and"] a maximum amplitude square wave.

But music tastes vary as evidenced in this post about music with (it seems) a positive dB FS rms where foobar goes wrong:
The reason I came across this is because I used this RMS value to volume match while testing and with some of the music I could still hear some volume difference. At least now I know it doesn't work properly with some of the (extremely loud) music I have.
 
Last edited:
     Share This Post       
  • Like
Reactions: VNandor

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top