Normalise mp3's

gillsman

Member
Joined
Jan 29, 2019
Messages
89
Reaction score
34
Credits
696
I cannot find an easy way to normalise mp3 volume levels in Linux Mint 20 (Mate)
I am looking for something simple (GUI not command line) Audacity can (apparently) do it but it sounds complicated, mp3gain is no longer available (dependency errors when I try to install it).
Does anyone know of a simple gui based program that will let me easily load a few files, click a button & hey presto job done.
I don't have time (or the inclination) to learn loads of commands or set up chains (Audacity) I just want easy.
Hope someone has some suggestions.
Thanks in advance.
 


Condobloke

Well-Known Member
Joined
Apr 30, 2017
Messages
5,546
Reaction score
4,648
Credits
33,684
Welcome to linux.org

Not sure if this will do what you need it to do......

DeaDBeef is a compact and efficient audio player that is written in C++ and comes with a native GTK3 GUI. IT supports a wide range of media formats and packs with multiple plugins.


It’s stripped down in terms of any advanced features and users will have to make do with playlist-based music and basic tasks such as shuffling, repeating music, and editing metadata to mention a few.

$ sudo add-apt-repository ppa:starws-box/deadbeef-player
$ sudo apt update
$ sudo apt install deadbeef
 

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
8,071
Reaction score
6,928
Credits
65,521
Do you need to normalize the files - or do you need a normalized output on your computer?

If the latter is what you really need, this may interest you:
 
OP
G

gillsman

Member
Joined
Jan 29, 2019
Messages
89
Reaction score
34
Credits
696
Yeah thank you but I need to normalise files so that's not what i'm after but thanks anyway.
 

Vrai

Well-Known Member
Joined
Mar 16, 2019
Messages
1,060
Reaction score
1,002
Credits
4,055
Here are a couple to check out. I don't use either and cannot say if they are any easier to use than Audacity. But it doesn't cost anything to look :)


 
OP
G

gillsman

Member
Joined
Jan 29, 2019
Messages
89
Reaction score
34
Credits
696
Thanks Vrai, frustratingly I've tried to install mp3 gain without success which is a shame as it looks like what I need
 
OP
G

gillsman

Member
Joined
Jan 29, 2019
Messages
89
Reaction score
34
Credits
696
Welcome to linux.org

Not sure if this will do what you need it to do......

DeaDBeef is a compact and efficient audio player that is written in C++ and comes with a native GTK3 GUI. IT supports a wide range of media formats and packs with multiple plugins.


It’s stripped down in terms of any advanced features and users will have to make do with playlist-based music and basic tasks such as shuffling, repeating music, and editing metadata to mention a few.

$ sudo add-apt-repository ppa:starws-box/deadbeef-player
$ sudo apt update
$ sudo apt install deadbeef
It has a function called replay gain which suggests its what I'm looking for but volume levels haven't changed, maybe that's not what it's designed to do. Thanks anyway
 

JasKinasis

Well-Known Member
Joined
Apr 25, 2017
Messages
1,615
Reaction score
2,315
Credits
12,249
Personally, I've always used sox (aka SOund eXchange, the "audio Swiss Army knife") for this kind of thing. It should be available in the repos for all distros. Unfortunately, it's a terminal based tool.

But - I've already created a bash function to normalise any mp3 files in the current working directory. So you don't need to learn anything fancy to do this. Literally, all you need to do is copy/paste some code into a specific file and then you're good to go.

But first you will need to install sox using your package manager.
The quickest and simplest way to do this is via the terminal (sorry, but it is!).
As you're using Mint:
Code:
sudo apt install sox libsox-fmt-all

After sox and its dependencies have installed, use a text editor like nano to edit the file ~/.bashrc:
Bash:
nano ~/.bashrc
.bashrc stores your settings for bash and is read any time you open a new terminal.
Again, you don't have to use the terminal to do this, but seeing as we just installed sox using the terminal, we may as well edit the file there too, right?!
And you don't have to use nano - I merely suggested it because it's what most ordinary users would use. I'm more of a vim man myself!

Next, copy/paste the following function at the end of the file:
Bash:
function normalise()
{
  tempdir="$(mktemp -d)"
  for f in *.mp3 ; do
    sox --norm "$f" "${tempdir}/sox.mp3"
    mv -v "${tempdir}/sox.mp3" "$f"
  done
  rm -r "${tempdir}"
}

BTW - I'm English so I've used the English spelling of normalise. Feel free to swap the s for a z in the function name if you prefer it!

Anyway - save the file, quit the editor and then close the terminal.

And that's it! That's all the set-up that's required.

Now, whenever you want to normalise a batch of mp3's, you can simply open a new terminal window, use the cd command to navigate into a directory containing mp3's and then use the normalise function.
like this:
Code:
cd Music/SomeBand/SomeAlbum/
normalise

And that will normalise all .mp3 files that are in the current directory using sox. Wait until it's finished doing it's thing and - Job done!

Also, if your file-manager has an "open terminal here" option anywhere - you could use your file-manager to browse into a directory containing mp3's. And then use the "open terminal here" functionality to open a terminal in the appropriate directory.
Once your file-manager has poppped up a terminal you simply use the command:
Code:
normalise
Without needing to use cd.

It might seem a little limiting only normalising one directory at a time, but because I've used mktemp - we can safely open multiple terminal windows to different directories and run multiple instances of normalise at the same time.

OR, what I do is to run normalise in the background by adding an & at the end of the line. That way, I can run multiple instances of it in a single terminal window. So I can navigate to one directory, start normalise in the background, then I can cd to another directory and run another instance of it in the background.
Like this:
Code:
cd /Music/SomeBand/SomeAlbum
normalise &
cd ../AnotherAlbum
normalise &
cd ../YetAnotherAlbum
normalise &
Above we navigate into three different directories and run 3 instances of the normalise function in the background.
Then we wait until no more messages are output by mv and verify that all of the processes have finished using the jobs command, before closing the terminal..

