Click to See Complete Forum and Search --> : Normalize mp3 volume with mp3gain


psych-major
02-20-2007, 04:03 PM
Having moved from Windows to Linux full time on my personal/work laptop, I noticed that Mp3 relative volume, i.e. gain, was not managed as automagically as it had been in iTunes. So, off to Google for a solution...

The following assumes that Mp3 playback is already enabled for your distro, which is a separate issue that is well documented elsewhere...

There are several apps suitable for this task; mp3gain is what we will use here...

First, download the appropriate version of mp3gain for your distro. The sourceforge site seems to have only Windows versions, but I have found pre-compiled packages for Slackware (http://platinum.linux.pl/download/linux/slackpkg/mp3gain-1.4.6-i686-1.tgz), and Debian/Ubuntu users can grab it from the package manager. There are also RPM files for RedHat/SuSE (http://rpm.pbone.net/index.php3).

After mp3gain is installed, it can be used from the command line with something like the following:
find /path/to/mp3/directory -type d -exec sh -c "cd \"{}\" && mp3gain -r -T *.mp3" \;This command will search for all mp3 files recursively under the directory you entered, and for each one it finds, it will cd into that directory and run the mp3gain command with the switches -r and -T. -r tells mp3gain to normalize all mp3 files relative to each other, and the -T does so directly in the file, without making a copy first. Feel free to read the man page of mp3gain and adjust as needed.


There is also a GUI front-end to mp3gain; JavaMP3Gain, which can be downloaded here (http://step.polymtl.ca/~guardia/archives/JavaMP3Gain_20040902_3.zip).

Once you have downloaded and unzipped it, copy the file JavaMP3Gain.jar to a logical location, such /home/username/apps.
You can then launch it from the command line with the following:
java -jar /home/username/apps/JavaMP3Gain.jarOr you can create a shortcut or menu entry with the same command.
Either way, you will get a nice, no-frills GUI with the basic options covered. Simply choose your options, and click 'Start'

*Permissions - Note, the user running mp3gain must have write privileges to the mp3 files being modified.

That's it, depending on the number of mp3's and the speed of your PC, within a few minutes you should have them all set to the same relative gain, and you will no longer need to reach for the volume every time a new song comes up!

Also of note, if your iPod is mounted, you can run mp3gain against it, too...;)

psych-major
02-21-2007, 12:33 PM
I use my iPod in the car with a Belkin TuneCast II. After running mp3gain -r -T against the songs on it, I am happy to report that the volume levels are PERFECT when using it through the car stereo!

Syngin
02-23-2007, 02:22 PM
Great walkthrough PM ;) I do believe I'll give this a go this weekend.

Thanks!

psych-major
02-23-2007, 02:28 PM
Glad somebody enjoyed it...

Since the write-up, I've run the java version a couple more times and it's pretty smooth.

pxumsgdxpcvjm
03-01-2007, 06:49 AM
Hey, random person logging in with BugMeNot here. Been working on running MP3gain since switching to Mandriva 2007 from Windows. Anyone know where to find the source for Linux?

edit: Scratch that. Found it here. Hope this helps, MP3gain rocks!
http://ftp.riken.go.jp/pub/Linux/debian/debian/pool/main/m/mp3gain/mp3gain_1.4.6.orig.tar.gz

Amarok users can also download a script to automatically adjust the volume based on mp3gain info. I think it's called replaygain.

JayMan8081
03-01-2007, 11:49 AM
Looks like someone had your same idea psych-major: http://www.linux.com/article.pl?sid=07/02/01/1633256

discmaster
05-20-2007, 08:57 AM
Hey psych-major!

Thanks so much for a clear definition on how to use this pgm. I have been trying for days, & your directions worked great for me. I am a new linux user, & I did manage to get the command line vers. of mp3gain working, but the GUI is nicer, IMO...

Besides, I am not sure what all is going on with the cmd. line, as far as "album gain/track gain", etc. I am an "x" windows user, so pictures are nice since I am just getting my feet wet! (Ubuntu 7.04)

Question: Is there a "tutorial" on what the settings all mean, how to use them, for example; "process recursively" ? What does that mean?

Thanks again! :)

discmaster
05-20-2007, 09:25 AM
"process recursively" ? What does that mean? Scratch that! I just found;
Click the Process Recursively button if you want to run operations on subdirectories containing MP3s as well.
From this (http://www.linux.com/article.pl?sid=07/02/01/1633256) site.

I read on there;
JavaMP3Gain isn't as full-featured as the MP3Gain GUI for Windows Do I understand that to mean it won't do as much as its' Windows counterpart? What is missing?

psych-major
05-20-2007, 11:53 AM
Do I understand that to mean it won't do as much as its' Windows counterpart? What is missing?I'm not sure, as I have never used the Windows version.

C_Pac
05-21-2007, 08:44 PM
I have been using normalize for that function on mix cds for a long time. It's got some great options and I think there's a xmms plugin for it. Great cli option.

http://normalize.nongnu.org/



Also of note, if your iPod is mounted, you can run mp3gain against it, too...;)

That's a great idea.

psych-major
05-22-2007, 10:30 AM
I have been using normalize for that function on mix cds for a long time. It's got some great options and I think there's a xmms plugin for it. Great cli option.I believe normalize is for .wav files. mp3gain does the exact same thing, but for mp3 files.