Bug 72558 - normalize volume level of different songs in juk
Summary: normalize volume level of different songs in juk
Status: CONFIRMED
Alias: None
Product: juk
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Scott Wheeler
URL:
Keywords:
: 78444 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-01-13 18:36 UTC by Marco Krohn
Modified: 2015-05-01 14:23 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Krohn 2004-01-13 18:36:04 UTC
Version:           1.96 (2.0 Beta 2) (using KDE 3.1.94 (CVS >= 20031206), compiled sources)
Compiler:          gcc version 3.3.2 (Debian)
OS:          Linux (i686) release 2.4.23-1-k7

Since mp3/ogg files often come from different sources they are usually not recorded at the same volume level. This means that I have to adjust the volume often by hand which a bit unpleasent. An option that would allow playing songs at the same volume level would be very handy.

It seems there are already tools out there to achieve that, e.g., normalize http://www1.cs.columbia.edu/~cvaill/normalize/ though it supports afaik mp3 only. Nevertheless that would be very helpful.

Perhaps the result could be stored in id3 RVAD tag?!
Comment 1 jsvrp.gw 2004-02-20 18:16:26 UTC
I want this also. I installed Juk in a bar this week and normalizing volumes is one of the top priorities. So please add.

BTW this can proberly also be a Arts issue.
Comment 2 Teemu Rytilahti 2004-02-22 21:28:18 UTC
Yes, I'd like to see this too, but I think Scott or someone else who can code well should implement plugin support for JuK.. It'd be nice to users who doesn't want to have all those "useless" features and if something is missing you could do it yourself. My 10 votes for this anyway :)
Comment 3 Scott Wheeler 2004-05-15 17:13:05 UTC
Sorry guys, but you shouldn't be confirming wishlist items for stuff that you don't work on.
Comment 4 Sérgio Gomes 2004-06-19 01:42:19 UTC
If you're thinking of adding normalizing support you should look at ReplayGain. It just requires an "analyse" phase, and then the small produced data can be saved in ID3V2 tags or such.

The (seriously outdated) site is at http://www.replaygain.org/ and has the full "proposed standard" there.

I think it's worth a look, since it's already done and is already used in some software, including commercial apps, some Winamp plugins, and open-source software as well, XMMS for instance (in its vorbis plugin).
Comment 5 Sérgio Gomes 2004-06-19 15:00:13 UTC
I did a little research today and found out that the Lame and FLAC encoders support Replay Gain while encoding. It would be a good idea to see where and how they store the data. Maybe the code can even be reused (I'm not sure about the legal aspects though, Lame is LGPL and FLAC is BSD).

As FLAC uses Vorbis tags, it should store the data in the same fashion as a Vorbis tool, but I'd check the XMMS vorbis plugin anyway.

This really seems to be the closest thing to a standard in normalizing audio...
Comment 6 Martijn Pieters 2004-07-07 01:18:15 UTC
The following ReplayGain metadata is stored for FLAC and Ogg Vorbis audio formats (from the vorbisgain man page):

              REPLAYGAIN_TRACK_GAIN=-7.03 dB
              REPLAYGAIN_TRACK_PEAK=1.21822226
              REPLAYGAIN_ALBUM_GAIN=-6.37 dB
              REPLAYGAIN_ALBUM_PEAK=1.21822226

I verified that the same metadata ids are used in the Flac format.

Lame uses the MP3 info tag to store Replay Gain info, as described here:

  http://gabriel.mp3-tech.org/mp3infotag.html#replaygain

The author of the vorbisgain tool (previously called replaygain) implemented the ReplayGain support for the XMMS Vorbis plugin; he describes the required algorithm in his initial announcement. Both the XMMS plugin and vorbisgain code are licensed under the LGPL, but the description allows for a clean-room implementation if one so desires:

  http://www.xiph.org/archives/vorbis-dev/200201/0150.html

I am pretty sure Juk should support ReplayGain directly (by adjusting the volume based on the ReplayGain values) and not the decoders (the aRts media format plugins). As ReplayGain commonly is something that is:

  a) switched on/off explicitly

  b) commonly implemented in the player code, not the decoding code

  c) offers a explicit choice between album gain and track gain

