I am looking for a way to normalize the sound in MANY MP3 files I have. Some have low sound, while others are louder so I have to turn the volume up or down depending on the song. What ways are there to do this for all files. I specially would like to do it via the terminal but GUI ways are also accepted.

  • For normalizing while playing see: askubuntu.com/questions/95716/…. This will however not change your mp3 file content - may be of advantage ;)
    – Takkat
    Commented Jan 22, 2013 at 18:09
  • Not while playing, don't want to have to set it everytime or have a player set the normalize every time I want to listen to the songs. For example, let us say I want to copy the songs to an ipod shuffle or to a pen drive to listen in a mp3 capable player. Commented Jan 22, 2013 at 18:13
  • @Takkat BTW nicely done in that other question. Good information. Commented Jan 22, 2013 at 18:24
  • 1
    My wife just tested the Audacity method, and it worked perfectly! Recommended. Please, when people ask for advice it is because they are NOT experts. So don´t tell them to use command line tools when they can do the job with easy-to-understand graphical tools like Audacity. Telling new Linux users to open terminal and run command line tools will just scare them away from Ubuntu, with a feeling that Windows is simple, Linux is difficult. It is not a surprise that DOS is dead, but Windows is alive.
    – user297240
    Commented Jun 23, 2014 at 20:42
  • It's great your wife was able to figure out the graphical way, but did you miss the part where the person asking the question specifically wanted to achieve it via the terminal?
    – RichardP
    Commented Apr 9, 2017 at 5:53

10 Answers 10


Take a look @ mp3gain which for me is even better than normalize-audio

mp3gain -r *.mp3

another useful version could be the -c which prevent to ask if you want to do the changes for many files:

mp3gain -c -r *.mp3

as said in the man page:

mp3gain does not just do peak normalization, as many normalizers do. Instead, it does some statistical analysis to determine how loud the file actually sounds to the human ear. Also, the changes mp3gain makes are completely lossless. There is no quality lost in the change because the program adjusts the mp3 file directly, without decoding and re-encoding.

Note: That package was removed on purpose on ubuntu 15.04.

Debian proposes the python-rgain package as replacement (The advantage is that 'replaygain' supports several file formats, namely Ogg Vorbis , Flac, WavPack and MP3. Also, it allows you to view existing Replay Gain information in any of those file types). After installing it, run replaygain.

To install python-rgain from the terminal, run the command

sudo apt-get install python-rgain

Noted lately the binary file is replaygain

Alternatively, get the .deb file for 14.04 (the latest) from here. Install as usual. After that, you need to run sudo apt-get -f install to correct some dependencies issues.

  • 1
    Also, if you don't want to use the terminal, there is a GUI available for it named easymp3gain-gtk, which makes it very handy! Commented Nov 12, 2014 at 21:26
  • This is super useful. I was very impressed by the quality of normalization using MP3Gain's Windows GUI, so I was glad to find this answer when I needed a Linux command line solution. Would definitely recommend to others. Commented Feb 5, 2015 at 18:05
  • Could you please add some information on how to install it? It doesn't come with Ubuntu by default, and I can't find the package. Commented May 3, 2016 at 17:36
  • 1
    Thanks... installed python-rgain without any dependency errors on Ubuntu 16.04. Commented Oct 13, 2018 at 6:47
  • 2
    install with mkdir mp3gain; cd mp3gain; wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/mp3gain/1.5.2-r2-6/mp3gain_1.5.2-r2.orig.tar.gz; tar -xvzf mp3gain_1.5.2-r2.orig.tar.gz; make; sudo make install
    – rubo77
    Commented Sep 27, 2019 at 19:21


With Audacity we can easily batch process files to apply conversions or effects to many files in a list. To do so we first have to define a "Chain" containing the effects we want to apply.

This is done with "File --> Edit Chains...". In the now opening window press the Add button on the bottom left to insert a new chain (give it a sensible name):

