Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Replay Gain in Linux (Read 11522 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Replay Gain in Linux

Hello, all.

Purely through ignorance, I'd been whinging for a while that there were no tools in Linux for calculating Replay Gain values for audio files. Having discovered the error of my ways, I've added a page to my site about using Replay Gain in Linux:

http://www.bobulous.org.uk/misc/Replay-Gain-in-Linux.html

I've created this page largely to remind myself how it's done in future (very bad memory, me), but I'm hoping it will also be of use to new Linux users who want to tag their audio files without resorting to Windows.

I know that a lot of this information is already out there, but I wanted it all in one place. Also, I couldn't find a script that recursively runs on each directory of music files in a specified location, so I've written a BASH script that does the job and made it available on this page. Very handy for metaflac and possibly mp3gain (though I have to admit that I wasn't having a lot of luck with Linux audio players, and couldn't get MP3 files to playback with gain adjusted at all).

There are bound to be errors (and a good chance of major oversights), so let me know where the howlers are at and I'll try to smooth things out.

Replay Gain in Linux

Reply #1
Nice to see some support for audio under Linux on a well presented page, which gave me some extra ideas. I am in fact testing your script right now and it runs well and elegant!

I have some comments that can be useful

(1)
Quote
According to the man page for vorbisgain, you should be able to add *.ogg to the end of the directory path so that it only examines files with a .ogg extension.


You probably did not include the quotes around the path name, as in the following:
Code: [Select]
vorbisgain -a -f -r "/media/music/ogg/Slayer/*.ogg"


(2) Replay Gain for MP3 using mp3gain: you should probably mention that, unfortunately, mp3gain will only write ape tags, and has no option to write id3 tags instead. Yet, some linux audio applications, notably mpd which is about the only one supporting gapless mp3 playback, only support id3 tags. The only workaround I know is a hack, published here: http://www.hydrogenaudio.org/forums/lofive...php/t42005.html
Nowadays, I tend to use flac and ogg, but my archive is still for a large part mp3.

(3) You page probably should not start with running a Windows program under Wine. Keep this as an option at the bottom of the page.

Replay Gain in Linux

Reply #2
Hello, Chromium.

Glad the script works for you.

As far as globbing with vorbisgain, I did use the quotes, but still got the error "can't find <directory path>". Very strange. I'm sure it's something I'm overlooking, but I'm not sure what it is.

I've added a note to the mp3gain section about APE tags being largely unsupported by audio players in Linux. (That would explain why foobar2000 could see the Replay Gain data, while Quod Libet and Rhythmbox could not.)

I've left foobar2000 at the start of the page, just so that Linux lightweights aren't scared off in the first five seconds by talk of shell commands. I have, however, added a page listing at the top so that more inquisitive visitors can jump to the more interesting parts.

Thanks for the comments.

Replay Gain in Linux

Reply #3
Sounkonverter is an all-in-1 tagger, replaygain scanner, converter:

http://www.kde-apps.org/content/show.php?content=29024


MPD replaygain worked on mp3 (id3v2), vorbis, MPC.. had trouble with flac (old bug ?) and aac. mpd 1.4 will have wavpack and additional format support.
Aqualung: Was reading RG from APE tags on the last stable release R-1000. Latest SVN builds don't seem to read it.. Anyone know how?

Replay Gain in Linux

Reply #4
Thanks for letting me know about soundKonverter, shadowking.

I've added an extra section to the page to let people know about it, including a quick-start guide to adding Replay Gain data to audio files using soundKonverter. It did calculate bad values for MP3 files, but it seems to invoke metaflac and vorbisgain without problems.

chromium, you'll be pleased to know that the page no longer begins with foobar2000, now that a native Linux application has stepped in.


Replay Gain in Linux

Reply #6
Thanks for that page. It's really good to see someone bringing out a page for Linux support. Hopefully it will get more audio stuff in there soon!

Replay Gain in Linux

Reply #7
For gnome users, there is also easymp3gain, which is modelled after the Windows graphical mp3gain tool. It does mp3, aac and ogg vorbis, but no flac, unfortunately.


Replay Gain in Linux

Reply #9
The page for gnormalize seems to suggest that it's only interested in normalizing the actual audio, rather than tagging the file with metadata, so I'm not sure it's any use for lossless volume adjustment. (It does mention that it uses the Replay Gain algorithm for the calculation, however, but doesn't mention metadata.) There's no documentation that I can see, so I'm going to leave gnormalize be for the time being.

easymp3gain looks potentially useful. The downloads page only offers a Debian package for i386 and I'm running AMD64 Ubuntu, so I'll take a look at it once I've found time to compile it manually.

Neasden, when you say you're hoping for more audio stuff, do you mean more information about audio players? I admit that the players section is the weakest part of the page, as I found so few that seemed to have any effect on Replay Gain-tagged audio. I'm hoping that the popularity and support of Replay Gain grows so that more players add support for it. If you know of any audio players that have good support for Replay Gain, let me know.

Replay Gain in Linux

Reply #10
"But as a Replay Gain scanner, foobar2000 under Linux is a very nice option."

Very true Bobulous. That's all I've ever used. Great page, by the way.

Replay Gain in Linux

Reply #11
I concur about the usefulness and elegance of the document. It really helps a lot.

With the same spirit of contributing to the completeness and accuracy of the document I would comment:

