HydrogenAudio

Lossless Audio Compression => FLAC => Topic started by: pbelkner on 2012-12-02 16:26:17

Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: pbelkner on 2012-12-02 16:26:17
FLAC1770 is a ITU BS.1770 loudness scanner and tagger for FLAC. For tagging it should do exactly tha same as "metaflac".

Binaries are available for Win32, Linux, and Linux64:
[blockquote][/blockquote]
Code: [Select]
$ flac1770
FLAC1170 v0.1.0, a ITU BS.1770 loudness scanner for FLAC.

Usage: flac1770 [options] <files>

Options:
  --help: dispaly this usage information and exit.
  --version: dispaly version information and exit.
  --tag: write replay gain tags to the input files (off).
  --r128: use EBU R128 compliant presets (default).
  --a85: use ATSC A/85 compliant presets.
  --rg: use ReplayGain compatible presets.
  --reference=<float>: set reference loudness (-23.0).
  --gate=<float>: set BS.1770 gate (-10.0).
  --partition=<int>: set BS.1770 partition (4).
  --unit=LU|LK|dB: use the respective loudness unit (LU).
  --progress=on|off: display progress percentage (on).
  --true-peak=fast|medium|best|off: determine inter-sample peaks (off).

Some examples:
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: eahm on 2012-12-02 16:32:41
Thanks for the software.

Shouldn't the / be \?

Also, why is the ReplayGain calculated by flac1770 much different than the one calculated by foobar2000?
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: pbelkner on 2012-12-02 16:42:29
Shouldn't the / be \?

It depends ...

It's true for the CMD window aka DOS-box on Windows. But mostly I'm using a MSyS shell on Windows or Linux at all ...

Also, why is the ReplayGain calculated by flac1770 much different than the one calculated by foobar2000?

You're right. ReplayGain is different from ITU BS.1770: it's not only a matter of units, I have to transform the values as well.
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: pbelkner on 2012-12-02 17:38:29
Also, why is the ReplayGain calculated by flac1770 much different than the one calculated by foobar2000?

I've uploaded a corrected version 0.1.1: https://sourceforge.net/projects/r128gain/f...s/flac1770/0.1/ (https://sourceforge.net/projects/r128gain/files/flac1770/0.1/).

Fortunately only the absolute loudness values displayed in the first column "loudness" where w.r.t the ITU world and not w.r.t. the RG world. The differences between two absolute values doesn't depend on that, and hence the calculated gains where correct.

I don't know how "foobar" calculates replay gain, i.e. whether it uses the RG algorithm or the ITU algorithm. Of course, the results of the two algorithms differ.
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Wombat on 2012-12-03 02:18:04
Hi, finally something to replace metaflac while it is supporting other sample rates.
Since you mention it to be meant as such replacement why does it use a different way of defining REPLAYGAIN_REFERENCE_LOUDNESS ? It now shows "-18.0 dBFS" instead of the "xxdB"
I didn´t follow the discussions about the new loudness scanner standards. Was it changed therefore? Sorry i ask but i didn´t find an answer in a short search i did.

Edit: just tried your 0.1.2 version and now it is a "89dBFS" new, against "89dB" metaflac standard.
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Surfi on 2012-12-03 20:40:30
I don't know how "foobar" calculates replay gain, i.e. whether it uses the RG algorithm or the ITU algorithm. Of course, the results of the two algorithms differ.
::

from foobar2000 1.1.7 change log:
"Updated ReplayGain scanning code to the latest version of libebur128."

... so shouldn't the results be identical?


Greetings, ...

::
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: pbelkner on 2012-12-04 07:22:38
from foobar2000 1.1.7 change log:
"Updated ReplayGain scanning code to the latest version of libebur128."

... so shouldn't the results be identical?

flac1770 is based on lib1770 and gives exact the same results as r128gain which is also based on lib1770. Both tools implement ITU BS.1770-2: i.e. a gate of -10.0 dB and a block overlap of 75%, which is also conformant with the latest EBU R128 (2011).

I don't know what fb2k or libebur128 are doing. Please note that the preliminary 2010 version of EBU R128 required a gate of -8.0 dB and a block overlap of 50%.
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Surfi on 2012-12-04 10:31:52
flac1770 is based on lib1770 and gives exact the same results as r128gain which is also based on lib1770.
::

