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: libebur128 - (yet another) EBU R 128 implementation (Read 155856 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

libebur128 - (yet another) EBU R 128 implementation

Reply #50
I've uploaded 0.1.8:
- Some improvements to the tagging script (r128-tag.py): better error handling, multiprocessing module is optional.
- Fixed building and running on FreeBSD.

Download

libebur128 - (yet another) EBU R 128 implementation

Reply #51
I've made my own preliminary foo_r128scan component almost from scratch, based on your library. Congratulations, it's as fast as foo_rgscan. And that's without any of the assembly SSE optimizations that foo_rgscan has. (Well, except for the SSE accelerated peak scanning function imported from the audio_math class in shared.dll.)

Except if I enable the optional "true" peak scanning, which uses the foobar2000 resampler service to resample the audio to 192KHz, but only uses that resampled audio for peak scanning, it slows down to less than half as fast. Good thing I decided to leave that disabled.

I'm not sure if I want to release it to the general public in its current form, however. It doesn't implement much of the GUI niceties of foo_rgscan, or the RG data editor. It does, however, implement automatic multi-threaded scanning, as well as RG tag removal which is redundant to the same option in foo_rgscan.

EDIT: I just implemented finer grained scanning progress reporting. I think I may actually be ready for a public release.

FURTHER EDIT: [a href='index.php?showtopic=86404']Blammo.[/a]

 

libebur128 - (yet another) EBU R 128 implementation

Reply #52
I've uploaded 0.1.9. This is mostly a library update:
- renamed ebur128_gated_loudness_* to ebur128_loudness_* for consistency with the other loudness functions.
- when starting a new segment, the current unfinished block is now discarded. This fixes the bug where "./r128-sndfile foo.wav foo.wav" returned two slightly different values.
- new function ebur128_set_channel to make channel setting easier.
- new function ebur128_change_parameters to change samplerate and channels of a state. This will discard the current unfinished block though.
- merged ebur128_loudness_global_multiple from kode54. This function takes multiple states (e.g. one per track of an album) and returns the global loudness. I've adjusted it a bit, so that it can take states with different samplerates! This should make resampling in scanners unnecessary.
- minor library fixes.

http://www-public.tu-bs.de:8080/~y0035293/libebur128.html

libebur128 - (yet another) EBU R 128 implementation

Reply #53
You made a mistake in ebur128_change_parameters:

Code: [Select]
  if ((size_t) samplerate != st->channels) {

libebur128 - (yet another) EBU R 128 implementation

Reply #54
And in ebur128.h it says:

Quote
/* Get short-term loudness (last 3s). Will return NaN if mode does not contain
* EBUR128_MODE_S or EBUR128_MODE_S. */

Other than that it looks more like a version 1.0 than a 0.1.x to me  Great work from the both of you!

Chris
If I don't reply to your reply, it means I agree with you.

libebur128 - (yet another) EBU R 128 implementation

Reply #55
Thank you for the bug reports!
I've uploaded 0.1.10 with the following changes:

Library:
- Added ebur128_loudness_range_multiple which takes many library states as input and calculates the loudness range (LRA).
- Removed code duplication in ebur128_loudness_global_multiple/ebur128_loudness_global.
- Fixed typos.

Scanner:
- Parallelized the scanning tools (r128-*) on track level, using GLib and GThread. This makes them use all cores when scanning just one album.
- Refactored scanners into one scanner.c and many input_*.c files for audio input.

http://www-public.tu-bs.de:8080/~y0035293/libebur128.html

libebur128 - (yet another) EBU R 128 implementation

Reply #56
Is SSE2 required to run this tool? The only version that works on my old PC (Athlon XP) is 0.1.6.

Thanks for you efforts.



libebur128 - (yet another) EBU R 128 implementation

Reply #59
Here are non SSE builds:
http://www-public.tu-bs.de:8080/~y0035293/...in32-no-sse.zip
http://www-public.tu-bs.de:8080/~y0035293/...x-no-sse.tar.gz

Thanks!


Hi all,
First of all congratulations for the library, Raiden. I'm no pro programmer but to me it seems you are making this with great attention to detail,
I'm new to the forum but quite familiar with R128. I tested the executable on some wav files and it worked great. But I have a couple of questions: When you say it's referenced to -18 LU what do you mean exactly? what does this imply?
I'm working in the context of broadcast TV (not music tracks) and thus handling with very long files (more than 1 hour). Just as a suggestion two things would be useful:
-progress indication
- it would be VERY cool if you could log the short-term loudnesses to a text file for further detailed analysis. I know this is part of the program itself, not the library, but is there a chance you could add this?
Thanks very much!

libebur128 - (yet another) EBU R 128 implementation

Reply #60
The R128 spec defines a measurement of short-term loudness. It is constantly updated over a 3 sec window. Would that better serve your needs?

libebur128 - (yet another) EBU R 128 implementation

Reply #61
The R128 spec defines a measurement of short-term loudness. It is constantly updated over a 3 sec window. Would that better serve your needs?

Yes, that's exactly what I mean. A text file that would show the loudness of the consecutive 3sec windows. Thanks!

libebur128 - (yet another) EBU R 128 implementation

Reply #62
First of all congratulations for the library, Raiden.

Thank you!

I'm new to the forum but quite familiar with R128. I tested the executable on some wav files and it worked great. But I have a couple of questions: When you say it's referenced to -18 LU what do you mean exactly? what does this imply?

It is just the ReplayGain tagger that uses -18 LUFS as a reference level. The library and scanners return a loudness value in LUFS.

I'm working in the context of broadcast TV (not music tracks) and thus handling with very long files (more than 1 hour). Just as a suggestion two things would be useful:
-progress indication
- it would be VERY cool if you could log the short-term loudnesses to a text file for further detailed analysis. I know this is part of the program itself, not the library, but is there a chance you could add this?
Thanks very much!

I will do it for the next version!

libebur128 - (yet another) EBU R 128 implementation

Reply #63
It is just the ReplayGain tagger that uses -18 LUFS as a reference level. The library and scanners return a loudness value in LUFS.

I will do it for the next version!

That's just GREAT! Later this month I'm participating at a conference about loudness in TV. I'll do a summary of R128 tools available. Do you mind if I mention your initative ?
Thanks!

libebur128 - (yet another) EBU R 128 implementation

Reply #64
Later this month I'm participating at a conference about loudness in TV. I'll do a summary of R128 tools available. Do you mind if I mention your initative ?
Thanks!

Not at all. Please go ahead! There are also a few other open-source implementations:
R128Gain by pbelkner: http://www.hydrogenaudio.org/forums/index....showtopic=85978
ebu_r128 by staale: http://labs.radionova.no/2011/01/07/ebu-r128-library/
and two foobar2000 plugins by kode54 that use libebur128:
http://www.hydrogenaudio.org/forums/index....c=86404&hl=
http://www.hydrogenaudio.org/forums/index....c=86444&hl=

libebur128 - (yet another) EBU R 128 implementation

Reply #65
I've uploaded 0.1.11. There are no changes to the library, but two new options for the scanner:
- Use "-m" or "-s" to enable logging of momentary or short-term loudness to standard output. Example:
Code: [Select]
./r128-sndfile -s 0.1 foo.wav

This prints the short-term loudness every 0.1 seconds to stdout. You can pipe it to a file:
Code: [Select]
./r128-sndfile -s 0.1 foo.wav > loudness

It also supports multiple input files, even if they have different channels and/or samplerates. If there is digital silence, the resulting output line will be "-inf".

Download:
http://www-public.tu-bs.de:8080/~y0035293/libebur128.html

libebur128 - (yet another) EBU R 128 implementation

Reply #66
You may want to take a look at the silly changes I made to the library for those two functions. I changed them so that they require EBUR128_MODE_I, and call the gated loudness function for the past 1 or 8 blocks. Then I added a function that will delete all blocks from the block list except for at least the last N which are above threshold. Probably beyond the scope of your library, though.

libebur128 - (yet another) EBU R 128 implementation

Reply #67
You may want to take a look at the silly changes I made to the library for those two functions. I changed them so that they require EBUR128_MODE_I, and call the gated loudness function for the past 1 or 8 blocks.


By specification the I and S mode must not use gating.

libebur128 - (yet another) EBU R 128 implementation

Reply #68
You may want to take a look at the silly changes I made to the library for those two functions. I changed them so that they require EBUR128_MODE_I, and call the gated loudness function for the past 1 or 8 blocks. Then I added a function that will delete all blocks from the block list except for at least the last N which are above threshold. Probably beyond the scope of your library, though.

What functions do you mean? In which source file?
By specification the I and S mode must not use gating.

I suppose you mean M and S modes, and yes, they don't use gating.

Tech 3341 also mentions a integrated mode 'live meter', but does not go into detail. How should that work? Does it simply recalculate and print the integrated loudness as new samples are added? Or is it more sophisticated?

libebur128 - (yet another) EBU R 128 implementation

Reply #69
I suppose you mean M and S modes


Yes, it's a typo.

Tech 3341 also mentions a integrated mode 'live meter', but does not go into detail. How should that work? Does it simply recalculate and print the integrated loudness as new samples are added? Or is it more sophisticated?


PS An integrated mode live meter basically doesn't do anything different than a track based I-mode calculation. It has start, stop, and reset buttons to delimit the range. The best design approach would probably be decoupling of calculation and printing. Calculation is done as new samples are pushed, results are made available asynchronously by a (thread safe) pull based interface. Optionally one could include signaling when updated results are available.

PPS You don't have to redo the whole calculation each time. The absolute gating threshold does not change and must only be compared once per block. The relative gating threshold must be updated and re-applied after every new block. You may hit a drawback of using plain ANSI C, though. C++ would allow comfortable storing of block energies of virtually infinite number in dynamically growing memory structures like vectors or lists. It's not trivial to match the latter in performance/maintainability by hand coding in plain C. But when you've come so far, I'm sure you are going to find a solution.

libebur128 - (yet another) EBU R 128 implementation

Reply #70
Tech 3341 also mentions a integrated mode 'live meter', but does not go into detail. How should that work? Does it simply recalculate and print the integrated loudness as new samples are added? Or is it more sophisticated?

I would expect them during playback rather than scanning.

libebur128 - (yet another) EBU R 128 implementation

Reply #71
Hi,

I have just tested last version (libebur128-0.1.11-win64) and LRA doesn't match with the intended target LRA =15 +-1LU.
The EBU test file was seq-3341-8_seq-3342-6-24bit and the command and result was:

C:\Users\Gabriel\Desktop\Sonoridad\libebur128-0.1.11-win64>"C:\Users\Gabriel\Des
ktop\Nueva carpeta\libebur128-0.1.11-win32-sse2\r128-sndfile.exe" -r -t C:\Users
\Gabriel\Desktop\Sonoridad\ebu-loudness-test-setv01\seq-3341-8_seq-3342-6-24bit.
wav
global loudness: -23.01 LUFS
LRA: 2.24
5.00907772 0.71829414 5.00907772 0.71829414


Have I done something wrong or there is a bug?

Gabriel

libebur128 - (yet another) EBU R 128 implementation

Reply #72
Thanks for the report! It was a bug in the comparison function to qsort (ebur128_double_cmp). This resulted in a list of loudness blocks that were not properly sorted, using Microsofts qsort implementation.

I've uploaded 0.1.12, which fixes this bug. No other changes!
Downloads

libebur128 - (yet another) EBU R 128 implementation

Reply #73
Thanks for the report! It was a bug in the comparison function to qsort (ebur128_double_cmp). This resulted in a list of loudness blocks that were not properly sorted, using Microsofts qsort implementation.

I've uploaded 0.1.12, which fixes this bug. No other changes!
Downloads


Thank you very much Raiden. I'll test right now!

libebur128 - (yet another) EBU R 128 implementation

Reply #74
Thanks for the report! It was a bug in the comparison function to qsort (ebur128_double_cmp). This resulted in a list of loudness blocks that were not properly sorted, using Microsofts qsort implementation.

I've uploaded 0.1.12, which fixes this bug. No other changes!
Downloads


[blockquote]C:\Users\Gabriel\Desktop\Sonoridad\libebur128-0.1.12-win64>C:\Users\Gabriel\Desk
top\Sonoridad\libebur128-0.1.12-win64\r128-sndfile.exe -r -t C:\Users\Gabriel\De
sktop\Sonoridad\ebu-loudness-test-setv01\seq-3341-8_seq-3342-6-24bit.wav
global loudness: -23.01 LUFS
LRA: 14.99
5.00907772 0.71829414 5.00907772 0.71829414
[/blockquote]

Raiden, It works flawlessly! Well done! (Can you feel you make me happy today?)

Sincerely,

Gabriel