ReplayGain

Share your Audacity/Nyquist plug-ins here, or test drive the latest plug-ins submitted by Audacity users.

After testing a plug-in from this forum, please post feedback for the plug-in author.
Post Reply
steve
Site Admin
Posts: 81314
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

ReplayGain

Post by steve » Fri Jan 13, 2012 10:31 pm

This plug-in is an implementation of ReplayGain that calculates the Track Gain of the selected audio track.

Note: This plug-in does not change the audio in any way and does not write metadata. It just calculates the Track Gain level for the selected audio and displays it. [UPDATE: The new version includes a "Normalize" option that does change the audio]

The gain level indicated by this plug-in may be slightly different to other implementations of ReplayGain due to minor differences between the Loudness Filter used in this plug-in and that specified in the ReplayGain 1.0 specification. However it should be sufficiently accurate to be useful.

How to install:
Installation is the same as for any other Nyquist plug-in.
Place the ReplayGain.ny file in the Plug-Ins folder inside the Audacity installation folder. On Windows computers, this is usually under "Program Files". On Mac OS X, it is usually under "Applications". On Linux it is often easiest to create a plug-ins folder ~/.audacity-files/plug-ins/
Restart Audacity, then the ReplayGain Plug-ins will appear underneath the divider in the "Analyze" menu.

Purpose of this plug-in:
When making compilation CDs is is often beneficial to adjust the volume level of individual tracks so that each track will play at a similar volume on the CD. The ReplayGain level that is calculated by this plug-in can act as a guide to how much amplification needs to be applied to each track so that they will have (approximately) equal loudness.

How to use:
  1. Import all of the tracks for the compilation into Audacity.
  2. Select the first track and apply the ReplayGain effect.
  3. Open the Amplify effect and enter the ReplayGain amount in the "Amplification (dB)" control, then apply to the selected track.
  4. Repeat steps 2 and 3 to each track.
  5. Review each track to ensure that the relative loudness is roughly equal for each track and adjust if necessary.
  6. Select all of the tracks (Ctrl+A) and apply the Amplification effect with the default settings.
Limitations of this plug-in:
The way that human hearing detects loudness is subjective, extremely complex and context sensitive, so as with all current algorithms for equal volume playback, ReplayGain can only offer a reasonable guess as to the required gain to achieve equal loudness. Because of this limitation it is advisable to listen to the tracks before exporting the files and committing to CD.

The track sample rate must be at least 44100. This is the minimum sample rate to support the full audio frequency range.

Not all tracks are supposed to be the same loudness. If your compilation includes a Thrash Metal track followed by a gentle lullaby, the second track should probably be quieter than the first. The plug-in is unaware of the emotive connotation of the music, so this decision must be made manually and appropriate action taken.

ReplayGain should be reasonably accurate at achieving equal loudness within a specific genre of music, but is less accurate when comparing music of different genres.

License:
Released under terms of the GNU General Public License version 2:
http://www.gnu.org/licenses/old-licenses/gpl-2.0.html .


Request from the author:
Please give feedback!
If you find this plug-in useful, please let me know.
If you have questions about how to use it, please ask.
If you have suggestions for improvements, please make them here.
Any other comments, please post.

Analyze plug-in (OLD VERSION):
ReplayGain.ny
(2.41 KiB) Downloaded 4663 times
UPDATE:
NEW VERSION This includes "Equal Loudness Normalizing" and will show up in the Effect menu as "ReplayGain".

waxcylinder
Forum Staff
Posts: 14668
Joined: Tue Jul 31, 2007 11:03 am
Operating System: Windows 10

Re: ReplayGain

Post by waxcylinder » Sat Jan 14, 2012 3:06 pm

Hi Steve,

does this interesting new plug-in address (at least part of) Koz' feature request on "Normalize a multi-channel show"
- see Here: http://forum.audacityteam.org/viewtopic ... 20&t=62465

or am I missing the point??

Peter
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * FAQ * * * * * Tutorials * * * * * Audacity Manual * * * * *

steve
Site Admin
Posts: 81314
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: ReplayGain

Post by steve » Sat Jan 14, 2012 4:19 pm

waxcylinder wrote:Hi Steve,

does this interesting new plug-in address (at least part of) Koz' feature request on "Normalize a multi-channel show"
- see Here: http://forum.audacityteam.org/viewtopic ... 20&t=62465

