mp3rgain
Lossless MP3/AAC volume adjustment - a modern mp3gain replacement written in Rust
mp3rgain adjusts MP3 and AAC volume without re-encoding by modifying the global_gain field in each frame. This preserves audio quality while achieving permanent volume changes.
Features
- Lossless & Reversible: No re-encoding, all changes can be undone (MP3 and AAC)
- ReplayGain: Track and album gain analysis for MP3 and AAC/M4A
- Zero dependencies: Single static binary (no ffmpeg, no mp3gain)
- Cross-platform: macOS, Linux, Windows (x86_64 and ARM64)
- mp3gain compatible: Drop-in replacement with identical CLI
- GUI Application: Native desktop app for drag-and-drop workflow
Installation
CLI (mp3rgain)
| Platform | Command |
|---|---|
| macOS | brew install M-Igashi/tap/mp3rgain |
| Windows | winget install M-Igashi.mp3rgain |
| Arch Linux (AUR) | yay -S mp3rgain-bin |
| Debian/Ubuntu | sudo apt install ./mp3rgain_*_amd64.deb (download) |
| Nix/NixOS | nix profile install github:M-Igashi/mp3rgain |
| Cargo | cargo install mp3rgain |
GUI (mp3rgui)
| Platform | Command |
|---|---|
| macOS | brew install --cask M-Igashi/tap/mp3rgui |
| Windows | winget install M-Igashi.mp3rgui |
| Arch Linux (AUR) | yay -S mp3rgui |
Binaries for all platforms are also available from GitHub Releases.
Quick Start
# Normalize a single track (ReplayGain)
# Normalize an album
# Manual gain adjustment (+3.0 dB)
# Undo changes
# Show file info
GUI Application
A native GUI application (mp3rgui) is available for users who prefer a graphical interface.
Features: Drag-and-drop, track/album analysis, one-click gain application, clipping warnings, progress indicators.
Install: See Installation above for Homebrew, Winget, and AUR options. Binaries are also available from GitHub Releases:
mp3rgui-*-macos-universal.dmg(macOS)mp3rgui-*-linux-x86_64.tar.gz(Linux)mp3rgui-*-windows-x86_64.zip/mp3rgui-*-windows-arm64.zip(Windows)
macOS manual download: If you see "mp3rgui cannot be opened" warning, run:
This is not needed when installing via Homebrew.
Command-Line Options
| Option | Description |
|---|---|
-r |
Apply Track gain (ReplayGain) |
-a |
Apply Album gain (ReplayGain) |
-g <i> |
Apply gain of i steps (1 step = 1.5 dB) |
-d <n> |
Modify target dB level (use with analysis) |
-u |
Undo gain changes |
-k |
Prevent clipping |
-R |
Process directories recursively |
-n |
Dry-run mode |
-o [fmt] |
Output format: text, json, tsv (default: tsv if no argument) |
Run mp3rgain -h for the full list of options.
Documentation
- Roadmap - Development plans and upcoming features
- Security - Memory safety and CVE analysis
- Compatibility Report - Verification against original mp3gain
- Technical Comparison - Comparison with similar tools
- Use Cases - Integration examples (beets, headroom, etc.)
Why mp3rgain?
The original mp3gain has been unmaintained upstream since ~2015 (though distribution maintainers continue to apply security patches). mp3rgain is a modern, memory-safe replacement written in Rust.
mp3rgain implements the ReplayGain 1.0 algorithm (89 dB reference level) for full compatibility with the original mp3gain. Loudness values will differ from EBU R128/LUFS-based tools (foobar2000, loudgain, ffmpeg loudnorm).
Library Usage
use ;
use Path;
let frames = apply_gain?; // +3.0 dB
let info = analyze?;
Contributing
Contributions welcome! See CONTRIBUTING.md.
License
MIT License - see LICENSE.
See Also
- Original mp3gain
- headroom - DJ audio loudness optimizer