[Rhythmbox-devel] Fixing ReplayGain support in rhythmbox



Hello,

Rhythmbox’s built-in Replay Gain support has been non-functional for
me for a long time, so I’ve set out to fix that issue. This is
actually a good deal easier now than when it was originally added to
Rythmbox, as there’s a GStreamer element rgvolume[1] that handles all
the hard work of adjusting the gain. I recalled that Rhythmbox’s
plugin architecture[2] allows a plugin to insert filter elements into
the playback pipeline, and 15 minutes later, I’ve written the shortest
functionality-improving Rhythmbox plugin ever:

import rb
import gst
class ReplayGainPlugin (rb.Plugin):
	def __init__(self):
		rb.Plugin.__init__(self)
	def activate(self, shell):
		self.rgvolume = gst.element_factory_make("rgvolume")
		shell.get_player().props.player.add_filter(self.rgvolume)
	def deactivate(self, shell):
		shell.get_player().props.player.remove_filter(self.rgvolume)
		del self.rgvolume

And with that, you will now get working Replay Gain support for any
file type that GStreamer can read the tags from, a welcome
improvement. I've attached a tar of it to this email which includes
the .rb-plugin file and license headers. Simply extract to your
plugins directory.

Naturally, it could use a few more features: I plan to add
configuration to allow choosing between Album and Track gain modes
(the rgvolume element defaults to Album mode), and it could use some
handling for detecting a fallback gain setting for tracks with no
Replay Gain tags. But even like this, I figure that there’s folk who
would find it useful.

There's at least one known bug – if you disable the plugin while
Rhythmbox is playing, it will hang. I’m not totally sure about the
cause of this problem, or how to solve it. Suggestions welcome.

1. http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-rgvolume.html
2. http://live.gnome.org/RhythmboxPlugins/WritingGuide#head-7cd42591b00fdab44374fd57538003a192960070

-- 
Calvin Walton

Attachment: replaygain.tar.bz2
Description: BZip2 compressed data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]