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: R128Norm (Read 57914 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

R128Norm

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.

R128Norm

Reply #1
Seems useful for night listening among other things. Thanks!

R128Norm

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

So, its quite nice, really.

R128Norm

Reply #3
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 .
In theory, there is no difference between theory and practice. In practice there is.

R128Norm

Reply #4
When I add configuration, I will add an option to only reduce gain instead of also increasing it.

R128Norm

Reply #5
Thank you for making this DSP kode54, now I can finally get rid of that horrible Vlevel.

R128Norm

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

R128Norm

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

R128Norm

Reply #8
That would explain the loud blasts during track transitions.

R128Norm

Reply #9
It should not be blasting, because it adjusts the gain level fairly quickly, and it looks ahead by half a second.

R128Norm

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


R128Norm

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

R128Norm

Reply #13
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. In practice there is.

R128Norm

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

R128Norm

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

R128Norm

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

R128Norm

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

R128Norm

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

R128Norm

Reply #19
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. In practice there is.

R128Norm

Reply #20
Updated.

This DSP is not guaranteed to prevent clipping. Use the Advanced Limiter if you also need that.

R128Norm

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

R128Norm

Reply #22
1.8 didn't increase the gain at all, so it was only a limiter.

R128Norm

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

R128Norm

Reply #24
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.
In theory, there is no difference between theory and practice. In practice there is.