New ReplayGain 2.0 Plugin Released

So this plugin uses now EBU R128, right? That’s what I get from the wiki.

Not by default, but you can normalize to the EBU R 128 standard by changing the following plugin settings:

  • Enable “Use true peak”
  • Set “Target Loudness” to -23 LUFS
  • Set “Max Peak” to -1 dB
4 Likes

Is there a way to automatically run this when saving tagged music files?

Also does this automatically calculate bpm?

Currently the plugin does not provide the ability to run on save, although this could be added.

BPM calculation is something different and is not part of the ReplayGain plugin.

2 Likes

deleted previous comment because I figured it out

Most of the time the addon work but some albums don’t work. Album is https://musicbrainz.org/release/979327a1-030a-3ed5-9e19-5880a5d11be5. Here is the Error Message:

E: 19:03:55,547 /usr/lib/python3.11/site-packages/picard/util/thread.run:66: Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/picard/util/thread.py", line 63, in run
    result = self.func()
             ^^^^^^^^^^^
  File "/home/user/.config/MusicBrainz/Picard/plugins/replaygain2.zip/replaygain2/__init__.py", line 231, in calculate_replaygain
    raise Exception(f"ReplayGain 2.0: Unexpected output from rsgain: {lines}")
Exception: ReplayGain 2.0: Unexpected output from rsgain: ['Filename\tLoudness (LUFS)\tGain (dB)\tPeak\t Peak (dB)\tPeak Type\tClipping Adjustment?', '01 Ready Lets Go.flac\t-21.05\t3.05\t0.292328\t-10.68\tSample\tN', '02 Music Is Math.flac\t-12.66\t-5.34\t0.988525\t-0.10\tSample\tN', '03 Beware the Friendly Stranger.flac\t-26.29\t8.29\t0.324341\t-9.78\tSample\tN', '04 Gyroscope.flac\t-11.68\t-6.32\t0.982361\t-0.15\tSample\tN', '05 Dandelion.flac\t-22.79\t4.79\t0.311981\t-10.12\tSample\tN', '06 Sunshine Recorder.flac\t-12.41\t-5.59\t0.999054\t-0.01\tSample\tN', '07 In the Annexe.flac\t-21.41\t3.41\t0.356781\t-8.95\tSample\tN', '08 Julie and Candy.flac\t-11.10\t-6.90\t0.975098\t-0.22\tSample\tN', '09 The Smallest Weird Number.flac\t-18.81\t0.81\t0.456482\t-6.81\tSample\tN', '10 1969.flac\t-11.10\t-6.90\t0.988525\t-0.10\tSample\tN', '11 Energy Warning.flac\t-19.33\t1.33\t0.630249\t-4.01\tSample\tN', '12 The Beach at Redpoint.flac\t-12.31\t-5.69\t0.998932\t-0.01\tSample\tN', '13 Opening the Mouth.flac\t-21.56\t3.56\t0.420502\t-7.52\tSample\tN', '14 Alpha and Omega.flac\t-11.64\t-6.36\t0.981201\t-0.16\tSample\tN', '15 I Saw Drones.flac\t-22.19\t4.19\t0.449127\t-6.95\tSample\tN', '16 The Devil Is in the Details.flac\t-15.00\t-3.00\t0.968567\t-0.28\tSample\tN', '17 A Is to B as B Is to C.flac\t-20.90\t2.90\t0.591492\t-4.56\tSample\tN', '18 Over the Horizon Radar.flac\t-18.38\t0.38\t0.533051\t-5.46\tSample\tN', '19 Dawn Chorus.flac\t-10.09\t-7.91\t0.865265\t-1.26\tSample\tN', '20 Diving Station.flac\t-21.73\t2.22\t0.774658\t-2.22\tSample\tY', '21 You Could Feel the Sky.flac\t-13.38\t-4.62\t0.989502\t-0.09\tSample\tN', '22 Corsair.flac\t-17.23\t-0.77\t0.617126\t-4.19\tSample\tN', 'Album\t-12.61\t-5.39\t0.999054\t-0.01\tSample\tN']

I’m using Picard version 2.8.5. My python version is: Python 3.11.3. Plugin Options are only “Calculate album gain/peak” “LUFS -18” “Clipping Protection: Enabled for positive gain values only” “Max Peak: 0” “Write standard ReplayGain tags”. rsgain is latest version from git.

i try also

it’s same error.

@floridaklaus Can you confirm that the 23rd track of that album is completely silent?

indeed it’s silent. not ripping fault. youtube say its normal. Boards of Canada - Magic Window (silence) - YouTube

i check all files but all of them don’t got replay gain info cause of the error of the silent track.

Thanks for confirming.

The error occurs because the rsgain backend doesn’t write tags to silent tracks. This was an intentional design choice I made in development that may have been a mistake in hindsight. The plugin sends 23 tracks for input, but only receives 22 in the output, then raises an error due to the mismatch.

