Help - Search - Members - Calendar
Full Version: Replaygain for Wave
Hydrogenaudio Forums > Hydrogenaudio Forum > General Audio
camote
Is it possible to do it in a lossless way, like with MP3s.
Tomcat
I think - isn't.
There is WaveGain. It isn't lossless, but acceptable.
DickD
QUOTE(camote @ Jul 22 2003, 01:36 AM)
Is it possible to do it in a lossless way, like with MP3s.

Assuming you're using 16-bit fixed point PCM WAV, then lossless (as in not changing the original signal at all so that you can recover a bit-perfect copy) requires you to use tagging, a cuesheet or a database to tell the player what gain to apply, but not to modify the audio in the file directly.

Foobar2000 supports this with all formats (even audio CDs, if you have the database enabled), so you can save space by compressing to FLAC or Monkey's Audio then tag it too.

For any other player, it's unsupported, as far as I know, and wavgain is the way to go (or Foobar's diskwriter is equivalent to wavgain). With strong ATH noise shaping dither in either of these, a gain of around -13 dB would be needed before the perceived noise floor is raised, if your original CD had no noise shaping dither.

In any reasonable circumstance, replaygaining a WAV directly with wavgain or FB2K's diskwriter and dithering properly will cause deterioration far less than encoding to MP3 in the first place. It's very simple mathematics, not something as difficult and subjective as MP3's psychoacoustic encoding.

Any recording with a high volume (strong negative RG value) is unlikely to use anything like the full dynamic range, so you don't lose anything audible (and they produce the same output you'd get when listening with ReplayGain turned on in a player). Why would you ever want to burn the CD excessively loud as it was originally? If you would, just tag your lossless file and use a player with RG support.

Theoretically, floating point PCM WAV could work a bit like mp3gain (by changing the exponent, but leaving the mantissa alone), but I think Foobar2000 is one of the few players to support floating point WAV, and it already supports ReplayGain tags.

It would be possible (but fairly pointless as far as I can see) to make software to apply gain like wavgain does (with appropriate dither or not) and store a "correction" file (probably Rice-coded to make it reasonably small) that would also include a header block indicating the gain required to Undo the wavgain. The correction file could be used to fill in the least significant few bits after a known gain and dither algorithm converted the file back to the original volume. By using pseudorandom numbers with a known seed for dither throughout the process (esp noise shaped dither) it could probably be made deterministic enough to be efficient yet still recover the original bit-perfect PCM audio data.

Like Wavpack lossy, if you stored the correction file as well as the wavgained file you'd then have the possibility to recreate the lossless file at a later date.

Apart from being obsessive about having a 'bit-identical' copy I still don't really see the point of keeping bit-perfect copies of CD with 'slovenly mastering' (overly dynamically compressed) which are so loud you have to turn the volume down such that the lowest bits become completely inaudible anyway.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.