Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Mp3gain In Linux (Read 4749 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Mp3gain In Linux

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?
"I told my psychiatrist that everyone hates me. He said I was being ridiculous - everyone hasn't met me yet." - Rodney Dangerfield

Mp3gain In Linux

Reply #1
There's none, the 'Max No Clip' is gone at GUI side, not in the command line.
"You have the right to remain silent. Anything you say will be misquoted, then used against you."

Mp3gain In Linux

Reply #2
hmmm.. sounds strange to me.. a GUI that has features the CLI doesnt have?

Mp3gain In Linux

Reply #3
well that bites now don't it?
"I told my psychiatrist that everyone hates me. He said I was being ridiculous - everyone hasn't met me yet." - Rodney Dangerfield

Mp3gain In Linux

Reply #4
Quote
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

 

Mp3gain In Linux

Reply #5
does that work for album mode too? (eg mp3gain -a -k -d 50 <files>)
"I told my psychiatrist that everyone hates me. He said I was being ridiculous - everyone hasn't met me yet." - Rodney Dangerfield