Welcome Guest ( Log In | Register )

Flaw in ReplayGain spec
post May 12 2002, 11:04
Post #1

Server Admin

Group: Admin
Posts: 4853
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?

Go to the top of the page
+Quote Post
Start new topic
post May 21 2002, 21:03
Post #2

Server Admin

Group: Admin
Posts: 4853
Joined: 24-September 01
Member No.: 13

First, thanks for the speedy reply!

Originally posted by Emmettfish

I have a very small staff, and they're very busy working on 1.0 of Vorbis and the Vorbis spec. I think it's clear to even the most casual observer that although replaygain support is important and useful, there are other, more pressing needs at the moment. That's number one, and that's outside the realm of even discussing replaygain.

I realize this; a full devotion of the devteam towards RG support is not for today or even the near or forseeable future. This is why I started working on it in the first place.

Number two, I still am not convinced that adding replaygain tags is the best solution to implement replaygain. I am convinced that it would be the easiest solution, but I am not convinced that it would be the right one. Let me go back to my original point a little bit. 

I agree the tags are likely not the best place to store it - I already
stated that in the thread above as well.

1.0 (and the spec) is due to be published very soon. Implementing a quick-and-dirty solution for replaygain is likely not a good idea, for a couple reasons. One, it's not a good idea to define temporary solutions in a 1.0 release. Two, if we do something we're going to change later, that means that you'll be bugging your player authors twice.

There is a lot of sense in not wanting to release a temporary solution, but it should not be generalized. If that is the case, we might not release 1.0 with the unavoidable preecho problems as well. Better wait till we finish 2.0 with wavelets so we won't have to bug the player authors twice.

That is not what we want, is it?

A temporary solution makes sense when there is no real solution in sight for the forseeable future. If you want to attach warning signs to it 'WARNING TEMPORARY HACK', feel free to do so. But don't just shoot it down without proposing a sensible alternative.

I don't feel it justified to call the current proposal quick-n-dirty. The vorbis implemenation predates your involvement with Xiph and it is based on the by now quite matured work of David Robinson. It's a complete solution with as only drawback that the data is not stored in the best place imaginable - forcedly so, since there is no other place for now and for the time to come.

The temporary solution is already out there. ReplayGain has been in use with Vorbis for half a year now. It was unofficial at first, but since there was interest from the Vorbis side as well, it got semi-official with talks of support in the libs. It wasn't clear to me there was a problem with the current method until things erupted on IRC (that was after several core Vorbis developers emailed me they were ok with the proposed change, even). Thing went from 'we're ok with this and like it' to 'it totally sucks and should die ASAP'.

I'm now in the unfortunate situation that the tools and player support are already out there, the proposal being ok with Vorbis developers or not. That's not my fault - the reason it got adopted by the players was because the player authors _wanted_ it. For the same reason, bugging them to change it is no problem at this point. (Moreso because the changes are minimal and we wrote most code ourselves anyway)

I proposed a change to the temporary hack because I saw a problem with it. I can leave it unchanged and not support it any longer, but it's not going to die. The feature is too important for some users. It will stay in use until Xiph comes with its own official implementation that is at least as good. If that's going to happen, I would at least like the hack to be as clean as possible, hence the proposed change.

The disagreement on what info (album/track/peak) should be stored is a non-issue because of this. It is clear at this point Xiph does not support the current proposal as something official at all, so no agreement is strictly needed - the proposal will be replaced at some unspecified point of time in the future anyway.

At the point Xiph does its own ReplayGain support it will quickly become obvious what is needed or not - if the official support is significantly more problematic (or misses essential features) than the temporary hack (which, IMHO, will happen unless Monty revises some of his opinions) then I will leave it up to you to draw the obvious conclusions.

Considering the choice right now is between doing nothing and leaving a somewhat broken proposal out there, or correcting it and having allmost-but-just-not-completely-perfect support out there right now, which can work until Vorbis finishes ReplayGain support itself (i.e. not for _quite_ a while), I will have to choose the latter.

The only real problem that will result from this is that player authors will not be inclined to support the temporary hack taking this into account. Considering the two most important players (WinAmp/XMMS), which are the ones I use, have already adapted the temporarly proposal, it's not a big problem. The others can do as if they feel like it, or might be inclined to if user pressure to do so exists.

