[vorbis] ReplayGain support for Vorbis

Erik Turner erik at turner.org
Tue Jan 15 11:05:26 PST 2002



Just wanted to comment on this.

The WAV file format (and FLAC for the purposes of this discussion)
doesn't have the same "reversability" that MP3 and Ogg files have.

Replay Gain has two distinct modes in which it can be used.

The first is by adjust the output by a scale factor on the way to the
sound card.  This doesn't require any change to the audio data in
the file.  But it does require that the player do the scaling in real-time.
This is the one that I would want to use for WAV (FLAC).

The second is by adjusting the output level of each audio frame on
disk.  Notice that this changes the audio data.  In an MP3 
(and I'm assuming OggVorbis) frame, there is already a place for
this value and ReplayGain just adjusts this value.  If you know what
bias you applied to this value, you can just reverse it (i.e. if you added
2.3 db, then, to reverse, subtract 2.3 db for each frame).

Unfortunately, this doesn't work for WAV files.  Recall that PCM data is
nothing but an integer (-32767..32767) representing a sound intensity.
Since it is an integer, reducing the volume by a factor is not exactly
reversible due to quantization.  Lets say you have a sample of 2344
that you wish to apply a -10db correction to.  The corrected value would
be 234 = Round(2344 / 10).  When you try to reverse this, you get 
234 * 10 = 2340 which is not what you started with.  Lower signal levels
suffer worse errors than higher signal levels.  Whether any of this is 
audible is not the point.  The point is that the file is now no longer the
same.

Erik Turner

----- Original Message ----- 
From: "Wilson" <defiler at null.net>
To: <vorbis at xiph.org>
Sent: Tuesday, January 15, 2002 12:57 PM
Subject: Re: [vorbis] ReplayGain support for Vorbis

<p><snip>

Also, AFAIU, you can return to the "original" file with the ReplayGain
system. Seems like a good fit with a lossless codec.

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis mailing list