loudgain

From Hydrogenaudio Knowledgebase
Revision as of 13:56, 17 May 2022 by Complexlogic (talk | contribs) (Undo revision 35506 by Complexlogic (talk))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
loudgain
{{{logo}}}

Loudgain running in a Linux terminal window.
Developer(s) Matthias C. Hormann, Alessandro Ghedini
Release information
Initial release 22 June 2014
Stable release 0.6.8 (September 6, 2019)
Preview release {{{preview_release}}}
Compatibility
Operating system Linux, MacOS, Windows 10
Additional information
Use Tagging
License BSD license
Website [1]

loudgain is an open-source ReplayGain 2 tagging tool for Linux, MacOS (via Homebrew) and Windows 10 (via the Linux bash). It analyzes many types of audio files, based on the EBU R128/ITU BS.1170 standard (at -18 LUFS), and uses the well-known MP3Gain commandline syntax. Loudgain never modifies the audio data, but instead only writes the appropriate ReplayGain tags.

For mass-tagging (assuming one album per folder), loudgain comes with a bash script called rgbpm that can be modified to the user’s needs.

Technical details

Loudgain computes the ReplayGain (volume adjustment), true peak value and loudness range, using the EBU R128 algorithm for each track and (optionally) a whole album. The optional clipping prevention feature can further reduce the computed gain to a level where no clipping should occur (default -1 dBTP). Computed values are then written to the audio files as tags in a suitable tag format.

For extra versatility, loudgain also supports writing the loudness range and loudness reference values, forcing upper- or lowercase ReplayGain tags, and stripping "foreign" tags from some file types.

In case of writing ID3v2 tags, these can be specified to be either ID3v2.4 (default) or ID3v2.3. Any neccessary conversions will be done internally (i.e., converting UTF-8 frames to UTF-16 when going from ID3v2.4 to ID3v2.3).

Supported file formats

  • Supported audio file formats as of version 0.6.8:
    • FLAC: Values written to Vorbis comment.
    • MP2, MP3: Values written to ID3v2 tags (ID3v2.3/ID3v2.4 selectable).
    • (Ogg) Vorbis: Values written to Vorbis comment.
    • (Ogg) FLAC: Values written to Vorbis comment.
    • (Ogg) Speex: Values written to Vorbis comment.
    • Opus: Values written to Vorbis comment, based on -23 LUFS Opus standard. Only R128_TRACK_GAIN and R128_ALBUM_GAIN are written, but the calculated true peak value can still be used to reduce the gain values (Clipping prevention).
    • MP4, M4A: Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain). ReplayGain values are stored under ----:com.apple.iTunes:…. This is for AAC and ALAC in MPEG-4 containers.
    • ASF, WMA: Values written to WMA tags, no prefix.
    • WAV: Values written to the ID3 chunk, in ID3v2 (ID3v2.3/ID3v2.4 selectable) format. Using the bext chunk (for BWF v2) isn’t (yet) supported, but won’t be destroyed on writing.
    • AIFF: Values written to the ID3 chunk, in ID3v2 format.
    • WavPack: Values written to APEv2 tags.
    • Monkey's Audio (APE): Values written to APEv2 tags.

Command line help

Usage: loudgain [OPTIONS] FILES...

loudgain 0.6.8 supports writing tags to the following file types:
  FLAC (.flac), Ogg (.ogg, .oga, .spx, .opus), MP2 (.mp2), MP3 (.mp3),
  MP4 (.mp4, .m4a), ASF/WMA (.asf, .wma), WavPack (.wv), APE (.ape).
  Experimental: WAV (.wav), AIFF (.aiff, .aif).

Options:
  -h,   --help            Show this help.
  -v,   --version         Show version number.

  -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.
  -O,   --output-new      New format tab-delimited list output.
  -q,   --quiet           Don't print scanning status messages.

Please report any issues to https://github.com/Moonbase59/loudgain/issues.

Closer analysis of files

Album data in spreadsheet

Using the -O (uppercase letter O) switch, loudgain can produce a detailed tab-separated list, ideal for redirection into a .csv spreadsheet file and later analysis.

Simply use a command like the following and then import the album.csv file into your spreadsheet application, specifying "tab-delimited CSV":

loudgain -O [OPTIONS] FILES... > album.csv

loudgain on Windows 10

loudgain in Windows 10’s Linux bash

There is currently no Windows-native version of loudgain, but it can easily be used with Windows 10’s Linux bash.

Detailed installation instructions can be found on loudgain’s GitHub page.

Known problems

  • Loudgain relies on standard libraries like TagLib. Linux distros (except rolling releases) sometimes deliver outdated libraries, so be sure you use the latest version of TagLib. Version 1.11.1 had a nasty bug for a while that could corrupt Ogg Vorbis files. This has been fixed in the meantime but the TagLib version not updated. Loudgain comes with a (slower) static version called loudgain.static in the repo’s /bin folder that doesn’t expose the bug and can also be used on older Linux versions (like Ubuntu 14.04, Linux Mint 17).
  • TagLib versions prior to Version 1.12 couldn’t write ID3v2.3 tags to AIFF files. This now works if loudgain is compiled against TagLib 1.12 or newer.

Development

loudgain v0.1 was originally developed by Alessandro Ghedini in 2014.

Matthias C. Hormann forked this version in 2019 and took over the development of loudgain after version 0.1, starting with version 0.2.1. The latest version is 0.6.8.

See also

External links