Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replay Gain too low on some MP3 files #10

Open
hjbaader opened this issue Jan 25, 2015 · 6 comments
Open

Replay Gain too low on some MP3 files #10

hjbaader opened this issue Jan 25, 2015 · 6 comments

Comments

@hjbaader
Copy link

I have some purchased MP3 files that have a rather low volume (and maybe bad mastering). After applying "loudness" I expected to get a positive Replay Gain so that the songs are played louder. This is what I get instead:

$ loudness tag -r CJSS\ -\ World\ Gone\ Mad/
Note: Illegal Audio-MPEG-Header 0x41504554 at offset 6286930. ] 33%
Note: Trying to resync...
Note: Hit end of (available) data during resync.
Note: Illegal Audio-MPEG-Header 0x41504554 at offset 7416658. ] 37%
Note: Trying to resync...
Note: Hit end of (available) data during resync.
Note: Illegal Audio-MPEG-Header 0x41504554 at offset 11440177. ] 58%
Note: Trying to resync...
Note: Hit end of (available) data during resync.
Note: Illegal Audio-MPEG-Header 0x41504554 at offset 12737160. ] 70%
Note: Trying to resync...
Note: Hit end of (available) data during resync.
Note: Illegal Audio-MPEG-Header 0x41504554 at offset 8137508. ] 74%
Note: Trying to resync...
Note: Hit end of (available) data during resync.
Note: Illegal Audio-MPEG-Header 0x41504554 at offset 8644374. ] 82%
Note: Trying to resync...
Note: Hit end of (available) data during resync.
Note: Illegal Audio-MPEG-Header 0x41504554 at offset 9060731.######## ] 94%
Note: Trying to resync...
Note: Hit end of (available) data during resync.
Note: Illegal Audio-MPEG-Header 0x41504554 at offset 11186843.########## ] 99%
Note: Trying to resync...
Note: Hit end of (available) data during resync.
Album gain, Track gain, Album peak, Track peak
-1.27 dB, -1.20 dB, 0.409112, 0.331055, 01 - Hell on Earth.mp3
-1.27 dB, -1.35 dB, 0.409112, 0.331267, 02 - No Mans Land.mp3
-1.27 dB, -1.91 dB, 0.409112, 0.395353, 03 - World Gone Mad.mp3
-1.27 dB, -0.29 dB, 0.409112, 0.324823, 04 - Run to Another Day.mp3
-1.27 dB, -0.74 dB, 0.409112, 0.330135, 05 - Gates of Eternity.mp3
-1.27 dB, -1.70 dB, 0.409112, 0.409112, 06 - Destiny.mp3
-1.27 dB, -0.80 dB, 0.409112, 0.395170, 07 - Welcome to Damnation.mp3
-1.27 dB, -1.84 dB, 0.409112, 0.396446, 08 - Living in Exile.mp3
Tagging........ Success!

System info: Debian 8, 64 Bit, everything in "loudness" enabled.

What's wrong here? Are the messages about " Illegal Audio-MPEG-Header 0x41504554" related to the problem or not? Thanks for your help.

Best regards,
hjb

@jiixyj
Copy link
Owner

jiixyj commented Jan 25, 2015

Those warnings come from the used decoding library. You can force a particular backend by "--force-plugin=ffmpeg" or "--force-plugin=mpg123" and see if the warnings go away. They seem mostly harmless, though.

A gain of -1.27 is not unusual for a "quiet" album. Many modern albums have gain values of -9 or more. A positive gain happens very rarely. In general, ReplayGain makes loud albums quieter, not quiet albums louder. If you just want to boost the levels of this one album, I can recommend mp3gain. That tool does not write ReplayGain tags, but modifies the scale factors of each mp3 frame. Per default it uses the ReplayGain algorithm to calculate appropriate scale factors, but you can manually set other factors. Each step corresponds to 1.5dB. For example, "mp3gain -g 5 .mp3" will boost the volume by 51.5=7.5dB.

@hjbaader
Copy link
Author

Thank you for your reply.

A gain of -1.27 is not unusual for a "quiet" album. Many modern albums have gain values of -9 or more.

Right, but in this case I doubt that the album was intended to be quiet. I have another example, in FLAC format, where loudness applied a gain of +3.9 dB. This gives the correct loudness for playing (IMHO), while the MP3 album is way too silent compared with other albums.

I thought Replay Gain should store the difference to an absolute loudness of 89 (or 83) dB. Maybe I'm wrong. If you're sure this is not a bug in loudness then I'll do something like the mp3gain command yo suggested.

Best regards,
hjb

@jiixyj
Copy link
Owner

jiixyj commented Jan 25, 2015

I thought Replay Gain should store the difference to an absolute loudness of 89 (or 83) dB.

This is correct. Maybe there really is a decoder issue. Can you try with both ffmpeg and mpg123 plugins and see if there are any differences in the resulting gain value?

@hjbaader
Copy link
Author

Hi,

I thought Replay Gain should store the difference to an absolute loudness of 89 (or 83) dB.

This is correct. Maybe there really is a decoder issue. Can you try with both ffmpeg and mpg123 plugins and see if there are any differences in the resulting gain value?

I just did this. There was no difference, only different warnings:

--force-plugin=mpg123:
Note: Illegal Audio-MPEG-Header 0x41504554 at offset 6286930. ] 34%
...
-1.27 dB, -1.20 dB, 0.409112, 0.331055, 01 - Hell on Earth.mp3

--force-plugin=ffmpeg:
[mp3float @ 0x7f2b78060b60] Header missing ] 32%
Error in decoder!
...
-1.27 dB, -1.20 dB, 0.409112, 0.331055, 01 - Hell on Earth.mp3

Best regards,

hjb

Pro-Linux - Germany's largest volunteer Linux support site
http://www.pro-linux.de/ Public Key ID 0x3DDBDDEA

@jiixyj
Copy link
Owner

jiixyj commented Jan 25, 2015

One more test:
loudness scan "01 - Hell on Earth.mp3"
and
ffmpeg -nostats -i "01 - Hell on Earth.mp3" -filter_complex ebur128 -f null -
should return the same value for integrated loudness in LUFS. This would rule out implementation bugs in the algorithm.
Maybe the album is mastered in a way that confuses the r128 algorithm? It could be that very high frequencies sometimes cause the algorithm to overrate the actual loudness. The loudness weighting curve of r128 is really simple and doesn't account for the fact that human hearing drops after >16kHZ or so.

@hjbaader
Copy link
Author

loudness scan:
-7.8 LUFS

ffmpeg -nostats:
Integrated loudness:
I: -7.8 LUFS
Threshold: -17.9 LUFS

Loudness range:
LRA: 2.5 LU
Threshold: -27.9 LUFS
LRA low: -9.2 LUFS
LRA high: -6.7 LUFS

I'm quite sure the album doesn't have any special effects
with sound frquencies. It's just guitar, bass, drums and voice.
It could be poorly mastered though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants