Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Lossless adjusting of loudness for MP3 and AAC files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Lossless adjusting of loudness for MP3 and AAC files
Authored by: qallunaaq on Apr 07, '05 03:38:11PM

Thank you, what a difference, in both convenience and sound!

Is there a way to get aacgain to process directories and sub-directories or is it really limited to dealing directly with files?



[ Reply to This | # ]
Lossless adjusting of loudness for MP3 and AAC files
Authored by: atverd on Apr 07, '05 04:27:09PM

It can work only with files directly. For -r option you may call it from "find" (option -exec).



[ Reply to This | # ]
Lossless adjusting of loudness for MP3 and AAC files
Authored by: jiclark on Apr 08, '05 11:52:38AM

I'm sorry, but that answer is simply greek to me...

Can you be a little more explicit on how to get the tool to work on the standard iTunes folder structure (Artist->Album->Song(s))?

Thanks!
John



[ Reply to This | # ]
Lossless adjusting of loudness for MP3 and AAC files
Authored by: atverd on Apr 08, '05 01:05:08PM

I cannot teach you how to write shell scripts, sorry :)

But in a simplest case - just go to an Album directory in Terminal, this is where all those tracks are, and run the above command. This will adjust every song individually with different gains. If you want to preserve relative volume of tracks use option -a instead of -r - this will treat album as one huge track and apply same gain to all tracks.

I'd strongly suggest you to backup your collection and play with aacgain a little - you'll get it in the process a lot faster, this is rather simple actually.
And probably hydrogenaudio forums are better place to ask your questions in future.



[ Reply to This | # ]
Lossless adjusting of loudness for MP3 and AAC files
Authored by: jiclark on Apr 08, '05 01:40:36PM

thanks atverd,

I really appreciate all the time you're spending here on the comments!

Later,
John



[ Reply to This | # ]
Lossless adjusting of loudness for MP3 and AAC files
Authored by: jctull on Apr 11, '05 04:34:31PM
You can use this command from the Terminal.app. Open Terminal and cd to your directory that has all of your music, e.g. 'cd ~/Music/'. Next, run the command below, all as a single line argument (no returns):

find -iname "*.mp3" -or -iname "*.m4a" -print0 | xargs -0 -n1 aacgain -r -p -k -t

You can tweak the parameters as needed. I run mine as 'aacgain -r -p -k' because I was getting errors with the -t option.

[ Reply to This | # ]

Lossless adjusting of loudness for MP3 and AAC files
Authored by: jctull on Apr 11, '05 05:03:13PM
Sorry, but the command should read:

find -iname "*.mp3" -print0 -or -iname "*.m4a" -print0 | xargs -0 -n1 aacgain -r -p -k -t

Please add corrections if this is not finding all of the files...

VERY IMPORTANT: Requires a newer version of findutils than is installed by default with OS X. I used fink to install a working version of findutils. If you are not familiar with fink, you can find out about it at http://fink.sf.net.

[ Reply to This | # ]

Lossless adjusting of loudness for MP3 and AAC files
Authored by: Xris on Apr 28, '10 03:56:40PM

I just used the built in find (in 10.5.8 that is):

Here is what I used (after changing to a directory that contains album folders):

xris$ find . -iname "*.m4a" -print0 | xargs -0 -n 1 /Users/xris/aacgain -r -p -k -t -m 4

I don't use mp3's, but you can easily add that if you need to. Note the "." (period) after find, that means "the current" directory, and I used the "-m #" to adjust the recomended gain UP slightly.

One interesting feature that can be exploited to great effect is the "-P" switch in xargs. This enables you to launch/start MULTIPLE instances of you comand, aacgain in this case, for every match found with find. I have a Core 2 Duo machine. Using only ONE instance of aacgain is a very lengthy process that does not tax the cpu very much... but with "-P 4" I get almost 100% cpu usage and takes a, well, almost half as long. I probably would get the same result with two, but just for kicks I went with 4!

So, the above looks something like:

find . -iname "*.m4a" -print0 | xargs -P 4 -0 -n 1 /Users/xris/aacgain -r -p -k -t -m 4

BTW: I could't get fink/macports/darwinports to install properly, I gave up on that and just fiddled with the buil-in version to get it to work. Ahh, also, I used the intel version of aacgain linked somewhere in this link.

As far as I'm concerned, aacgain works, although I did adjust the gain slighly up. On some stereos, thru the mini 3.5" plug, even at max volume it was a bit quiet for my taste.



[ Reply to This | # ]
Lossless adjusting of loudness for MP3 and AAC files
Authored by: sanzoghenzo on Feb 10, '11 03:39:39AM

Thanks for the hint!
I prefer to use album gain, and use only mp3 files.
The following will do the job:

find . -type d -exec sh -c 'set -- "$0"/*.mp3; [ -e "$1" ]' {} \; -print0 | xargs -P 4 -0 -n 1 -I % sh -c "aacgain -a -p -k -m 4 \"%\"/*.mp3"

This, in conjunction with beets and pylywi will tidy up your collection from CLI!



[ Reply to This | # ]