Amarok/Archives/Proposals/VorbisGain Support - What Would it Take?

This is a page dedicated to defining the features that should be in a player that supports ReplayGain/VorbisGain


What is it?

Replaygain/VorbisGain is a method by which the volume level of tracks being played is adjusted so that they all sound equally loud.

The amaroK wishlist item is KDE Bug 81661.

There is an a.k.o forum thread here.

More and more people are asking about this, and it is an important feature because all (most) of the Windows based players support this, and those converting from Windows because of apps like amaroK expect it to be there.

A temporary workaround until amaroK supports "real" ReplayGain:

Links to More Info (some parts outdated) (Replaygain script homepage, has some related utilities)

Desired Features

With respect to the player

  • Have the output volume automatically adjusted if replaygain meta-info is present in the media file.
  • Configuration Menu should allow user to choose either Disable Replay Gain, use Replay Gain Radio/Track tag, or use Replay Gain Audiophile/Album tag.
  • Album-gain should fall-back to Track-gain on tracks w/o album-gain info, perhaps optionally.
  • Clipping Prevention support
  • Support for an optional 6dB Hard Limiter

With respect to tagging

  • Be able to scan files and calculate ReplayGain settings and then automatically tag the files

Both per-track and per-album scans should be supported

  • Be able to manually edit the values
  • Be able to remove replaygain info from files

What's Needed?

What code is needed for this to be properly supported?

  • Rhythmbox supports replaygain tags. They only support gstreamer as engine, and simply adjust the volume specified by the user by the gain factor. No gstreamer support is needed. Rhythmbox prefers the album gain if given a choice between album and track gain. There is no code to let the user add or change the replaygain tags, as this is considered the task of the ripping software.

Engine Support

gstreamer needs a plugin ( or maybe element, to use gstreamer terminology) that would read the tag and apply the specified volume adjustment to the stream

The gstreamer feature request is GNOME Bug 127574.

xine would need (don't know yet, need to research)

I'd say that all engines need to register a property "SupportsReplayGain" and then we provide a virtual function "setReplayGain" and then it's up to the engine to provide multiple volume mixers. For xine I'd write a volume post-plugin that I'd insert before the output sink. Same for GStreamer presumably. --Mxcl

Taglib Support

taglib must support the ability to read and edit replaygain tags. There is a patch to add support for this here. Please vote for it here.

Player Support

UI features would need to be added so that tags could be edited by the user

  • Relevant menu entries
  • Relevant helper menu entries
  • Relevant statusbar entries
  • Relevant config options


There is now a Noatun normalization plugin that sounds like it does everything we would want it to. [1]. It requires a patched Taglib, perhaps Taglib will have everything we need on its next release.


Muine is a GPL player in C# (though using a C library to handle their engines) and is mostly by Jorn Baayen. I've (Ian) actually failed to install it, probably don't have my gtk-sharp library setup right. Anyways, it supposedly has replay support for both xine and gstreamer. Here is some code from player-xine.c. player-gst.c actually has the exact same function (didn't their CS teacher tell them to not copy and paste?).

1 void
player_set_replaygain (Player *player, double gain, double peak)
 double scale;
 g_return_if_fail (IS_PLAYER (player));
 if (gain == 0)
     player->priv->volume_scale = 1.0;
     update_volume (player);
 scale = pow (10., gain / 20);
 /* anti clip */
 if (peak != 0 && (scale * peak) > 1)
   scale = 1.0 / peak;
 /* For security */
 if (scale > 15)
   scale = 15;
 player->priv->volume_scale = scale;
 update_volume (player);

For xine, update_volume is what you would expect, just with the addition of their volume_scale.

1static void
update_volume (Player *player)
 int real_vol;
 real_vol = player->priv->cur_volume * player->priv->volume_scale;
 if (player->priv->stream != NULL)    {
     xine_set_param (player->priv->stream,  XINE_PARAM_AUDIO_AMP_LEVEL, CLAMP (real_vol, 0, 100));
  • Yeah I can't use this method, I'll have to make our own volume element. Muine is using preamp as the volume element here and we need that for the eq. Mxcl

This page was last edited on 14 December 2012, at 11:00. Content is available under Creative Commons License SA 4.0 unless otherwise noted.