or am I missing the point??

Peter
No it addresses a different issue.

As you are aware, even within a specific genre of music, some records (vinyl) can be much louder/quieter than others. When you throw in recordings from other sources (cassette recordings, MP3 downloads etc.) the variation in track loudness can be very significant. Normalizing the tracks so that they have the same peak level will frequently fail to make the tracks sound the same loudness because peak level is a poor indicator of loudness.

The problem is particularly evident when making compilation CDs ("My Favourite Rock n Roll Songs", or "Background Music for the Wedding Reception", or whatever).
If the tracks are just burned to CD without any editing there is a good chance that you'll be diving for the volume control every couple of tracks. Even if all of the tracks are Normalised the same problem is quite likely (it only takes one loud peak to throw the overall loudness way out). In particular, modern recordings tend to be a lot louder than old recordings (thanks to the Loudness War)

RMS level is generally a better guide to the loudness of a track than peak level, so in terms of achieving the same loudness in tracks, Normalizing to the same RMS level is a better than the standard peak level Normalizing.

Although RMS normalizing is an improvement, it is still not a particularly good indicator of loudness, so ReplayGain was invented as a better indicator.

The way that ReplayGain is most commonly used is by scanning each track and embedding the ReplayGain value in the track metadata. Players that support ReplayGain can then adjust the playback volume automatically so, in effect, the player does the "dive for the volume control" to save you from needing to do it. Many software MP3 players and some hardware players support ReplayGain, but audio CDs don't have metadata. When making an audio CD the track volume needs to be adjusted before burning the tracks.

The best way to adjust the track level is to listen carefully to the tracks and adjust the levels manually before Export Multiple. However, many people want some sort of automatic way to determine the level. That's where this plug-in comes in....

This plug-in calculates a "track gain" level to achieve a standard loudness level.
Once the track gain level has been calculated, the Amplify effect can be used to apply the gain.

By running this plug-in on each track in turn and applying the calculated amount of amplification to each track, the tracks should all then have similar loudness.

In most cases, the calculated level will produce a peak level substantially below 0 dB. With a few exceptional tracks the peak level may be above 0 dB.
Once all tracks for the compilation have been adjusted so that they are all the same loudness (relative to the other tracks in the compilation), the overall level may be adjusted up or down, provided that all tracks are adjusted by the same number of dB. The easy way to do this is to select all tracks at once and apply the Amplify effect with the default settings (step 6 in my previous post). This will bring the level of all tracks up (or down) by the same amount, so they will still have the same relative loudness. The default settings in the Amplify effect will bring the highest peak in the compilation to 0dB.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 81314
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: ReplayGain

Post by steve » Sat Jan 14, 2012 4:24 pm

As a side note, the reason that the plug-in only analyses the tracks and does not actually normalize the track is because normalizing with Nyquist plug-ins can consume all available RAM if long tracks are selected. Analyzing (without normalizing) is done in this plug-in without loading all of the selection into RAM at the same time, so although processing very long tracks may be quite slow it should be memory safe.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

waxcylinder
Forum Staff
Posts: 14668
Joined: Tue Jul 31, 2007 11:03 am
Operating System: Windows 10

Re: ReplayGain

Post by waxcylinder » Sun Jan 15, 2012 6:44 pm

OIC - thanks for the explanation Steve, most illuminating

Peter
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * FAQ * * * * * Tutorials * * * * * Audacity Manual * * * * *

steve
Site Admin
Posts: 81314
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: ReplayGain

Post by steve » Sun Jan 15, 2012 7:59 pm

waxcylinder wrote:OIC - thanks for the explanation Steve, most illuminating

Peter
Next time you are making a compilation CD, give it a go and see if it works ;)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 81314
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: ReplayGain

Post by steve » Tue Jan 17, 2012 11:47 pm

Today I needed to make a compilation CD which gave me the opportunity to try this plug-in out "for real".

Considering that my tracks were all under 4 minutes and the computer had plenty of RAM, I found it a bit irritating that the plug-in only analysed , requiring me to manually apply the necessary gain with Audacity's Amplify effect. I therefore changed the plug-in into a "process" type plug-in and added the ability to actually apply the calculated gain. In other words, this effect is now an "Equal Loudness Normalize" effect.