No, it doesn't. Here's a comparison (click thumbs, please):

(http://img233.imageshack.us/img233/1453/comparison1l.th.jpg) (http://img233.imageshack.us/i/comparison1l.jpg/)(http://img195.imageshack.us/img195/1421/comparison2va.th.jpg) (http://img195.imageshack.us/i/comparison2va.jpg/)

FLAC1770:
(http://img197.imageshack.us/img197/9535/flac1770.th.jpg) (http://img197.imageshack.us/i/flac1770.jpg/)

r128gain
(http://img542.imageshack.us/img542/5706/r128gain.th.jpg) (http://img542.imageshack.us/i/r128gain.jpg/)

::
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: skamp on 2012-12-04 10:46:48
The first two thumbs show the same values, except for rounding differences in the peak values.
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Surfi on 2012-12-04 11:17:38
::

... so why that many decimals?
And why does flac1770 tag the positive algebraic sign?
(db - dB, REPLAYGAIN_ALGORITHM tag)

I know it's a bit nitpicking but I wish it would be more consistent ... and I hope those differences really result from rounding and are not caused by SOX's automatic dithering.

::
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: pbelkner on 2012-12-04 17:06:44
I know it's a bit nitpicking but I wish it would be more consistent ... and I hope those differences really result from rounding and are not caused by SOX's automatic dithering.

I have to admit that there are considerable differences between "r128gain" and "flac1770", but I think "flac1770" is doing it right:
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Surfi on 2012-12-04 19:30:15
::

Thanks for answering, all of your tools and your persistency to update them with the latest algorithms.
I hope you'll take a closer look into r128gain because I like to scan and tag my OGG-Vorbis files with it.


Regards, ...

::
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: leo-bogert on 2012-12-04 20:55:55
Very nice, thank you.

This is a component which I have been missing a lot for perfect-flac-encode (https://github.com/leo-bogert/perfect-flac-encode).

However, I'm very reluctant to use software which is not packaged. Can we expect an official Ubuntu package any soon?
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Triza on 2012-12-04 23:33:24
I use loudness command from libebur128. Works great. Added advantage of that that it can handle vorbis and supposedly mp3. That uses -10 dB gate and 75% overlap AFAIK. I certainly did not find any issue against Quasi Audio and the EBU test vector.
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Surfi on 2012-12-05 06:58:13
That uses -10 dB gate and 75% overlap AFAIK.
::

How can I verify this?

::
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Triza on 2012-12-05 20:28:25
I have read through libebur128 thread and tested against EBU and Quasi Audio test files. The results looked okay.

That uses -10 dB gate and 75% overlap AFAIK.
::

How can I verify this?

::

Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Surfi on 2012-12-06 10:29:52
... Quasi Audio test files.
::

Found the updated EBU Loudness test set but what are the target values (references) for the files and where can i get the Quasi Audio test files?

::
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: jangk on 2012-12-06 11:15:53
Target for EBU R128 is -23dBFS, but this possibly may be adapted in the future.

Jean
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Singtoh on 2012-12-06 12:22:15
Hello All,

Just stumbled upon the r128gain program and would like to thank Mr. Belkner for a fine job and well done. I have been looking for something that could tag all of my vinyl rips. I Just downloaded r128gain-1.0-alpha-7-3 64bit and have tried a couple of the previous releases and am having a problem that maybe someone else is having?? I am on Ubuntu 12.10 64 bit. Anyway, I can't seem to get the program to recurse thru directories. Whenever I highlite my music folder to start the tagging process r128gain crashes, but I can highlight a single flac file and it does it's job no problem. I extracted the program to my home directory and just run it from clicking on the icon. Is that the correct way?? or do I need to actually install it?? And if I need to install it maybe I am missing something because the folder only has some libs, ffmpeg and sox in it. I already have those other two programs installed. Any info or tounge lashings about being a bonehead for doing something wrong will be taken graciously. I just really want this program to work. Thanks for the help.

Cheers,

Singtoh
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Surfi on 2012-12-06 14:35:42
Target for EBU R128 is -23dBFS, ...
::

Have a look at the loudness column in post #11, 1st list. This must be wrong for e.g.

seq-3341-2-16bit (-32.96 LUFS)
seq-3342-2-16bit (-16.82 LUFS)
seq-3342-3-16bit (-20.05 LUFS)
seq-3342-4-16bit (-24.50 LUFS)

and maybe

seq-3341-6-6channels-WAVEEX-16bit (-23.68 LUFS)
seq-3342-1-16bit (-22.60 LUFS)

too. Or are these rounding errors? I can't believe that.


Greetings, ...

::


Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: pbelkner on 2012-12-06 16:39:05
Have a look at the loudness column in post #11, 1st list. This must be wrong for e.g.

The expected results for the test cases regarding loudness measurement according to EBU R128 are specified in the respective standards document "Loudness Metering: ‘EBU Mode’ metering to supplement loudness normalisation in accordance with EBU R 128" (http://tech.ebu.ch/docs/tech/tech3341.pdf (http://tech.ebu.ch/docs/tech/tech3341.pdf)).

"flac1770" passes all these test cases in the specified range except #6 (which is multi channel):

Code: [Select]
           expected |    measured | deviation | track
--------------------+-------------+-----------+-------------------------------
I = -23.0 ±0.1 LUFS | -22.96 LUFS |   0.04 LU | seq-3341-1-16bit.flac
I = -33.0 ±0.1 LUFS | -32.96 LUFS |   0.04 LU | seq-3341-2-16bit.flac
I = -23.0 ±0.1 LUFS | -23.03 LUFS |   0.03 LU | seq-3341-3-16bit-v02.flac
I = -23.0 ±0.1 LUFS | -23.02 LUFS |   0.02 LU | seq-3341-4-16bit-v02.flac
I = -23.0 ±0.1 LUFS | -22.99 LUFS |   0.01 LU | seq-3341-5-16bit-v02.flac
I = -23.0 ±0.1 LUFS | -23.68 LUFS |   0.68 LU | seq-3341-6-6channels-WAVEEX-16bit.flac
I = -23.0 ±0.1 LUFS | -22.99 LUFS |   0.01 LU | seq-3341-7_seq-3342-5-24bit.flac
I = -23.0 ±0.1 LUFS | -23.00 LUFS |   0.00 LU | seq-3341-2011-8_seq-3342-6-24bit-v02.flac

Please note that all these test cases inluding #6 are passed by "r128gain":

Code: [Select]
$ r128gain --fast *3341*.flac
SoX sucessfully loaded.
FFmpeg sucessfully loaded.
analyzing ...
  [1/8] "seq-3341-1-16bit.flac": -23.0 LUFS (-0.0 LU)
  [2/8] "seq-3341-2-16bit.flac": -33.0 LUFS (10.0 LU)
  [3/8] "seq-3341-2011-8_seq-3342-6-24bit-v02.flac": -23.0 LUFS (0.0 LU)
  [4/8] "seq-3341-3-16bit-v02.flac": -23.0 LUFS (0.0 LU)
  [5/8] "seq-3341-4-16bit-v02.flac": -23.0 LUFS (0.0 LU)
  [6/8] "seq-3341-5-16bit-v02.flac": -23.0 LUFS (-0.0 LU)
  [7/8] "seq-3341-6-6channels-WAVEEX-16bit.flac": -23.0 LUFS (0.0 LU)
  [8/8] "seq-3341-7_seq-3342-5-24bit.flac": -23.0 LUFS (-0.0 LU)
  [ALBUM]: -23.2 LUFS (0.2 LU)
done.

There are three other test cases specifying the expected result in the file name. These test cases are also passed in the specified range of ±0.1 LUFS:

Code: [Select]
           expected |    measured | deviation | track
--------------------+-------------+-----------+-------------------------------
I = -20.0 ±0.1 LUFS | -19.96 LUFS |   0.04 LU | 1kHz Sine -20 LUFS-16bit.flac
I = -26.0 ±0.1 LUFS | -25.96 LUFS |   0.04 LU | 1kHz Sine -26 LUFS-16bit.flac
I = -40.0 ±0.1 LUFS | -39.99 LUFS |   0.01 LU | 1kHz Sine -40 LUFS-16bit.flac

The remaning test cases are w.r.t. the loudness range. These test cases are specified in the respective document "Loudness Range: A measure to supplement loudness normalisation in accordance with EBU R 128" (http://tech.ebu.ch/docs/tech/tech3342.pdf (http://tech.ebu.ch/docs/tech/tech3342.pdf)). For these test cases there's no expected value w.r.t loudness.

"flac1770" doesn't support loudness range, i.e. w.r.t. "flac1770" these test cases are maeningless.

Please note that "r128gain" passes these test cases:

Code: [Select]
$ ~/r128gain-1.0-alpha-7-3/r128gain --fast --range  *3342*.flac
SoX sucessfully loaded.
FFmpeg sucessfully loaded.
analyzing ...
  [1/6] "seq-3341-2011-8_seq-3342-6-24bit-v02.flac": -23.0 LUFS (0.0 LU)
      range: 15.3 LU
  [2/6] "seq-3341-7_seq-3342-5-24bit.flac": -23.0 LUFS (-0.0 LU)
      range: 4.8 LU
  [3/6] "seq-3342-1-16bit.flac": -22.6 LUFS (-0.4 LU)
      range: 10.0 LU
  [4/6] "seq-3342-2-16bit.flac": -16.8 LUFS (-6.2 LU)
      range: 5.0 LU
  [5/6] "seq-3342-3-16bit.flac": -20.1 LUFS (-2.9 LU)
      range: 20.0 LU
  [6/6] "seq-3342-4-16bit.flac": -24.5 LUFS (1.5 LU)
      range: 15.0 LU
  [ALBUM]: -21.2 LUFS (-1.8 LU)
      range: 16.5 LU
done.
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Surfi on 2012-12-06 20:02:06
::

Thank you very much for clarifying.

::
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Singtoh on 2012-12-07 04:15:48
Hello All Again,

I am not sure if this is the correct place to post about bugs for r128gain but I am sure someone will let me know. Anyway, in my last post I wasn't sure if I was running the program correctly, but it appears that I am. After doing a few tests with r128gain this is what I have found.

1. The program strips artwork, as was mentioned in an earllier post. Not a big deal if you are only tagging a few albums, but kind of a big deal when I want to do 1.5 terrabyte.

2. The program runs nicely and recurses thru directories of only 44100 sample rate albums. Runs thru to the end, no problem.

3. The program will not recurse thru directories of 96000 sample rate albums and higher. It crashes immediatley and the window closes in an instant. So if there is a mix of 44100 and 96000 it won't run(on this machine anyway). Or even if only 96000 sample rate albums are in the directory it still crashes.

4. The program will tag 96000 sample rate albums if done seperatley one by one. Not a big deal if you are only tagging a few albums, but as mentioned above, kind of a problem if your doing a terabyte or more. I don't have that many of these 96000 sample rate albums but it will still take awhile to get them sorted doing it one by one.

I am using Ubuntu 12.10 64bit with the default settings using replaygain settings as shown on the homepage, I hope they are the best settings??  The program is really nice, I like it alot. Kudos to Mr. Belkin for this fine program. I just thought I would post my findings here for others that may be having similiar problems, and sorry if some of these problems have been mentioned before, I didn't see it.

Cheers,

Singtoh
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: pbelkner on 2012-12-07 06:42:39
3. The program will not recurse thru directories of 96000 sample rate albums and higher. It crashes immediatley and the window closes in an instant. So if there is a mix of 44100 and 96000 it won't run(on this machine anyway). Or even if only 96000 sample rate albums are in the directory it still crashes.

Many thanks for the detailed report. Analysis will take a few days.
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Singtoh on 2012-12-07 06:59:18
Sure thing, and thanks again for your hard work on this program!!

Cheers,

Singtoh
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: pbelkner on 2012-12-07 16:42:38
Sure thing, and thanks again for your hard work on this program!!

Cheers,

Singtoh

I've continued in the "r128gain" thread: http://www.hydrogenaudio.org/forums/index....st&p=816487 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=85978&view=findpost&p=816487)
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: pbelkner on 2012-12-07 19:15:21
FLAC1770 v0.2.0 released

What's new?
Binaries are available for Win32, Linux, and Linux64:
Code: [Select]
$ flac1770
FLAC1770 v0.2.0, a ITU BS.1770 loudness scanner for FLAC.

Usage: flac1770 [options] <files>

Options:
  --help: dispaly this usage information and exit.
  --version: dispaly version information and exit.
  --tag: write replay gain tags to the input files (off).
  --r128: use EBU R128 compliant presets (default).
  --a85: use ATSC A/85 compliant presets.
  --rg: use ReplayGain compatible presets.
  --reference=<float>: set reference loudness (-23.0).
  --gate=<float>: set BS.1770 gate (-10.0).
  --partition=<int>: set BS.1770 partition (4).
  --unit=LU|LK|dB: use the respective loudness unit (LU).
  --progress=on|off: display progress percentage (on).
  --quiet: suppress writing to stdout (off).
  --true-peak=fast|medium|best|off: determine inter-sample peaks (off).
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Wombat on 2012-12-07 19:23:01
FLAC1770 v0.2.0 released

What's new?
  • Unit for absolute loudness is dB.


Thanks!

Edit: How to prevent reporting of positive album peaks like "REPLAYGAIN_ALBUM_PEAK 1.00003052" ? --true-peak=off is not it.
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: pbelkner on 2012-12-07 20:53:15
How to prevent reporting of positive album peaks like "REPLAYGAIN_ALBUM_PEAK 1.00003052" ? --true-peak=off is not it.

By using v0.2.1
[blockquote]Download: http://sourceforge.net/projects/r128gain/files/flac1770/0.2/ (http://sourceforge.net/projects/r128gain/files/flac1770/0.2/)[/blockquote]This version takes into account that the largest negative integer is by 1 larger then the largest positive integer.
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: Wombat on 2012-12-07 22:24:05
By using v0.2.1

Indeed!
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: JJZolx on 2012-12-08 05:01:53
As a casual follower of these threads, is there a difference between ITU BS.1770 and the R128GAIN algorithm discussed in the other  thread? If not, what's the difference between this tool and the one offered in the R128GAIN thread?
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: pbelkner on 2012-12-08 06:33:08
As a casual follower of these threads, is there a difference between ITU BS.1770 and the R128GAIN algorithm discussed in the other  thread? If not, what's the difference between this tool and the one offered in the R128GAIN thread?

"flac1770" is meant to be a lightweight version of "r128gain" specialized to FLAC working around some specufic FFmpeg and SoX related issues brought up in the r128gain thread (http://www.hydrogenaudio.org/forums/index.php?showtopic=85978):
Both, "r128gain" and "flac1770" use the  ITU BS.1770 (http://www.itu.int/rec/R-REC-BS.1770/en) loudness algorithm as provided by "lib1770".
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: pbelkner on 2012-12-09 20:47:08
FLAC1770 v0.3.0 released

What's new?
Binaries are available for Win32, Linux, and Linux64:
Code: [Select]
$ flac1770
FLAC1770 v0.3.0, a ITU BS.1770 loudness scanner for FLAC.

Usage: flac1770 [options] <files>

Options:
  --help: dispaly this usage information and exit.
  --version: dispaly version information and exit.
  --tag: write replay gain tags to the input files (off).
  --r128: use EBU R128 compliant presets (default).
  --a85: use ATSC A/85 compliant presets.
  --rg: use ReplayGain compatible presets.
  --reference=<float>: set reference loudness (-23.0).
  --gate=<float>: set BS.1770 gate (-10.0).
  --partition=<int>: set BS.1770 partition (4).
  --range: compute loudness range (off).
  --range-min=<int>: set lower bound for loudness range (0.10).
  --range-max=<int>: set upper bound for loudness range (0.95).
  --range-gate=<float>: set BS.1770 gate for loudness range (-20.0).
  --range-partition=<int>: set BS.1770 partition for loudness range (3).
  --true-peak=fast|medium|best|off: determine inter-sample peaks (off).
  --unit=LU|LK|dB: use the respective loudness unit (LU).
  --progress=on|off: display progress percentage (on).
  --quiet: suppress writing to stdout (off).
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: pbelkner on 2012-12-12 17:28:59
FLAC1770 v0.4.0 released
Finally added Unicode support for Win32.
Title: FLAC1170: a ITU BS.1770 loudness scanner for FLAC
Post by: pbelkner on 2012-12-19 17:58:36
FLAC1770 v0.4.1 released
New: Binaries for 64 bit Windows.