HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: darkflame23 on 2018-09-14 09:55:45

Title: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: darkflame23 on 2018-09-14 09:55:45
When I scan files with ReplayGain for their Track Gain (including True Peak levels with 4 times oversampling, as set in in Preferences - Tools - ReplayGain Scanner), I get the results you can see at the bottom of the pic. The Track Peak column on the far right gives both a value between 0 and 1, as well as the actual True Peak level in dBTP in brackets to the right. I update the file tags, no problem so far.

In the Playlist, I have a custom column labelled TP, which I want to display the True Peak levels in dB. This is the string I am currently using to do so:

%replaygain_track_peak%

However, the value it returns is the value between 0 and 1, as you can see from the picture. It's the same value as the first number in the Track Peak column of the scan results.

So, to cut a long story short, how do I get FB to display the second TP number in dBTP instead? What string would I need to use?

Thanks in advance for any help!
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: j7n on 2018-09-14 20:34:17
Good request. The floating point values are hard to interpret outside of few memorized values like 0.50, 0.707. I'd also like a display in decibels for the difference level in foo_bitcompare. I don't think the conversion is doable with a title formatting string as that would involve a power function.
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: darkflame23 on 2018-09-14 20:42:04
Thanks!

Yeah, I asked this recently in an unrelated thread, and didn't get any replies, so thought it deserved its own one.

My programming chops are non-existent, TBH even the simple strings scare me... ;) But my reasoning is, I mean the value is actually there, right now, within FB2k itself, and so it should just be a matter of being able to copy it over into the playlist field, right?

I'm a mastering engineer, and when I've mastered all of the tracks individually, it's fantastic to be able to load them all into FB2K for the final album listen through/QC, with the LUFS integrated and TP levels right there in front of me (after RPGain scanning, of course).

The programmability of FB is one of its best points, but not being a programmer sometimes means I require help from the (fantastic) community in order to get it to do exactly what I want it to do. :)
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: Rollin on 2018-09-14 21:10:26
I don't think the conversion is doable with a title formatting string as that would involve a power function.
Maybe it is doable with JScript panel?
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: yetanotherid on 2018-09-17 19:31:26
I remember when almost everyone I knew was listening to MP3s at wildly varying volumes while peak normalising their soundtrack audio, but whenever I could I'd try to share the joy of ReplayGain. Now the world's gone mad over EBU-R128 though, and loudness units are everywhere, is referring a target volume of 89dB starting to feel a little silly or is it just me?

Not so long ago I was explaining to a poster in a video forum, how to convert/adjust soundtrack audio to -23LUFS with fb2k. He was fairly familiar with fb2k so I was able to explain the process in ReplayGain-speak after providing a quick ReplayGain to LU translation. Someone still came along and told me off for not explaining it according the EBU standard.

I'll confess I don't get it. I understand the need for backwards compatibility. There must be at least five MP3 players on the market capable of reading ReplayGain tags. The data written to tags is one thing though. Couldn't fb2k display volume in both formats while ReplayGain fades away? It seems virtually inevitable to me.
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: darkflame23 on 2018-09-18 08:52:33
For me it comes down to the fact that loudness standards and metering have been adopted by the film and broadcast industries (and to a lesser, but growing extent, audio engineers), and it is a far better gauge of perceived loudness than VU, peak, RMS or so called "DR" figures ever were. So while it might seem like a fad, for me it's actually a much more useful measurement, as I am balancing the track to track loudness on albums on a daily basis.

Being able to see the LUFS integrated figures for tracks in the FB playlist is great (I could finally ditch that horrible, buggy DR component), and being able to see the over-sampled TP level in dB would just be the icing on the cake. ;)

So is it possible?
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: Zarggg on 2018-09-18 15:22:08
I remember when almost everyone I knew was listening to MP3s at wildly varying volumes while peak normalising their soundtrack audio, but whenever I could I'd try to share the joy of ReplayGain. Now the world's gone mad over EBU-R128 though, and loudness units are everywhere, is referring a target volume of 89dB starting to feel a little silly or is it just me?
This reminds me of a recent thread where someone created a custom column that showed the ReplayGain track peak in terms of LUFS, but I can't seem to find it at the moment.

Edit: Never mind. I was thinking of darkflame23's other thread that covered ReplayGain adjustment in terms of LUFS. I second his desire to see the "true peak" value in similar terms.
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: darkflame23 on 2018-09-18 16:24:15
Yes, guilty as charged!

My request had nothing to do with ReplayGain or adjustment for listening (although I do use that when I make a dinner party playlist), I just wanted the pure Integrated LUFS value readout in the playlist. As ReplayGain now uses LUFS to work out its values, it was possible to derive the figure from the ReplayGain one. Some very kind souls helped me out there!
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: darkflame23 on 2018-09-25 09:10:55
Anyone? It's still killing me not being able to arrive at, for example, -1.12 from 0.88.
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: darkflame23 on 2018-09-25 10:52:17
Thanks to a good friend, I was pointed in this direction. This is the calculation needed to convert the 0-1 values into dB:

linear-to-db(x) = log(x) * 20

See here:

http://www.playdotsound.com/portfolio-item/decibel-db-to-float-value-calculator-making-sense-of-linear-values-in-audio-tools/

But I understand power functions are needed to do that, in which case it's impossible to implement via the regular FB2K title formatting strings, right?

Off to research whatever JScript Panel is...
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: Porcus on 2018-09-25 18:54:06
But I understand power functions are needed to do that, in which case it's impossible to implement via the regular FB2K title formatting strings, right?

What accuracy do you need, really? I mean, the -1.5 dB to -0.5 dB interval - which you possibly could round-off to "-1" dB? - is 0.84something  to 0.94something.
Above you had a -1.12, so I take it that integers are not satisfactory. But are integers good enough if it is beyond ... -6 dB?

