-
-
Notifications
You must be signed in to change notification settings - Fork 93
Replay Gain Data Format
This page is cloned from: http://privatewww.essex.ac.uk/~djmrob/replaygain/rg_data_format.html
Three values must be stored.
- Peak signal amplitude
- "Radio" = Replay Gain adjustment required to make all tracks equal loudness
- "Audiophile" = Replay Gain adjustment required to give ideal listening loudness
If calculated on a track-by-track basis, ReplayGain yields (2). If calculated on a disc-by-disc basis, ReplayGain will usually yield (3), though this value may be more accurately determined by a human listener if required.
To allow for future expansion: If more than three values are stored, players should ignore those they do not recognise, but process those that they do. If additional Replay Gain adjustments other than "Radio" and "Audiophile" are stored, they should come after "Radio" and "Audiophile". The Peak Amplitude must always occupy the first 4 bytes of the Replay Gain header frame. The three values listed above (or at least fields to hold the three values, should the values themselves be unknown) are required in all Replay Gain headers.
The replay gain adjustment must be between -51.0dB and +51.0dB. Values outside this range must be limited to be within the range, though they are certainly in error, and should probably be re-calculated, or stored as "not set". For example, trying to cause a silent 24-bit file to play at 83dB will yield a replay gain adjustment of +57dB.
In practice, adjustment values from -23dB to +17dB are the likely extremes, and values from -18dB to +2dB are more usual.
Each Replay Gain value should be stored in a Replay Gain Adjustment field consisting of two bytes (16 bits). Here are two example Replay Gain Adjustment fields:
Radio Gain Adjustment Audiophile Gain Adjustment
0 0 1 0 1 1 1 0 0 1 1 1 1 1 0 1 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0
\___/ \___/ | \_______________/ \___/ \___/ | \_______________/
| | | | | | | |
name | sign | name | sign |
code | bit | code | bit |
| | | |
originator | originator |
code | code |
Replay Gain Replay Gain
Adjustment Adjustment
In the above example, the Radio Gain Adjustment is -12.5dB, and was calculated automatically. The Audiophile Gain Adjustment is +2.0dB, and was set by the user.
000 = not set
001 = Radio Gain Adjustment
010 = Audiophile Gain Adjustment
other = reserved for future use
000 = Replay Gain unspecified
001 = Replay Gain pre-set by artist/producer/mastering engineer
010 = Replay Gain set by user
011 = Replay Gain determined automatically, as described on this site
other = reserved for future use
For each Replay Gain Adjustment field, if the name code is valid, but the Originator code is 000 (Replay Gain unspecified), then the player should ignore that Replay Gain adjustment field.
For each Replay Gain Adjustment field, if the name code is valid, but the Originator code is unknown, then the player should still use the information within that Replay Gain Adjustment field. This is because, even if we are unsure as to how the adjustment was determined, any valid Replay Gain adjustment is more useful than none at all.
If no valid Replay Gain Adjustment fields are found (i.e. all originator codes are 000), then the player should proceed as if the file contained no Replay Gain Adjustment information (see player requirements).
The value, multiplied by ten, stripped of its sign (since the + or - is stored in the "sign" bit), is represented in 9 bits. e.g. -3.1dB becomes 31 = 000011111
.
$00 $00 (0000000000000000)
should be used where no Replay Gain has been calculated or set.
This value will be interpreted by players in the same manner as a file without a Replay Gain field in the header (see player requirements).
The values of xxxyyy0000000000
(where xxx is any name code, and yyy is any originator code) are all valid, but indicate that the Replay Gain is to be left at 83dB (0dB Replay Gain Adjustment).
These are not default values, and should only be used where appropriate (e.g. where the user, producer, or Replay Gain calculation has indicated that the correct Replay Gain is 83dB).
The values xxxyyy1000000000
are all illegal. You cannot have negative zero! These values may be used to convey other information in the future. They must not be used at present.
If enountered, players should treat them in the same manner as $00 $00 (the default value).
The value $xx
$ff
is not illegal, but it would give a false synch value within an mp3 file. The problems this may cause should be investigated, and a solution (e.g. unsychronisation) sought.
Maybe this is a use for negative zero?