IPB

Welcome Guest ( Log In | Register )

Improving ReplayGain, some ideas for Devs etc
2Bdecided
post Nov 18 2003, 17:04
Post #1


ReplayGain developer


Group: Developer
Posts: 4945
Joined: 5-November 01
From: Yorkshire, UK
Member No.: 409



Every now and again I wish I had the time to update the ReplayGain website and add some new ideas, and maybe even clarify some old ones. I don't, so this thread will have to do.


Firstly, the format used to store ReplayGain info in files is not documented correctly on the ReplayGain website, and it would be good to "publish" what has emerged as the standard for each format.

Secondly, what is stored is not documented correctly on the ReplayGain website, and I'd like to re-examine what is stored...


One change has already happened, and I think it's a good change:

Forget Radio and Audiophile - Track and Album are much better names.
(that's an open admission of me being wrong, for anyone who discussed this with me previously!)


So, we store:

ReplayGain Track adjustment
ReplayGain Album adjustment
(ReplayGain) Track peak
(ReplayGain) Album peak

(this last one wasn't in the original proposal, but it has been widely used - I've put it in bold to remind me to include it in the update)

That makes sense, and most software supports this. I'd like to formalise some extensions, some of which were there from the start, and others that have cropped up more recently:


1. (ReplayGain) undo adjustment
- this is written when the gain of the file is changed (e.g. by mp3gain, or by decoding with ReplayGain enabled), and is the gain change required to put the file back to where it started.

e.g. If I apply -8dB gain change using mp3gain, then
(ReplayGain) undo adjustment = +8dB

e.g. If I use --scale 0.5 when encoding (for whatever reason?!), then
(ReplayGain) undo adjustment = +6dB

If the gain of an already ReplayGained file is changed, the original four values (Track and Album adjustment and peak) should be updated so that they are correct for the new audio data. (see an example in this thread: http://www.hydrogenaudio.org/forums/index....topic=15412&hl= )

I can't see any argument against defining this field. It would be zero (or absent) if the audio file hasn't been altered. It's useful in all formats because you can always apply wavgain before encoding, and it would be nice to know that this has been done.


2. ReplayGain calculation method

OK - I've had this argument before, but this really is important. ReplayGain can be improved, but you'll never know whether files are tagged using the old or new ReplayGain calculation unless the calculation method (actually a number which corresponds to the method) is stored. This doesn't increase the complexity of players, as they won't care - it just makes it very easy to pick out files that were tagged with the old version, and update them.


3. ReplayGain lossy approximation

This is just a single bit: 0 or 1.

0= this ReplayGain info has been calculated from the data in this file
1=this file has been lossily encoded/transcoded since this ReplayGain info was calculated.

What's the point of this? If you have a file with ReplayGain info, you can transcode it and copy the RG info across. It'll be close enough to give you excellent loudness equalisation, and you won't have to re-calculate it. Yet they'll be a label there to tell all you anal retentives that it's not quite right, and should be recalculated if you want to be 100% sure (especially important for peak amplitude).

You could (should?) have one “ReplayGain lossy approximation” bit for each of the four values, which gives you the chance (for example) of re-calculating the peak values (quick, and important - so let's do it), but leaving the ReplayGain values (slow, and unimportant - so let's not do it).


4. ReplayGain user adjustment

Instead of suggesting that users should change the calculated values if they wish, give them a field to enter their own value if they really have to. Players should give the option to read the user value in preference to any others (i.e. let it act as an over-ride), and taggers should give the option of removing the user values from all (downloaded) files.


5. ReplayGain RealLife adjustment

The gain required to give the actual SPL of the original event (in a calibrated system), or a human judged sensible replay level (see the explanation behind the original "Audiophile" level and the work of Bob Katz if you think this is an impossible idea). I've found a few DVD-A discs that have this information (it's in the MLP stream), so it would be nice to have somewhere to store it. It's unlikely to get used much, but it would be a useful thing to have. It would be the last link in some of the best recordings out there.



I'd like to come to a consensus of which ones of these (if any/all) should be included, and then get some specs as to how they are/should be stored in each file format (especially APE2.0 tags) finalised and published on-line.

Comments? Suggestions? Offers of help?


btw I've received a couple of suggestions for improving the ReplayGain calculation. One is trivial, and seems like a great idea. I'll post it for testing when the problem of version numbering is solved. If anyone else has slightly or totally re-worked the ReplayGain algorithm/concept, now would be a good time to step forward! We could do listening tests to find the best candidate for "calculation version 2".


Cheers,
David.

Newbie warning: this thread is not for asking questions about ReplayGain that are already answered on www.replaygain.org or in previous threads on HA. (I'm always happy to answer "silly" questions via email – half of them aren't silly at all.)

However, if you do already have some understanding of ReplayGain then this thread is the perfect place for clarifying anything to do with the above proposals which is not clear.

This post has been edited by 2Bdecided: Nov 18 2003, 17:42
Go to the top of the page
+Quote Post
 
Start new topic
Replies
Xenno
post Jul 19 2004, 23:01
Post #2





Group: Members
Posts: 393
Joined: 23-July 02
From: Blue Grass, IA
Member No.: 2760



2B > The peak sample value tells you _exactly_ how much headroom the material has - usually none!

...and I am at a loss on how RG actually does this. If I take a 20 kHz sine wave (or whatever that will yield 2 sample points per cycle) and encode at 44.1 kHz, there is no guarantee that the sample points will fall on the amplitude maximums (unless phase locked). They could fall on the x-axis crossing nodes...or anywhere on the waveform up to the peaks. Given my example above, is RG actually reconstructing the wave to determine the peak value...or is it using the data in the file?

xen-uno


--------------------
No one can be told what Ogg Vorbis is...you have to hear it for yourself
- Morpheus
Go to the top of the page
+Quote Post
SamK
post Jul 20 2004, 00:52
Post #3





Group: Members
Posts: 57
Joined: 4-January 04
Member No.: 10938



QUOTE (Xenno @ Jul 19 2004, 11:01 PM)
2B > The peak sample value tells you _exactly_ how much headroom the material has - usually none!

...and I am at a loss on how RG actually does this. If I take a 20 kHz sine wave (or whatever that will yield 2 sample points per cycle)


in fact 2+epsilon sample points are required by shannon theorem in the case of real valued samples, if you look at it closely enough.
(ie : notice that cos(Wt) = 0.5*(exp(iWt) + exp(-iWt)), and thus its bandwidth is not in [-W,+W[ )

QUOTE
and encode at 44.1 kHz, there is no guarantee that the sample points will fall on the amplitude maximums (unless phase locked). They could fall on the x-axis crossing nodes...or anywhere on the waveform up to the peaks.


on a long enough sequence of such a sine wave, some of the sample points will fall very close to maximums of the continuous wave.
By a quick estimation, 4000 samples are enough to insure that the discrete peak lies within 100/(4000^2) percents of the continuous wave's real peak for high frequencies up to 22.05/(1+1/4000) = 22.044 kHz.
(I'm using 1-x^2/2 as an estimate of the sine wave near the optimums)

Even with only 10 samples, you get 1% peak precision for high-frequency sines up to 20.04 kHz.
(i.e., from 2.2kHz to 20.04kHz. low frequencies are of no interest here, since they don't show much max difference between discrete and continuous signal)

Conclusion : for a sine wave, you don't really have to worry about the difference between the discrete peak and the underlying continuous peak.

QUOTE
Given my example above, is RG actually reconstructing the wave to determine the peak value...or is it using the data in the file?


my opinion is it doesn't matter, even slightly, though I only made my point with sine waves and not the general case of just any sampled sound.

This post has been edited by SamK: Jul 20 2004, 00:58
Go to the top of the page
+Quote Post
SamK
post Jul 20 2004, 00:55
Post #4





Group: Members
Posts: 57
Joined: 4-January 04
Member No.: 10938



QUOTE (SamK @ Jul 20 2004, 12:52 AM)
my opinion is it doesn't matter, even slightly, though  I only made my point with sine waves and not the general case of just any sampled sound.
*


on top of that, you can consider it's not really clipping as long as the digital signal is conserved.
Then, if the DAC chops of the true peaks of the analog signal due to that kind of issue, I'd say it's his fault.
Go to the top of the page
+Quote Post

Posts in this topic
- 2Bdecided   Improving ReplayGain   Nov 18 2003, 17:04
- - Gabriel   I think that a point that should be clarified/upda...   Nov 18 2003, 17:11
- - 2Bdecided   Frank heavily criticised my proposal for storing R...   Nov 18 2003, 17:22
- - Gabriel   You might be interested by: http://sourceforge.net...   Nov 18 2003, 17:32
- - 2Bdecided   Moderators: On this page: http://replaygain.hydro...   Nov 18 2003, 17:35
|- - danbee   QUOTE (2Bdecided @ Nov 18 2003, 04:35 PM)Almo...   Oct 27 2004, 17:54
- - 2Bdecided   QUOTE (Gabriel @ Nov 18 2003, 04:32 PM)You mi...   Nov 18 2003, 17:38
- - Digga   QUOTE (2Bdecided @ Nov 18 2003, 05:35 PM)(It...   Nov 18 2003, 23:26
- - Mike Giacomelli   I would just like a way to write replaygain info i...   Nov 18 2003, 23:49
- - Gabriel   QUOTE Almost everyone is using a reference level o...   Nov 19 2003, 15:28
- - 2Bdecided   That would be fine. Or... Would the following ...   Nov 20 2003, 12:43
- - Gabriel   Seems interesting. It would be nice to hear other ...   Nov 20 2003, 13:04
- - 2Bdecided   Do none of the developers have any comments? Two...   Nov 21 2003, 12:24
- - phwip   QUOTE (2Bdecided @ Nov 21 2003, 12:24 PM)1. I...   Nov 21 2003, 12:31
- - 2Bdecided   QUOTE (phwip @ Nov 21 2003, 11:31 AM)QUOTE (2...   Nov 21 2003, 14:04
- - n68   QUOTE (2Bdecided @ Nov 21 2003, 02:04 PM)QUOT...   Nov 21 2003, 14:43
- - robUx4   Just a question from a user point of view. iTunes ...   Nov 23 2003, 17:03
- - robUx4   QUOTE (2Bdecided @ Nov 18 2003, 05:35 PM)Almo...   Nov 23 2003, 17:05
- - guruboolez   QUOTE (robUx4 @ Nov 23 2003, 05:03 PM)Just a ...   Nov 23 2003, 17:23
- - 2Bdecided   QUOTE (robUx4 @ Nov 23 2003, 04:05 PM)QUOTE (...   Nov 23 2003, 17:30
- - Case   QUOTE (robUx4 @ Nov 23 2003, 06:05 PM)QUOTE (...   Nov 23 2003, 17:55
- - dev0   3. ReplayGain lossy approximation Storing this se...   Nov 23 2003, 18:36
- - /\/ephaestous   QUOTE (2Bdecided @ Nov 21 2003, 06:24 AM)1. I...   Nov 24 2003, 06:02
- - /\/ephaestous   QUOTE (dev0 @ Nov 23 2003, 12:36 PM)3. Replay...   Nov 24 2003, 07:01
- - guruboolez   Try lame abr for exemple (there's a --scale 0....   Nov 24 2003, 11:18
- - 2Bdecided   QUOTE (Case @ Nov 23 2003, 04:55 PM)QUOTE (ro...   Nov 24 2003, 11:50
- - 2Bdecided   QUOTE (dev0 @ Nov 23 2003, 05:36 PM)3. Replay...   Nov 24 2003, 11:51
- - 2Bdecided   QUOTE (guruboolez @ Nov 24 2003, 10:18 AM)Try...   Nov 24 2003, 11:58
- - guruboolez   And what about the idea of a personnal track/album...   Nov 24 2003, 12:26
- - 2Bdecided   See my reply in your other thread, and my suggesti...   Nov 24 2003, 12:54
- - Case   QUOTE (2Bdecided @ Nov 24 2003, 12:50 PM)Sorr...   Nov 24 2003, 18:06
- - 2Bdecided   Another suggestion (this isn't fundamental)......   Nov 26 2003, 11:02
- - andyh   I'm confused as to how the RealLife level is d...   Jan 2 2004, 17:44
- - Lear   QUOTE (2Bdecided @ Nov 18 2003, 05:35 PM)(It...   Jan 2 2004, 19:10
- - Lear   QUOTE (2Bdecided @ Nov 20 2003, 12:43 PM)Fiel...   Jan 2 2004, 22:46
- - SamK   I think it's the right time to switch to absol...   Jan 4 2004, 15:48
- - knik   QUOTE (2Bdecided @ Nov 18 2003, 07:35 PM)Almo...   Jan 5 2004, 12:16
- - Mike Giacomelli   Stupid question: Is 0dB relative also 96 dB in 16...   Jan 6 2004, 06:28
- - SamK   QUOTE (knik @ Jan 5 2004, 12:16 PM)After clos...   Jan 6 2004, 14:52
- - 2Bdecided   QUOTE (Lear @ Jan 2 2004, 06:10 PM)QUOTE (2Bd...   Jan 6 2004, 15:12
- - knik   QUOTE (2Bdecided @ Jan 6 2004, 05:12 PM)I do,...   Jan 6 2004, 18:45
- - knik   QUOTE (SamK @ Jan 6 2004, 04:52 PM)So you...   Jan 6 2004, 20:56
- - 2Bdecided   QUOTE (knik @ Jan 6 2004, 07:56 PM)QUOTE (Sam...   Jan 7 2004, 14:07
- - 2Bdecided   QUOTE (Lear @ Jan 2 2004, 09:46 PM)QUOTE (2Bd...   Jan 7 2004, 14:16
- - Gabriel   Lame is using the fixed point representation from ...   Jan 7 2004, 14:23
- - SamK   QUOTE (2Bdecided @ Jan 7 2004, 02:07 PM)Repla...   Jan 7 2004, 15:57
- - SamK   reading http://home.earthlink.net/~bobkatz24bit/in...   Jan 7 2004, 20:34
- - Lear   QUOTE (2Bdecided @ Jan 7 2004, 02:16 PM)QUOTE...   Jan 7 2004, 20:47
- - knik   Thanks for explanation, 2Bdecided. It really helpe...   Jan 7 2004, 21:32
- - 2Bdecided   QUOTE (SamK @ Jan 7 2004, 02:57 PM)QUOTE (2Bd...   Jan 8 2004, 12:29
- - 2Bdecided   QUOTE (SamK @ Jan 7 2004, 07:34 PM)reading ht...   Jan 8 2004, 13:11
- - 2Bdecided   I remembered something last night. When it stored...   Jan 8 2004, 13:18
- - SamK   QUOTE (2Bdecided @ Jan 8 2004, 01:11 PM)No, b...   Jan 8 2004, 14:15
- - SamK   QUOTE (2Bdecided @ Jan 8 2004, 01:18 PM)I...   Jan 8 2004, 14:27
- - SamK   QUOTE so the relative gain itself will still be br...   Jan 8 2004, 16:29
- - SamK   To sum up my opinion, I am for storing 3 values i...   Jan 8 2004, 17:07
- - 2Bdecided   I think you've got more time to write that I h...   Jan 8 2004, 18:03
- - SamK   QUOTE (2Bdecided @ Jan 8 2004, 06:03 PM)I thi...   Jan 8 2004, 20:31
|- - David Nordin   QUOTE (SamK @ Jan 8 2004, 08:31 PM)QUOTE (2Bd...   Jul 18 2004, 09:10
|- - 2Bdecided   QUOTE (David Nordin @ Jul 18 2004, 08:10 AM)I...   Jul 19 2004, 12:02
- - Iconoclast_a   Well, I think the genre dependent adjustment could...   Jul 13 2004, 10:03
|- - Kuuenbu   There should be an option to turn the equal loudne...   Jul 18 2004, 00:54
|- - 2Bdecided   QUOTE (Kuuenbu @ Jul 17 2004, 11:54 PM)There ...   Jul 19 2004, 12:06
|- - Kuuenbu   QUOTE The peak sample value tells you _exactly_ ho...   Jul 26 2004, 02:18
- - Pio2001   I'd still like to see a plugin that would read...   Jul 18 2004, 08:07
|- - 2Bdecided   QUOTE (Pio2001 @ Jul 18 2004, 07:07 AM)I...   Jul 19 2004, 12:01
|- - Peter   QUOTE (2Bdecided @ Jul 19 2004, 02:01 PM)QUOT...   Jul 19 2004, 21:08
- - Ariakis   For CDs from lossy files in fb2k, you can clean yo...   Jul 18 2004, 08:43
|- - Pio2001   QUOTE (Ariakis @ Jul 18 2004, 08:43 AM)For CD...   Jul 18 2004, 17:32
- - indybrett   If it hasn't been brought up yet, I would like...   Jul 18 2004, 18:09
- - snek_one   only thing i have to get off my chest about replay...   Jul 18 2004, 18:52
|- - Cyaneyes   QUOTE (snek_one @ Jul 18 2004, 01:52 PM)only ...   Jul 18 2004, 19:30
|- - Pio2001   QUOTE (snek_one @ Jul 18 2004, 06:52 PM)only ...   Jul 19 2004, 20:50
- - indybrett   I don't think that is the same as what he is a...   Jul 19 2004, 21:51
- - dev0   This can be done by raising the Pre-Amp.   Jul 19 2004, 22:01
|- - indybrett   QUOTE (dev0 @ Jul 19 2004, 04:01 PM)This can ...   Jul 19 2004, 22:29
|- - Pio2001   QUOTE (indybrett @ Jul 19 2004, 09:51 PM)QUOT...   Jul 19 2004, 22:50
- - Xenno   2B > The peak sample value tells you _exactly_ ...   Jul 19 2004, 23:01
|- - SamK   QUOTE (Xenno @ Jul 19 2004, 11:01 PM)2B > ...   Jul 20 2004, 00:52
|- - SamK   QUOTE (SamK @ Jul 20 2004, 12:52 AM)my opinio...   Jul 20 2004, 00:55
- - 2Bdecided   The RG peak value is the largest absolute value wi...   Jul 20 2004, 13:07
|- - SamK   QUOTE (2Bdecided @ Jul 20 2004, 01:07 PM)The ...   Jul 20 2004, 14:08
||- - 2Bdecided   QUOTE (SamK @ Jul 20 2004, 01:08 PM)Wow, 1.5x...   Jul 20 2004, 14:50
|- - SamK   QUOTE (2Bdecided @ Jul 20 2004, 01:07 PM)isn...   Jul 20 2004, 14:19
- - dev0   CODEreplaygain_track_gain = -10.99 dB replaygain_t...   Jul 20 2004, 14:59
- - 2Bdecided   That's different to the latest issue discussed...   Jul 20 2004, 15:13
- - jcoalson   not a bad idea, e.g. replaygain_reference_level=9...   Oct 27 2004, 18:23


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: 21st April 2014 - 11:22