I’ll figure out a solution for this issue in the near future. For a workaround in the meantime, you can just select tracks 1-22 using a Shift + click operation, then scan those selected tracks. That will exclude the silent track and prevent the error from occuring.

4 Likes

thanks for the workaround.
as you name it for just one album it works and there are not many
out there where silent tracks are a problem, i guess.

is the replaygain result even different to just ignore the silence track at all (album replay gain)?

Sorry to disturb again with more bad news @complexlogic . Now i have a crash when i scan album which contain “%” in album name. That is just a guess because with both albums the error appears.
As far a i know none of the two albums contain silent tracks. this seems total different error because it leads to a crash. So i’m unable to scan the albums at all.

Error message which lead to exit picard:
I start picard with args --debug and the only message i got:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/picard/ui/itemviews.py", line 113, in __callback
    self.callback(objs)
  File "/home/user/.config/MusicBrainz/Picard/plugins/replaygain2.zip/replaygain2/__init__.py", line 310, in callback
  File "/usr/lib/python3.11/site-packages/picard/ui/mainwindow.py", line 462, in set_statusbar_message
    echo(message % mparms)
         ~~~~~~~~^~~~~~~~
TypeError: not enough arguments for format string
Aborted

EDIT: just for info i create two bug reports guess this is better place i should have use it in first place,sorry.

Dear @complexlogic,

I’m trying to get ReplayGain working with my collection which I have playing in Foobar2000. Most of my collection is in Opus, so I believe I have to use R128 gain, yes? Foobar was not recognizing the standard ReplayGain tags, and Foobar’s own ReplayGain scanner was writing R128. My problem is that using the plugin in Picard with R128 provides different values than if I had scanned it in Foobar2000.

For example, scanning Debut by Bjork in Picard with normal ReplayGain gave an album gain of -1.81 and peak of 0.97, and the first track, Human Behavior a track gain of -2.33 and peak of 0.83. Scanning in Foobar2000 with R128 gave nearly the exact same results. However, when I switch to R128 in Picard, I now get an album gain of +3.19, no peak value, and for the track +2.66 gain with no peak value.

I was hoping you could clarify this difference? If it’s something to be concerned about? Should I be using the ReplayGain from this plugin or from Foobar?

Thanks

E: I see, I needed to change the plugin settings as described in the reply a bit higher. Leaving this anyway in case someone 5 years from now has the same question.

2 Likes

Im getting " Failed to calculate replaygain for “ALBUMNAME” ".
Here are the logs:

D: 12:02:31,898 /usr/local/lib/python3.6/dist-packages/picard/ui/mainwindow.set_statusbar_message:462: Failed to calculate ReplayGain for "???".
D: 12:05:32,324 /usr/local/lib/python3.6/dist-packages/picard/ui/mainwindow.set_statusbar_message:462: Calculating ReplayGain for "???"...
E: 12:05:32,324 /usr/local/lib/python3.6/dist-packages/picard/util/thread.run:66: Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/picard/util/thread.py", line 63, in run
    result = self.func()
  File "/config/xdg/config/MusicBrainz/Picard/plugins/replaygain2.zip/replaygain2/__init__.py", line 216, in calculate_replaygain
    text=True
TypeError: __init__() got an unexpected keyword argument 'text'

D: 12:05:32,339 /usr/local/lib/python3.6/dist-packages/picard/ui/mainwindow.set_statusbar_message:462: Failed to calculate ReplayGain for "???".

Here are my settings:

Have i downloaded the wrong version for my platform?
I downloaded rsgain_3.3_amd64.deb from the github.

Im using Picard in docker on unraid using Docker.

@crayonbro Please update the plugin to the latest version 1.3 in Options > Plugins. That issue should be fixed there.

1 Like

weird. mine is already up to date

@puppeht Glad you were able to figure it out.

For those users migrating from foobar2000: the ReplayGain 2.0 plugin can serve as a drop-in replacement for foobar2000’s ReplayGain scanner, because both programs utilize the same open source software library (libebur128) to measure audio loudness, and therefore obtain identical results, with only a few corner cases.

One of those cases pertains to Opus files. If you would like the ReplayGain 2.0 plugin to behave exactly like foobar2000 for Opus files, change the following plugin settings:

  • Under “Opus Files”, change the combo box to “Write R128_*_GAIN tags”
  • Check the box that says "Always reference Opus R128_*_GAIN tags to -23 LUFS
2 Likes

@crayonbro A couple questions for you:

  1. Is this error happening for every album, or only specific ones?
  2. Are you a new user to this plugin? Or are you an existing user and this error started occurring recently?

@floridaklaus Both of those issues have now been fixed. Rebuild rsgain from git for the silent tracks fix, and upgrade the plugin to 1.3 for the album title fix.

2 Likes

this happens on every album i test it on. i must have tested over 10 different by now. this is my first time using the plugin.

@outsidecontext, are there plans to add running this plugin on save since this question was posed in Dec of last year? Since I manually run this plugin with each album, I find that sometime I miss running it before saving. Do I need to add an enhancement request somewhere?