MP3Gain vs Audacity Normalising

Effects, Recipes, Interfacing with other software, etc.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
spaarks
Posts: 17
Joined: Thu Dec 27, 2007 2:04 pm
Operating System: Windows 10

MP3Gain vs Audacity Normalising

Post by spaarks » Tue Mar 23, 2021 4:52 pm

When I normalize (imported mp3 tracks at 13dB with Audacity, MP3Gain shows clipping on all tracks.
Why should this be?

steve
Site Admin
Posts: 80326
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: MP3Gain vs Audacity Normalising

Post by steve » Tue Mar 23, 2021 5:01 pm

spaarks wrote:
Tue Mar 23, 2021 4:52 pm
When I normalize
Is that with the "Normalize" effect (https://manual.audacityteam.org/man/normalize.html) or the "Loudness Normalization" effect (https://manual.audacityteam.org/man/lou ... ation.html)?
spaarks wrote:
Tue Mar 23, 2021 4:52 pm
imported mp3 tracks at 13dB with Audacity,
Do you mean that the imported track was at 13 dB, or that you normalized to 13 dB?
Also, note that signal levels are usually negative. I'm guessing that you mean "-13 dB", but perhaps not - please clarify.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

spaarks
Posts: 17
Joined: Thu Dec 27, 2007 2:04 pm
Operating System: Windows 10

Re: MP3Gain vs Audacity Normalising

Post by spaarks » Tue Mar 23, 2021 5:25 pm

Sorry, typo. I meant to type -3db.
Effects>Normalize> Normalize peak amplitude to -3dB.
I have just tried it from the original file to -6dB, and MP3Gain gives the same clipping levels, between 4 and 6dB too high - I mean MP3GAIN requires -4 to -6dB reduction to give no clipping on any of the tracks.

steve
Site Admin
Posts: 80326
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: MP3Gain vs Audacity Normalising

Post by steve » Tue Mar 23, 2021 6:24 pm

MP3Gain calculates an amount of amplification to achieve a specific "loudness".

If a track is mostly quiet, with a few high peaks (as is likely with something like acoustic guitar), then it is impossible to make it "loud" without the high peaks clipping.

On the other hand, a very dense waveform that is all about the same level (such as a thrash metal track) can be made very loud without clipping any peaks.

If MP3Gain is saying that the track will clip, it's because you have set the required "loudness" to a level where it is impossible to achieve that loudness without clipping some peaks.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

DVDdoug
Forum Crew
Posts: 9218
Joined: Fri Sep 10, 2010 11:30 pm
Operating System: Windows 10

Re: MP3Gain vs Audacity Normalising

Post by DVDdoug » Tue Mar 23, 2021 10:05 pm

I have just tried it from the original file to -6dB, and MP3Gain gives the same clipping levels, between 4 and 6dB too high
Which clipping field are you looking at?

Clipping tells you if it currently goes over 0dB. That shouldn't show clipping if you've normalized to -3 or -6dB.

...MP3 is lossy so it does change the wave shape and some peaks often get higher. i.e. If you normalize to 0dB and export as MP3, the MP3 peaks may go over 0dB and if you re-import the MP3 Audacity may "show red". But it usually only peaks about 1dB higher.

The other two clip(Track) and clip(Album) are just warning you of clipping if you adjust to the target loudness. If you don't allow clipping it will only adjust it as much as it can. That won't change when you normalize because the ratio between loudness and peak doesn't change.

If you make the target loudness higher you are more likely to clip (or find more files that can't hit the target without clipping).
If you make it lower, MP3Gain has "more room to work" and fewer files will clip. The 89dB default is a compromise that works with more files.


--------------------------------------------------
Some other notes:

MP3 can go over 0dB without clipping so your file might not really be clipped. In that case, the actual audio will only be clipped if you feed it to your digital-to-analog converter at (or near) full-digital volume. Regular WAV files, audio CDs, digital-to-analog converters (playback) and analog-to-digital converters (recording) all all hard-limited to 0dB and they will clip if you try to go over.

Audacity shows potential clipping (red). Audacity isn't looking at the wave shape. It's just looking for samples over 0dB, or a few 0dB samples in a row. Or if you have a truly-clipped file you can reduce the volume so the peaks are below 0dB (which of course doesn't fix the clipped wave shape) and Audacity won't show it as clipped.

MP3 can only be adjusted losslessly in 1.5dB steps and since MP3Gain works losslessly it can only adjust in 1.5dB steps.

When you open an MP3 in Audacity (or any "normal" audio editor) it gets decompressed. If you re-export as MP3 you are going through another generation of lossy compression and some "damage" does accumulate. It's best to work with a lossless format (if possible) and convert ONCE to MP3.

There are special purpose MP3 editors (like MP3DirectCut) that can do some limited editing without decompressing/re-compressing. Again, you are limited to volume adjustment (or normalization) in 1.5dB steps

spaarks
Posts: 17
Joined: Thu Dec 27, 2007 2:04 pm
Operating System: Windows 10

Re: MP3Gain vs Audacity Normalising

Post by spaarks » Wed Mar 24, 2021 11:26 am

steve wrote:
Tue Mar 23, 2021 6:24 pm
MP3Gain calculates an amount of amplification to achieve a specific "loudness".

If a track is mostly quiet, with a few high peaks (as is likely with something like acoustic guitar), then it is impossible to make it "loud" without the high peaks clipping.
Thanks. So the is the 'equivalent' Audacity effect is "Loudness Normalization"?
According to Sourceforge MP3Gain is based on "Replay Gain", which (it is alleged) is used by most music programs including Audacity.

spaarks
Posts: 17
Joined: Thu Dec 27, 2007 2:04 pm
Operating System: Windows 10

Re: MP3Gain vs Audacity Normalising

Post by spaarks » Wed Mar 24, 2021 11:51 am

DVDdoug wrote:
Tue Mar 23, 2021 10:05 pm
I have just tried it from the original file to -6dB, and MP3Gain gives the same clipping levels, between 4 and 6dB too high
Which clipping field are you looking at?

Clipping tells you if it currently goes over 0dB. That shouldn't show clipping if you've normalized to -3 or -6dB.

...MP3 is lossy so it does change the wave shape and some peaks often get higher. i.e. If you normalize to 0dB and export as MP3, the MP3 peaks may go over 0dB and if you re-import the MP3 Audacity may "show red". But it usually only peaks about 1dB higher.

The other two clip(Track) and clip(Album) are just warning you of clipping if you adjust to the target loudness. If you don't allow clipping it will only adjust it as much as it can. That won't change when you normalize because the ratio between loudness and peak doesn't change.

If you make the target loudness higher you are more likely to clip (or find more files that can't hit the target without clipping).
If you make it lower, MP3Gain has "more room to work" and fewer files will clip. The 89dB default is a compromise that works with more files


--------------------------------------------------
Some other notes:

MP3 can go over 0dB without clipping so your file might not really be clipped. In that case, the actual audio will only be clipped if you feed it to your digital-to-analog converter at (or near) full-digital volume. Regular WAV files, audio CDs, digital-to-analog converters (playback) and analog-to-digital converters (recording) all all hard-limited to 0dB and they will clip if you try to go over.

Audacity shows potential clipping (red). Audacity isn't looking at the wave shape. It's just looking for samples over 0dB, or a few 0dB samples in a row. Or if you have a truly-clipped file you can reduce the volume so the peaks are below 0dB (which of course doesn't fix the clipped wave shape) and Audacity won't show it as clipped.

MP3 can only be adjusted losslessly in 1.5dB steps and since MP3Gain works losslessly it can only adjust in 1.5dB steps.

When you open an MP3 in Audacity (or any "normal" audio editor) it gets decompressed. If you re-export as MP3 you are going through another generation of lossy compression and some "damage" does accumulate. It's best to work with a lossless format (if possible) and convert ONCE to MP3.

There are special purpose MP3 editors (like MP3DirectCut) that can do some limited editing without decompressing/re-compressing. Again, you are limited to volume adjustment (or normalization) in 1.5dB steps
Thanks for this very detailed explanation Doug. I have some thinking to do!
The tracks I have been trying are ripped from a CD using Audiograbber (without using the normalizing option) using LAME at 192kbps constant bitrate.
CD is a digital format, so am I right in thinking it is converted to mp3 without being converted to analogue. If so then there is no ADC involved?
At the output end, is there a standard output level corresponding to 0dB. Like 1V peak to peak, or what?

steve
Site Admin
Posts: 80326
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: MP3Gain vs Audacity Normalising

Post by steve » Wed Mar 24, 2021 12:31 pm

spaarks wrote:
Wed Mar 24, 2021 11:51 am
At the output end, is there a standard output level corresponding to 0dB. Like 1V peak to peak, or what?
For digital audio, "0 dB" is defined as "full scale".

Example 1:
16-bit audio has a numeric range from -32,768 to +32,767. Thus if the signal goes up to 32,767, or down to -32,768, then it is "0 dB".

Example 2:
Because 32-bit float format handles fractional values, "full range" is defined as -1.0 to +1.0. Thus if a signal goes up to +1.0, or down to -1.0, then it is 0 dB.


The actual voltage level depends on the sound card, but most consumer sound cards will output around +/- 0.5 volt for a "full scale" digital input.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

spaarks
Posts: 17
Joined: Thu Dec 27, 2007 2:04 pm
Operating System: Windows 10

Re: MP3Gain vs Audacity Normalising

Post by spaarks » Thu Apr 08, 2021 3:33 pm

I understand what you say about the 16-bit range. So, as far as the codec is concerned there will be no clipping unless the peaks exceed these digital values.
The reason we have to choose a lower "maximum amplitude" is because of the dynamic range of the audio card or audio amplifier path may not cope with whatever analog voltage the DAC puts out (i am assuming the DAC would be designed to cope with the full +/- 32k).

On Import, does audacity convert the mp3 file to PCM (plus edit codes)? I ask this because of the large size of the project file.
As the Import and Output conversion will introduce losses would it be best to use MP3Gain, rather than Audacity?

Does Audacity use the ReplayGain algorithm for both the "Normalize" effect and the "Loudness Normalize" effect?

steve
Site Admin
Posts: 80326
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: MP3Gain vs Audacity Normalising

Post by steve » Thu Apr 08, 2021 4:56 pm

spaarks wrote:
Thu Apr 08, 2021 3:33 pm
i am assuming the DAC would be designed to cope with the full +/- 32k
I read an article a while back that tested a range of CD players and found that very few of them handled 0 dB very well. The article was looking at "measurable" distortion rather than "audible" distortion. Most of them (even expensive models) showed measurable signs of clipping close to 0 dB. Unfortunately that was an article that I found on-line and I didn't bookmark it and haven't found it again since then.
In practice, I doubt that the tiny amount of clipping would be audible, but interesting nonetheless (I wish I could find that article again ;))

spaarks wrote:
Thu Apr 08, 2021 3:33 pm
On Import, does audacity convert the mp3 file to PCM (plus edit codes)?
Yes. Audacity decodes MP3s to PCM on import. Audacity does this for all file types that are not already PCM.
Decoding MP3 is essentially lossless - it's the encoding that loses quality.

spaarks wrote:
Thu Apr 08, 2021 3:33 pm
As the Import and Output conversion will introduce losses would it be best to use MP3Gain, rather than Audacity?
If you only want to adjust the gain, and will be using a player that supports MP3Gain metadata, then better (and quicker) to use MP3Gain.

spaarks wrote:
Thu Apr 08, 2021 3:33 pm
Does Audacity use the ReplayGain algorithm for both the "Normalize" effect and the "Loudness Normalize" effect?
"Normalize" simply amplifies up to a peak level.

"Loudness Normalize" has two options: LUFS (EBU R128 standard), and RMS ("Root Mean Square", a kind of "average" that is commonly used in scientific / engineering applications).

EBU R128 specifies how to measure loudness. It is a similar idea to Replay Gain, but implemented differently. EBU provide a range of related standards for different applications that are widely adopted in TV / Radio broadcast and Cinema. Detailed information here: https://tech.ebu.ch/docs/r/r128.pdf
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply