mardi 20 novembre 2018

Normalize a bunch of audio files to the same loudness

I had a bunch of audio files in a directory, each recorded live with different devices, and it proved very ear-painful to hear the audio files in a playlist because of the difference of loudness.
To normalize audio filesm  you can find a number of tool working with ID3 tags, but after testing with vlc, mplayer, and the pogo mp3 player none of them did produce a measurable change. So I converted everything to wav, normalized the wav files, then converted back to mp3.

delete funny chars and spaces in file names
detox music_dir
converting files to wav is just a matter of
for f in $(ls); do ffmpeg -i $f $(basename $f .mp3).wav; done
normalizing files with the normalize-audio program, from the debian package of the same name.
normalize-audio *
converting back to mp3
for f in $(ls); do ffmpeg -b:a 192k -acodec libmp3lame -i $f $(basename $f .wav).mp3; done