PDA

View Full Version : Bug when using Replaygain



cliveb
2007-06-19, 00:33
A few days ago in another thread I reported the results of an experiment which demonstrated that when using Replaygain, the Squeezebox can introduce clipping if the RG value is positive. (Here's a link to that report:
http://forums.slimdevices.com/showpost.php?p=208322&postcount=22)

I have now raised this as a bug report here: http://bugs.slimdevices.com/show_bug.cgi?id=5119

Initial response from Slim Devices doesn't seem to show too much concern, which I found a little surprising. So I'm flagging it up here in case anyone else feels this is something that ought to be sorted in the reasonably near future. Please add your vote if you agree.

Mark Lanctot
2007-06-19, 06:54
There are reasons why this might not be as high a priority here as you would like. Don't shoot the messenger here, I'm just thinking out loud:

- RG values are overwhelmingly negative, mostly -7 to -10 dB. They are very, very rarely positive, I'd say less than 5% of any CDs short of classical you could buy today.

- your example was purposefully manipulated to an extreme. In my 4462 track collection the highest positive RG value I have is probably + 2 dB. +21.9 dB really means it's recorded improperly.

- audiophiles don't use RG anyway as they believe it introduces distortion

MelonMonkey
2007-06-19, 08:32
I can assure you that in my collection which sits at just over 20k tracks right now, there were numerous tracks with positive RG when calculating for a target of 89db. The overwhelming majority required negative RG, but there were still a significant number of positives.

This process was for track RG, not Album RG. If I can find some script to help me count, I'll see if I can find what the ratio is of negative to positive gain throughout the collection.

cliveb
2007-06-19, 09:03
- RG values are overwhelmingly negative, mostly -7 to -10 dB. They are very, very rarely positive, I'd say less than 5% of any CDs short of classical you could buy today.
Agreed. But as you say, classical CDs often have positive RG values. Since my collection covers a range of styles with a wide spread of perceived loudness, I find RG to be very useful, and would prefer it not to clip my classical albums.


- your example was purposefully manipulated to an extreme. In my 4462 track collection the highest positive RG value I have is probably + 2 dB. +21.9 dB really means it's recorded improperly.
Yes, I deliberately prepared an extreme example so as to make it absolutely obvious that the clipping occurs. I also subsequently uploaded a short extract of a real recording (Apassionata Sonata) that also exhibits clipping when RG is used on the Squeezebox.

cliveb
2007-06-19, 10:08
I can assure you that in my collection which sits at just over 20k tracks right now, there were numerous tracks with positive RG when calculating for a target of 89db. The overwhelming majority required negative RG, but there were still a significant number of positives.
That doesn't surprise me. I just did a quick check of my own collection, and out of 1135 albums, was surprised to find that 138 have positive album_gain values. That's over 12%. (Perhaps I'm unusual in having a fair number of CDs from the 80s and 90s, and quite a lot of LP transfers which haven't been compressed to death).

But I have some good news. After examining the database structure, there's a simple way to update it to "correct" the ReplayGain values:


update albums
set replay_gain = -20*log10(replay_peak)
where -20*log10(replay_peak) < replay_gain;
update tracks
set replay_gain = -20*log10(replay_peak)
where -20*log10(replay_peak) < replay_gain;
commit;
(This does of course require you to have a MySQL client of some sort available. The Query Browser Tool can be downloaded from http://dev.mysql.com/downloads/gui-tools/5.0.html for Windows, MacOS and Linux).

I have updated the bug report to suggest that perhaps the scanner process could do this as a final step.