Replaygain support

I've been playing with MOC for a few days, and it's Fantastic! Thank you!
One thing, though. Is/Will there be Replaygain support in MOC? I know many of the en/decode libraries already support it (Vorbis, FLAC, musepack), and even if they do not (libmad), it's just matter of reading Replaygain info from the tag and scaling the output volume accordingly. More info on Replaygain are here:

Thanks for such a great program, and Happy Holidays!


Personally I don't use it, but I know it's useful. There are no plans to add it in the next release, but I'm sure we will see replay gain in the future.

Damian Pietras - MOC developer

Indeed, it lacks the support of replay--vorbisgain that MOC is the ultimate audio player (like audacious in GTKui)

just ran into Gnome-mplayer. It uses Mplayer as the back end, so it has replay gain. It's a pretty good app, but I still prefer mocp. Gnome-mplayer uses mplayer, Amarok uses xine... Can't mocp use mplayer as an optional backend?

I've been craving that feature because the volume on my notebook is pretty quiet. Mplayer and VLC can increase gain, but I hate their interfaces/commands. I like mocp.

Replay gain is great. I consider it pretty much essential. I love moc, but I have a lot of music with wildly varying levels.

It's really irritating when you're listening to some music, and then suddenly there's a song that's just blaring loud.

It should be fairly trivial to implement since there's already software volume control. All you would have to do is look at the tags and turn down the volume accordingly.

A player with no db tie and no relation to gst/xine and X would be refreshing. Gapless playback and replay-gain support is a must though, IMHstO.
So far moc and cmus look promising, neither supports RG though.
What a bummer and a showstopper (for me, naturally).
I see RG support is in TODO list, but listed in (prolly not so near) future section.
Hope you guys could reconsider ;)

With slight hope and best regards

mocp is already my player of choice, but replay-gain would be a wonderful addition to the already slick program.

after years of playing around with broadcasting dsp (compressors, limiters, etc) i replay-gain tag EVERYTHING. it preserves track dynamics, album dynamics (if the tags and player support), and maintains a comfortable listening volume. for my ends track-gain data is all that's needed, i tend not to use album-gain data at all.

replay-gain is important enough for me to put a bounty out, but i've never done it before. any tips/suggestions on that process?

the only other feature mocp is missing is a big D command for deleting a file off the file-system, then i would stop thinking back fondly to my days with amarok and foobar ;) ... EDIT: oops, i've read: "ExecCommand config option, look at the example configuration file." ... will check that out!

"it's just matter of reading Replaygain info from the tag and scaling the output volume accordingly"

I don't believe this is true. That is what normalize-audio does, and if you run it on any quality recording, you get noticeable distortion. I think proper replaygain support must take different frequencies into account.

nobrowser (Ian)

No, 'different frequencies' are taken into account when scanning the files and writing the replay gain tags. At playback time only the level needs to be scaled according to the tag. There still might be a need to prevent clipping.

If bounty means a bunch of people put money together to encourage programmers to write something, I'd participate to get ReplayGain support in moc.

Comment moved below the thread.

Hello patient people.

Please try this patch (tested with moc-2.5.0-alpha4). [Ed: Dead link]

If you have an audio file with ReplayGain which isn't working, send it to

Cool, thanks for the replaygain patch!

Is there a reason why you don't read the replaygain_album_peak tag in get_comment_tags in vorbis.c?

Hi. I use Lubuntu (LXDE desktop) and have only been using Linux for 3 months.

Should I copy and paste the patch to the MOC "softmixer" file?

Thanks in advance. I hope this solves the clipping issue. I hear clipping in some mp3s and wav files. I'm not sure why it affects wav files. If I play them using VLC it sounds fine but overall MOC sounds clearer when it doesn't clip.



I am using moc for some time now and its lack of handling repalygain is the only thing bothering me.
I was very happy to learn that some work had been been done towards closing this gap.
However, the above link does not work anymore and I was not able to find anything else online but this thread.
Where can I get the patch?
Is there still work in progress?
Are there plans to inlcude replaygain (based on that patch or not) in moc?
Is there any way I could help to make this happen?


...the above link does not work anymore...

I do still have a copy of it. I'll mark the link as dead.

Where can I get the patch?

I had hoped that we would have had a Contributions Coordinator by now who would maintain contributions on the MOC website until such time as they were integrated into the code base. But that now looks unlikely.

Is there still work in progress?

Yes, definitely... but progress is slow. MOC is currently stalled awaiting the resolution of the few bugs blocking the release of 2.5. Unfortunately, MOC is not getting its fair share of my time at present (in part due to having just experienced the most glorious summer in 70 years, but with tomorrow being the official start of autumn the great outdoors may start looking less inviting). The remaining bugs are not strightforward and at least one represents a design flaw in the underlying library and so there is no clear way to proceed.

Are there plans to include replaygain ... in MOC?

ReplayGain is one of my personal favourites too, so it will definitely make it into MOC. ReplayGain itself is easy to do but I want to do it in a more flexible way than the contributed patch allows for, and the infrastructure to support that is not yet there. Ideally, I'd like to have the patch supported by the Contributions Coordinator as previously described. The other alternatives are to introduce it as is in MOC 2.6 (which will collect a number of contributions in its alpha2 release) or wait until MOC 2.7 by which time the required infrastructure will be in place.

The trade off with introducing contributed features early or not is whether MOC users should be subjected to a (often significant) change in the way the feature operates when it later becomes more seamlessly integrated or not. The ideal would be maintaining it as a patch on the website until proper intergration takes place, but... well, I've already explained that.

Is there any way I could help to make this happen?

Maybe. It depends on what your capabilities are and whether you're asking about ReplayGain specificly or MOC development more generally. Send mocmaint a more detailed description of what you're able and willing to do.

It all boils down to available time.

Hi guys!

I'd love to use moc as my only music player, because I don't like being forced to use databases (cmus), especially if they are implemented poorly (yes cmus!). Mpd is nice, but just too fat for me and it is also based on a database.

So, really the only thing missing is this replay gain functionality. So I'm asking here if at least one of you still has this patch, maybe even updated to the latest development release / svn snapshot.

I'm no coder, so I cannot write this patch by myself.

Thanks already!

I have been keeping this patch up to date with respect to the SVN HEAD. I have just applied it and MOC builds cleanly, but I cannot offer any assurances that it actually works.

If you are able to build MOC from SVN then I can e-mail it to you. (No need to post your e-mail address here.)

Yes I'd love to have this patch. But why don't you upload it to another paste service, so everyone can benefit?

edit: Sorry I should have hit "reply", I cannot undo it now. Won't happen again ;)

But why don't you upload it to another paste service, so everyone can benefit?

The proper place for these patches is on the MOC web site, and I'm reluctant to use an ad hoc approach like cyberlockers. Ideally, we'd have a collection of patches available for anyone who wishes to make use of them. They would include user contributions, development code which has not yet been committed and more experimental features.

But it has to be properly managed, kept up-to-date and documented, and I don't have the time to do that and keep working on MOC development. I have asked for volunteers to take that task on but no one's interested. None of us can do everything we would like to do.

That's a good point and yes, the patches section here is better than a pastebin.
Thanks for the mail, very appreciated!

Could I have a copy of the replaygain patch please?

A copy of the patch has been e-mailed to you.