Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Replaygain Data (Read 6062 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Replaygain Data

Could anyone please explain, what those "peak" values mean and how they're interpreted during playback?

Code: [Select]
replaygain_track_gain = -9.01 dB
replaygain_track_peak = 1.092741
replaygain_album_gain = -9.58 dB
replaygain_album_peak = 1.220819


Btw., these come from Lenny Kravitz's album "Baptism". Yes, it's way to loud...

..:: sundance ::..

Replaygain Data

Reply #1
They are the maximum values of the output signal, 1.0 being full scale (the maximum).

This effectively means that the file needs to be reduced in volume before being able to be played back without clipping.

Replaygain Data

Reply #2
Thanks for the reply, Garf.
But, to be honest, now I'm sort of confused. How can the maximum value be larger than full scale other than already being clipped? And if that would be the case, reducing the volume is void...


Replaygain Data

Reply #4
If we are dealing with lossy formats like MP3, the output of the MP3 decoder can very well be above 1.0, since its a lossy format. And since it is above 1.0 it gets clipped.

Now, I am also wondering if those peak values represent the peak value achieved without replaygain adjustment or if it is taken into consideration. From the values below I guess it is without adjustment...

Replaygain Data

Reply #5
Without adjustment.

Replaygain Data

Reply #6
Quote
Without adjustment

So, what does that mean then:
If I playback that file (yes, it's an MP3 lame file) without replaygain (say with foobar), the output is clipped.
But if replaygain is enabled, is it
a) applied before the rendering takes place (thus results in an unclipped output) or
b) is the clipped output just lowered by some 9 dB (in this case)?

If b) is true it would make sense to apply mp3Gain to the file to force the renderer to use lower volumes right away?

[edit: typo]

Replaygain Data

Reply #7
Taken from http://replaygain.hydrogenaudio.org/peak_data_format.html

Quote
Data Format
The maximum peak amplitude (a single value) should be stored as a 32-bit floating point number, where 1=digital full scale.

Uncompressed Files
Simply store the maximum absolute sample value held in the file (on any channel). The single sample value should be converted to a 32-bit float, such that digital full scale is equivalent to a value of 1.

Compressed files
Compressed audio does not exist as a waveform until it is decoded. Unfortunately, psychoacoustic coding of a heavily limited file can lead to sample values larger than digital full scale upon decoding. However, it is likely that such values will be brought back within range after scaling by the replay level. Even so, it is necessary to store the peak value of a compressed file as a 32-bit floating-point representation, where +/-1 represent digital full scale, and values outside this range would usually clip.


I got curious and asked in #foobar2000 about this and Moneo and Peter Pawlowski said that two conditions must be satisfied in order to do this correctly;

1) decoder shouldn't clip by itself (solved by use of floatingpoint data, or int types that have range beyond normal sample range).
2) replaygain itself should operate at >16bit so last bits dont get discarded.

So the correct way of doing it is 'a)'. Unfortunately, the only player I know that satisfies these conditions out-of-the-box is foobar2000.

Cya

Replaygain Data

Reply #8
Quote
AFAIK, ReplayGain is good for clipping introduces by the encoder. If the source (CD for example) was already clipped, lowering the volume will not get rid of the clipping, but it will be less audible.

Except the changes in peak values introduced by the encoding process are almost often so minimal as to be insignificant, thus the amount clipping introduced by the encoding proccess is pretty much a non-issue.  You'd be lucky if you could get more than 3 samples over full-scale from a limited peak.

In fact, a lot of samples in the encoded clipped peak are actually ATTENUATED, which means that clipping in decoded MP3s is usally LESS than the original, even when at full-scale.  Really, using ReplayGain to avoid/lessen clipping is rather pointless.

Replaygain Data

Reply #9
I find most hard limited tracks which hit 0dB FS originally will clip when mp3 encoded.

Whether it's worth avoiding this kind of clipping is debatable - I'm not too bothered by it (as such tracks often sound pretty nasty already), but I'll remove it if I can. People have certainly ABXed it:

http://www.ff123.net/norm.html
http://www.ff123.net/mad.html
http://www.ff123.net/clipping.html

(some of these tests refer to the audibility of clipping which occurs for others reasons, but the first is about psychoacoustic coding)

Cheers,
David.