enter image description here

Then choose the effect and it's parameters to insert to the chain (here shown for default values and the Normalize effect).

Important: we always need to also add the effect "Export MP3" (or any other export format) for saving the resulting conversion to disk.

When done leave this window with OK to open "File --> Apply Chain...". Select the Chain we have just created and load all files you need with "Apply to files...". Several files can be selected from the file chooser that opens.

enter image description here

Processed files will be saved in a new subdirectory "cleaned" in the original's path.


From version > 14.3 we can use the sox filter --norm for normalizing audio on the command line or for batch processing:

sox --norm infile outfile

MP3-support is added to Sox with libsox-fmt-all:

sudo apt install sox libsox-fmt-all
  • 2
    Do these tools decode and re-encode?
    – qed
    Commented Oct 29, 2014 at 21:59
  • You can't normalize without re-encoding, at least the levels...
    – Takkat
    Commented Oct 29, 2014 at 22:03
  • For non-destructive live-normalizing using LADSPA and pulseaudio see askubuntu.com/questions/95716/…
    – Takkat
    Commented Oct 29, 2014 at 22:08
  • 2
    This does re-encode, so it reduces quality. See my answer if you want to preserve your file quality. Re-encoding is not necessary if your player supports volume tagging.
    – Wil
    Commented May 16, 2019 at 6:21
  • 4
    to use sox in a batch you can use for f in *.mp3; do sox --norm "$f" /tmp/sox.mp3; mv -v /tmp/sox.mp3 "$f"; done
    – rubo77
    Commented Sep 27, 2019 at 18:12

I would use this project Normalize, it's a command-line tool for normalizing audio files. Looks to be exactly what you need. Can do batch processing and doesn't require resampling to intermediate formats.

It's in the package repos as normalize-audio, sudo apt-get install normalize-audio. This is a build maintained upstream by Debian so it should be in anything LTS or newer and is built with mp3 compatibility (tested). There is a good manpage man normalize-audio to explore the options but the commands defaults appear to work well. For batch processing (normalize volume across multiple files), normalize-audio -b *.mp3 or specify individual filenames instead of using wildcards.

  • The OP wants instructions for doing this. Can you provide those?
    – Seth
    Commented Jan 22, 2013 at 18:13
  • @iSeth I was initially incorrect about the source only comment because I couldn't find it with apt-cache search. I've updated with details about the deb package.
    – sean_m
    Commented Jan 23, 2013 at 8:23
  • This seems a good alternative but can't find the correct encoder and get rid of "no encoder available". Tried with libsox-fmt-mp3, libavcodec-extra. -b *.mp3 do something with only one (random?) file. Commented Mar 22, 2017 at 19:04

rgain3 (formerly replaygain/rgain )

Update 2020: replaygain/rgain is currently not being developed, try rgain3, a modern fork. Here on pip.

Update 2023: There will be big changes in relation to pip. Debian (Debian 12 Bookworm) and Ubuntu (Ubuntu 23.04 Lunar Lobster) releases will likely adopt PEP668 (PEP = Python Enhancement Proposal). tl;dr? pippipx.

Install: pipx install rgain3, then run replaygain as usual.

replaygain is faster and easier:

This package provides a Python package to calculate the Replay Gain values of audio files and normalize the volume of those files according to the values. Two basic scripts exploiting these capabilities are shipped as well.

Replay Gain is a proposed standard designed to solve the very problem of varying volumes across audio files.

Install: sudo apt install python-rgain.

replaygain --force *.mp3
  • -f, --force Recalculate Replay Gain even if the file already contains gain information.