Quote
Replay Gain audio players in Linux
Quod Libet
To enable Replay Gain adjustment in Quod Libet, go to the Music menu, then select Preferences. In the preferences window that appears, open the Player tab. Then check the box labeled "Replay Gain volume adjustment". In my test, Quod Libet was reducing volume on FLAC and Ogg Vorbis tracks with a negative gain, but it wasn't playing tracks with a positive gain any louder than tracks which weren't tagged (possibly it was doing this to prevent clipping). I don't know whether Quod Libet uses album or track gain values when it adjusts volume.


In regards the positive gain I got the following reply from the QL's mailing list:

Quod Libet does indeed refuse to raise the volume of a track if the result would clip, but will raise it if it won't clip and the gain field is positive.

In regards RG using album or track:

It varies depending on the play order and browser. For example, in the album view when playing in order, you will get album gain; in the search view playing shuffled you'll get track gain.

I was also trying to find a way to do RG calculations natively in Linux and tried the following:

I used mp3gain to tag files with RG info. As stated above in the thread this will write APE tags which are not widely used on Linux players. So I used a plugin included in quodlibet to convert APEv2 tags to ID3v2 tags and the RG tags were properly translated.

After the translation, QL properly applied the RG adjustments while playing.

So that basically is one way to do RG calculations in Linux without the need to run wine.

However, while trying to find out how exactly RG settings are handled in quodlibet I found that QL also has a ReplayGain calculation plugin which is done with GStreamer, and works on flacs, oggs, mp3s, musepack, wavpack, etc. It uses QL's tagging so you don't have to go through any broken intermediate formats.

So it seems that's all I would ever use!



is this possibly another reason to move foobar2k further down the page??

Replay Gain in Linux

Reply #12
is this possibly another reason to move foobar2k further down the page??


Personally, I think that are still some programs that have no suitable equivalents on Linux: Imgburn, EAC and Foobar spring to mind. They all (generally) run find under Wine.

Call me pragmatic, but I like the simplicity of:

1. Install Wine
2. Install Foobar
3. Load files into Foobar
4. Right click on the selected files
5. Replaygain > scan selection as albums (by tags)

Job done.

Replay Gain in Linux

Reply #13
simonh I agree with you in the sense that foobar2k does not have an equivalent per se. It would be awesome if we could have a linux port (I know it is not happening), but if we promote running linux native applications and more users engage in using, testing, documenting, donating ... a particular application could evolve to what we all love(d) about foobar2k and even more.

To my taste, experience and knowledge quodlibet aims to be the case of such application. With proper clarification that I do not mean QL tries to emulate/copy/clone the foobar2k project, which is something that any QL user could easily tell.

I can also be honest and tell you that I once had a bad experience using foobar2k under wine with a reiserfs filesystem. Basically I lost 40gb worth of EAC/OGG rips because foobar/wine did something funky when reading from the filesystem.

Replay Gain in Linux

Reply #14
manthis, which version of Quod Libet are you using, and where do you get hold of the plugins that add those features?

I'm using version 1 (standard in Ubuntu) and it has no plugins by default.

Replay Gain in Linux

Reply #15
Bobulous, I am on Debian Lenny with version 1.0 as well, and there is a package named quodlibet-plugins that seems to get installed when quodlibet gets installed. However this package does not have all the plugins available in the community and particualy the RG plugin.

In order to install all the plugins available you need to do a "subversion checkout" of the following URL to your .quodlibet in your home directory:

$ cd ~/.quodlibet
$ svn co http://svn.sacredchao.net/svn/quodlibet/trunk/plugins/

On Debian Lenny I had to also install the package gstreamer0.10-plugins-bad from the repositories but it seems that on Ubuntu the 'replaygain' element was moved from gst-plugins-bad-0.10.8 to gst-plugins-good-0.10.9, so you will most likely need the latter.

Once you have done this, you should be able to fire up quodlibet and enable the plugins you want via the Music>Plugins menu.

If you run into any issue please post the output of the "Show Errors" button in the Plugins window.

Replay Gain in Linux

Reply #16
HI all,

I have an idea for replay gain and I have no idea if it's possible. I've searched the web for a few days and this post is all I could find.

Can a script be written so any new mp3's added to a set folder are automatically processed? 

What do you think?

Thanks

Replay Gain in Linux

Reply #17
manthis, which version of Quod Libet are you using, and where do you get hold of the plugins that add those features?

I'm using version 1 (standard in Ubuntu) and it has no plugins by default.


Version 1 is ok, but you need a recent Gstreamer suite, because the rg analysis plugin came in last year, or so. The big advantage is, that it can tag all formats with RG values.

http://i41.tinypic.com/984uu0.png

 

Replay Gain in Linux

Reply #18
Wow, haven't been on this board in ages (10 year member!) hoping to get some help.

I use Nautilus Actions to select MP3s in a folder. Is the following a good commandline to use?

Code: [Select]
-a -c -s i -s


Essentially I want my files to use album gain, force rechecking each time I run the command ans write to ID3 (for presumed compatibilty). Does this look right? Any further suggestions? Is there a way to force meta-tags only or does MP3Gain on linux still manually adjust the MP3 file itself. I'm afraid I've lost some of the gain adjstments on some of my older MP3s and would like to prevent this in the future.

Thanks so much in advance for any suggestions.
Sorry, I have nothing witty to say here.