IPB

Welcome Guest ( Log In | Register )

3 Pages V   1 2 3 >  
Reply to this topicStart new topic
R128Norm, A simple normalizer based on EBU R128
kode54
post Jan 27 2011, 23:25
Post #1





Group: Admin
Posts: 4619
Joined: 15-December 02
Member No.: 4082



Welp. I went and made a normalizer DSP out of libebur128. Have fun with it. Oh, and I posted the source, which requires the libebur128 files from the R128Scan source.

It's currently hard coded to maintain a preview latency of 500ms, and uses the short-term loudness level measured from a three second window as the gain correction reference, which it updates every 100ms. I may make this configurable in the future.

Change log:
  • Version 1.10 - 2011-02-07 14:12 UTC:
    • Fixed a bug in libebur128 when handling weird sample rates.
  • Version 1.9 - 2011-02-05 06:11 UTC:
    • Re-enabled increasing the gain level.
    • Changed momentary and short-term loudness to gated loudness.
  • Version 1.8 - 2011-02-04 13:44 UTC:
    • Disabled the gain from increasing above 1.0, for now.
  • Version 1.7 - 2011-01-28 06:19 UTC:
    • Fixed initial gain values on startup, again.
  • Version 1.6 - 2011-01-27 23:43 UTC:
    • Now correctly flushes the buffer on playback termination.
  • Version 1.5 - 2011-01-27 23:07 UTC:
    • Reenabled momentary loudness polling.
    • Changed volume ramping to 1 dB every 50ms.
    • Current scale is now forced to the detected target scale after the initial buffering completes.
  • Version 1.4 - 2011-01-27 20:19 UTC:
    • Increased the latency to maintain at least 500ms worth of samples.
  • Version 1.3 - 2011-01-27 20:06 UTC:
    • Reverted short-term gain level changes to instantaneous again.
  • Version 1.2 - 2011-01-27 19:58 UTC:
    • Disabled momentary loudness polling and increased short-term loudness polling frequency.
  • Version 1.1 - 2011-01-27 19:22 UTC:
    • Adjusted gain level changes a bit.
  • Version 1.0 - 2011-01-27 19:00 UTC:
    • Initial release.
  • Version 0.0 - 2011-01-27 16:53 UTC:
    • Created project.
Go to the top of the page
+Quote Post
markanini
post Jan 28 2011, 08:23
Post #2





Group: Members
Posts: 550
Joined: 22-December 03
From: Malmö, Sweden
Member No.: 10615



Seems useful for night listening among other things. Thanks!
Go to the top of the page
+Quote Post
mudlord
post Jan 29 2011, 18:43
Post #3





Group: Developer (Donating)
Posts: 813
Joined: 1-December 07
Member No.: 49165



Oh yeh, its around 2.8x faster than my port of Garf's Dynamics Compressor.

So, its quite nice, really.
Go to the top of the page
+Quote Post
GeSomeone
post Jan 31 2011, 00:26
Post #4





Group: Members
Posts: 922
Joined: 22-October 01
From: the Netherlands
Member No.: 335



QUOTE (mudlord @ Jan 29 2011, 19:43) *
its around 2.8x faster than my port of Garf's Dynamics Compressor.

They don't do the exact same thing, as you will know. The effect of foo_r128norm is more like that of Vlevel, i.e. it seems to adjust the volume (slowly) over time as opposed to compressing the dynamics to make it sound louder. It sounds obviously radio-ish. The calculations will probably be much different (from Vlevel) though, and a fixed 3 sec. sliding window is used.

It could have it's use, configurable settings are welcome. It might need something like a maximum gain or lowest (source) level to amplify (threshold). Right now start of (next) track after a couple of seconds silence and some fade-outs are handled unpleasantly.
A name suggestion? foo_dsp_r128norm .

This post has been edited by GeSomeone: Feb 1 2011, 23:46


--------------------
In theory, there is no difference between theory and practice.
Go to the top of the page
+Quote Post
kode54
post Jan 31 2011, 01:52
Post #5





Group: Admin
Posts: 4619
Joined: 15-December 02
Member No.: 4082



When I add configuration, I will add an option to only reduce gain instead of also increasing it.
Go to the top of the page
+Quote Post
TuNk77
post Feb 1 2011, 00:13
Post #6





Group: Members
Posts: 136
Joined: 1-December 06
From: Norway
Member No.: 38241



