Replay Gain - A Proposed Standard

Replay Gain ID3v2 File Format

Existing format

The ID3v2 format is explain at The most useful document is the ID3v2 v2.3.0 standard*. Note that all ID3v2 tag frames are written in Big Endian Byte order.

* Whilst this document has been superseded by v2.4.0 (see ID3v2 Developer Information) the earlier document is complete (rather than an update), and in indexed HTML form. As such, it represents a better technical introduction to ID3v2.

The ID3v2 standard defines a "tag" which is situated before the data in an mp3 file. The original ID3 (v1) tags resided at the end of the file, and contained a few fields of information. The ID3v2 tags can contain virtually limitless amounts of information, and new "frames" within the tags may be defined.

Replay Gain Adjustment chunk

In the language of the ID3v2 standard document, a new frame is suggested, thus:

	<Header for 'Replay Gain Adjustment', ID: "RGAD">
	Peak Amplitude				$xx $xx $xx $xx
	Radio Replay Gain Adjustment		$xx $xx
	Audiophile Replay Gain Adjustment	$xx $xx

	Header consists of:
	Frame ID		$52 $47 $41 $44	= "RGAD"
	Size			$00 $00 $00 $08
	Flags			$40 $00		(%01000000 %00000000)

In the RGAD frame, the flags state that the frame should be preserved if the ID3v2 tag is altered, but discarded if the audio data is altered.

Does it work?

I haven't tried this myself. Some example code for parsing ID3v2 tags is available here, which could easily be extended to write the above tag. Within-range Replay Gain data can contain the synchronisation code ($FF), so unsynchronisation may be necessary for this frame.

Suggestions and Further Work

If you can see any problem with this proposal, please let me know. No software implements this (as yet).