this probably belongs in Juk.

At this moment, there is no ReplayGain support in any of the aRts supported formats that also include gain information in the file format.

Here is an overview of current ReplayGain support in the aRts plugins, and available ReplayGain implementations:

 - Ogg support:

     http://lxr.kde.org/source/kdemultimedia/mpeglib/lib/decoder/vorbisPlugin.cpp

   This is licensed under the GPL so it could reuse the XMMS implementation;
   implentation is at:

     http://cvs.xmms.org/index.cgi/xmms/Input/vorbis/vorbis.c?rev=HEAD

 - MP3 support:

     http://lxr.kde.org/source//kdemultimedia/mpeglib/lib/decoder/splayPlugin.cpp

   Licensed under the GPL. The MAD project does have ReplayGain support in
   their madplay package, and this is also under the GPL. It is the player
   that decodes the RealPlay information and adjusts the mp3 decoder/audio 
   output accordingly. Mostly in player.c (in madplay), downloadable from:

     ftp://ftp.mars.org/pub/mpeg/

 - FLAC support:

   Done via xine, so flac decoding is done at:

    http://cvs.xmms.org/index.cgi/xmms/Input/vorbis/vorbis.c?rev=HEAD

   Licensed under the GPL. So is he flac project, which includes a XMMS plugin 
   that supports ReplayGain:

    http://cvs.xmms.org/index.cgi/xmms/Input/vorbis/vorbis.c?rev=HEAD
   
   and a encoder/decoder/player tool that also supports ReplayGain:

    http://cvs.sourceforge.net/viewcvs.py/flac/flac/src/flac/decode.c?rev=HEAD

   Both cases its again the player code that adjusts the gain based on
   preferences and file info.
Comment 7 Martijn Pieters 2004-07-07 01:19:57 UTC
Oh, and Flac is (now?) licensed under the GPL.
Comment 8 Nathan Toone 2004-08-21 02:13:19 UTC
There's also the standard normalize libs you can find at http://www.cs.columbia.edu/~cvaill/normalize  This is a fairly standard linux package (most distros include it) and it shouldn't be too hard to be able to pipe through it.  (Or something...I haven't looked at it, so I don't know exactly what it does...I just know that K3B uses this package.)
Comment 9 Ismail Donmez 2005-01-10 12:21:40 UTC
*** Bug 78444 has been marked as a duplicate of this bug. ***
Comment 10 Stefan Briesenick 2005-02-05 13:31:55 UTC
Using 'normalize' is a bad Idea, since it needs 2 passes.

ReplayGain is the only thing, we should use. There's ReplayGain-Support in almost every relevant Audio-Format nowadays. So we need some kind of libreplaygain, which could be fed with the volumelevel and/or gainlevel. Basically, you take the pcm-samples, convert them to float32 (if not already done so), and apply the wanted level.

The player interface could have a small icon which tells you, if the current song has replay-infos or not, so you can fix it. Perhaps the player could offer a function to run 'mp3gain', 'vorbisgain', 'metaflac --add-replay-gain', etc. on selected files.
Comment 11 Eugene Miller 2005-10-04 03:51:06 UTC
This is an off the cuff didn't read everything reply.

I don't know if juk can run with esd or not - I don't use it - 

There is however a program called AudioCompress that normalizes esd quite well, and it will normalize for *all sounds* not just what's playing in juk.

This is how I start it.

~/.kde/Autostart/start_esd
---------------------------
#!/bin/sh
nohup esd&>/dev/null&
sleep 1
nohup AudioCompress -g 255 -e localhost&>/dev/null&

Comment 12 Luke Tucker 2005-10-17 14:38:05 UTC
Just adding my vote. It would be good it juk could store the volume levels it calculates as part of the playlist db. That way, each file would not need to be parsed beofre playing each time.