[mythtv] ReplayGain support for MythMusic

Steven Adeff adeffs.mythtv at gmail.com
Tue Feb 26 18:35:15 UTC 2008

On Tue, Feb 26, 2008 at 11:54 AM, Chris Hamilton <chamilton at cs.dal.ca> wrote:
> > 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.

the only thing I see wrong with this, and its something I don't do but
I've seen my friends do, is that they will put like 2 or 3 tracks from
an album on a playlist which would cause your test to use the album
gain as opposed to track gain which would be more appropriate. I'd say
if it were possible to do a % of total tracks check that it may work
better. Though checking whether shuffle mode is on may make this
scenario a moot point.

>  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?

well, unless we want to store two values a clipped and a non-clipped
value I think we should either just go with the non-clipping value or
somehow allow the user to decide. I personally would never want to
clip my tracks, but I can see how for a DJ a little clipping would not
be a big deal compared to a large change in perceived volume.


More information about the mythtv-dev mailing list