6

I require that the sound levels of all the songs for my project are uniform. The songs are from different albums and different artists, hence they are not uniform from the perspective of volume level.

I found MP3Gain for MP3 files. But people say it does not work with the WAV file format. There are some problems like reducing audio quality when it comes to Audacity.

Which programs like MP3Gain which can be successfully utilized for wave files?

Can I use SoX for this, and how?

1
  • 1
    I'm not sure Wav or Aif can hold ReplayGain data; flac, ogg, mp3 & aac can, so you might be better off using one of those formats - en.wikipedia.org/wiki/ReplayGain has an explanation & links to available software.
    – Tetsujin
    Commented Sep 25, 2015 at 6:57

5 Answers 5

2

You are talking about perceived loudness. This is quite unlike peak level. What you can do is measure the perceived loudness for all your songs and then adjust the gain accordingly. The best way currently available to measure perceived loudness is using the R128 standard. I hope you're on a Mac, because then you can use this free commandline tool:

https://github.com/audionuma/r128x

Perceived loudness according to R128 is measured in LUFS (loudness units full scale), but these are identical to deciBels, except that they are measuring an RMS window over a certain time (which is of course the only way to measure perceived loudness). Now comes the tricky thing: if your song has a loud part and a more quiet part, statistics dictates that the perceived integrated loudness for the the song you're measuring is a function of the entire song. What you can do:

  • Isolate the parts of all your songs that you want to sound the same to the listener. If a song has several drops, you can just take a single portion of a few seconds that is representative of the loudness of the song.

  • Measure all these isolated parts using the above tool or another R128 measuring tool. You will have to differentiate between M, S and I loudness values. You can simply ignore M (momentary) and S (short term) loudness and just look at the I (integrated) level.

  • R128 wants tv programs to all be at -23 LUFS, but you don't care about this. Just make notes of all the integrated levels of your song snippets. As they are digital full scale measurements, the measurements will yield negative results, like -9 LUFS and -15 LUFS.

  • Like we've seen, LUFS are just RMS deciBels, so you can gain scale the entire song using any linear gain plugin or adjustment. Take the softest song, e.g. the one that measures -15 LUFS and use that one as a reference. You can now gain scale a song that measured -9 LUFS using a -6 dB gain adjustment, and the song will then have the same perceived loudness for the parts you selected.

  • Voila, album mastered.

You may want to be sure your tracks are all mastered in terms of dynamics and EQ before you do all of the above. You can even normalize them first, so you know you are not wasting bits because all songs are way too quiet. If you are very technical inclined, you can even measure the LRA (loudness range) using R128 tools and compare those of songs you think should pretty much be in the same loudness range.

If all else fails, I'd be happy to master your songs for you, but it won't be free! Good luck,

Hens Zimmerman http://henszimmerman.audio

2
1

Replaygain is a metadata based system - it analyses the absolute peak value of your audio, then writes a scaling value which the player reads and uses to amplify the audio data when you play it back.

The wave format doesn't natively support the metadata used for it so you have to either alter the actual audio data to normalise it, or use a hack to the format - I refer you to this old hydrogenaudio post: https://www.hydrogenaud.io/forums/index.php?s=&showtopic=54958&view=findpost&p=492968

Can't guarantee interoperability with any of your other apps.

Simplest thing to do would be to use foobar, do a batch convert with a normalisation processing step and save copies of the files for your project use.

1

MP3 metadata has a sort of dynamics compression hack where an individual track can say to the player “play me at 110% volume” and another track can say “play me at 90% volume” and the result is that those 2 MP3’s seem to be at the same perceived volume.

With lossless audio, you don’t have this hack. You have to use actual dynamics compression. So the way you compress the dynamics is to run the audio files through the same dynamics compressor and create new lossless audio files that all play at the same perceived volume. This is classic audio editing.

Note that this has nothing to do with normalization. You can normalize 10 WAV files and they can all still have a different perceived volume. Normalizing is math, but perceived volume comes from art. Each song has a different dynamic range because of the way the people who made it expressed themselves artistically. A dynamics compressor is how you can make 2 songs from 2 different sources match.

There is an art to finding the right settings for your dynamics compressor based on your source material. That is why the tools that set one MP3 at 110% and another at 90% do an analysis of the audio first. With lossless audio, you will listen in real-time to the output of the dynamics compressor and make the adjustments you want. Some dynamics compressors also have automatic features that simplify their use and are equivalent to what is done with MP3.

