Flaw in ReplayGain spec
Flaw in ReplayGain spec
May 12 2002, 11:04
Group: Developer (Donating)
Joined: 24-September 01
Member No.: 13
It occured to me today that there is a problem with the current ReplayGain spec, or rather, my proposal for doing it in Vorbis.
The issue is combining replaygain and clipping prevention.
If applying the replaygain would cause the track to clip, clipping prevention kicks in, and reduces the level. This will make the output loudness different from the ideal, 'equal' level.
When running in radio/track mode, there is no way around this, since you don't know in advance what you are going to encounter. The best you can do is set the default level low enough so you can hope it'll never happen. I believe this was the idea (among possibly other things) behind setting the default level to K-20 in the new MPC decoders? (Frank? )
If the implementation in the current Vorbis players is correct, a similar effect can be reached by setting the preamp in the plugin to -6dB or so.
In album gain, you could avoid this from happening for the entire album you're listening to, since you already ReplayGain-processed them in group and thus know what is coming up, however, my current proposal poses problems for doing this: You would need to read in all files that belong to the album, read in the peak values, and remember the largest, and use that as the peak value for the individual tracks.
This is what I originally envisioned, however, looking back, this is both ugly, cumbersome and it may not even be possible in some player/plugin architectures.
I think the correct solution would probably be to store an album-peak value.
It would be trivial to implement in the ReplayGain tools, and require only minimal changes in the players without all the uglyness the current method would require (which isn't done correctly by anyone anyway).
The disadvantage is that it requires another tag. However, since the Vorbis people seem to have gotten a bit more enthousiastic about ReplayGain lately, perhaps that isn't so much of a problem.
I believe it's valuable to do this, as it may post a real problem in practise. Moreover, the proposal as it is now is broken by design in this regard, and I'd prefer to fix it while it's still fixable.
Also, the ReplayGain proposal on David's site doesn't mention anything about this? Is there another way to address this problem?
There's two other issues with the current spec that I'd like to discuss about while it's still possible.
1) Change RG_* into REPLAYGAIN_*
This was proposed by Segher, with the idea that someone looking at the tags and that doesn't know what they are can at least google to find out, whereas you'd be left clueless with the current 'RG'. I think this idea is valuable and good.
2) Source/version tag
I didn't include one originally because I saw no way to keep it consistent if you allow the user to edit the tags (you can't require them to know the spec...), and because I didn't see the RG calculations being improved for quite a while. Unfortunately, Frank Klemm has already proven me wrong on the latter. I don't see a way to make such a tag actually _work_ though.
I'd like feedback from everyone about all of this. Is it worthwhile to change the current proposal and fix some of the above issues?
May 13 2002, 17:36
Joined: 15-December 01
Member No.: 659
Originally posted by Garf
On the pratical side, I'm considering
REPLAYGAIN=ALBUM:-6.00dB; TRACK:-7.00dB; ALBUM_PEAK:1.12443; TRACK_PEAK:1.04343
Advantage: only one tag
Disadvantage: harder to parse
4 == sscanf ( buffer, "REPLAYGAIN=ALBUM:%lfdB; TRACK:%lfdB; ALBUM_PEAK:%lf; TRACK_PEAK:%lf %c, &ga, >, &pa, &pt, &trash)
Useful if exact this form is forced.
-- Frank Klemm
|Lo-Fi Version||Time is now: 5th September 2015 - 05:33|