IPB

Welcome Guest ( Log In | Register )

Replay Gain in Linux, Page for Linux users who want to use Replay Gain.
Bobulous
post Nov 17 2008, 17:19
Post #1





Group: Members
Posts: 12
Joined: 31-May 06
From: London, UK
Member No.: 31325



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.
Go to the top of the page
+Quote Post
 
Start new topic
Replies (1 - 18)
chromium
post Nov 18 2008, 09:59
Post #2





Group: Members
Posts: 82
Joined: 3-February 08
Member No.: 51007



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
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.

This post has been edited by chromium: Nov 18 2008, 10:03
Go to the top of the page
+Quote Post
Bobulous
post Nov 18 2008, 23:12
Post #3





Group: Members
Posts: 12
Joined: 31-May 06
From: London, UK
Member No.: 31325



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.
Go to the top of the page
+Quote Post
shadowking
post Nov 19 2008, 02:15
Post #4





Group: Members
Posts: 1529
Joined: 31-January 04
Member No.: 11664



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?

This post has been edited by shadowking: Nov 19 2008, 02:18


--------------------
Wavpack -b450s0.7
Go to the top of the page
+Quote Post
Bobulous
post Nov 22 2008, 17:41
Post #5





Group: Members
Posts: 12
Joined: 31-May 06
From: London, UK
Member No.: 31325



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.
Go to the top of the page
+Quote Post
caligae
post Nov 22 2008, 18:21
Post #6





Group: Members
Posts: 186
Joined: 23-January 02
Member No.: 1132



QUOTE (shadowking @ Nov 19 2008, 02:15) *
MPD replaygain worked on mp3 (id3v2), vorbis, MPC.. had trouble with flac (old bug ?) and aac.


Yes, the flac bug is rather old. A patch is available and it should be finally fixed in the next release. See http://musicpd.org/mantis/view.php?id=1616
Go to the top of the page
+Quote Post
Neasden
post Nov 22 2008, 19:15
Post #7





Group: Banned
Posts: 185
Joined: 1-July 08
Member No.: 55148



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!
Go to the top of the page
+Quote Post
chromium
post Nov 23 2008, 18:13
Post #8





Group: Members
Posts: 82
Joined: 3-February 08
Member No.: 51007



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.
Go to the top of the page
+Quote Post
Tartalo
post Nov 25 2008, 01:07
Post #9





Group: Members
Posts: 5
Joined: 18-November 08
Member No.: 62641



I just found this (I haven't tried it yet):
http://gnormalize.sourceforge.net/
Go to the top of the page
+Quote Post
Bobulous
post Nov 29 2008, 18:27
Post #10





Group: Members
Posts: 12
Joined: 31-May 06
From: London, UK
Member No.: 31325



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.
Go to the top of the page
+Quote Post
simonh
post Nov 29 2008, 21:24
Post #11





Group: Members
Posts: 177
Joined: 16-July 03
Member No.: 7820



"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.
Go to the top of the page
+Quote Post
manthis
post Dec 3 2008, 21:15
Post #12





Group: Members
Posts: 3
Joined: 3-December 08
Member No.: 63772



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! smile.gif



is this possibly another reason to move foobar2k further down the page?? smile.gif
Go to the top of the page
+Quote Post
simonh
post Dec 3 2008, 22:45
Post #13





Group: Members
Posts: 177
Joined: 16-July 03
Member No.: 7820



QUOTE (manthis @ Dec 3 2008, 12:15) *
is this possibly another reason to move foobar2k further down the page?? smile.gif


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.
Go to the top of the page
+Quote Post
manthis
post Dec 4 2008, 00:33
Post #14





Group: Members
Posts: 3
Joined: 3-December 08
Member No.: 63772



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.
Go to the top of the page
+Quote Post
Bobulous
post Dec 6 2008, 15:24
Post #15





Group: Members
Posts: 12
Joined: 31-May 06
From: London, UK
Member No.: 31325



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.
Go to the top of the page
+Quote Post
manthis
post Dec 7 2008, 21:37
Post #16





Group: Members
Posts: 3
Joined: 3-December 08
Member No.: 63772



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.
Go to the top of the page
+Quote Post
pspreston
post Jan 7 2009, 17:35
Post #17





Group: Members
Posts: 1
Joined: 7-January 09
Member No.: 65304



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
Go to the top of the page
+Quote Post
towolf
post Jan 7 2009, 18:57
Post #18





Group: Members
Posts: 61
Joined: 2-April 03
Member No.: 5795



QUOTE (Bobulous @ Dec 6 2008, 15:24) *
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
Go to the top of the page
+Quote Post
flloyd
post Dec 2 2012, 00:44
Post #19





Group: Members
Posts: 131
Joined: 3-October 02
From: Santa Monica, CA
Member No.: 3472



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
-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.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 25th December 2014 - 13:26