"Process" type Nyquist plug-ins appear in the Audacity "Effect" menu (below the divider line).

The other advantage of it being a process type plug-in is that the effect can be repeated using Ctr+R (command+R on Mac). This is much more convenient when processing multiple tracks, particularly as this effect must only be applied to one track at a time.

The reason that it must only be applied to one track at a time is that Nyquist can not tell the difference between "silence" and "white space" (empty track).

The ReplayGain algorithm tends to set the volume quite low, particularly on tracks that have a lot of dynamic compression. I have therefore added a slider that allows manual adjustment of the Normalized output level. Obviously, when making a compilation it is essential to have this manual adjustment set to the same value for all tracks, otherwise there is no point using the effect.

Overall I was quite pleased with the result. The processed tracks were all quite close to the same loudness.
In the worst case, one track differed from the value calculated by foobar2000 v.1.1.5 (the last version of foobar2000 to use the ReplayGain specification) by 1.6 dB, but considering that test have shown that ReplayGain can be out by 6 dB or more, I think the results are quite reasonable.

If anyone wants to try and tweak this plug-in to get results that are closer to the ReplayGain specification, I think the part that needs tweaking is the equal loudness filter.
Here is the current code for the filter:

Code: Select all

;;; equal loudness curve
(defun eqloud (s-in)
  (lowpass2
    (highpass2
      (eq-band
        (eq-band
          (eq-band
            (eq-lowshelf 
              (highpass2 
                (lowpass2 s-in 4000 0.9) 
              140 0.5)
            2200 -6 2)
          1400 -4 1)
        10000 -10 1)
      12000 14 0.7)
    20)
  16000))
And the new version of the plug-in:
ReplayGain.ny
(2.89 KiB) Downloaded 13515 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Whistler
Posts: 8
Joined: Tue Nov 16, 2010 6:56 am
Operating System: Please select

Re: ReplayGain

Post by Whistler » Wed Feb 08, 2012 9:47 pm

Steve, you’re a star! This is exactly what I was looking for in Audacity and it works brilliantly. I admit, I don’t know how you do it. Since the effect is applied to individual tracks, how does it calculate levels for the respective tracks which make all tracks sound equally loud? Well, how ever you do it, it works. I tested it on several Rory Gallagher tracks from vinyl, original CD and remastered CD which differed considerably. The result is perfect equal loudness. I’m delighted!
There is one slight improvement I would like to suggest. I understand the “adjust” slider to be an “adjust by”, rather than an “adjust to” option. However it’s difficult to tell how many dB to adjust by, if you don’t know the dB Full Scale level which the adjustment will result in. DBfs is after all what we digital sound editors have to go by.
My suggestion is to change it into an “adjust to dBSF” slider. I think it’s more straight forward to enter a target level, than having to work out the amount to adjust by to get to that level. What do you think?

Thanks again for this wonderful effect.
Robbie

steve
Site Admin
Posts: 81314
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: ReplayGain

Post by steve » Thu Feb 09, 2012 12:02 am

Whistler wrote: I think it’s more straight forward to enter a target level, than having to work out the amount to adjust by to get to that level. What do you think?
That would be nice, but the plug-in does not know what the dBFS level will be. The plug-in is attempting to work out how "loud" the track is, but some tracks will need to have a different dBFS level than others if they are to "sound the same loudness". So what the plug-in does is to work out how much to amplify the track so that it sounds a as loud as a "standard" sound. The "standard" sound is defined by the ReplayGain specification here: http://wiki.hydrogenaudio.org/index.php ... ence_level
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Whistler
Posts: 8
Joined: Tue Nov 16, 2010 6:56 am
Operating System: Please select

Re: ReplayGain

Post by Whistler » Thu Feb 09, 2012 9:49 am

Hi Steve!
Thanks for the link. I read up on it and have come up with another idea.
Apparently ReplayGain uses a reference level of -14 dBSF of pink noise. Would it be possible to have a slider to adjust the reference level? The reason I’m so interested in such an option is that it would simplify the process of achieving a certain target level. If for instance I’m producing a radio show for a station broadcasting at -6 dBSF, that value could be entered as a reference level. Is that doable?
Sorry for asking for more and more adjustments. In fact I’m really glad of this plug-in.

Robbie

Post Reply