Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/foedusprogramme/gramophone/llms.txt

Use this file to discover all available pages before exploring further.

ReplayGain is a standard for storing loudness metadata in audio files so that a player can normalize volume across tracks or albums without permanently altering the files. Gramophone implements full ReplayGain 2.0 support.

Why ReplayGain matters

Different albums and tracks are mastered at different loudness levels. Without normalization, you may need to adjust the volume every time you switch between an old vinyl rip and a modern pop track. ReplayGain solves this by letting the player apply a calculated gain offset based on metadata stored in the file.

Gain modes

Gramophone supports three modes, configurable under Settings > Audio > ReplayGain:
ModeBehavior
NoneReplayGain is disabled. No gain adjustment is applied.
TrackNormalizes each track independently to a consistent loudness. Recommended for shuffle playback.
AlbumNormalizes at the album level, preserving the relative loudness differences between tracks within an album. Recommended for listening to albums from start to finish.
In Track mode, if track gain is missing from a file, album gain is used as a fallback, and vice versa.

Supported metadata tags

Gramophone reads ReplayGain information from a wide range of tag formats and conventions:
  • TXXX:REPLAYGAIN_TRACK_GAIN and TXXX:REPLAYGAIN_ALBUM_GAIN
  • TXXX:REPLAYGAIN_TRACK_PEAK and TXXX:REPLAYGAIN_ALBUM_PEAK
  • RVA2 (ID3v2.4), XRV, XRVA (ID3v2.2/2.3 backports)
  • RVAD / RVA (ID3v2.2/2.3)
  • RGAD (classic ReplayGain ID3 proposal)
  • R128_TRACK_GAIN / R128_ALBUM_GAIN (EBU R128 / Opus-style, stored as fixed-point Q7.8)
  • iTunNORM (iTunes SoundCheck, MP3 and MP4)
  • LAME header gain values (Mp3InfoReplayGain)
  • JRiver Media Center comment tags (MEDIA JUKEBOX: REPLAY GAIN, etc.)
  • REPLAYGAIN_TRACK_GAIN, REPLAYGAIN_ALBUM_GAIN
  • REPLAYGAIN_TRACK_PEAK, REPLAYGAIN_ALBUM_PEAK
  • R128_TRACK_GAIN, R128_ALBUM_GAIN (OGG Opus standard)
  • JRiver tags: REPLAY GAIN, PEAK LEVEL
  • com.apple.iTunes domain frames: REPLAYGAIN_TRACK_GAIN, REPLAYGAIN_ALBUM_GAIN, and related
  • iTunNORM internal frame (iTunes SoundCheck for MP4)
ReplayGain normalization only works if your audio files already contain ReplayGain tags. Use a tool such as loudgain, mp3gain, or your audio tagger of choice to analyze and tag your files before enabling this feature.

Additional gain controls

Beyond the mode selection, Gramophone provides two extra gain parameters:
SettingDescription
Pre-amp (boost gain)Adds a fixed dB offset on top of the ReplayGain value. Useful if your files were tagged to a loudness target that is too quiet for your listening environment.
Reduce gainPrevents clipping by capping the applied gain so that the loudest peak in the track does not exceed digital full scale.

Adaptive Dynamic Range Compression (ADRC)

When the applied gain would cause the signal to clip (i.e. when ReplayGain pushes the peak above 0 dBFS and Reduce gain is not sufficient to prevent it), Gramophone can invoke Adaptive Dynamic Range Compression via the hificore native module. ADRC applies a soft knee compressor that brings transients under control rather than hard-clipping or reducing gain aggressively. The compressor uses the following parameters internally:
ParameterValue
Compression ratio2:1
Attack time constant (τ)1.4 ms
Release time constant (τ)93 ms
ADRC output is always floating-point PCM to preserve precision during the compression process.

Integration with ExoPlayer

ReplayGainAudioProcessor is implemented as a BaseAudioProcessor and is inserted into ExoPlayer’s audio processing chain. It receives PCM audio frames and applies the gain multiplier (or passes them through ADRC) before they reach the audio output. The processor updates its parameters in real time as settings change or as new tracks begin — no restart is required.

Settings location

Settings > Audio > ReplayGain

Build docs developers (and LLMs) love