Skip to main content

Notice

Please be aware that much of the software linked to or mentioned on this forum is niche and therefore infrequently downloaded. Lots of anti-virus scanners and so-called malware detectors like to flag infrequently downloaded software as bad until it is either downloaded enough times, or its developer actually bothers with getting each individual release allow listed by every single AV vendor. You can do many people a great favor when encountering such a "problem" example by submitting them to your AV vendor for examination. For almost everything on this forum, it is a false positive.
Topic: Syntax for Album Volume (Read 2144 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Syntax for Album Volume

Reply #25
Adil,
maybe I didn't understand what you were trying to achieve originally, and to be honest I'm still a little confused, but my logic was for the volume to display as -23 LUFS when the TrackGain info says +5dB, and maybe I assumed you were only interested in displaying the volume, so that's what the syntax with the value of 500 does. When TrackGain is +5dB the syntax displays -23 LUFS.

Of course fb2k can't know TrackGain should be relative to a non ReplayGain volume. TrackGain has baked in relativity to ReplayGain's target volume, so to adjust the volume to -23 LUFS you need to adjust to ReplayGain volume minus another 5dB. The TrackGain tags will be correct relative to ReplayGain's target volume, but if you adjust the volume to -23 LUFS , the TrackGain tags will be "incorrect" relative to that volume, so from there I assume you need syntax for displaying TrackGain after subtracting 5dB, reversing the polarity, and renaming it as LU.

I prefer to stick with the existing volume info as it's burned into my brain. -18LUFS  = TackGain 0.
To adjust to -23 LUFS you still have to start at ReplayGain volume and subtract another 5dB, but the syntax displays the volume  correctly.
After adjusting to -23dB I'd expect the TrackGain to be +5dB, so I can live with that. Having multiple fb2k columns specify different TrackGain and LU values referring to different target volumes.... I can feel an Aneurysm developing just thinking about it.

Was that the general idea or did I miss the object of the exercise completely and do you still need syntax for converting TrackGain to LUGain? I think I'll call it LUGain from now on. It'll at least give LU some context in these situations.

Re: Syntax for Album Volume

Reply #26
@yetanotherid

Thank you for your patience and dedication.

In fact, now I see the confusion I was making myself. I am trying to normalize the volume of a very large music library and I would like everything to reflect the most modern standards in this regard (LUFS/LU).

Studying various articles about it, now I realize that the first collaborations from you and @j7n , in fact, have already solved my needs. The problem is that I made some mistakes with all these terminologies and ended up creating confusion here, I apologize sincerely.

I am a fan of ReplayGain and its original specifications. The current rules from EBU R128 and the like, left me lost, but there is no other way: you have to get used to them because it is the language of the world today.

Resuming, I place below the syntaxes that perfectly provided my needs (all credits go to @yetanotherid and @j7n ):

LUFS:
Code: [Select]
$if(%replaygain_album_gain%,$puts(X,$sub(-1800,$replace(%replaygain_album_gain%,.,)))$ifequal($get(X),0,0,$ifgreater($get(X),0,$replace(+$substr($num($get(X),4),1,2),+0,+),$replace($substr($num($get(X),5),1,3),-0,-))).$substr($num($get(X),5),4,5) LUFS))
or
Code: [Select]
$if(%__replaygain_album_gain%,<$puts(temp,$num($sub($replace(%__replaygain_album_gain%,.,,+,),-21800),5))$ifgreater($get(temp),20000,<->,<+>$puts(temp,$num($replace($sub($get(temp),20000),-,),5)))$num($substr($get(temp),2,3),1)<.$substr($get(temp),4,4)< lufs)

LU:
Code: [Select]
$if(%replaygain_album_gain%,$puts(X,$sub(500,$replace(%replaygain_album_gain%,.,)))$ifequal($get(X),0,0,$ifgreater($get(X),0,$replace($substr($num($get(X),4),1,2),+0,+),$replace($substr($num($get(X),5),1,3),-0,-))).$substr($num($get(X),5),4,5)LU))
or
Code: [Select]
$if(%__replaygain_album_gain%,<$puts(temp,$num($sub($replace(%__replaygain_album_gain%,.,,+,),-19500),5))$ifgreater($get(temp),20000,<->,$puts(temp,$num($replace($sub($get(temp),20000),-,),5)))$num($substr($get(temp),2,3),1)<.$substr($get(temp),4,4)< lu)

Both styles give me the result I wanted, just in a (interesting) different way.

As far as Track Gain is concerned, I only replace %replaygain_album_gain% to % replaygain_track_gain%, and my boat does float perfectly, as you mentioned at the beginning.  ;)