(fb2k can calculate powers: $mul(3,3,3,3) gives you 3^4=81. But it requires integers. And rescaling to integers and doing high powers before downscaling ... overflow. So it has to be coded a bit carefully.)


Off to research whatever JScript Panel is...

Good idea ... thread: https://hydrogenaud.io/index.php/topic,110499.450.html
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: darkflame23 on 2018-09-25 19:12:51
Accuracy for True Peak readings I'd like to two decimal places, e.g. -1.23 dBTP but that's not the concern. The concern is I can't get a RG TP readout in the playlist in dB, only as a meaningless (to me, an audio engineer), number between zero and one.

Will check link, thanks!
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: j7n on 2018-09-25 19:50:33
I need to correct myself. The function needed is log(). I was thinking of conversion in the opposite direction from db to float. It probably makes more sense for Foobar to provide a pair of new technical info %__fields% than to add generic floating point functions, which don't work in older versions and have the other arithmetic operations confusingly still limited to integers.

The Play Dot Sound site makes a good case for decibels. I don't remember why the current tag format was chosen. The gain could have been a straight multiplier too. Maybe the extra digits near fullscale are helpful when doing EAC-style peak level comparisons to determine likely identical masterings. But as the float values get smaller, they are increasignly hard to visualize (in the bitcompare tool the difference values are always small).

I'll confess I don't get it. I understand the need for backwards compatibility. There must be at least five MP3 players on the market capable of reading ReplayGain tags. The data written to tags is one thing though. Couldn't fb2k display volume in both formats while ReplayGain fades away? It seems virtually inevitable to me.
The peak level statistic isn't really related to loudness normalization, except in the name chosen in Vorbis/Ape. The player can derive the required format regardless how it is encoded in the particular format. Renaming the tags serves no purpose. I prefer that the original loudness normalization standard remains.
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: yetanotherid on 2018-09-26 04:43:34
The peak level statistic isn't really related to loudness normalization, except in the name chosen in Vorbis/Ape. The player can derive the required format regardless how it is encoded in the particular format. Renaming the tags serves no purpose. I prefer that the original loudness normalization standard remains.

I wasn't suggesting the tags should be renamed, although I'm boldly assuming there's a method for saving R128 volume information to tags using fields that have nothing to do with ReplayGain. If so, why not do both?

foobar2000 can write SoundCheck tags. I don't know if they include a peak loudness value or if it'd be easier to convert to a True Peak LUFS value for fb2k to display, but Opus decided to do it differently and that's supported by fb2k too, so between ReplayGain, SoundCheck, Opus and R128, the concept of a "universal" volume system is looking a little messy.
ReplayGain is the only method not using loudness units as a way to express volume, but considering fb2k no longer uses the original ReplayGain scanning method and supports True Peak scanning, even if the format for saving ReplayGain tags remains unchained for eternity, I'm not sure why moving to loudness units in the GUI isn't a good idea.

In fact fb2k's advanced options for configuring SoundCheck tags allows the SoundCheck target volume to be adjusted to match the ReplayGain target volume, and both volumes are expressed as loudness units, no doubt because choosing between a target volume of -16LUFS and 89dB would meaningless to most mortals, which is pretty much the point I was trying to make.
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: darkflame23 on 2018-09-26 06:15:24
It probably makes more sense for Foobar to provide a pair of new technical info %__fields% than to add generic floating point functions, which don't work in older versions and have the other arithmetic operations confusingly still limited to integers.

That would be my preferred way of dealing with it, perhaps something like %replaygain_track_peak_db% or something?
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: darkflame23 on 2018-10-09 14:13:06
From the 1.4.1 beta change log:

"Added title formatting fields for showing track/album peaks as decibel values."

Thanks for adding this! But where can I find which string to use to get that value? It doesn't seem to be either in the "Columns" drop down menu list, or the Foobar2000 Title Formatting Reference web page.
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: Case on 2018-10-09 14:17:05
It's in the titleformat help bundled with the player. %replaygain_track_peak_db% and %replaygain_album_peak_db%.
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: darkflame23 on 2018-10-09 14:17:32
OK, I think I worked it out, they went ahead and used my recommended string, wahey! I am so happy. Thank you Peter and crew!

EDIT: Thanks Case!
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: C3POwen on 2018-10-11 17:50:16
But where can I find which string to use to get that value? It doesn't seem to be either in the "Columns" drop down menu list, or the Foobar2000 Title Formatting Reference web page.
I’ve taken the liberty of adding these new fields to the wiki page (https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#Technical_information_functions). 😊
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: darkflame23 on 2018-10-11 18:03:21
Thanks, that's great!
Title: Re: [Request] View ReplayGain Track Gain True Peak Levels in Playlist as dB
Post by: Porcus on 2018-10-17 21:01:40
If I choose to prevent clipping according to peak, how much is it reduced then? So much that the maximizing sample hits full scale precisely, or is it kept a bit lower due to safeguard against some Microsoft behaviour near full peak?

This new field gave some interesting info:

I think this should return what is limited by peak in order to prevent clipping, right?
Code: [Select]
%replaygain_album_gain% PRESENT AND %replaygain_album_peak% PRESENT AND "$add($replace(%replaygain_album_gain%,.,,dB,),$replace(%replaygain_album_peak_db%,.,,dB,))" GREATER -1
... assuming album mode is used, then.

Throwing in "%__encoding% HAS lossless AND", returns two thirds of my classical music.

How many tracks hit the ceiling? Replace "album" by "track" returns a third. Again, of my (lossless-encoded) classical music.

Non-classical? Not so much.