Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: [Request] Scan files for LUFS values (Read 9032 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[Request] Scan files for LUFS values

We already have the ITU-R BS.1770-3 compliant true-peak scanner for files and albums, that we can use to apply ReplayGain, but I think it would also be very very helpful if we could scan for the average LUFS values and be able to display these in the main play list window. I'm not sure if the current ReplayGain scanner is already using LUFS, but if it is, there is no way to easily see what the Integrated LUFS value for the whole file is.

There is the Dynamic Range Meter which is very buggy and not recommended by the devs, plus it's not used by very many audio engineers. These days we are all using LUFS (Momentary, Short Term and Integrated), it would be very handy to be able to see the value, particularly the integrated value for the whole track.

Re: [Request] Scan files for LUFS values

Reply #1
For momentary and short-term a new flavor of meter with labels would be best. A textual readout would be changing too quickly to read.

Maybe you will find these ReplayGain display colums useful for the integrated measurement. The bar graphs give a quick overview of levels within a compilation. There might be more efficient ways of writing the script, but I can't untangle what I have written here.

Spoiler (click to show/hide)

Re: [Request] Scan files for LUFS values

Reply #2
Thanks, will give those a try!

Yeah, I realised after posting that the only one that would be really helpful would be the Integrated LUFS value, which either builds over time in real time, or is displayed after "scanning" a whole track, the latter would be most awesome. I can do this with my various meters and with iZotope RX's "Details" function on a file, etc., but it would be super cool to have it built into FB2K.

Your RG/LUFS column figures look like what I need, I will give it a go now, thanks once again!

Re: [Request] Scan files for LUFS values

Reply #3
Just tried your LUFS string:

$if(%__replaygain_track_gain%,<$puts(temp,$num($sub($replace(%__replaygain_track_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)

And it's spot on, it agrees with the Integrated LUFS values in RX5 Advanced for the most part (sometimes 0.1dB off but that is due to there being various ways to implement the standard).

I have no idea how you did that (I haven't programmed anything since BASIC in the 80's), but I would like to offer a huge thank you! I got rid of the "lufs" bit at the end of the readout, now I just need to work out how you keep the text the same colour, it's not obvious to me from just reading the string, and the decimal point and following digits are grey.


Re: [Request] Scan files for LUFS values

Reply #5
sometimes 0.1dB off...

I just need to work out how you keep the text the same colour, it's not obvious to me from just reading the string, and the decimal point and following digits are grey.
I didn't do rounding and just truncanced the last digit for a compact display, as I figured it was accurate enough. I used < and > symbols to set darker colors in order to highlight the most important part of the data.

This shows both decimals from the tag without color.
Code: [Select]
$if(%__replaygain_track_gain%,$puts(temp,$num($sub($replace(%__replaygain_track_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,5))

Re: [Request] Scan files for LUFS values

Reply #6
You could just use the gain values directly, assuming you've scanned your files again since the newer scanner was integrated a few years ago. It targets an LUFS level of -18, so RG values of 0.0 dB are LUFS of -18. This is periodic windowed samples, integrated over the entire file, as far as I know.

Re: [Request] Scan files for LUFS values

Reply #7
Thanks for all the info.

@j7n Thank you so much, that is perfect!

@kode54 So you should be able to write a string that just reads the RGain track gain and do a +18 and it would also give you the same LUFS readout only with a much easier string?

The main loudness standards and how to implement them are available in the documents listed here:

https://www.tcelectronic.com/brand/tcelectronic/loudness-broadcast-standards

https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.1770-4-201510-I!!PDF-E.pdf

I'm looking for the Integrated LUFS value which is arrived at either by playing or offline scanning a whole audio file. I'm pretty sure I read somewhere the new RGain scanner in FB2K is based on this. Last night I spent 4 hours rescanning and updating the tags on my entire collection and all seems to be working fine!

Re: [Request] Scan files for LUFS values

Reply #8
Multiply ReplayGain by -1 (it decreases as loudness increases) and add -18.00 to arrive at the LUFS. The complexity of the string comes down to removing the decimal point and adding it back in afterwards in the correct position, as the titleformatting functions don't work with fractions. I assumed that there are always 2 decimal digits in RG as used in Foobar, which seems to be the case for all formats.

Re: [Request] Scan files for LUFS values

Reply #9
Thanks for the explanation, and all the help. The main thing is, as a mastering engineer, it's something I've been wanting in FB2K for over a decade, and now I have it. I should have asked much earlier! :)

It can replace the horribly buggy DR Meter component finally.

Re: [Request] Scan files for LUFS values

Reply #10
Another quick question, thanks in advance if you can help:

Is it now possible after doing this scan, using the Search or Library functions, to be able to Sort a search query by this LUFS loudness value? So for example, I could search my entire collection for the loudest releases etc?

Re: [Request] Scan files for LUFS values

Reply #11
You can use album gain directly, except there is a jump at -18 lufs (+0.00), returning the loudest releases in the middle of the list:

%__replaygain_album_gain% PRESENT SORT BY %__replaygain_album_gain%

I would load the whole library in a playlist, and sort by clicking on the column header. I'm not sure what are the advantages of using database search. Make a new column using album gain to sort by releases instead of tracks.

Sorry, I'm not much help with database as I rarely use it.


Re: [Request] Scan files for LUFS values

Reply #13
Sorry for all the questions, and thanks once again for bearing with me!

1) Is there also a way to show the True Peak level? I have the 'True Peak Scanner' component installed (not sure if it came with the Foobar installation or I installed it from a third party), and can scan and update the files fine (figure shows up in Properties), but can't find the string to use for the playlist view here:

http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference

[EDIT] Scratch that, I cut and copied the string from the "Properties" tab and pasted it into the Playlist View Custom Columns and it seems to work. :)

%replaygain_track_true_peak%

But it gives a long readout, any way to get it to only display the first 3 digits, e.g. 0.99? I am guessing this is a percentile readout too? It would be great to have it as a dB readout as used on most audio software e.g. -0.01 dBfs

2) I read that you can adjust the oversampling level for the True Peak Scanner readings in Foobar, but I can't find it in the Preferences, does anyone know where it is?

Re: [Request] Scan files for LUFS values

Reply #14
The True Peak scanner you have now sounds like a component I made a while back. You won't need it anymore as the built-in ReplayGain scanner can now perform the action natively.

In foobar2000 v1.4 you'll find the configuration in Preferences -> Tools -> ReplayGain Scanner where you can directly customize which resampler is used for the purpose.

Note that the values will be stored in the regular replaygain_track_peak and replaygain_album_peak tag fields.

Re: [Request] Scan files for LUFS values

Reply #15
Also, there exists foo_r128meter which can display LUFS in realtime.

Re: [Request] Scan files for LUFS values

Reply #16
Thanks @Case

I just removed the old TruePeak Scanner. I switched on the new True Peak scan mode in the Preferences -> Tools -> ReplayGain Scanner, then re-scanned some files with 'Scan per file track gain', and updated the file tags, but now the True Peak values are not showing up with the %replaygain_track_true_peak% string in the playlist (they are just showing up as a question mark), although I can see them (and as dB values, yay!) clearly in the ReplayGain Scan Results.

 Any ideas? Is there a different string I need to use to display this True Peak value?


Re: [Request] Scan files for LUFS values

Reply #18
As I mentioned in my earlier reply just use the regular peak tags. If you don't care about album value just %replaygain_track_peak%.

Re: [Request] Scan files for LUFS values

Reply #19
Thanks, I've got that working fine now, but is there any way to display it as a dBTP value, like the second figure in the ReplayGain scan results for Track Peak (in brackets)? At the moment it gives the raw figure instead. See image.

Re: [Request] Scan files for LUFS values

Reply #20
They have added the TP value in dB in the latest beta, with %replaygain_track_peak_db% which is great, but now I am wondering if they could also consider a much simpler string for the integrated LUFS vale too? Right now I have:

$if(%__replaygain_track_gain%,$puts(temp,$num($sub($replace(%__replaygain_track_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))

But something like %replaygain_LUFS% would be a lot simpler!

Re: [Request] Scan files for LUFS values

Reply #21
Why do you use such a complex calculation? The values of the current scanner correlate exactly with the LUFS scale. The reference value is -18 LUFS for the current ReplayGain tags.

Re: [Request] Scan files for LUFS values

Reply #22
Why do you use such a complex calculation? The values of the current scanner correlate exactly with the LUFS scale. The reference value is -18 LUFS for the current ReplayGain tags.

Because that is one of the strings very kindly provided by @j7n above (see second post in this thread), that does exactly what I want it to do. If you have a shorter string that returns the same value, I'm all ears... :)

Re: [Request] Scan files for LUFS values

Reply #23
I don't know what kode54 has in mind but lack of float support forces a bit of extra work. My suggestion for a replacement string would be $if(%replaygain_track_gain%,$puts(l,$sub(-1800,$replace(%replaygain_track_gain%,.,)))$div($get(l),100).$right($get(l),2),)

Re: [Request] Scan files for LUFS values

Reply #24
Thanks Case, that is shorter and returns exactly the same value, thank you! Sorry my programming chops are non-existent.