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: FLAC1170: a ITU BS.1770 loudness scanner for FLAC (Read 28189 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

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:
  • Analyze some individual tracks:
    Code: [Select]
    flac1770 track1.flac track2.flac track3.flac


  • Analyze some individual tracks and write RG tags to them:
    Code: [Select]
    flac1770 --tag track1.flac track2.flac track3.flac


  • Analyze all tracks from a folder:
    Code: [Select]
    flac1770 dir/*.flac


  • Analyze all tracks from a folder and write RG tags to them:
    Code: [Select]
    flac1770 --tag dir/*.flac


  • Analyze all tracks from a folder and write RG tags to them, compatible with standard ReplayGain:
    Code: [Select]
    flac1770 --rg --tag dir/*.flac


  • Analyze all tracks from a folder, including inter-sample peak determination, and write RG tags to them, compatible with standard ReplayGain:
    Code: [Select]
    flac1770 --rg --true-peak=fast --tag dir/*.flac

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #1
Thanks for the software.

Shouldn't the / be \?

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

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #2
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.

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #3
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/.

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.

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #4
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.
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #5
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, ...

::

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #6
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%.

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #7
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):



FLAC1770:


r128gain


::

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #8
The first two thumbs show the same values, except for rounding differences in the peak values.

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #9
::

... 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.

::

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #10
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:
  • Let "flac1770" run on the EBU R128 test vector converted to FLAC in order to see that it reproduces the expected results:

    Code: [Select]
    $ flac1770 *.flac
        loudness |      gain |       peak | track
    -------------+-----------+------------+-------------------------------
    -19.96 LUFS |  -3.04 LU |-19.94 dBFS | 1kHz Sine -20 LUFS-16bit.flac
    -25.96 LUFS |   2.96 LU |-25.93 dBFS | 1kHz Sine -26 LUFS-16bit.flac
    -39.99 LUFS |  16.99 LU |-39.78 dBFS | 1kHz Sine -40 LUFS-16bit.flac
    -22.96 LUFS |  -0.04 LU |-22.94 dBFS | seq-3341-1-16bit.flac
    -32.96 LUFS |   9.96 LU |-32.75 dBFS | seq-3341-2-16bit.flac
    -23.00 LUFS |   0.00 LU | -2.64 dBFS | seq-3341-2011-8_seq-3342-6-24bit-v02.flac
    -23.03 LUFS |   0.03 LU |-23.00 dBFS | seq-3341-3-16bit-v02.flac
    -23.02 LUFS |   0.02 LU |-23.00 dBFS | seq-3341-4-16bit-v02.flac
    -22.99 LUFS |  -0.01 LU |-20.00 dBFS | seq-3341-5-16bit-v02.flac
    -23.68 LUFS |   0.68 LU |-24.00 dBFS | seq-3341-6-6channels-WAVEEX-16bit.flac
    -22.99 LUFS |  -0.01 LU | -8.91 dBFS | seq-3341-7_seq-3342-5-24bit.flac
    -22.60 LUFS |  -0.40 LU |-20.00 dBFS | seq-3342-1-16bit.flac
    -16.82 LUFS |  -6.18 LU |-15.00 dBFS | seq-3342-2-16bit.flac
    -20.05 LUFS |  -2.95 LU |-20.00 dBFS | seq-3342-3-16bit.flac
    -24.50 LUFS |   1.50 LU |-20.00 dBFS | seq-3342-4-16bit.flac
    -------------+-----------+------------+-------------------------------
    -21.99 LUFS |  -1.01 LU | -2.64 dBFS | album

  • Change the reference loudness from (implicit) -23.0 LU to -18.0 LU which is generally assumed to be the equivalent of ReplayGain's reference loudness of 89.0 dB and observe that the absolute loudness stays the same (indeed it is the same) but the gain has changed by 5.0 dB as expected:

    Code: [Select]
    $ flac1770 --reference=-18.0 *.flac
        loudness |      gain |       peak | track
    -------------+-----------+------------+-------------------------------
    -19.96 LUFS |   1.96 LU |-19.94 dBFS | 1kHz Sine -20 LUFS-16bit.flac
    -25.96 LUFS |   7.96 LU |-25.93 dBFS | 1kHz Sine -26 LUFS-16bit.flac
    -39.99 LUFS |  21.99 LU |-39.78 dBFS | 1kHz Sine -40 LUFS-16bit.flac
    -22.96 LUFS |   4.96 LU |-22.94 dBFS | seq-3341-1-16bit.flac
    -32.96 LUFS |  14.96 LU |-32.75 dBFS | seq-3341-2-16bit.flac
    -23.00 LUFS |   5.00 LU | -2.64 dBFS | seq-3341-2011-8_seq-3342-6-24bit-v02.flac
    -23.03 LUFS |   5.03 LU |-23.00 dBFS | seq-3341-3-16bit-v02.flac
    -23.02 LUFS |   5.02 LU |-23.00 dBFS | seq-3341-4-16bit-v02.flac
    -22.99 LUFS |   4.99 LU |-20.00 dBFS | seq-3341-5-16bit-v02.flac
    -23.68 LUFS |   5.68 LU |-24.00 dBFS | seq-3341-6-6channels-WAVEEX-16bit.flac
    -22.99 LUFS |   4.99 LU | -8.91 dBFS | seq-3341-7_seq-3342-5-24bit.flac
    -22.60 LUFS |   4.60 LU |-20.00 dBFS | seq-3342-1-16bit.flac
    -16.82 LUFS |  -1.18 LU |-15.00 dBFS | seq-3342-2-16bit.flac
    -20.05 LUFS |   2.05 LU |-20.00 dBFS | seq-3342-3-16bit.flac
    -24.50 LUFS |   6.50 LU |-20.00 dBFS | seq-3342-4-16bit.flac
    -------------+-----------+------------+-------------------------------
    -21.99 LUFS |   3.99 LU | -2.64 dBFS | album

  • Finally switch to ReplayGain which implies a reference loudness of -18.0 LU and absolute values transformed according to -18.0 LU (ITU BS.1770) == 89.0 dB (ReplayGain). As expected, 1) the absolute values are changed accordingly but 2) the gain is not altered:

    Code: [Select]
    $ flac1770 --rg *.flac
        loudness |      gain |       peak | track
    -------------+-----------+------------+-------------------------------
      87.04 dBFS |   1.96 dB |-19.94 dBFS | 1kHz Sine -20 LUFS-16bit.flac
      81.04 dBFS |   7.96 dB |-25.93 dBFS | 1kHz Sine -26 LUFS-16bit.flac
      67.01 dBFS |  21.99 dB |-39.78 dBFS | 1kHz Sine -40 LUFS-16bit.flac
      84.04 dBFS |   4.96 dB |-22.94 dBFS | seq-3341-1-16bit.flac
      74.04 dBFS |  14.96 dB |-32.75 dBFS | seq-3341-2-16bit.flac
      84.00 dBFS |   5.00 dB | -2.64 dBFS | seq-3341-2011-8_seq-3342-6-24bit-v02.flac
      83.97 dBFS |   5.03 dB |-23.00 dBFS | seq-3341-3-16bit-v02.flac
      83.98 dBFS |   5.02 dB |-23.00 dBFS | seq-3341-4-16bit-v02.flac
      84.01 dBFS |   4.99 dB |-20.00 dBFS | seq-3341-5-16bit-v02.flac
      83.32 dBFS |   5.68 dB |-24.00 dBFS | seq-3341-6-6channels-WAVEEX-16bit.flac
      84.01 dBFS |   4.99 dB | -8.91 dBFS | seq-3341-7_seq-3342-5-24bit.flac
      84.40 dBFS |   4.60 dB |-20.00 dBFS | seq-3342-1-16bit.flac
      90.18 dBFS |  -1.18 dB |-15.00 dBFS | seq-3342-2-16bit.flac
      86.95 dBFS |   2.05 dB |-20.00 dBFS | seq-3342-3-16bit.flac
      82.50 dBFS |   6.50 dB |-20.00 dBFS | seq-3342-4-16bit.flac
    -------------+-----------+------------+-------------------------------
      85.01 dBFS |   3.99 dB | -2.64 dBFS | album

    The only thing left is that the unit for the absolute loudness in ReplayGain world should be dB instead of dBFS.

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #11
::

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, ...

::

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #12
Very nice, thank you.

This is a component which I have been missing a lot for perfect-flac-encode.

However, I'm very reluctant to use software which is not packaged. Can we expect an official Ubuntu package any soon?

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #13
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.



FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #16
... 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?

::

 

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #17
Target for EBU R128 is -23dBFS, but this possibly may be adapted in the future.

Jean

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #18
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

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #19
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, ...

::



FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #20
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).

"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). 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.

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #21
::

Thank you very much for clarifying.

::

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #22
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

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #23
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.

FLAC1170: a ITU BS.1770 loudness scanner for FLAC

Reply #24
Sure thing, and thanks again for your hard work on this program!!

Cheers,

Singtoh