MP3GAIN(1)

πŸ“¦
version 1.6.2 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing

πŸ’– MP3GAIN πŸ’–

okay bestie, welcome to mp3gain β€” the General Commands Manual page for a lossless mp3 normalizer, and honestly? she's iconic. let's get into it πŸŽ€


✨ NAME ✨

mp3gain β€” lossless mp3 normalizer


🌸 SYNOPSIS 🌸

mp3gain [options]  [infile]  [infile 2 ...]

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, this manual page is a quick little rundown of the mp3gain command, periodt.

it was written for the Debian distribution because the original program literally doesn't have a manual page. not me writing docs for free πŸ’…

here's the tea: mp3gain can analyze and adjust mp3 files so that they all have the same volume. no more reaching for the volume knob mid-playlist, we love that for us.

and it's not just doing peak normalization like all the other normalizers out there (no shade... okay a little shade). instead, it does actual statistical analysis to figure out how loud the file really sounds to the human ear. and the changes it makes are completely lossless ✨ β€” zero quality lost, because the program adjusts the mp3 file directly, without decoding and re-encoding. the way she does it without touching the audio?? main character energy fr fr.

mp3gain optionally writes gain adjustments directly into the encoded data. when it does that, the adjustment works with all mp3 players, i.e. no support for a special tag is required. this mode gets activated by any of the options -r, -a, -g, or -l.

if none of the above options are given, the recommended gain change is instead written to a special tag in the mp3 file. in that case the adjustment only works with mp3 players that support this tag. some mp3 players refer to this as ReplayGain. the tag is written either in APEv2 format (default) or in ID3v2 format (with -s i). and if you only want to print the recommended gain change and not modify the file at all, you may use the -s s (skip tag) option. lowkey the safest option ngl 🫢

the method mp3gain uses to determine the desired volume is described at www.replaygain.org (link to URL http://www.replaygain.org/). see also /usr/share/doc/mp3gain/README.method.


⭐ OPTIONS ⭐

  • -?, -h β€” show summary of options. your little cheat sheet, bestie.
  • -g i β€” apply gain i to mp3 without doing any analysis. just straight to it, no questions asked.
  • -l 0 i β€” apply gain i to channel 0 (left channel) of mp3 without doing any analysis. ⚠️ ONLY works for STEREO mp3s, not Joint Stereo mp3s.
  • -l 1 i β€” apply gain i to channel 1 (right channel) of mp3 without doing any analysis. ⚠️ ONLY works for STEREO mp3s, not Joint Stereo mp3s.
  • -r β€” apply Track gain automatically (all files set to equal loudness). every file, same loudness, no drama.
  • -k β€” automatically lower Track gain to not clip audio. she's being careful, respect it.
  • -a β€” apply Album gain automatically (files are all from the same album: a single gain change is applied to all files, so their loudness relative to each other remains unchanged, but the average album loudness is normalized). keeping the album's whole vibe intact while fixing the overall level 🎢
  • -m i β€” modify suggested MP3 gain by integer i.
  • -d n β€” modify suggested dB gain by floating-point n.
  • -c β€” ignore clipping warning when applying gain.
  • -o β€” output is a database-friendly tab-delimited list. spreadsheet girlies rise πŸ“
  • -t β€” mp3gain writes modified mp3 to temp file, then deletes original instead of modifying bytes in original file. (this is the default in Debian!)
  • -T β€” mp3gain modifies bytes in original file instead of writing to temp file.
  • -q β€” Quiet mode: no status messages.
  • -p β€” Preserve original file timestamp.
  • -x β€” Only find max. amplitude of mp3.
  • -f β€” Force mp3gain to assume input file is an MPEG 2 Layer III file (i.e. don't check for mis-named Layer I or Layer II files).
  • -s c β€” only check stored tag info (no other processing).
  • -s d β€” delete stored tag info (no other processing).
  • -s i β€” use ID3v2 tag for gain information; if the file contained gain data in APEv2 format, it is upgraded to ID3v2.
  • -s a β€” use APEv2 tag for gain information (default).
  • -s s β€” skip (ignore) stored tag info (do not read or write tags).
  • -s r β€” force re-calculation (do not read tag info).
  • -u β€” undo changes made by mp3gain (based on stored tag info). we love an undo button πŸ™ˆ
  • -w β€” "wrap" gain change if gain+change > 255 or gain+change < 0 (see below or use -? wrap switch for a complete explanation).
  • -v β€” Show version of program.

if you specify -r and -a, only the second one will work.

if you do not specify -c, the program will stop and ask before applying gain change to a file that might clip.


πŸŽ€ The WRAP option πŸŽ€

here's the problem, bestie: the "global gain" field that mp3gain adjusts is an 8-bit unsigned integer, so the possible values are 0 to 255.

MOST mp3 files (in fact, ALL the mp3 files I've examined so far) don't go over 230. so there's plenty of headroom on top β€” you can increase the gain by 37dB (multiplying the amplitude by 76) without a problem. slay.

the problem is at the bottom of the range. some encoders create frames with 0 as the global gain for silent frames. what happens when you lower the global gain by 1? well, in the past, mp3gain always simply wrapped the result up to 255. that way, if you lowered the gain by any amount and then raised it by the same amount, the mp3 would always be exactly the same.

there are a few encoders out there, unfortunately, that create 0-gain frames with other audio data in the frame. as long as the global gain is 0, you'll never hear the data. but if you lower the gain on such a file, the global gain is suddenly huge. if you play this modified file, there might be a brief, very loud blip πŸ’€ not cute.

so now the default behavior of mp3gain is to not wrap gain changes. in other words,

  1. if the gain change would make a frame's global gain drop below 0, then the global gain is set to 0.
  2. if the gain change would make a frame's global gain grow above 255, then the global gain is set to 255.
  3. if a frame's global gain field is already 0, it is not changed, even if the gain change is a positive number.

to use the original "wrapping" behavior, use the -w switch.


🌈 SEE ALSO 🌈

the homepage of mp3gain is located at http://mp3gain.sourceforge.net/ (link to URL http://mp3gain.sourceforge.net/).


πŸ‘‘ AUTHOR πŸ‘‘

this manual page was written by Stefan Fritsch sf@sfritsch.de for the Debian system (but may be used by others). permission is granted to copy, distribute and/or modify this document under the terms of the GNU Lesser General Public License, Version 2.1 or any later version published by the Free Software Foundation.

on Debian systems, the complete text of the GNU Lesser General Public License can be found in /usr/share/common-licenses/LGPL.


and that's the whole thing, bestie πŸ’– this was MP3GAIN(1) from the General Commands Manual β€” go normalize something and think of me. bye pookie πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from