[mythtv] ReplayGain support for MythMusic

Chris Hamilton chamilton at cs.dal.ca
Tue Feb 26 16:54:10 UTC 2008

> Just remember that some of us use S/PDIF and the soundcard's "volume"
> doesn't actually do anything! (ie I'd much prefer it does it in
> 'software' like most other apps do).

Good point.  So, the software approach is the only one, really.  I
should have a modified AudioOutputBase supporting software
pre-amplification by the end of the week.

> so Chris has it right in my mind (and how I use replygain). What is
> being played should be looked at to determine the correct one to use.
> I would say default to track gain "unless" a whole album is being
> played which hopefully can be determined by looking at what the
> playing play list contains and if it matches say >80% of the tracks in
> that album as determined by the db. It would probably also be good to
> have an override ability. A small icon displaying the current replay
> gain status (a "T" or an "A" or blank) would probably also be helpful
> and fairly non-intrusive.

My thoughts on this was to do the following simple test:

If the 'next' or 'previous' track (as defined by the current playlist
ordering) belongs to the same album, then play the present song using
the album gain if defined.  Otherwise, use the track gain if defined.

Finally, a global setting might be useful, selecting between
no replaygain / track gain only / album gain only / smart album gain

> also, don't forget that replaygain *can* cause clipping if a gain
> value is too great. I believe it will tell you both the suggested gain
> to reach the target and the greatest gain that will not cause
> clipping.
> I'd highly suggest using the greatest non-clipping gain, or if made an
> option using that as the default.

While it doesn't explicitly tell you the maximum gain, most (all?)
ReplayGain calculators also store peak information.  From that, you can
calculate the maximum possible gain before clipping will occur. So
amplifying to a maximum gain before clipping occurs is reasonable.

I've also got a few tracks that MP3 gain doesn't like for some reason,
and has calculated ridiculous gains of like +53 dB.  It might also be
useful to have a configurable minimum and maximum gain.

Finally, one last idea.  The idea of ReplayGain is to make all tracks
have the same perceived loudness.  For some tracks, it may be that some
amplification is needed, resulting in clipping if we truly amplify to 89
dB SPL.  Maybe we could have a configurable output level, and choose
this such that *no* songs in the database will be clipped when amplified
to this level?



More information about the mythtv-dev mailing list