Running out of original titles on the subject of replay gain

Now that Amarok can read replay gain tags from almost all the files that it can read metadata from, I feel replay gain support in Amarok is pretty much there.  And, yes, all this will be in Amarok 2.1.

A small caveat: the reading of replay gain tags from MP4 files only works if Amarok was built against libMP4v2.  Amarok uses its own (home-brewed?) code for reading MP4 tags when it can’t find libMP4v2 at build-time, but it doesn’t support freeform tags and I don’t see the point of implementing that support when libMP4v2 does the job.

Amarok 2.1 will support all the file formats that Amarok 1.4’s replay gain script did (and more), apart from Musepack (mpc).  Ironically, this is because of Musepack’s native support for replay gain – rather than abusing metadata tags to store the replay gain information, Musepack has a special field in the file header to specify the values.  However, TagLib doesn’t let us at this field, so we’re a bit stuck.

So the state of replay gain support in Amarok is that, for files in the main collection or elsewhere on your computer’s filesystem (so not streaming media and not portable music players), replay gain tags (both album and track mode) will be read from the following formats:

  • MP3 (as written by mp3gain/aacgain, Foobar2000 and Mutagen/Quod Libet – yes, there are three different ways of writing the tags to MP3 files)
  • OGG Vorbis (as written by vorbisgain and anything compatible)
  • OGG FLAC (assuming the tags are stored in the same way as in OGG Vorbis)
  • OGG Speex (assuming the tags are stored in the same way as in OGG Vorbis)
  • FLAC (as written by flac [with it’s –replay-gain switch] and anything compatible)
  • WMA/ASF (as written by the Amarok 1.4 replay gain script)
  • MP4 (as written by aacgain and anything compatible, providing Amarok was built with libMP4v2)
  • WavPack (assuming the tags are stored in a similar way to how mp3gain stores them in MP3 files)
  • TrueAudio (assuming the tags are stored in a similar way to how Foobar2000 or QuodLibet/Mutagen store the tags in MP3 files)

In addition, Amarok will use the track mode tags (or the album mode ones if there aren’t any track mode tags) to adjust the gain during playback.  I haven’t added an option to switch to album mode (or even disable it, if you really want to) yet, but that will come.  I just have to figure out where it should go in the user interface…

Of course, this is only half the functionality provided by the Amarok 1.4 replay gain script.  That also parsed and tagged files in the playlist.  This could be implemented nicely as a script (I certainly don’t believe it belongs in the core of Amarok).  But that’s for another day, and probably another person.


Tags: , , , , , , , , , ,

20 Responses to “Running out of original titles on the subject of replay gain”

  1. Lukas Lalinsky Says:

    Just a quick note, TagLib SVN has MP4 code with support for freeform tags. You could take the code from there and not depend on libmp4v2.

  2. Thomas R. Says:

    Is there a schedule for amarok 2.1? I haven’t found any on the webpage.

  3. KDE Fan Says:

    This does not touch service right? I know that its their problem, but I don’t think they are even working on it…

  4. randomguy3 Says:

    @KDE Fan: We can’t really do anything about streaming media, as they are unlikely to already have the necessary tags. Generating the information needed for replay gain ourselves would require dowloading the entire track first. So it’s really up to (et al) to do it from their end (preferably by recoding the tracks at a standard perceived level of 83dB).

    @Thomas R: no, nothing fixed as yet. The plan at the moment is no more concrete than “in a few months”. So probably late spring, I’d have thought.

  5. TheBlackCat Says:

    Looking good. How come it doesn’t work with portable media players?

  6. randomguy3 Says:

    @TheBlackCat: because I don’t know anything about how tags are got from portable media players (when the devices are accessed using MTP or the IPod protocols, for example). If the necessary tags can be read using libmtp or libgpod, it should be easy to add support. But I don’t have any devices to test this with.

  7. yaomtc Says:

    Good to hear this. I’ve been sticking with Amarok 1 because of the Replay Gain script, but have been really put off by the lag (I have installed the KDE bindings for Python or whatever it was, still lags). I’m looking forward to 2.1. Would there be any way to be notified when 2.1 is released? Say, through some RSS feed or email subscription or something?

  8. alkopedia Says:

    How do I enable this in Amarok SVN? What about pregain and default gain settings?

  9. randomguy3 Says:

    alkopedia: if your files are tagged, it should just work. You may need to do a full rescan if you’ve been following svn trunk, though, to get tags from all the file formats.

    There are no pregain or default gain settings. I see no point complicating things when Amarok’s volume slider will do what most people want: change the output volume as a whole, after replay gain has been applied.

    Currently, you can’t change from track gain mode to album gain mode. That will come before 2.1 is released. I just need to figure out where to put the option in the GUI.

  10. alkopedia Says:

    I can’t say, that it works.

    Do I get the 2.1 branch with:
    svn co svn://

    In “About Amarok” it says: Version 2.0-SVN

  11. randomguy3 Says:

    @alkopedia: yes, that’s right. In fact, the lastest version from SVN allows you to change the mode between track, album and off. That may go away again if I figure out a good way to automate the selection between track and album mode.

    Note that you need to have your files tagged already (using mp3gain, vorbisgain or whatever else) and you’ll probably need to rescan your collection to pick up the tags (a full rescan, the sort you do from the configuration dialog).

    If you want to see something visual, enable debugging output (run amarok as `amarok –debug`) and you’ll get a line when the track changes saying what the replay gain is being set to.

  12. alkopedia Says:

    OK, just installed today’s SVN version and I can see the settings now.
    There seem to be some situations where the Amarok 1.4 script has worked better, but I can’t compare at the moment. 1.4 doesn’t run with my KDE 4.2.

    I’ll test the debug option and try to give some feedback.

    In my opinion it’s best to let the user chose between album and track mode and use the other one as fallback (only interesting for album mode, because non album tracks won’t have an album tag).

    PS: Of course my files are all tagged and the collection was newly scanned 2 days ago, when switching from 1.4 mysql to 2.0-svn emysql database.

  13. randomguy3 Says:

    @alkopedia: what do you mean by “worked better”? If you ignore the ability of the 1.4 script to tag files, it should work identically, except that it won’t work on Musepack files.

  14. alkopedia Says:

    I think there are files where it does not work. Could you tell me for what I can grep the amarok -debug output? Can’t see any replay gain messages.

  15. randomguy3 Says:

    Grep for “Using gain of”. That should always turn up when a track starts playing, unless you actually have replay gain turned off. If it can’t find the tags, the gain will always be 0.0.

  16. alkopedia Says:

    Ok, now I can see the gain values, but I can’t hear any difference between off/track/album. I’ve even restarted Amarok to be sure the new setting is applied. I’ve tested with a track with ca. -12 db.

  17. nono Says:

    If we copy the replaygain tags from Musepack header to the APEv2 tags, will amarok use it ?
    This is easily done and could fix the problem of no gain support for Musepack which is for me a real problem (70% of my files are musepack)

  18. randomguy3 Says:

    @nono: as of thirty seconds ago, yes.

  19. valz Says:

    I’m intrested in making Amarok use replaygain on Musepack files, but following the comments I didn’t understand what is the current situation. Is it possible for Amarok to read replaygain info from APEv2 tags in mpc files? And how can I write such info in my mpc collection?

  20. randomguy3 Says:

    valz: It should read replaygain info from APEv2 tags in mpc files, yes. As for how you can write such info, I’m afraid I don’t know.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: