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

)
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