Audacity probably has a built-in dynamics compressor and if not, then you can probably use a plug-in. If you are running on a Mac there is one built-in called “AUDynamicsCompressor.”

If you were only going to have one audio processor, it would be a dynamics processor. It’s the most fundamental of audio processors. It would be hard to imagine any kind of audio editing going on without a dynamics processor.

0

For Windows users. Since utilities to calculate replay gain/peak values are mostly designed for compressed "lossy" formats such as mp3, enabling ReplayGain for wav tracks/albums, is a problem. I found a workaround was encoding mp3s from wav sources and using Winamp (v5.8) to both calculate and write the ReplayGain to the mp3 id3v2.3 tags, then applying those values to the original wavs. There's a Windows freeware tool that copies id3 tags directly onto an existing wav file called Mp3tag. Below is a screenshot:

Mp3tag v3.04a ID3v2.3 editor - WAV example

In your player that supports ReplayGain playback simply enable it. In VLC the option called 'Replay gain mode' allows you to select: 'Album', 'Track' or 'None'.

I hope this answer still has relevance. ReplayGain is especially useful for chamber music in my limited experience.

For that track above I also measured the 'Perceived Loudness' (before ReplayGain) in dB. It was, Left: -11.82; Right: -12.22. The whole track should hence be louder, much louder, when Winamp's ReplayGain value -5.26 dB is applied, however, in practice, track playback becomes somewhat quieter on good headphones.

My understanding is that -5.26 dB track gain is an average figure when applied that falls below the left/right peak amplitudes to avoid clipping artefacts above 0 dB. Average 'Loudness', another value, is subtracted from a -14 dB pink noise reference. ReplayGain attenuates or raises the peak amplitude in line with either the Album or the Track average. I have encountered so far significantly more tracks in which volume decreases as a result of using ReplayGain. The net effect is usually to normalize the loudness and in the process lower the volume.

I may be wrong of course, but whether in dB or LUFS, 'Perceived Loudness' is that which you want to manipulate or change.

People write volumes trying to explain all this.

Edit: It turns out that ReplayGain multiplies each sample value by a constant.

Ten raised to the power of one-twentieth of replay gain. In short, if the ReplayGain is put at -5.26 dB (as computed by Winamp), sample values across the board should be multiplied by 0.54575786109127092251134492267094. May this be accurate. I'm citing from: http://wiki.hydrogenaud.io/index.php?title=ReplayGain_1.0_specification

Conclusion: Having normalized the WAV file above by 54.575786109127092251134492267094 percent and compared it to the MP3 version that contains ReplayGain, I must regrettably report that VLC (3.0.11 Vetinari) on Windows 10 fails to respect the metadata in the MP3 tag, if ReplayGain mode is enabled in the Audio Preferences section. ReplayGain ID3 tags inserted into WAV tracks are ignored as well, unsurprisingly. While Winamp does respect these values in the ID3v2.3 tags in MP3s, as does PowerAmp on Android, Winamp also does not recognize the WAV file tags, to my astonishment. It implements a default gain in the absence of proper ReplayGain.

Back to the question: How to ensure uniform sound levels in multiple WAV files?

My normalized WAV played back in Winamp sounds exactly the same as the MP3 with RG. The formula "ten raised to the power of one-twentieth of replay gain" therefore, in this instance, replicated ReplayGain accurately. You can probably rely on the formula, using Winamp to obtain ReplayGain. A better option might be to normalize loudness in music tracks of varying loudnesses employing one of the other standards. EBU R128 set to -23 LUFS has been recommended, I think.

Edit: Minor correction. VLC applies ReplayGain to MP3s (not to WAV files), provided the RG metadata exists. You must relaunch the player (in Windows) after you enable Replay gain mode under Audio Preferences. Then it works fine. My mistake.

-2

If you're needing auto-gain to be applied in realtime then your best bet would be to convert the WAV's in question to MP3 using the highest possible quality settings in Audacity (trust me, if no one is specifically listening for audio artifacts/deformities, no one will notice any change in quality).

If you don't need auto-gain to be applied in realtime you can just use Audacity's Amplify effect and let it automatically determine the exact amount of gain to apply to bring the audio up to 0dB. Proceed to render the WAV to the disk and use where needed.

1
  • 1
    Normalising is not the same as adjusting for replay gain
    – Tetsujin
    Commented Sep 25, 2015 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.