Csound Csound-dev Csound-tekno Search About

[Csnd] how to reinit lufs ktrig w multiple opcode instances

Date2021-06-08 23:23
Fromwalker
Subject[Csnd] how to reinit lufs ktrig w multiple opcode instances
Hi everybody,

Really digging the new Lufs opcode.  However, when I use it in a UDO and have 3 or more instances of this UDO, the audio stops getting passed through and/or processed properly.  I think it has something to do with the ktrig init 0(or lack thereof on multiple instances, but I am not sure...).  I have tried passing global k statements per UDO instance, but that did not work either.  Any advice here is greatly appreciated, thank you.




-odac



sr=48000
ksmps=64
0dbfs=1.0
nchnls=2

opcode LufGainer, aa, aaki
ainL, ainR, ktargetDB, isig xin
ktrig init 0
kupRamp linseg -1000, 0.3, 0, 100, 0
ktargetDB min kupRamp, ktargetDB
kM,kI,kS lufs ktrig, ainL, ainR
printks "%f -> M: %f, I: %f, S: %f LUFS\n", 0.3, isig, kM, kI, kS
aOffset = ampdb(ktargetDB - kI)
xout ainL * aOffset, ainR * aOffset
endop


instr 1
aamp linseg 0, p3, 1 
a1 poscil aamp,1000,1
a2 poscil aamp,1200,1
a1, a2 LufGainer a1, a2, -10, 1 #last arg here not functional, for debugging only
a1, a2 LufGainer a1, a2, -10, 2
a1, a2 LufGainer a1, a2, -10, 3
outs a1, a2
endin



f1 0 8192 10 1

i1 0 5



Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2021-06-08 23:40
From"Jeanette C."
SubjectRe: [Csnd] how to reinit lufs ktrig w multiple opcode instances
Jun 9 2021, walker has written:

> Hi everybody,
>
> Really digging the new Lufs opcode.
...
> I think it has something to do with the ktrig init 0(or lack thereof on multiple instances, but I am not sure...).
...
I am not sure, but maybe you could try something like:
kTrig init 1
; rest of your opcode
xout(a1, a2)
kTrig = 0
endop

I hope this helps!

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
  * GitHub: https://github.com/jeanette-c

What's practical is logical. What the hell, who cares?
All I know is I'm so happy when you're dancing there. <3
(Britney Spears)

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2021-06-09 00:12
Fromwalker davis
SubjectRe: [Csnd] how to reinit lufs ktrig w multiple opcode instances
Hey Jeanette,

Thanks for the quick response.  Prior to posting here, I tried a few similar approaches.  That method does pass audio through multiple UDO's containing `lufs`.  However, the resulting audio is super loud and potentially ear damaging if wearing headphones, so be careful...  

Thanks again for the response though Jeanette, cheers.


On Tue, Jun 8, 2021 at 3:40 PM Jeanette C. <julien@mail.upb.de> wrote:
Jun 9 2021, walker has written:

> Hi everybody,
>
> Really digging the new Lufs opcode.
...
> I think it has something to do with the ktrig init 0(or lack thereof on multiple instances, but I am not sure...).
...
I am not sure, but maybe you could try something like:
kTrig init 1
; rest of your opcode
xout(a1, a2)
kTrig = 0
endop

I hope this helps!

Best wishes,

Jeanette

--
  * Website: http://juliencoder.de - for summer is a state of sound
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
  * GitHub: https://github.com/jeanette-c

What's practical is logical. What the hell, who cares?
All I know is I'm so happy when you're dancing there. <3
(Britney Spears)

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2021-06-09 20:55
Fromjoachim heintz
SubjectRe: [Csnd] how to reinit lufs ktrig w multiple opcode instances
hi -

i had a look at your code, and i think the reason why it is not working 
is the expression
	ampdb(ktargetDB - kI)

not sure what you want to do here, but if you change your udo to this 
and look at the printout, you will see very strange values:

opcode LufGainer, aa, aaki
ainL, ainR, ktargetDB, isig xin
ktrig init 0
kupRamp linseg -1000, 0.3, 0, 100, 0
ktargetDB min kupRamp, ktargetDB
kM,kI,kS lufs ktrig, ainL, ainR
;printks "%f -> M: %f, I: %f, S: %f LUFS\n", 0.3, isig, kM, kI, kS
kOffset = ampdb(ktargetDB - kI)
printk .5, kOffset
xout ainL*kOffset, ainR*kOffset
endop

definitely it is not a performance issue.  my execution reports:
	Elapsed time at end of performance: real: 5.118s, CPU: 0.311s

perhaps this helps a bit, best -
	joachim


On 09/06/2021 00:23, walker wrote:
> Hi everybody,
> 
> Really digging the new Lufs opcode.  However, when I use it in a UDO and have 3 or more instances of this UDO, the audio stops getting passed through and/or processed properly.  I think it has something to do with the ktrig init 0(or lack thereof on multiple instances, but I am not sure...).  I have tried passing global k statements per UDO instance, but that did not work either.  Any advice here is greatly appreciated, thank you.
> 
> 
> 
> 
> -odac
> 
> 
> 
> sr=48000
> ksmps=64
> 0dbfs=1.0
> nchnls=2
> 
> opcode LufGainer, aa, aaki
> ainL, ainR, ktargetDB, isig xin
> ktrig init 0
> kupRamp linseg -1000, 0.3, 0, 100, 0
> ktargetDB min kupRamp, ktargetDB
> kM,kI,kS lufs ktrig, ainL, ainR
> printks "%f -> M: %f, I: %f, S: %f LUFS\n", 0.3, isig, kM, kI, kS
> aOffset = ampdb(ktargetDB - kI)
> xout ainL * aOffset, ainR * aOffset
> endop
> 
> 
> instr 1
> aamp linseg 0, p3, 1
> a1 poscil aamp,1000,1
> a2 poscil aamp,1200,1
> a1, a2 LufGainer a1, a2, -10, 1 #last arg here not functional, for debugging only
> a1, a2 LufGainer a1, a2, -10, 2
> a1, a2 LufGainer a1, a2, -10, 3
> outs a1, a2
> endin
> 
> 
> 
> f1 0 8192 10 1
> 
> i1 0 5
> 
> 
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>          https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> 

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here