Re: [Faudiostream-users] lufs loudness analyser

2022-05-10 Thread Julius Smith
Hi Klaus,

Could the averaging time be too small?  I'm worried about the line

Tg = 0.4; // 3 second window for 'short-term' measurement

The comment seems to indicate it should be "Tg = 3;", i.e., 3 seconds of
averaging instead of 0.4 s.

Below is an expansion of your test program that allows for more exploration.

Cheers,
Julius

import("stdfaust.lib");

freq = hslider("[0] Test Sine Frequency (Hz) [unit:Hz]",1000,30,16000,1);
level = hslider("[1] Test Sine Level (dBFS) [unit:dBFS]",-10,-80,0,0.1);
avg = hslider("[2] Averaging Time (s) [unit:sec]",3,0.01,10,0.1);

amp = 10^(level/20);
testSignal = amp * os.osc(freq);

process = testSignal <: _,_ : lk2 : vbargraph("[3] LUFS S",-40,0) : *(1e-7);

//Tg = 0.4; // 3 second window for 'short-term' measurement
Tg = avg;
zi = an.ms_envelope_rect(Tg); // mean square: average power = energy/Tg =
integral of squared signal / Tg
kfilter = fi.highpass(1, 60) : fi.high_shelf(4, 1800);

// 2-channel
lk2 = par(i,2,kfilter : zi) :> 10 * log10(max(ma.EPSILON)) : -(0.691);


On Tue, May 10, 2022 at 7:00 AM Klaus Scheuermann  wrote:

> Hi Julius,
>
> this is, of course, the way to go.
>
> I did some test with a series of sines, each  at -18lufs, and found these
> filter settings to be quite close (except for the 30Hz):
> kfilter = fi.highpass(1, 60) : fi.high_shelf(4, 1800);
>
> Hz  lufs
> 30 -16.693
> 60 -18.111
> 80 -18.204
> 100 -18.211
> 130 -18.177
> 180 -18.133
> 250 -18.113
> 300 -18.099
> 400 -18.099
> 600 -18.169
> 1000 -18.405
> 2000 -18.241
> 3000 -17.894
> 4000 -17.784
> 6000 -17.503
> 8000 -18.083
> 1 -18.026
> 12000 -18.035
> 14000 -17.784
> 16000 -18.083
>
> What I don't quite understand is why the values read a little different,
> every time I do the test with same filter settings and same sines. (I am on
> faustide.grame.fr).
>
> For my application, this should work fine. Out of curiosity, why do I
> approximate the filters? So that it works on all samplerates?
>
> Full test code is this:
> import("stdfaust.lib");
>
> process = _,_ : lk2 : vbargraph("LUFS S",-40,0);
>
> Tg = 0.4; // 3 second window for 'short-term' measurement
> zi = an.ms_envelope_rect(Tg); // mean square: average power = energy/Tg =
> integral of squared signal / Tg
> kfilter = fi.highpass(1, 60) : fi.high_shelf(4, 1800);
>
>
> // 2-channel
> lk2 = par(i,2,kfilter : zi) :> 10 * log10(max(ma.EPSILON)) : -(0.691);
>
> Thanks!!
> Klaus
>
>
>
>
> On Sun, 2022-05-08 at 13:17 -0700, Julius Smith wrote:
>
> Hi Klaus,
>
> To go after this, it would be useful to measure the discrepancy for
> some number of sinusoidal frequencies across the audio band, with at
> least one example including both single-channel and multichannel
> input.
> Based on the filter approximations used, I would predict a measurable
> discrepancy around 1 kHz (guessed transition-frequency tuning), and
> very high frequencies (due to bilinear transform frequency-warping).
>
> The high-frequency discrepancy should go away with oversampling, even 2x.
>
> Glad to hear noise is looking good!
>
> - Julius
>
> On Sat, Jul 3, 2021 at 1:08 AM Klaus Scheuermann  wrote:
>
>
> Hello everyone :)
>
> Would someone be up for helping me implement an LUFS loudness analyser
> in faust?
>
> Or has someone done it already?
>
> LUFS (aka LKFS) is becoming more and more the standard for loudness
> measurement in the audio industry. Youtube, Spotify and broadcast
> stations use the concept to normalize loudness. A very positive side
> effect is, that loudness-wars are basically over.
>
> I looked into it, but my programming skills clearly don't match
> the level for implementing this.
>
> Here is some resource about the topic:
>
> https://en.wikipedia.org/wiki/LKFS
>
> Specifications (in Annex 1):
>
> https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.1770-3-201208-S!!PDF-E.pdf
>
> An implementation by 'klangfreund' in JUCE / C:
> https://github.com/klangfreund/LUFSMeter
>
> There is also a free LUFS Meter in JS / Reaper by Geraint Luff.
> (The code can be seen in reaper, but I don't know if I should paste it
> here.)
>
> Please let me know if you are up for it!
>
> Take care,
> Klaus
>
>
> ___
> Faudiostream-users mailing list
> Faudiostream-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/faudiostream-users
>
>
>
>
>
>

