Rockbox Technical Forums

Rockbox Development => Feature Ideas => Topic started by: nwimpney on July 15, 2010, 02:54:56 PM

Title: Alternative for level matching non replaygain tracks. (or replaygain via volume)
Post by: nwimpney on July 15, 2010, 02:54:56 PM
There's currently a pre-gain for level matching replaygain tracks to other tracks, but it seems this would often cause clipping, right?

Would it not make sense to have an option to attenuate non-replaygain files by a set amount?

This would have the same effect, except without the possibility of clipping.

Of course, if replaygain is implemented through the volume control (It probably should be), it probably doesn't matter from a clipping perspective, and would be moot, except at the extremes of the volume settings.  Is this the case, or is it done by scaling the samples? 

I know I saw it mentioned in the battery life faq that it does sample scaling, but that seems a little silly to me, so maybe it's been changed.

-Nick
Title: Re: Alternative for level matching non replaygain tracks. (or replaygain via volume)
Post by: Chronon on July 16, 2010, 05:00:29 AM
I have never seen a ReplayGain  with positive gain adjustment.  Many modern tracks have ReplayGain adjustments close to -10dB
Title: Re: Alternative for level matching non replaygain tracks. (or replaygain via volume)
Post by: saratoga on July 16, 2010, 10:09:47 AM
There's currently a pre-gain for level matching replaygain tracks to other tracks, but it seems this would often cause clipping, right?

Theres basically no way you'd get clipping if you're using it correctly.

Would it not make sense to have an option to attenuate non-replaygain files by a set amount?

This has been discussed and we're generally in favor of it.

Of course, if replaygain is implemented through the volume control (It probably should be),

Its not done through volume control for several reasons:

1)  It can't be done through volume control because theres no way to exactly synchronize changes to the output amplifier gain with track boundaries. 

2)  The volume control has suboptimal resolution on many devices (1-1.5dB is typical).

3)  Applying analog gain would increase clipping when decoding near maximum volume mp3 files.  The audibility of this is debatable, but its still an obvious drawback.
Title: Re: Alternative for level matching non replaygain tracks. (or replaygain via volume)
Post by: nwimpney on July 16, 2010, 03:48:10 PM
Theres basically no way you'd get clipping if you're using it correctly.

Okay.  I was just thinking that pre-gaining the replay gained tracks back up to a level where they match most other "loudness war" style tracks, would give too much gain on ones that are already at an appropriate level, but with a wide dynamic range.

For example.  Most songs tend to have about 8dB or more of reduction through replaygain, so setting the pre-gain to 8db would make them sound around the same level.  (along with ones with a more common 9-10 dB )
If I applied that same 8dB of pre-gain to a track that was already near reference level (say 3dB or so) I'm getting a potential of 5dB of clipping assuming the track has very high peaks compared to its average level.

This probably doesn't happen all that much in practice, and doing 5-6dB would probably give you enough headroom, while bringing your replay gain tracks up sort of close, though still noticably quieter. 

Quote
This has been discussed and we're generally in favor of it.
Cool.  I eagerly await this functionality. :D

Quote

Its not done through volume control for several reasons:

1)  It can't be done through volume control because theres no way to exactly synchronize changes to the output amplifier gain with track boundaries. 

2)  The volume control has suboptimal resolution on many devices (1-1.5dB is typical).

3)  Applying analog gain would increase clipping when decoding near maximum volume mp3 files.  The audibility of this is debatable, but its still an obvious drawback.

Yeah.  That makes sense.

#1 I guess would mostly be a problem mostly with gapless tracks with content right at the start/end.

#2 Is the dealbreaker I guess.  1dB doesn't seem like a huge problem, but I guess some players are a fair bit wider (or aren't on a proper log scale at all) :(

#3 I guess it's pretty academic due to #2,  but I don't really see where you'll get any additional clipping.
The only situation where I could see it being a problem is where you're applying a positive replay gain to quiet tracks with large peaks, and run into the analog limit of the amp.   Seems like a bit of a stretch, not that it really matters, since there's not precise enough control to do it anyways.  :-\