Hmmm, it looks like the attach is introducing a new instance of x. Maybe something like this will work:
process(x,y) = x,y <: x, attach(y, (Lk2 : vbargraph("LUFS",-90,0))) : _,_; On Tue, Jul 13, 2021 at 6:14 AM Klaus Scheuermann <kla...@posteo.de> wrote: > Hi Julius, > > but this makes two (or n) meters, right? > > I would like to attach the lufs meter (which only has one hbargraph) to > a stereo signal and leave the stereo signal untouched. > > Here is the working code for the stereo lufs meter, but it ends up > having 3 channels. If I terminate the last channel with (_,_,!) , the > meter is optimized out too. What I need is a function Lufs_Meter_Stereo > that does nothing to the stereo sound, but only adds one meter (and > preferably takes no arguments): _,_ : Lufs_Meter_Stereo : _,_ > > import("stdfaust.lib"); > > // Highpass: > // At 48 kHz, this is the right highpass filter (maybe a Bessel or > Thiran filter?): > //A48kHz = ( /* 1.0, */ -1.99004745483398, 0.99007225036621); > //B48kHz = (1.0, -2.0, 1.0); > //highpass48kHz = fi.iir(B48kHz,A48kHz); > highpass = fi.highpass(2, 40); // Butterworth highpass: roll-off is a > little too sharp > > // High Shelf: > boostDB = 4; > boostFreqHz = 1430; // a little too high - they should give us this! > highshelf = fi.high_shelf(boostDB, boostFreqHz); // Looks very close, > but 1 kHz gain has to be nailed > > kfilter = highshelf : highpass; > > // Power sum: > Tg = 0.4; // spec calls for 75% overlap of successive rectangular > windows - we're overlapping MUCH more (sliding window) > //zi = an.ms_envelope_rect(Tg); // mean square: average power = > energy/Tg = integral of squared signal / Tg > > //envelope via lp by dario > lp1p(cf, x) = fi.pole(b, x * (1 - b)) with { > b = exp(-2 * ma.PI * cf / ma.SR); > }; > > zi_lp(x) = lp1p(1 / Tg, x * x); > > // Gain vector Gv = (GL,GR,GC,GLs,GRs): > N = 5; > Gv = (1, 1, 1, 1.41, 1.41); // left GL(-30deg), right GR (30), center > GC(0), left surround GLs(-110), right surr. GRs(110) > G(i) = *(ba.take(i+1,Gv)); > Lk(i) = kfilter : zi_lp : G(i); // one channel, before summing and > before taking dB and offsetting > LkDB(i) = Lk(i) : 10 * log10 : -(0.691); // Use this for a mono input > signal > > // Five-channel surround input: > Lk5 = par(i,5,Lk(i)) :> 10 * log10 : -(0.691); > // stereo > Lk2 = Lk(0),Lk(2) :> 10 * log10 : -(0.691); > > process(x,y) = x,y <: (_,_), attach(x, (Lk2 : vbargraph("LUFS",-90,0))) > : _,_,_ ; > > > > > > On 12.07.21 03:08, Julius Smith wrote: > > Hi Klaus, > > > > I sympathize! Been there! > > > > There are various examples in demos.lib. This seems to be right, but > > let me know if not: > > > > import("stdfaust.lib"); > > > > level_meter(chan) = abs : max(ma.EPSILON) : 20*log10 : > > hbargraph("Channel %chan [unit:dB]",-70,10); > > meter_lk(N) = si.bus(N) <: ro.interleave(N,N) : > > par(i,N,attach(level_meter(i+1))); > > > > // Test: > > sig(i) = 0.1 * no.noise; > > process = sig(1),sig(2) : meter_lk(2) : _,_; > > > > Where would be a good place for this in the Faust libraries or examples? > > > > Cheers, > > Julius > > > > > > On Sun, Jul 11, 2021 at 10:23 AM Klaus Scheuermann <kla...@posteo.de > > <mailto:kla...@posteo.de>> wrote: > > > > Guys, I am biting my teeth out here, although it is probably super > > simple... (making a new thread, as the lufs-loudness-meter is getting > > quite full...) > > > > I have a function Lk2 which has 2 inputs and one output. The output > does > > not matter to me, but it contains a vbargraph meter. > > > > How do I make a function meter_lk2 that has 2 inputs, 2 outputs and > no > > arguments, that attaches Lk2 to it only for metering, passing through > > the inputs to the outputs? > > > > process = _,_ : meter_lk2 : _,_; > > > > meter_lk2 = ??? > > > > (mono is easy, but stereo is killing me.) > > > > Thanks, > > Klaus > > > > > > _______________________________________________ > > Faudiostream-users mailing list > > Faudiostream-users@lists.sourceforge.net > > <mailto:Faudiostream-users@lists.sourceforge.net> > > https://lists.sourceforge.net/lists/listinfo/faudiostream-users > > <https://lists.sourceforge.net/lists/listinfo/faudiostream-users> > > > > > > > > -- > > "Anybody who knows all about nothing knows everything" -- Leonard > Susskind > -- "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