Replay Gain - A Proposed Standard

Scale to the Replay Gain

Reading the Replay Gain

First, the player needs to determine if the user requires "Radio" style level equalisation (all tracks same loudness), or "Audiophile" style level equalisation (all tracks "ideal" loudness). This option should be selectable in the Replay Gain control panel, and should default to "Radio".

Then the player reads the appropriate Replay Gain adjustment value from the file header, and converts it back to its original dB value. See the Replay Gain Data Format for more details. Please remember to divide it by ten!

The player also needs to read (or calculate) the Peak amplitude. This is required for Clipping prevention.

Scaling by the Replay Gain adjustment

Changing the level of an audio signal simply means multiplying each sample value by a constant value. This constant is given by:

      scale=10.^(replay_gain/20);

Or, in words: ten to the power of (the replay gain divided by 20).

After any such operation, it's a good idea to dither the result. If this calculation and the pre-amp are implemented separately, then dither should only be added to the final result, just before the result is truncated back to 16 bits, or 24, or 8, as limited by the soundcard - not the file (i.e. after Replay Gain adjustment, an 8-bit file should be sent to a 16-bit soundcard at 16-bits).

If the Replay Gain information is absent...

Simply disabling Replay Gain control for tracks without Replay Gain information would cause these tracks to be louder than the others, so bringing back the original problem!

If neither ("Radio" or "Audiophile") Gain adjustment is set, or if the track does not contain Replay Gain information, then the player should use an average of the previous 10(?) Replay Gains. This represents the typical loudness of tracks in the users music collection, and is a much better estimate of the likely Replay Gain than 0dB, or no adjustment at all.

If the file only contains one of the Replay Gain adjustments (e.g. Audiophile) but the user has requested the other (Radio), then the player should use the one that is available (in this case, Audiophile).

Implementation

As above.

Suggestions and further work

None as yet.