Thank you, again, and please excuse me for any misfortune... I'm trying to adapt (even if it's a little late) to the new specifications...  :-[

Re: Syntax for Album Volume

Reply #27
Adil,
Don't apologise. ReplayGain's 89dB kept me confused for a while when I first started using it, which was a long time ago. I think subconsciously my brain was trying to give it a meaning it understood, and for a while I remember thinking 100dB must represent full-scale, which seems silly now.

I was lucky enough to stumble across MP3Gain before EBU 128 was a thing, and before I discovered fb2k, so I've been using ReplayGain ever since, and as much as I think ReplayGain was a clever idea, the way it refers to a target volume and how it's displayed (or rather how it isn't) could be updated. As far as I know fb2k doesn't display the volume as such (just the track/album gain) because the original ReplayGain spec says not to, but fortunately fb2k gives you the ability to customise that.

I meant to mention... you might be interested in playing around with this.
http://r128gain.sourceforge.net/
It's scanning is slow compared to fb2k, but it'll tell you the loudness range and write BWF tags, or ReplayGain compliant tags when it's in ReplayGain mode.

Cheers.

Re: Syntax for Album Volume

Reply #28
hey, thanks for that suggestion, I'm going to check this out!  ;)

Re: Syntax for Album Volume

Reply #29
Adil,
Here's another version of the syntax for displaying LU, relative to -23 LUFS. I barely understand my own syntax at the moment (I punished too many brain cells yesterday) so hopefully it's fine.

The reason for the change is because as it was, positive numbers were padded to 4 digits before proceeded them with a + sign. So you might end up with +00 (without the decimal). $replace then removes any +0's it finds and replaces them with +, changing +00 to +0.

To dump the + sign completely and keep the non-padded formatting, you can use the same syntax as before with $replace having two goes at it. The first to replace +0 with nothing, then a second one to remove the remaining plus signs. Although you could use any non-numerical character instead of +, because it'll be removed. I used "@" below to hopefully make the change easier to see.

Sorry, I didn't change track gain back to album gain, so you'll need to do that.

Code: [Select]
$if(%replaygain_track_gain%,$puts(X,$sub(500,$replace(%replaygain_track_gain%,.,)))$ifequal($get(X),0,0,$ifgreater($get(X),0,$replace(@$substr($num($get(X),4),1,2),@0,,@,),$replace($substr($num($get(X),5),1,3),-0,-))).$substr($num($get(X),5),4,5) LU)

Re: Syntax for Album Volume

Reply #30
@yetanotherid

Any and all improvements will always be welcome, thanks again! ;)


Re: Syntax for Album Volume

Reply #31
Adil,
maybe I didn't understand what you were trying to achieve originally, and to be honest I'm still a little confused, but my logic was for the volume to display as -23 LUFS when the TrackGain info says +5dB, and maybe I assumed you were only interested in displaying the volume, so that's what the syntax with the value of 500 does. When TrackGain is +5dB the syntax displays -23 LUFS.

Did I explain all that backward?  The "500" syntax wasn't for displaying volume. Sigh.... I shouldn't kill brain cells and post at the same time.

I should have said the 500 syntax displays zero when the volume is -23 LUFS.

And now my brain is catching up with the +/- issue, I assume if LU is relative to -23 LUFS then it won't always be the opposite of track/album gain. For volumes between -23 LUFS and -18 LUFS they'll both be positive due to the 5dB adjustment. That didn't sink in until I'd played with the syntax a bit. That's correct though, isn't it?

I hate being stupid. :)

Re: Syntax for Album Volume

Reply #32
I should have said the 500 syntax displays zero when the volume is -23 LUFS.
I have been concentrating with a lot of devotion to what you and @j7n  have posted here. Do not worry, despite some primary slips on my part, I have carefully assimilated the answers given to this topic.

Initially, I would just like to get a syntax that reproduces the same information contained in MP3Gain, as placed in the initial post. And it was given to me perfectly. However, in the course of the responses, I was interested in obtaining measurements in LUFS and LU, a need that was also met in an exemplary way. From then on, I made some confusions with myself and ended up posting here, but I think that everything is already very well clarified.

And now my brain is catching up with the +/- issue, I assume if LU is relative to -23 LUFS then it won't always be the opposite of track/album gain. For volumes between -23 LUFS and -18 LUFS they'll both be positive due to the 5dB adjustment. That didn't sink in until I'd played with the syntax a bit. That's correct though, isn't it?
Well, I think so... I am still familiarizing myself with these modern specifications. I was used to thinking only in dB, dBFS, etc., now I am adapting to LUFS, LU... What I can say at this moment is that according to what I have seen, in fact the values measured in LU are all with a sign contrary to TrackGain. The result given to them will always be the same as the added value of 84dB, when compared to ReplayGain. Eg 100dB (EBU R128) = 16LU. And that value coincides with the information provided by the Loudness Meter of my DAW.

That is, the values informed by these syntaxes in foobar2000, coincide with those informed by my DAW - and that was what I wanted most, as I use foobar2000 to test some music projects, in addition to organizing my library.

Re: Syntax for Album Volume

Reply #33
Adil,
I modified the TrackGain data in some MP3 tags to make it easy to check, and yes, if LU is relative to -23 LUFS, then between -23 and -18 LUFS they'll both be positive. Outside of that, one will be positive and the other negative.

Displaying LU even looks ugly compared to dB. :(

One other thing it might be handy to know one day....
For mono files, the R128 program I linked to and fb2k will disagree on the volume by 3dB. I assume R128 does it the "official" way, but at some stage fb2k was changed to account for the fact that most people listen to mono audio through two speakers rather than one. For anything else, I'm pretty sure the result will be the same.

Re: Syntax for Album Volume

Reply #34
Good to know, thanks! I'm still learning! ;)

 
SimplePortal 1.0.0 RC1 © 2008-2021