[mythtv] ReplayGain support for MythMusic

Chris Hamilton chamilton at cs.dal.ca
Mon Feb 25 22:50:58 UTC 2008


I've recently been tinkering with adding ReplayGain support to
MythMusic.  Things I have working:

- Reading of ReplayGain tags for MP3 files (using LAME headers,
QuodLibet formatted ID3v3 comments, standard replaygain_* ID3v2
comments, RGAD frames, RVAD frames, RVA2 frames, etc) Anybody know of
any other ways in which ReplayGain information is typically embedded?

- Reading of ReplayGain tags for OGG/Vorbis files using REPLAYGAIN_*
comments.

(Obviously, replaygain support needs to be added to each of the metaio*
classes. I've only added it to the two media types commonly found on my
system for the time being. I'd appreciate pointers to documentation for
how replay gain info is embedded in other media types, and even sample
files containing replaygain info.)

- Currently, I'm storing a 'track_gain' and an 'album_gain' parameter in
the music_songs table.  The 'album_gain' parameter is theoretically the
same for an entire album, and could be stored in the music_albums table
instead.  Should I move the 'album_gain' to the albums table, or should
we handle the possibility that people customize 'album_gain' on a per
track basis? (in which case it won't be the same for all tracks in an album)

- Application of the replaygain correction directly to the samples
before they are fed to the sound-card.  This is currently manually
hooked in for each decoder class, but I was thinking about making an
abstract AudioOutput class that handles an 'amplification' affect, or
adding such functionality to the AudioOutputBase class.  Ideas here?
Should I even be doing the amplification myself, or should I modify the
sound-card volume directly?

- Somewhat intelligent decision of whether to use the track_gain or the
album_gain depending on the shuffle mode. (Use track_gain always, and
album_gain when in album mode.)  I was thinking this should be smarter
still, and probably use album_gain when the player notices it is playing
in any sequential mode and that there is more than one successive track
from the same album.  Ideas here?

The patch in its current form is relatively small, and restricted to the
mythmusic module.  Making changes to AudioOutput stuff is going to
require changes to libmyth directly, which may want to be avoided.

Things to do:

- Add replaygain support to other metaio* classes.

- Add replaygain support to CD ripping. Would be easiest to use external
tools (vorbisgain, mp3gain, etc) but maybe it would be better to use
some library that can work directly on the raw PCM audio.  Do such
libraries exist?

- I'm sure there's more, but that's all off the top of my head.

Any comments would be appreciated!

Cheers,

Chris Hamilton


More information about the mythtv-dev mailing list