Thank you for making this DSP kode54, now I can finally get rid of that horrible Vlevel.
Go to the top of the page
+Quote Post
markanini
post Feb 1 2011, 12:23
Post #7





Group: Members
Posts: 550
Joined: 22-December 03
From: Malmö, Sweden
Member No.: 10615



I don't mind that it raises volume of quiet parts personally but it gets extremely loud right at the start of tracks. This becomes especially annoying when listening to live recordings. I guess I'm reporting a simmilar issue as GeSomeone. Perhaps adding buffer och that's capable of looking ahead into the next track would be a solution for the issues I'm experiencing. FWIW
Go to the top of the page
+Quote Post
kode54
post Feb 2 2011, 05:52
Post #8





Group: Admin
Posts: 4619
Joined: 15-December 02
Member No.: 4082



It already looks ahead, but it doesn't ask for track change notifications, so it keeps whatever amplification level was achieved by the end of the previous track.
Go to the top of the page
+Quote Post
markanini
post Feb 3 2011, 00:10
Post #9





Group: Members
Posts: 550
Joined: 22-December 03
From: Malmö, Sweden
Member No.: 10615



That would explain the loud blasts during track transitions.
Go to the top of the page
+Quote Post
kode54
post Feb 3 2011, 09:18
Post #10





Group: Admin
Posts: 4619
Joined: 15-December 02
Member No.: 4082



It should not be blasting, because it adjusts the gain level fairly quickly, and it looks ahead by half a second.
Go to the top of the page
+Quote Post
amalone
post Feb 3 2011, 15:59
Post #11





Group: Members
Posts: 29
Joined: 22-February 10
Member No.: 78388



QUOTE (kode54 @ Feb 3 2011, 04:18) *
It should not be blasting, because it adjusts the gain level fairly quickly, and it looks ahead by half a second.


I noticed momentary blasts also. I think it happened with Last FM with songs from different artists. I believe it also happened when playing songs on a playlist with Replaygain shut off.

A great component.
Go to the top of the page
+Quote Post
markanini
post Feb 3 2011, 20:27
Post #12





Group: Members
Posts: 550
Joined: 22-December 03
From: Malmö, Sweden
Member No.: 10615



Here's an excerpt where output clips at a track transition: http://www.box.net/shared/0qpuv6r21f
From 0:18 I start the second track directly and gain is more reasonable.
Go to the top of the page
+Quote Post
kode54
post Feb 4 2011, 14:51
Post #13





Group: Admin
Posts: 4619
Joined: 15-December 02
Member No.: 4082



Hopefully, locking the gain scale to 1.0 or less will fix that problem. I can't make the component request track change marks because it could cause gaplessness issues when using resampling DSPs and such.
Go to the top of the page
+Quote Post
GeSomeone
post Feb 4 2011, 18:11
Post #14





Group: Members
Posts: 922
Joined: 22-October 01
From: the Netherlands
Member No.: 335



QUOTE (kode54 @ Feb 4 2011, 15:51) *
Hopefully, locking the gain scale to 1.0 or less will fix that problem.

Version 1.8 highlights: Disabled the gain from increasing above 1.0, for now

Yes, it does ... but now it is just a limiter instead of a normalizer. Wouldn't the correct solution be to make it work "gated", meaning ignore the silence (and probably also near silence like tape noise etc)? Somewhat like you did in the R128scanner.
Another possible approach could be looking ahead just as much as looking back. e.g. look back 1.5s and look ahead 1.5, still a 3s sliding window :-) Just adding suggestions to the pile.


--------------------
In theory, there is no difference between theory and practice.
Go to the top of the page
+Quote Post
amalone
post Feb 5 2011, 00:11
Post #15





Group: Members
Posts: 29
Joined: 22-February 10
Member No.: 78388



That change certainly made School from Crime of the Century by Supertramp much better. With version 1.7, it would get almost deafening in parts as it is a very dynamic song. It did not seem to change anything with the flac file previously posted though. Might that be because the quiet part is so long?

Thanks for working on this.
Go to the top of the page
+Quote Post
markanini
post Feb 5 2011, 00:39
Post #16





Group: Members
Posts: 550
Joined: 22-December 03
From: Malmö, Sweden
Member No.: 10615



I agree with GeSomeone. With the lastetst update R128Norm loses functionality that makes it a gem of a volume leveler for me. Please consider making it selectable. And if convenient please add track change awareness, also selectable.