It's by no means a perfect solution, but it works for me.
I have been thinking of writing a script that can deal with a list of directories, and normalising them with sox. But I haven't quite got around to it yet.

I have also been thinking about the possibility of creating a desktop application that will allow me to graphically choose one or more directories to normalise and then normalise them all in one go using sox. I might just accelerate my plans for that!
 
Last edited:
OP
G

gillsman

Member
Joined
Jan 29, 2019
Messages
89
Reaction score
34
Credits
696
Personally, I've always used sox (aka SOund eXchange, the "audio Swiss Army knife") for this kind of thing. It should be available in the repos for all distros. Unfortunately, it's a terminal based tool.

But - I've already created a bash function to normalise any mp3 files in the current working directory. So you don't need to learn anything fancy to do this. Literally, all you need to do is copy/paste some code into a specific file and then you're good to go.

But first you will need to install sox using your package manager.
The quickest and simplest way to do this is via the terminal (sorry, but it is!).
As you're using Mint:
Code:
sudo apt install sox libsox-fmt-all

After sox and its dependencies have installed, use a text editor like nano to edit the file ~/.bashrc:
Bash:
nano ~/.bashrc
.bashrc stores your settings for bash and is read any time you open a new terminal.
Again, you don't have to use the terminal to do this, but seeing as we just installed sox using the terminal, we may as well edit the file there too, right?!
And you don't have to use nano - I merely suggested it because it's what most ordinary users would use. I'm more of a vim man myself!

Next, copy/paste the following function at the end of the file:
Bash:
function normalise()
{
  tempdir="$(mktemp -d)"
  for f in *.mp3 ; do
    sox --norm "$f" "${tempdir}/sox.mp3"
    mv -v "${tempdir}/sox.mp3" "$f"
  done
  rm -r "${tempdir}"
}

BTW - I'm English so I've used the English spelling of normalise. Feel free to swap the s for a z in the function name if you prefer it!

Anyway - save the file, quit the editor and then close the terminal.

And that's it! That's all the set-up that's required.

Now, whenever you want to normalise a batch of mp3's, you can simply open a new terminal window, use the cd command to navigate into a directory containing mp3's and then use the normalise function.
like this:
Code:
cd Music/SomeBand/SomeAlbum/
normalise

And that will normalise all .mp3 files that are in the current directory using sox. Wait until it's finished doing it's thing and - Job done!

Also, if your file-manager has an "open terminal here" option anywhere - you could use your file-manager to browse into a directory containing mp3's. And then use the "open terminal here" functionality to open a terminal in the appropriate directory.
Once your file-manager has poppped up a terminal you simply use the command:
Code:
normalise
Without needing to use cd.

It might seem a little limiting only normalising one directory at a time, but because I've used mktemp - we can safely open multiple terminal windows to different directories and run multiple instances of normalise at the same time.

OR, what I do is to run normalise in the background by adding an & at the end of the line. That way, I can run multiple instances of it in a single terminal window. So I can navigate to one directory, start normalise in the background, then I can cd to another directory and run another instance of it in the background.
Like this:
Code:
cd /Music/SomeBand/SomeAlbum
normalise &
cd ../AnotherAlbum
normalise &
cd ../YetAnotherAlbum
normalise &
Above we navigate into three different directories and run 3 instances of the normalise function in the background.
Then we wait until no more messages are output by mv and verify that all of the processes have finished using the jobs command, before closing the terminal..

It's by no means a perfect solution, but it works for me.
I have been thinking of writing a script that can deal with a list of directories, and normalising them with sox. But I haven't quite got around to it yet.

I have also been thinking about the possibility of creating a desktop application that will allow me to graphically choose one or more directories to normalise and then normalise them all in one go using sox. I might just accelerate my plans for that!
Firstly,Thank you for this detailed reply, unfortunately it's not working for me. I have followed your instructions, when I get to the bit cd Music/Artist/Album I just get a blinking cursor in the terminal, nothing else happens so I don't get to put the normalise command in. Iv'e installed sox ok as I can see that in the software manager, I copied & pasted your details so that must be ok
 

JasKinasis

Well-Known Member
Joined
Apr 25, 2017
Messages
1,615
Reaction score
2,315
Credits
12,249
The path
Code:
Music/Artist/Album
was an abstract example. Replace that path with an actual path to a directory that exists on your system which contains MP3’s.

The cd command is a standard system command. If you try to cd into a directory, it will either move into that directory, or will give you some kind of error message - if the directory does not exist, or if the permissions of the directory prevent cd from entering the directory. I’ve never seen the cd command cause a system to hang.

However - when you run the normalise command in the foreground, the terminal will not appear to do anything at first, but it will start normalising the files straight away. Depending on the speed of your pc, it might take some time to normalise each track.

And because we used the -v option with the mv command in the bash function - you should see a message when each file has finished and is copied from the temporary directory in /tmp/.

Can you post any screenshots of the problem?? Because this definitely works. I’ve been using it for years!
 
Last edited:

alexandrul

New Member
Joined
Oct 29, 2020
Messages
1
Reaction score
0
Credits
6
I'm using normalize-audio for all my files and had no reason to complain so far:

manpages.ubuntu.com/manpages/precise/man1/normalize-audio.1.html
 

bob466

Well-Known Member
Joined
Oct 22, 2020
Messages
762
Reaction score
537
Credits
5,643
If you have wine installed, then you can install and run MP3Gain .exe... I have it installed and it works just fine, another one is MP3 Quality Modifier .exe
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Latest posts

Top