-- 
"Anybody who knows all about nothing knows everything" -- Leonard Susskind
___
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users


Re: [Faudiostream-users] lufs loudness analyser

2022-05-10 Thread Klaus Scheuermann
Hi Julius,

this is, of course, the way to go.

I did some test with a series of sines, each  at -18lufs, and found
these filter settings to be quite close (except for the 30Hz):
kfilter = fi.highpass(1, 60) : fi.high_shelf(4, 1800);

Hz  lufs
30 -16.693
60 -18.111
80 -18.204
100 -18.211
130 -18.177
180 -18.133
250 -18.113
300 -18.099
400 -18.099
600 -18.169
1000 -18.405
2000 -18.241
3000 -17.894
4000 -17.784
6000 -17.503
8000 -18.083
1 -18.026
12000 -18.035
14000 -17.784
16000 -18.083

What I don't quite understand is why the values read a little
different, every time I do the test with same filter settings and same
sines. (I am on faustide.grame.fr).

For my application, this should work fine. Out of curiosity, why do I
approximate the filters? So that it works on all samplerates?

Full test code is this:
import("stdfaust.lib");

process = _,_ : lk2 : vbargraph("LUFS S",-40,0);

Tg = 0.4; // 3 second window for 'short-term' measurement
zi = an.ms_envelope_rect(Tg); // mean square: average power = energy/Tg
 = integral of squared signal / Tg
kfilter = fi.highpass(1, 60) : fi.high_shelf(4, 1800);


// 2-channel
lk2 = par(i,2,kfilter : zi) :> 10 * log10(max(ma.EPSILON)) : -(0.691);

Thanks!!
Klaus




On Sun, 2022-05-08 at 13:17 -0700, Julius Smith wrote:
> Hi Klaus,
> 
> To go after this, it would be useful to measure the discrepancy for
> some number of sinusoidal frequencies across the audio band, with at
> least one example including both single-channel and multichannel
> input.
> Based on the filter approximations used, I would predict a measurable
> discrepancy around 1 kHz (guessed transition-frequency tuning), and
> very high frequencies (due to bilinear transform frequency-warping).
> 
> The high-frequency discrepancy should go away with oversampling, even
> 2x.
> 
> Glad to hear noise is looking good!
> 
> - Julius
> 
> On Sat, Jul 3, 2021 at 1:08 AM Klaus Scheuermann 
> wrote:
> > 
> > Hello everyone :)
> > 
> > Would someone be up for helping me implement an LUFS loudness
> > analyser
> > in faust?
> > 
> > Or has someone done it already?
> > 
> > LUFS (aka LKFS) is becoming more and more the standard for loudness
> > measurement in the audio industry. Youtube, Spotify and broadcast
> > stations use the concept to normalize loudness. A very positive
> > side
> > effect is, that loudness-wars are basically over.
> > 
> > I looked into it, but my programming skills clearly don't match
> > the level for implementing this.
> > 
> > Here is some resource about the topic:
> > 
> > https://en.wikipedia.org/wiki/LKFS
> > 
> > Specifications (in Annex 1):
> > https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.1770-3-201208-S!!PDF-E.pdf
> > 
> > An implementation by 'klangfreund' in JUCE / C:
> > https://github.com/klangfreund/LUFSMeter
> > 
> > There is also a free LUFS Meter in JS / Reaper by Geraint Luff.
> > (The code can be seen in reaper, but I don't know if I should paste
> > it
> > here.)
> > 
> > Please let me know if you are up for it!
> > 
> > Take care,
> > Klaus
> > 
> > 
> > ___
> > Faudiostream-users mailing list
> > Faudiostream-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/faudiostream-users
> 
> 
> 

___
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users