This post has been edited by markanini: Feb 5 2011, 00:40
Go to the top of the page
+Quote Post
kode54
post Feb 5 2011, 07:20
Post #17





Group: Admin
Posts: 4619
Joined: 15-December 02
Member No.: 4082



Try now. Although I had to make some ugly additions to the library so I could use EBUR128_MODE_I indefinitely without allocating more and more memory.
Go to the top of the page
+Quote Post
amalone
post Feb 5 2011, 08:08
Post #18





Group: Members
Posts: 29
Joined: 22-February 10
Member No.: 78388



I installed 1.9 and tried it. At around the 12 second mark the song School i mentioned before blasts pretty strongly. That part of the song was recorded to go from near silence to quite loud instantly. I did not try the blast flac that was posted before. Thanks.
Go to the top of the page
+Quote Post
markanini
post Feb 5 2011, 16:21
Post #19





Group: Members
Posts: 550
Joined: 22-December 03
From: Malmö, Sweden
Member No.: 10615



It's better, blasts are reduced even though they're not avoided completely. Volume leveling sounds more natural than before. Thanks for your great work so far!
Go to the top of the page
+Quote Post
GeSomeone
post Feb 6 2011, 16:48
Post #20





Group: Members
Posts: 922
Joined: 22-October 01
From: the Netherlands
Member No.: 335



Thanks very much for your work, I'm sorry it made the code ugly.
What you changed, did help, but unfortunately, not a lot. If a track ends really abrupt the next track may start at a reasonable volume. However when a track fades out a bit slower, R128norm is cranked up at the start of the next track (the "blast" effect). Is the look ahead you mentioned is working as intended?

This happens not only at track changes. I uploaded a sample of the intro of Monkey Wrench by Foo Fighters from their Greatest Hits. There is a 1.15s break at 0:11.5 that triggers the "blast" effect. At least when played from the beginning, the strange thing is when I start it and skip to 0:10 immediately it won't happen.

In this same sample after seeking (with the seekbar) to 0:09 the volume becomes instantly very high as well. When doing so to 0:08 or 0:10 this doesn't happen.

Another example I will just mention is the intro of Echoes by Pink Floyd. R128norm (used as only DSP) introduces severe clipping there. That can't be right.


used foobar 1.1.2 with track gain applied and only active DSP "EBU R128 compressor" (1.9)


--------------------
In theory, there is no difference between theory and practice.
Go to the top of the page
+Quote Post
kode54
post Feb 7 2011, 15:26
Post #21





Group: Admin
Posts: 4619
Joined: 15-December 02
Member No.: 4082



Updated.

This DSP is not guaranteed to prevent clipping. Use the Advanced Limiter if you also need that.
Go to the top of the page
+Quote Post
amalone
post Feb 7 2011, 20:12
Post #22





Group: Members
Posts: 29
Joined: 22-February 10
Member No.: 78388



Installed 1.10 and I think it blasted louder than the previous versions. So far, version 1.8 has been the only one that has not done it. ReplayGain on and Advanced Limiter on. Thanks.

This post has been edited by amalone: Feb 7 2011, 20:13
Go to the top of the page
+Quote Post
kode54
post Feb 7 2011, 20:37
Post #23





Group: Admin
Posts: 4619
Joined: 15-December 02
Member No.: 4082



1.8 didn't increase the gain at all, so it was only a limiter.
Go to the top of the page
+Quote Post
amalone
post Feb 7 2011, 20:58
Post #24





Group: Members
Posts: 29
Joined: 22-February 10
Member No.: 78388



I understand. Well, the song "School" really blasted with version 1.10. It was louder than with 1.9. I think I heard it on streaming radio also. Thanks.
Go to the top of the page
+Quote Post
GeSomeone
post Feb 7 2011, 22:26
Post #25





Group: Members
Posts: 922
Joined: 22-October 01
From: the Netherlands
Member No.: 335



QUOTE (kode54 @ Feb 7 2011, 16:26) *
This DSP is not guaranteed to prevent clipping.

Ah, it's just that every other dynamics compressor I've come accross (by far not all that exist) did have a mechanism to keep the signal (just) below 0dBFS. Maybe the term is commonly used for a compressor/limiter combination.

I hope you have an opportunity to play with that sample (and others) to find out what's going on.
Go to the top of the page
+Quote Post

3 Pages V   1 2 3 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 30th September 2014 - 11:59