Help - Search - Members - Calendar
Full Version: Mp3gain In Linux
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - General
netarchy
How does one do a "Max no-clip gain" for the album using the commandline mp3gain for linux, all i can tell (since there is a lack of documentation) is mp3gain -a (-a for album mode) and then the files, but this defaults to mp3gain targeting 89db.
In the windows version you can apply instead a max no-clip gain for the album, what is the corresponding command for the linux version?
/\/ephaestous
There's none, the 'Max No Clip' is gone at GUI side, not in the command line.
Rasi
hmmm.. sounds strange to me.. a GUI that has features the CLI doesnt have?
netarchy
well that bites now don't it? wink.gif
Snelg
QUOTE(Rasi @ Jun 21 2003 - 11:06 AM)
hmmm.. sounds strange to me.. a GUI that has features the CLI doesnt have?

Sorry, it's a bit of simple math that I keep forgetting to add to the CLI.
If you have the peak amplitude (which you can do a quick scan for with the -x switch in mp3gain), then you use this formula:

gain = 4 * log2 (32768 / peak)

Of course, most languages don't have a base 2 log function built in, so for those a bit rusty with math, you can get the base 2 log of a number with this formula:

log2(x) = log10(x) / log10(2)
or
log2(x) = ln(x) / ln(2)
or whatever log function you have built-in.

Anyhow, when you've computed that gain, floor it (round it down) and use the command-line

mp3gain -g <gain> <mp3 file>


...oh, wait, I just remembered that I added a bit of functionality to the latest code that might come in handy here. It's very, very kludgy, though.
Here's the deal: the new -k switch says, "when applying the suggested Track Gain, if the Track Gain will cause the file to clip then apply the max no-clip gain instead." (Yes, if I'd been thinking more clearly I would have made the max no-clip thing a separate function at this point. Again, sorry for the oversight)

Anyhow, the following command line will effectively do the max no-clip thing:

mp3gain -r -k -d 50 <mp3 file(s)>

The -r switch says "apply the suggested Track Gain".
The -d 50 adjusts the default 89dB target by +50. (If you have files that are 139dB then you have problems wink.gif )

So mp3gain will scan the file, decide that it needs to adjust the file by some ridiculous amount to match 139dB, see that this amount will cause clipping, and apply the max no-clip gain instead.

The downside of this (other than it being kludgy and non-intuitive) is that mp3gain will waste time calculating the Replay Gain value when all it really needs is the simple max amplitude.

I'll add a more direct max no-clip function to the CLI the next time around.

-Glen
netarchy
does that work for album mode too? (eg mp3gain -a -k -d 50 <files>)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.