The net result will be that for most users Vorbis will effectively have ReplayGain support _now_, even if it is nonofficial.

The nice side effect is that there will be less pressure on the Vorbis team to finish their own implementation.

The only bad thing is that work is going to be duplicated to some extend. Not a problem for me, nor do I suspect it will be for Lear. As long as it is made clear to player authors the solution is temporary, it is completely up to them to go for it or not.

Please remember that we are basically volunteers. We work on this stuff full-time when we could easily go out and find well-paying jobs elsewhere. We do this because we love it, and because we think it's important. People tend to lose sight of the fact that we do good work, and we give it away.

You don't have to tell us that - most of the people that have been involved in this are in exactly the same situation, with the difference that they receive zip for their efforts.

Go to the top of the page
+Quote Post

Posts in this topic
- Garf   Flaw in ReplayGain spec   May 12 2002, 11:04
- - SometimesWarrior   I think an album (peak) gain value would be good t...   May 12 2002, 13:42
- - Garf   QUOTE Originally posted by SometimesWarrior I thi...   May 12 2002, 13:47
- - Case   Seems like Garf has valid points. I don't believe ...   May 12 2002, 15:58
- - DSPguru   QUOTE Originally posted by Garf It already is in ...   May 12 2002, 17:12
- - Garf   QUOTE Originally posted by DSPguru shouldn't thi...   May 12 2002, 18:12
- - DSPguru   unfortunate name ? come-on.. hehe.. btw, the fix...   May 12 2002, 18:31
- - Garf   QUOTE Originally posted by DSPguru as for "human...   May 12 2002, 23:22
- - Garf   Another thing would be renaming AUDIOPHILE to DISK...   May 13 2002, 11:41
- - 2Bdecided   You know my thoughts on most of this, but my opini...   May 13 2002, 14:31
- - john33   Interesting how things run full circle!! I propo...   May 13 2002, 14:31
- - Garf   QUOTE Originally posted by 2Bdecided 2) Source/v...   May 13 2002, 15:24
- - Garf   QUOTE Originally posted by john33 Interesting how...   May 13 2002, 15:27
- - Garf   On the pratical side, I'm considering REPLAYGAIN...   May 13 2002, 16:04
- - Frank Klemm   QUOTE Originally posted by Garf On the pratical s...   May 13 2002, 17:36
- - Garf   QUOTE Originally posted by Frank Klemm 4 == ssc...   May 13 2002, 17:59
- - john33   KISS rules, I think! john33   May 13 2002, 22:12
- - Garf   There has been a huge discussion about this on #vo...   May 15 2002, 15:33
- - john33   This is really rather sad! I thought that part o...   May 15 2002, 16:33
- - sam   I think your idea's Garf are great - clear, simple...   May 15 2002, 16:34
- - Lear   Only incuding radio gain does indeed seem to be a ...   May 15 2002, 18:32
- - Case   I have even better idea. Let's store all the tags ...   May 15 2002, 19:34
- - HotshotGG   QUOTE it seems that this tag is wanted for purpose...   May 15 2002, 20:56
- - Garf   QUOTE Originally posted by HotshotGG What exact...   May 15 2002, 21:57
- - Garf   QUOTE Originally posted by Lear You might then j...   May 15 2002, 22:04
- - john33   The ReplayGain values are the 'property' of a part...   May 15 2002, 22:13
- - JohnV   Also, even if there's going to be replaygain calcu...   May 15 2002, 22:17
- - gnoshi   Couple of thoughts.. I use replaygain; I use ogg;...   May 16 2002, 01:14
- - Garf   QUOTE Originally posted by gnoshi On tags in gene...   May 16 2002, 08:06
- - Lear   QUOTE Originally posted by Garf So, if anyone has...   May 20 2002, 09:52
- - 2Bdecided   Is almost the same discussion happening in two thr...   May 20 2002, 11:19
- - Lear   QUOTE Originally posted by 2Bdecided Is almost th...   May 20 2002, 13:39
- - 2Bdecided   All other things being equal, assuming a complete ...   May 20 2002, 17:50
- - Lear   I'll try to keep this short, since we seem to agre...   May 20 2002, 18:16
- - Garf   QUOTE Originally posted by Lear OK, I've mostly ...   May 20 2002, 18:45
- - sam   QUOTE Originally posted by Lear But there's anoth...   May 20 2002, 19:27
- - Lear   QUOTE Originally posted by Garf A little note: V...   May 20 2002, 19:36
- - sam   QUOTE Originally posted by Lear Considering the a...   May 20 2002, 19:42
- - 2Bdecided   sam, that's just the point. the track isn't 89dB ...   May 21 2002, 10:32
- - matthijsln   QUOTE Originally posted by 2Bdecided It's the cal...   May 21 2002, 10:54
- - Case   QUOTE Originally posted by matthijsln I'm going t...   May 21 2002, 11:06
- - 2Bdecided   Case, I think you missunderstood his question. or...   May 21 2002, 12:33
- - Case   QUOTE Originally posted by 2Bdecided I think you ...   May 21 2002, 13:02
- - sam   QUOTE Originally posted by 2Bdecided that's just ...   May 21 2002, 13:20
- - 2Bdecided   OT: That's really bizarre - we both live in Essex,...   May 21 2002, 14:02
- - sam   QUOTE Originally posted by 2Bdecided OT: That's r...   May 21 2002, 14:22
- - Lear   QUOTE Originally posted by 2Bdecided sam, that's...   May 21 2002, 14:30
- - Case   QUOTE Originally posted by Lear Really, my sugges...   May 21 2002, 14:41
- - 2Bdecided   I appologise if I've sounded harsh to anyone in th...   May 21 2002, 16:17
- - Lear   And Case saw a quite good reason to keep it the wa...   May 21 2002, 16:25
- - 2Bdecided   Great! back to the issue in hand... what are the ...   May 21 2002, 16:53
- - Garf   QUOTE Originally posted by sam Also, storing a +...   May 21 2002, 18:25
- - Garf   QUOTE Originally posted by 2Bdecided Great! back...   May 21 2002, 18:47
- - Emmett_v2   Quoth Garf: "Beats me. I'm no longer willing to d...   May 21 2002, 19:48
- - Garf   First, thanks for the speedy reply! QUOTE Origina...   May 21 2002, 21:03
- - Emmett_v2   Quoth Garf: "I don't feel it justified to call th...   May 21 2002, 22:19
- - john33   I have no wish to get heavily involved in this dis...   May 21 2002, 23:11
- - HotshotGG   QUOTE You don't have to tell us that - most of the...   May 22 2002, 00:25
- - Lear   QUOTE Originally posted by Garf Lear, if updating...   May 22 2002, 15:09
- - Garf   QUOTE Originally posted by Emmettfish Quoth Garf:...   May 22 2002, 18:19
- - Garf   QUOTE Originally posted by john33 I have no wish ...   May 22 2002, 18:24
- - john33   To Lear - Thanks. And, to Garf - You're welcome!   May 22 2002, 18:45
- - lijil   Although my technical audio knowlege and programmi...   Jun 22 2002, 22:17
- - Garf   QUOTE Originally posted by lijil It is still hum...   Jun 23 2002, 08:36
- - mijj   This discussion on VorbisGain suggests there may b...   Jul 22 2002, 02:16
- - Lear   QUOTE Originally posted by mijj This discussion o...   Jul 22 2002, 11:22
- - Jon Ingram   QUOTE Sort of. There has been discussions about ad...   Jul 22 2002, 12:42
- - mijj   < ... mijj contributes with a confidence and co...   Jul 22 2002, 17:57
- - rjamorim   QUOTE Originally posted by mijj < ... mijj con...   Jul 22 2002, 20:01
- - smok3   a question: when turning on RG in mpc winamp dec...   Jul 23 2002, 03:08
- - mijj   ... and speaking of tags ... ... how come whoever...   Jul 26 2002, 16:25
- - Case   QUOTE Originally posted by smok3 when turning on ...   Jul 26 2002, 19:21
- - greenirft   I don't quite understand what the deal with th...   Aug 27 2002, 16:27
- - SometimesWarrior   I love how this thread keeps getting resurrected f...   Aug 27 2002, 20:57

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 17th April 2014 - 05:53