Since only calculate/change replaygain value, is also faster: With an average PC (Intel i7-6500U, 8GB RAM) the rate was ~20 files/minute.


  • Unfortunately these tools only support album gain, not track gain.
    – DBedrenko
    Commented Feb 6, 2021 at 17:50
  • @DBedrenko From rgain3: "If the file doesn't contain a Musicbrainz album ID or an album tag, it is presumed to be a single track without album; it will only get track gain, no album gain" Commented Feb 6, 2021 at 23:53
  • That's good for those few tracks, but when I have many albums but want track gain across my entire music collection, not album gain, it's lacking. An alternative that does this is loudgain
    – DBedrenko
    Commented Feb 7, 2021 at 9:10
  • @DBedrenko Maybe you should file an issue. About loudgain, do you mean this or this fork with more stars? Commented Feb 7, 2021 at 17:00
  • The fork with more stars
    – DBedrenko
    Commented Feb 8, 2021 at 9:42

For the sake of it, I'll throw my 2 cents in. I was looking for exactly the same thing (only for ogg files) and started a thread at Crunchbang Forum. You can view it here: Normalize-audio can't find mp3 decoder

Basically my solution was the script in post #8. It works for mp3, flac, and ogg input files, possibly others but definitely not wav.

Just create a file (name it whatever you want, I called mine db_adjust_mp3), chmod +x , and stick it in your ~/bin folder. It fills in any missing codec data as well. Example:

Original file: 16._This_Protector.mp3: Audio file with ID3 version 2.3.0, contains:


Normalized file: 16._This_Protector.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 192 kbps, 44.1 kHz, JntStereo

I've modified the script to use normalize-mp3 here so you can use it if you want:


find "$1" -iname "*.""$2" > $HOME/file_list

cat $HOME/file_list | while read line; do
#  echo "$line"
  orig_gain="$(normalize-mp3 -n "$line" | cut -d 'd' -f1)"
  larger=$(echo "$orig_gain"'>'-12 | bc)
  if [[ larger ]]
      gain_difference=$(echo "$orig_gain"*-1-12 | bc)
      gain_difference=$(echo "$orig_gain"-12 | bc)
  echo "Gain Difference will be: $gain_difference""db"
  normalize-ogg --mp3 --bitrate "$3" -g "$gain_difference""db" -v "$line"

This script calculates the difference between the current db level and -12db, then applies a gain adjustment to put the gain at exactly -12db, which is what I've found works the best for me. It is recursive as well, which makes it great for doing entire music collections or files in many subfolders. If you wish to set a different db level, just change the both instances of the number "12" to whatever db level you would like to use. As I posted in my Crunchbang thread, usage is as follows:

normalize-mp3 <directory> <file extenstion(with no leading dot)> <bitrate>

However, when I used to keep my music library in mp3 format, I used to use mp3gain as well, just as Philippe suggested. The dead simplicity of it is great and I really liked it. The problem with normalize-audio though is that it does decode an re-endcode the files, so there is some sound degradation. But unless you're an audiophile and your mp3's are encoded at a high bitrate you shouldn't notice much difference.

The thing I noticed with mp3gain though was that no matter what options I tried I couldn't get everything in my collection to be exactly the same db level, which is what I want so that I never have to adjust the volume from one track to the next. This script does exactly that. Sorry for being so long winded. Hope this helps.


This will recursively ffmpeg-normalize all .mp3 throughout the subfolder structure to the sample rate 240k

find -name "*.mp3" -exec ffmpeg-normalize {} -b:a libmp3lame -b>a 240k \;

(you could change this for higher rates or use gain instead of normalize with the same synthax. Anyone?)

  • And where did you get ffmpeg-normalize? It's not in any of the default Ubuntu repositories, and there are also no close matches to that name (tried on Kubuntu 20.10).
    – Zilk
    Commented Apr 9, 2021 at 23:40

The normalize CLI's name was changed some time ago to normalize-audio. It's available in the package normalize-audio on Debian/Ubuntu.

$ dpkg-query -S /usr/bin/normalize-audio
normalize-audio: /usr/bin/normalize-audio

normalize-audio can handle both MP3, OGG, & FLAC, just use the frontend CLI normalize-audio.

