loudgain is a command line loudness normalizer that scans music files and calculates loudness-normalized gain and loudness peak values according to the EBU R128 standard. It can optionally write ReplayGain 2.0-compatible metadata and implements a subset of mp3gain's command-line options, which means that it can be used as a drop-in replacement in many situations. It currently works for FLAC, Ogg Vorbis and MP3 files and can thus replace mp3gain, vorbisgain and metaflac.
loudgain defaults to the ReplayGain 2.0 standard (-18 LUFS, "dB" units) but can do a lot more. It is freely available on GitHub (https://github.com/Moonbase59/loudgain) and distributed in source code. Self-compiling it on a modern Linux system is easy, though. A special prebuilt binary for older Ubuntu-based Linuxes (pre Ubuntu 18.04/Linux Mint 19) is also provided.
Link: https://github.com/Moonbase59/loudgain
Will test it. Noticed that foobar2000 doesn't accurately compute Replaygain (Winamp and Flac computes same value and foobar differs).
Maybe that’s due to Winamp and metaflac (flac) still using the older RG1 algorithm. Foobar already uses RG2 (EBU R128 based).
Nevertheless, I’m looking forward to any test results (and probably bug reports—please use the issue tracker (https://github.com/Moonbase59/loudgain/issues)).
RG1 and RG2 produce slightly different results, with RG2 (derived from EBU R128) being the more "accurate" (closer to human perception of loudness) version.
loudgain v0.4.1 is available. This version also handles AAC and ALAC audio data in .m4a and .mp4 files.
ReplayGain tags are written to "----:com.apple.iTunes:REPLAYGAIN_*", or to "----:com.apple.iTunes:replaygain_*" if the "-L" (force lowercase) switch is used. Existing SoundCheck (iTunNORM) tags are left untouched.
loudgain v0.5.0 is available. This version isn’t dependent on the (now deprecated) libavresample anymore and should compile much more easily on modern systems.
Tested on Ubuntu 18.04, Linux MInt 19.1, Manjaro 18.0.4 and Arch.
I have a question.
Why use ffmpeg/libav when you can use dr_flac.h, stb_vorbis.c and minimp3.c for decoding, thus saving a ton on dependancies?
Thanks for the fresh idea, I’ll surely have a look.
Otherwise:
- loudgain v0.1 was using libav when I forked it, and I’m lazy ;-)
- I quite like FFmpeg, and it’s available almost anywhere
- I need FFmpeg’s resampler anyway (up to 4x resampling needed for true peak calculations)
- it works
:D
loudgain v0.5.2 adds support for MPEG-1 Layer 2 (.mp2) audio files.
loudgain v0.5.3 adds experimental support for Opus (.opus) audio files and is now also available in the AUR (Arch User Repository) (https://aur.archlinux.org/packages/loudgain/).
Please read How I handle Opus (.opus) audio files (https://github.com/Moonbase59/loudgain#how-i-handle-opus-opus-audio-files).
I’d value your feedback on this, because a) I don’t have many test files, and b) I’m not sure if FFmpeg’s avformat applies the header’s 'output_gain' so I get the correct samples to work on.
loudgain 0.5.4 adds support for
Apple MacOS X. It can be manually compiled on a Mac now, but also installed using
Homebrew:
brew install Moonbase59/tap/loudgain
loudgain v0.6.0 supports the newer FFmpeg API and also runs with FFmpeg 4.2+ (and on MacOS X).
loudgain v0.6.1 now handles files with more than 2 channels correctly (i.e., 5.0, 5.1, …). It can now also read almost any kind of audio file for analysis. Tagging is currently supported for FLAC, Ogg, MP2, MP3, MP4, M4A, AAC, ALAC, Opus.
loudgain v0.6.2 fixes a bug in album gain calculation for Opus albums.
See https://hydrogenaud.io/index.php/topic,118085.msg974715.html#msg974715
Hello Moonbase,
Nice piece of software.
Sorry for my English, I will do my best.
Is loudgain recursive when "calculate track gain only" (-r) is used ?
No, it would just work on the list of files you give it (like
loudgain [options] file1 file2 file3 …).
But you can use the included
rgbpm bash script which allows recursive tagging, assuming there is one album per (sub-)folder. I use this myself every day.
So assume you have a folder ~/Music/todo and subfolders like this:
/home/rafael/Music/todo/
└── ZZ Top
├── ZZ Top - Afterburner (1985 album, DE)
│ ├── cover.jpg
│ ├── ZZ Top - Can't Stop Rockin'.flac
│ ├── ZZ Top - Delirious.flac
│ ├── ZZ Top - Dipping Low (In the Lap of Luxury).flac
│ ├── ZZ Top - I Got the Message.flac
│ ├── ZZ Top - Planet of Women.flac
│ ├── ZZ Top - Rough Boy.flac
│ ├── ZZ Top - Sleeping Bag.flac
│ ├── ZZ Top - Stages.flac
│ ├── ZZ Top - Velcro Fly.flac
│ └── ZZ Top - Woke Up With Wood.flac
├── ZZ Top - Antenna (1994 album, GB)
│ ├── cover.jpg
│ ├── ZZ Top - Antenna Head.flac
│ ├── ZZ Top - Breakaway.flac
│ ├── ZZ Top - Cherry Red.flac
│ ├── ZZ Top - Cover Your Rig.flac
│ ├── ZZ Top - Deal Goin' Down.flac
│ ├── ZZ Top - Everything.flac
│ ├── ZZ Top - Fuzzbox Voodoo.flac
│ ├── ZZ Top - Girl in a T-Shirt.flac
│ ├── ZZ Top - Lizard Life.flac
│ ├── ZZ Top - PCH.flac
│ ├── ZZ Top - Pincushion.flac
│ └── ZZ Top - World of Swirl.flac
...
you just do
rgbpm ~/Music/todo/ and it’ll work through all folders recursively. :-)
rgbpm is just a bash script, you can modify it to your heart’s content. Or, better, make a copy (maybe "my-rgbpm") and modify
that, maybe just to calculate the track gain.
Hope this helps.
Thanks, I will try.
loudgain v0.6.3 has experimental support for ASF/WMA (WMAv1, WMAv2, WMA Pro, WMA Lossless).
Read How I handle ASF/WMA (.asf, .wma) audio files (https://github.com/Moonbase59/loudgain#how-i-handle-asfwma-asf-wma-audio-files).
loudgain v0.6.5 has undergone a lot of internal code rework, making it safer to use. It now also offers rudimentary WAV file support (by writing ID3v2 tags into the "ID3 " chunk), compatible with foobar2000, VLC, Mp3tag and probably others.
loudgain v0.6.6 now handles many more codecs in the Ogg container: Vorbis, FLAC, Speex and Opus. Also, experimental support for WavPack (*.wv) has been introduced.
loudgain v0.6.7 brings AIFF support. And an entry in the HA Knowledgebase (http://wiki.hydrogenaud.io/index.php?title=ReplayGain#loudgain). ;-)
loudgain v0.6.8 brings support for Monkey’s Audio (APE), some minor bug fixes, and enhancements for seamless work with the next version 2.2 of MusicBrainz Picard (https://picard.musicbrainz.org/).
More info on loudgain in the HA Knowledgebase (https://wiki.hydrogenaud.io/index.php?title=Loudgain).