rsgain

From Hydrogenaudio Knowledgebase
Revision as of 05:37, 11 May 2022 by Complexlogic (talk | contribs)
rsgain
{{{logo}}}

Default help screen in a Linux terminal
Developer(s) complexlogic
Release information
Initial release 10 May 2022
Stable release 2.0 (May 10, 2022)
Preview release {{{preview_release}}}
Compatibility
Operating system Windows, macOS, Linux
Additional information
Use ReplayGain tagging
License BSD license
Website [1]

rsgain (really simple gain) is a free and open source ReplayGain 2 tagging utility for Windows, macOS, and Linux. 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 a heavily modified fork of loudgain. The goal of rsgain is to take the excellent platform created by loudgain and simplify it for the average user, while also preserving the advanced features for users that need them. The following improvements have been made from loudgain:

  • Native Windows support
  • Built-in recursive directory scanning without the need for a wrapper script. See Easy Mode for more details.
  • Multithreaded scanning

Installation

rsgain is available in source form on all platforms, and executable form on some platforms.

Windows

rsgain is compatible with Windows 10 and later. Download the win64 .zip file from the latest release on GitHub, and extract its contents to a directory of your choosing.

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 using the full path to its .exe file. In the Windows taskbar search, type "env", then select "Edit the system environment variables". In the resulting window, click the "Environment variables" button. In the next window under "System variables", select "Path", then press Edit. Add the folder that you extracted rsgain.exe to in the previous step.

macOS

There is currently no binary package available for macOS, so Mac users will need to build from source. See the build instructions on GitHub.

Linux

An amd64 .deb package is provided on the GitHub release page. It is installable on most APT-based distro releases from 2020 and later. There is also a PKGBUILD script available for Arch/Manjaro users.

Users of other distros will need to build from source. See the build instructions on GitHub.

Usage

rsgain has two modes of operation: Easy Mode and Custom Mode. Easy Mode is recommended over Custom Mode for almost all use cases. Custom Mode exists to provides backwards compatibility with the legacy loudgain/mp3gain command line.

Easy Mode

Easy Mode recursively scans your entire music library using the recommended settings for each file type. You can use Easy Mode if the following conditions apply:

  • Your music library is organized by album, i.e. each album has its own folder
  • In each album folder, all audio files are of the same type. It is acceptable to have non-audio files mixed in such as log files or artwork, but if multiple audio file types are detected, the folder will not be scanned.

Easy Mode is invoked with the command rsgain easy followed by the root of the directory you want to scan, e.g.:

rsgain easy /path/to/music/library

rsgain easy "C:\path\to\music library"

This is all that is required for most users. Advanced users should see Setting Overrides for more information about the default settings and how to override them, if desired.

Multithreaded Scanning

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 be one per physical CPU core or fewer. For example, if you have a quad core CPU:

rsgain easy -m 4 /path/to/music/library

The scan progress bar is automatically disabled in multithreaded operation because multiple files are being scanned in parallel.

The speed gains offered by multithreaded scanning are significant. With -m 4 or higher, you can typically expect to see speed gains of 60-70%. However, you will also have close to 100% CPU utilization when scanning multithreaded. Consider using multithreaded on a full library scan, and the default single threaded mode when incrementally adding one or two albums to your library.

Setting Overrides

Easy Mode scans files with the following settings by default:

  • Clipping protection enabled
  • Lowercase tags for MP2/MP3, M4A, WMA, WAV, and AIFF (uppercase for all others)
  • Decibal units
  • All optional tags enabled:
    • Range calculations
    • Peak calcuations
    • Reference loudness
    • Album tags
  • ID3 version 2.3 tags
  • Strip obsolete ID3 version 1 tags
  • -1 dBTP max true peak
  • No pregain

These settings are recommended for maximum comptatibility with available players. However, if you need one of the settings changed, you can override them on a per-format basis using the -o option, and an overrides file.

The overrides file is an INI-formatted file that contains sections enclosed in square brackets which correspond to the available formats, and each section contains key=value pairs that correspond to settings. The overrides feature is intended for users that can't use the default settings of Easy Mode, but still prefer the functionality of Easy Mode over Custom Mode.

For example, rsgain writes lowercase tags on MP3 files by default, but suppose you want uppercase tags instead. Format your overrides.ini file as follows:

[MP3]
Lowercase=false

Then, pass the path to the overrides file with the -o option:

rsgain easy -o /path/to/overrides.ini /path/to/music/library

A default overrides.ini file ships with rsgain in the root package directory for Windows, and in <install prefix>/share/rsgain for Unix. The file is pre-populated will all settings that are available to change. Note that this is an overrides file, not a configuration file, i.e any formats or settings you're not interested in can simply be deleted and the defaults will be used instead.

Custom Mode

Custom Mode preserves loudgain's command line syntax for users that still need it. Unlike Easy Mode, Custom Mode works with files, not directories. If you want recursive directory-based scanning, you will need to use a wrapper script.

Custom Mode is invoked with rsgain custom followed by options and a list of files to scan. For example, scan all FLAC files in the current directory with album gain and clipping protection enabled:

rsgain custom -a -k -s e *.flac

See the command line help for all available options:

Usage: rsgain custom [OPTIONS] FILES...
  Custom Mode allows the user to specify the options to scan the files with. The
  list of files to scan must be listed explicitly after the options.

Options:
  -h,   --help            Show this help.

  -r,   --track           Calculate track gain only (default).
  -a,   --album           Calculate album gain (and track gain).

  -c,   --clip            Ignore clipping warning.
  -k,   --noclip          Lower track/album gain to avoid clipping (<= -1 dBTP).
  -K n, --maxtpl=n        Avoid clipping; max. true peak level = n dBTP.
  -d n, --pregain=n       Apply n dB/LU pre-gain value (-5 for -23 LUFS target).

  -s d, --tagmode=d       Delete ReplayGain tags from files.
  -s i, --tagmode=i       Write ReplayGain 2.0 tags to files.
  -s e, --tagmode=e       like '-s i', plus extra tags (reference, ranges).
  -s l, --tagmode=l       like '-s e', but LU units instead of dB.
  -s s, --tagmode=s       Don't write ReplayGain tags (default).

  -L,   --lowercase       Force lowercase tags (MP2/MP3/MP4/WMA/WAV/AIFF).
                          This is non-standard but sometimes needed.
  -S,   --striptags       Strip tag types other than ID3v2 from MP2/MP3.
                          Strip tag types other than APEv2 from WavPack/APE.
  -I 3, --id3v2version=3  Write ID3v2.3 tags to MP2/MP3/WAV/AIFF.
  -I 4, --id3v2version=4  Write ID3v2.4 tags to MP2/MP3/WAV/AIFF (default).

  -O,   --output          Database-friendly tab-delimited list output.
  -q,   --quiet           Don't print scanning status messages.

Please report any issues to https://github.com/complexlogic/rsgain/issues

Format Support

rsgain has support for the following file formats:

See also

External links