Browse by type
rsgain (really simple gain) is a ReplayGain 2.0 command line utility for Windows, macOS, Linux, BSD, and Android. rsgain applies loudness metadata tags to your files, while leaving the audio stream untouched. A ReplayGain-compatible player will dynamically adjust the volume of your tagged files during playback.
rsgain is designed with a "batteries included" philosophy, allowing a user to scan their entire music library without requiring external scripts or other tools. It aims to strike the perfect balance between power and simplicity by providing multiple user interfaces. See Usage for more information.
rsgain is the backend for the MusicBrainz Picard ReplayGain 2.0 plugin. Users that are not comfortable with command line interfaces may prefer this method since the plugin provides a GUI frontend to rsgain. See MusicBrainz Picard Plugin for more information.
Binary packages are available on the Release Page for Windows, macOS, and some Linux distributions. You can also build the program yourself, see BUILDING.
Download the ZIP file from the link below and extract its contents to a folder of your choice: - rsgain v3.7 portable ZIP (x64)
rsgain should be run on Windows 10 or later for full compatibility, but it can run on Windows versions as early as Vista with some caveats. See Windows Notes for more information.
It is recommended to add the directory to your Path system environment variable so you can invoke the program with the rsgain command instead of the path to its .exe file.
1. Use Windows key + R to bring up the run box, then type sysdm.cpl and press enter
2. In the resulting window in the "Advanced" tab, click the "Environment variables" button.
3. In the next window under "System variables", select "Path", then press "Edit".
4. Add the folder that you extracted rsgain.exe to.
rsgain is available in the Scoop extras bucket. Installing via Scoop enables you to receive automatic upgrades to future versions, unlike the manual installation method described above.
First, make sure you have enabled the extras bucket. Then, install using the command below:
scoop install extras/rsgain
Separate builds are available for Apple Silicon and Intel based Macs. Both require macOS 12 (Monterey) or later. Download and extract the correct version according to your hardware: - rsgain v3.7 portable ZIP (Apple Silicon) - rsgain v3.7 portable ZIP (Intel)
These builds are not codesigned, and the macOS Gatekeeper will most likely block execution. To work around this, you can remove the quarantine bit using the command below:
xattr -d com.apple.quarantine /path/to/rsgain
Substitute /path/to/rsgain with the actual path on your system.
rsgain can also be installed through Homebrew and MacPorts.
rsgain is available as an official Debian package starting in Debian 13 (Trixie) and Ubuntu 24.04 (noble). Install via apt:
sudo apt install rsgain
There is also a .deb package for Debian Bookworm available on the release page. Use the following commands to install:
wget https://github.com/complexlogic/rsgain/releases/download/v3.7/rsgain_3.7-1_amd64.deb
sudo apt install ./rsgain_3.7-1_amd64.deb
The above package won't work on recent Ubuntu releases due to an FFmpeg ABI break.
rsgain is available in the AUR via the packages rsgain and rgsain-git. You can install with an AUR helper such as yay:
yay -S rsgain
rsgain is packaged in Fedora's repositories. You can use dnf to install:
sudo dnf install rsgain
rsgain is in nixpkgs. Some options:
sh
nix run nixpkgs#rsgainsh
nix-env -f '<nixpkgs>' -iA rsgainnix
environment.systemPackages = with pkgs; [ rsgain ];An x86_64 static build is available that should run on recent releases of most GNU-based Linux distros (any distro shipping GCC 10 or later). Download the archive below and extract it to a directory of your choice: - rsgain v3.7 portable TAR (x86_64)
Available via ports tree or using packages (2023Q1 and later) as listed below:
cd /usr/ports/audio/rsgain && make install clean
pkg install rsgain
rsgain can be installed on Android devices via the Termux terminal emulator package manager:
pkg install rsgain
The repo contains a Dockerfile which can be used to run rsgain in a virtual environment. It will build a container based on the current Debian Stable release:
docker build -t rsgain https://github.com/complexlogic/rsgain.git
rsgain requires a relatively up-to-date operating system, so this method can be used to run rsgain on an older system if necessary.
A Docker container doesn't have access to the host filesystem by default. To use rsgain in a container, you need to mount your music library to a mount point in the container. Use the -v option followed by the path to your library and the mount point, separated by a colon. For example, if your music library is located at /path/to/library:
docker run -v /path/to/library:/mnt rsgain easy -m MAX /mnt
The docker log to stdout updates too slowly for the scan progress bar. If you don't use multithreaded mode consider passing -q to silence the output.
rsgain supports all popular file formats. See the below table for compatibility. rsgain sorts files internally based on file extension, so it is required that your audio files match one of the extensions in the second column of the table in order to be recognized as valid.
| Format | Supported File Extension(s) |
|---|---|
| Audio Interchange File Format (AIFF) | .aiff |
| Free Lossless Audio Codec (FLAC) | .flac |
| Monkey's Audio | .ape |
| MPEG-1 Audio Layer II (MP2) | .mp2 |
| MPEG-1 Audio Layer III (MP3) | .mp3 |
| MPEG-4 Audio (AAC, ALAC)¹ | .m4a |
| Musepack (MPC)² | .mpc |
| Ogg (Vorbis, Speex, FLAC) | .ogg, .oga, .spx |
| Opus | .opus |
| Tom's lossless Audio Kompressor | .tak |
| Waveform Audio File Format (WAV) | .wav |
| Wavpack | .wv |
| Windows Media Audio (WMA) | .wma |
rsgain contains two separate user interfaces: Easy Mode and Custom Mode. The distinction between the two modes is rooted in the history of ReplayGain utilities.
Legacy ReplayGain tagging utilities such as mp3gain did not support recursive directory-based scanning. The user was required to manually specify a list of files on the command line, preceded by options which were numerous and complex. This interface provided a lot of power and flexibility, but it wasn't particularly user friendly. Performing a full library scan typically required the user to supplement the program with a wrapper script that traversed the directory tree and detected the files.
rsgain's Easy Mode is that wrapper script; the functionality is built-in to the program. In Easy Mode, the user points the program to their library and it will be recursively scanned with all recommended settings enabled by default.
The legacy-style interface has been retained as "Custom Mode" for users that require a higher level of control. Custom Mode is mostly used for scripting.
Easy Mode recursively scans your entire music library using the recommended settings for each file type.
Easy Mode is invoked with the command rsgain easy followed by the root of the directory you want to scan:
rsgain easy /path/to/music/library
rsgain easy "C:\path\to\music library"
Easy Mode assumes that you have you have your music library organized by album, so that each album is contained in its own folder. The album gain calculations rely on this assumption. If you do not have your music library organized by album, you should disable the album tags because the calculated values will not be valid. rsgain ships with a scan preset which can disable the album tags for you; invoke it with -p no_album. See the Scan Presets section for more information about how the scan preset feature works.
Easy Mode includes optional multithreaded operation to speed up the duration of a scan. Use the -m option, followed by the number of threads to create. The number of threads must not exceed the number that your CPU supports. For example, if you have a CPU with 4 threads:
rsgain easy -m 4 /path/to/music/library
If you don't know how many threads your CPU has, you can also specify -m MAX and rsgain will use the number provided by your operating system. This is useful for writing scripts where the hardware properties of the target machine are unknown.
Parallel scan jobs are generated on a per-directory basis, not a per-file basis. If you request 4 threads but there is only 1 directory to scan, a single thread will be working and the other 3 will sit idle the entire time. Multithreaded mode is optimized for scanning a very large number of directories. It is recommended to use multithreaded mode for full library scans and the default single threaded mode when incrementally adding 1 or 2 albums to your library.
The speed gains offered by multithreaded scanning are significant. With -m 4 or higher, you can typically expect to see a 50-80% reduction in total scan time, depending on your hardware, settings, and library composition.
rsgain has an option which will skip files with existing ReplayGain information, invoked by passing -S or --skip-existing. When enabled, rsgain will check whether the given file has a REPLAYGAIN_TRACK_GAIN tag, and skip scanning any files that do. If album tags are enabled, the files in the list will be judged collectively, i.e. if a single file is missing ReplayGain info, then all of them will be scanned.
This feature merely checks for the existence of the tags, and does not verify that the tags are complete, and are compatible with your current settings, e.g. target loudness. You should use this feature only if you are confident in the integrity of the files in the directory to be scanned. It's generally not a good idea to run this on files that you've recently download from the internet, which may have pre-existing ReplayGain information that was tagged by a different scanner.
You can use the -O option to enable scan logs. The program will save a tab-delimited file titled replaygain.csv with the scan results for every directory it scans. The log files can be viewed in a spreadsheet application.
Microsoft Excel doesn't recognize the tab delimiter in CSV files by default. To enable Excel compatibility, rsgain has an option -Os which will add a sep header to the CSV file. This is a non-standard Microsoft extension which will enable the outputted CSV files to open in Excel.
If you want the output sorted alphanumerically by filename, use the 'a' option, e.g. -Oa.
The options can be chained. For example, if you want both Excel compatibility and alphanumeric sorting, you can pass -Oas.
Easy Mode scans files with the following settings by default:
$ claude mcp add rsgain \
-- python -m otcore.mcp_server <graph>