NOTE: It can handle both what it calls a mix-mode as well as a batch mode.

       This  mode  is made especially for making mixed CD's and the like.  
       You want every song on the mix to be the same volume, but it 
       doesn't matter if they are the same volume as the songs on some 
       other mix you made last week. In mix mode, average level of all the 
       files  is  computed,  and  each file is separately normalized to 
       this average volume.

       When  operating on a group of unrelated files, you usually want all 
       of them at the same level, and this is the default behavior.  
       However, a group of music files all from the same album is 
       generally meant to be listened to at the relative volumes they were 
       recorded at.  In batch mode, all the specified  files  are  
       considered to be part of a single album and their relative volumes 
       are preserved.  This is done by averaging the volumes of all the 
       files, computing a single adjustment from that, and applying the 
       same adjustment to all the files.  Some analysis is  also  done  
       so  that files  with  volumes that appear to be statistical 
       aberrations are not considered in the average.  This is useful if 
       you have albums (like many of the author's) in which there is one 
       "quiet song" that throws off the average.

For mix CDs with tracks from a variety of sources I'll typically use MIX MODE for those.


You can run it with the -n switch which is basically a dry-run mode where it'll tell you what will be done without manipulating your files.

$ normalize-audio -m -n *.mp3
Computing levels...
  level        peak         gain
-6.7043dBFS  0.0000dBFS   -3.1662dB  01 - Danny Phantom theme.mp3
-6.9161dBFS  0.0000dBFS   -2.9544dB  02 - Way Less Sad - AJR.mp3
-10.8860dBFS 0.0000dBFS   1.0154dB   03 - Ghost - Telehope.mp3
-10.5776dBFS 0.0000dBFS   0.7070dB   04 - Another One of Those Days - Cavetown.mp3
-7.0341dBFS  0.0000dBFS   -2.8365dB  05 - 100 Years - OR3O.mp3
-10.5194dBFS -0.0252dBFS  0.6488dB   06 - Paul - Cavetown.mp3
-12.3048dBFS -0.5617dBFS  2.4343dB   07 - Sharpener's Calling Me Again (feat. Kina) - Cavetown.mp3
-7.7725dBFS  0.0000dBFS   -2.0981dB  08 - Meet Me in the Woods - Lord Huron.mp3
-10.4332dBFS 0.0000dBFS   0.5626dB   09 - World Burn - Mean Girls (covered by Annapantsu).mp3
-9.3893dBFS  0.0000dBFS   -0.4812dB  10 - What I Know Now - Leslie Kritzer, Beetlejuice Original Broadway Cast Recording Ensemble.mp3
-11.7401dBFS -0.6264dBFS  1.8695dB   11 - We're Through - The Hollies.mp3
-14.9380dBFS -1.4977dBFS  5.0674dB   12 - Catch You Catch Me - Cardcaptor Sakura.mp3
-16.2943dBFS 0.0000dBFS   6.4237dB   13 - I Don't Dance - High School Musical 2.mp3
-8.5112dBFS  0.0000dBFS   -1.3594dB  14 - Everything Moves - Bronze Radio Return.mp3
-8.3120dBFS  0.0000dBFS   -1.5586dB  15 - Shut It Down - Patent Pending.mp3
-25.5607dBFS -14.0065dBFS 15.6901dB  16 - 1 • 2 • 3 Pokemon Journeys OP - After the Rain.mp3
-11.3168dBFS 0.0000dBFS   1.4462dB   17 - Candle Queen - GHOST & Silverchordmusic (feat. Gumi English).mp3
-7.6292dBFS  0.0000dBFS   -2.2413dB  18 - World's Smallest Violin - AJR.mp3
-7.4818dBFS  0.0000dBFS   -2.3888dB  19 - Karma - OR3O.mp3
-8.5264dBFS  0.0000dBFS   -1.3441dB  20 - Three-Thirty - AJR.mp3
-7.0809dBFS  0.0000dBFS   -2.7897dB  21 - 3 O’Clock Things - AJR.mp3
-9.2129dBFS  0.0000dBFS   -0.6577dB  22 - All Eyes On Me - OR3O.mp3
-9.7747dBFS  0.0000dBFS   -0.0959dB  23 - Railroad Wrath - Cuphead OST.mp3
-11.8156dBFS 0.0000dBFS   1.9451dB   24 - 004 Fallen Down - Toby Fox.mp3
-13.4141dBFS 0.0000dBFS   3.5435dB   25 - 022 Snowdin Town - Toby Fox.mp3
-10.5288dBFS 0.0000dBFS   0.6582dB   26 - 014 Heartache - Toby Fox.mp3
-16.3542dBFS -5.1780dBFS  6.4836dB   27 - 033 Quiet Water - Toby Fox.mp3
-11.3877dBFS 0.0000dBFS   1.5172dB   28 - 063 It's Raining Somewhere Else - Toby Fox.mp3
-9.8706dBFS  average level

To execute this take the -n switch out.

$ normalize-audio -m *.mp3
Computing levels...
 28 - 063 It's Rai  99% done, ETA 00:00:00 (batch 100% done, ETA 00:00:00)
Applying adjustment of -3.17dB to 01 - Danny Phantom theme.mp3...
 01 - Danny Phanto 100% done, ETA 00:00:00 (batch   1% done, ETA 00:00:00)
Applying adjustment of -2.95dB to 02 - Way Less Sad - AJR.mp3...
 02 - Way Less Sad 100% done, ETA 00:00:00 (batch   6% done, ETA 00:00:00)
Applying adjustment of 1.02dB to 03 - Ghost - Telehope.mp3...
 03 - Ghost - Tele 100% done, ETA 00:00:00 (batch   9% done, ETA 00:00:00)
Applying adjustment of 0.71dB to 04 - Another One of Those Days - Cavetown.mp3...
 04 - Another One  100% done, ETA 00:00:00 (batch  15% done, ETA 00:00:00)
Applying adjustment of 3.54dB to 25 - 022 Snowdin Town - Toby Fox.mp3...
 25 - 022 Snowdin  100% done, ETA 00:00:00 (batch  93% done, ETA 00:00:00)
Applying adjustment of 0.66dB to 26 - 014 Heartache - Toby Fox.mp3...
 26 - 014 Heartach 100% done, ETA 00:00:00 (batch  96% done, ETA 00:00:00)
Applying adjustment of 6.48dB to 27 - 033 Quiet Water - Toby Fox.mp3...
 27 - 033 Quiet Wa 100% done, ETA 00:00:00 (batch  96% done, ETA 00:00:00)
Applying adjustment of 1.52dB to 28 - 063 It's Raining Somewhere Else - Toby Fox.mp3...
 28 - 063 It's Rai 100% done, ETA 00:00:00 (batch 100% done, ETA 00:00:00)

NOTE: Use this with caution, it will overwrite your existing files. If you want to preserve the original files, you can simply make a duplicate and work off the copies.

Other scripts included

If you want to maintain more control over your conversion you can opt to use one of the other 2 scripts included, normalize-mp3 or normalize-ogg.

$ dpkg -L normalize-audio | grep /usr/bin/no

Using the normalize-mp3 script for example you can specify to backup the originals prior to normalizing them:

$ normalize-mp3 -m --backup *.mp3
Decoding 01 - Danny Phantom theme.mp3...
Decoding 02 - Way Less Sad - AJR.mp3...
Decoding 03 - Ghost - Telehope.mp3...
Decoding 27 - 033 Quiet Water - Toby Fox.mp3...
Decoding 28 - 063 It's Raining Somewhere Else - Toby Fox.mp3...
Running normalize...
Re-encoding 01 - Danny Phantom theme.mp3...
Re-encoding 02 - Way Less Sad - AJR.mp3...
Re-encoding 03 - Ghost - Telehope.mp3...
Re-encoding 04 - Another One of Those Days - Cavetown.mp3...
Re-encoding 26 - 014 Heartache - Toby Fox.mp3...
Re-encoding 27 - 033 Quiet Water - Toby Fox.mp3...
Re-encoding 28 - 063 It's Raining Somewhere Else - Toby Fox.mp3...

Here you can see the backed up files with a ~ suffix added to their name's:

$ ls -l | head -7
total 220212
-rw-r--r-- 1 root users  897453 Apr  3 21:52 01 - Danny Phantom theme.mp3
-rw-r--r-- 1 root users 1711341 Apr  3 21:42 01 - Danny Phantom theme.mp3~
-rw-r--r-- 1 root users 3327405 Apr  3 21:52 02 - Way Less Sad - AJR.mp3
-rw-r--r-- 1 root users 6534189 Apr  3 21:42 02 - Way Less Sad - AJR.mp3~
-rw-r--r-- 1 root users 2944941 Apr  3 21:52 03 - Ghost - Telehope.mp3
-rw-r--r-- 1 root users 5572365 Apr  3 21:42 03 - Ghost - Telehope.mp3~

NOTE: to use these scripts you'll need to make sure to have mpg123, oggenc, oggdec, & flac installed for re-encoding MP3, OGG, or FLAC files.

You can do so like this:

$ apt install mpg123 vorbis-tools flac



I liked Neil's answer the most, because it doesn't introduce correlation between audio files: just pick one gain level and adjust everything to it.

However I had some problems parsing the output of normalize-ogg with some files I have. There is also one nasty issue with bc: it doesn't do real rounding, it only truncates.

So eventually I gave up on shell scripting and moved to python.

Note1: the exiftool part might be overkill but I wanted to be 100% sure that the original bitrate would be preserved.

Note2: this will overwrite the originals, if you want to preserve them, use --backup in the last call to normalize-ogg. But I found more practical to keep a copy in a separate, safer, directory.

Note3: this solution deals with ogg files, but it's trivial to adapt it to mp3, just replace the occurrences of "ogg" with "mp3".

Here's my take at the problem. The latest version can be found here: regain.py

Parallel normalize gains
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Absolute value, in dB for the desired gain of each file


from subprocess import Popen, PIPE
from multiprocessing.dummy import Pool as ThreadPool
from os import listdir
import logging

def initlogger(logfile="log.log", mainlevel=logging.DEBUG,
               filelevel=logging.DEBUG, consolelevel=logging.DEBUG):
    # create logger 
    logger = logging.getLogger()
    # create file handler which logs even debug messages
    fh = logging.FileHandler(logfile)
    # create console handler also logging at DEBUG level
    ch = logging.StreamHandler()
    # create formatter and add it to the handlers
    formatter = logging.Formatter("%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s]  %(message)s")
    # add the handlers to the logger

def logcommand(command=[]):
    if not isinstance(command, list):
        return "", "", -1
    logging.info("Command:\n" + " ".join(command) + "\n")
    proc = Popen(command, stdin=PIPE, stdout=PIPE, stderr=PIPE)
    output, err = proc.communicate()
    output = output.decode("utf-8")
    err = err.decode("utf-8")
    logging.info("Output:\n" + output + "\n")
    logging.info("Error:\n" + err + "\n")
    logging.info("Return Code:\n" + str(proc.returncode) + "\n")
    return output, err, proc.returncode

def regain(target):
    logging.info("============================ Start File  ============================")
    logging.info("Extracting gain info.\n")
    commandgetlevels = ['normalize-ogg', '-n', target["name"]]
    output, err, retcode = logcommand(commandgetlevels)

    level  = output.split()[0]
    logging.debug("Level: " + level)
    if "dBFS" in level:
        level = level.split("dBFS")[0]
    level = level.replace(',', '.')
    level = int(round(float(level)))
    delta = target["gain"] - level
    logging.info("Required adjustment: " + str(delta) + "\n")
    if delta is 0:
        logging.warning(target["name"] + " is already at the correct level")
        return 0

    logging.info("Extracting average bitrate.\n")
    commandgetinfo = ['exiftool', target["name"]]
    output, err, retcode = logcommand(commandgetinfo)
    bitrate = '0'
    for line in output.split('\n'):
        if 'Nominal Bitrate' in line:
            bitrate = line.split(':')[1].split()[0]
    logging.info("Average bitrate is: " + str(bitrate) + "\n")
    if bitrate is '0':
        logging.error("No valid bitrate found, aborting conversion.\n")

    commandrenormalize = ['normalize-ogg', '--ogg', '--bitrate', bitrate,
                          '-g', str(delta) + 'db', target["name"]]
    output, err, retcode = logcommand(commandrenormalize)
    if retcode is not 0:
        log.error("Output:\n" + output)
        log.error("err:\n" + err)

    return retcode

# function to be mapped over
def parallelregain(gain=TARGET_GAIN, threads=MAX_THREADS):
    logging.info("Creating thread pool with " + str(threads) + " elements.\n")
    pool = ThreadPool(threads)
    targets = []
    files_list = listdir(".")
    counter = 0
    for filename in files_list:
        if filename.endswith("ogg"):
            target = {
            counter = counter + 1
    pool.map(regain, targets)

if __name__ == "__main__":
    initlogger(logfile="normalize.log", consolelevel=logging.WARNING)


If you don't care about quality losses, you can use sox in a batch

for f in *.mp3; do
  sox --norm "$f" /tmp/sox.mp3;
  mv -v /tmp/sox.mp3 "$f";

But this is not perfect, it will re-encode all files and also there is no way to tell Sox to use the highest possible Bitrate.


Since mp3gain was gemoved from debian repositories, install simply with

mkdir mp3gain;
cd mp3gain;
wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/mp3gain/1.5.2-r2-6/mp3gain_1.5.2-r2.orig.tar.gz; tar -xvzf mp3gain_1.5.2-r2.orig.tar.gz;
sudo make install

The changes mp3gain makes are completely lossless. There is no quality lost in the change because the program adjusts the mp3 file directly, without decoding and re-encoding.

Use on all files in the current folder with:

mp3gain -r *.mp3


This seems to be the perfect tool: https://github.com/Moonbase59/loudgain

It uses the well-known mp3gain commandline syntax but will never modify the actual audio data. Just what you ever wanted: The best of mp3gain, ReplayGain 2.0 and Linux combined.

It reduces gain to -1 dBTP (instead of 0 dBTP, according to EBU recommendation). Almost a security margin in the event that the further playout route "only" understands ReplayGain, but has no clipping prevention

Install LoudGain (using Homebrew):

wget https://raw.githubusercontent.com/Homebrew/install/master/install.sh
# first check what you get before install ;)
less install.sh
# press q and then install homebrew with:
/bin/bash -c install.sh
brew install Moonbase59/tap/loudgain

apply on folder

recommended use to scan & tag an MP3 album:

loudgain -I3 -S -L -a -k -s e *.mp3

For other formats, see https://github.com/Moonbase59/loudgain/blob/master/docs/loudgain.1.md#recommendations

throttle the CPU while processing

If you have a Laptop with intel >=8th gen. and still want to use it without being burnt, disable turbo-boost while processing multiple files in the background ;)


Another option for mp3gain - I just used this to install mp3gain on my Ubuntu 20.20 computer and its ripping through library as I type

git clone https://github.com/Sound-Linux-More/mp3gain.git
cd mp3gain/
sudo apt-get install libmpg123-dev
sudo make install

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .