cant get stereo.rms, rms, stereo.peak and peak working anymore #4091
Replies: 6 comments
-
Hi @liquidpeter, I have very little experience with radio = sine();
def source_rms(s)
r = rms.stereo(s, duration=1.)
rl = rms(stereo.left(radio), duration=1.)
rr = rms(stereo.right(radio), duration=1.)
output.dummy(r)
output.dummy(rl)
output.dummy(rr)
{
rms = r.rms,
rms_left = rl.rms,
rms_right = rr.rms
}
end
r = source_rms(radio)
thread.run({log("#{r.rms()} #{r.rms_left()} #{r.rms_right()}")}, every=1.)
output.dummy(radio) AlternativeIf the first one looks too complicated, here's another one. radio = sine();
r = rms.stereo(radio, duration=1.)
rl = rms(stereo.left(radio), duration=1.)
rr = rms(stereo.right(radio), duration=1.)
output.dummy(r)
output.dummy(rl)
output.dummy(rr)
def log_rms()
log("#{r.rms()} #{rl.rms()} #{rr.rms()}")
end
thread.run(log_rms, every=1.)
output.dummy(radio) |
Beta Was this translation helpful? Give feedback.
-
There are two “defs” that basically try to achieve the same result but cause different problems.
|
Beta Was this translation helpful? Give feedback.
-
I think what is happening here is that 2.0.2 and 2.2.4 are different. Lots of stuff has changed and syntax that you try to use in 2.2.4 just doesn't work. Vito has provided you with 2 working options. How this is not helpful?
Still this function makes no sense at all. But now it doesn't show an error.
and use
Now you've edited your post and pasted this
It's all the same again. It's wrong use of functions. If you want it to work - use the right syntax given by @vitoyucepi radio = sine();
radio = stereo(radio)
r = rms.stereo(radio, duration=1.)
r1 = peak.stereo(duration=1., radio)
rl = rms(stereo.left(radio), duration=1.)
rr = rms(stereo.right(radio), duration=1.)
pl = peak(duration=1., stereo.left(radio))
pr = peak(duration=1., stereo.right(radio))
output.dummy(r)
output.dummy(r1)
output.dummy(rl)
output.dummy(rr)
output.dummy(pl)
output.dummy(pr)
def log_rms_peak()
log("#{r.rms()} #{rl.rms()} #{rr.rms()}")
log("#{r1.peak()} #{pl.peak()} #{pr.peak()}")
end
thread.run(log_rms_peak, every=1.)
output(radio) or radio = sine();
def source_rms(s)
r = rms.stereo(s, duration=1.)
rl = rms(stereo.left(radio), duration=1.)
rr = rms(stereo.right(radio), duration=1.)
output.dummy(r)
output.dummy(rl)
output.dummy(rr)
{
rms = r.rms,
rms_left = rl.rms,
rms_right = rr.rms
}
end
def source_peak(s)
p = peak.stereo(s, duration=1.)
pl = peak(stereo.left(radio), duration=1.)
pr = peak(stereo.right(radio), duration=1.)
output.dummy(p)
output.dummy(pl)
output.dummy(pr)
{
peak = p.peak,
peak_left = pl.peak,
peak_right = pr.peak
}
end
r = source_rms(radio)
p = source_peak(radio)
thread.run({log("#{r.rms()} #{r.rms_left()} #{r.rms_right()}\n#{p.peak()} #{p.peak_left()} #{p.peak_right()}")}, every=1.)
output(radio) |
Beta Was this translation helpful? Give feedback.
-
Hi Stefan and Vito, Thank you very much for the clarification, and Vito, and I apologize for my earlier response. I should have tested your code before providing feedback. I mistakenly conflated the mono and stereo cases in the same function, which led to an oversight on my part. Specifically, I incorrectly used the I have still two questions open 2.)
In each line, values (1, 2) are from the stereo operators, while values 3 and 4 are from the mono operators. I expected the values to be identical for both mono and stereo channels, whether for peak or RMS calculations. However, it seems that the mono channel values are half as large as the stereo channel values. Could you explain why this discrepancy exists between mono and stereo calculations? Thanks for your patience! |
Beta Was this translation helpful? Give feedback.
-
Hi @liquidpeter.
Yeap, it is somehow misleading. Not sure about it at all. I've created an issue #4090 |
Beta Was this translation helpful? Give feedback.
-
Thanks for the help y'all! I think that this issue should be moved to a discussion. |
Beta Was this translation helpful? Give feedback.
-
Description
I wanted to upgrade my scripts from Liquidsoap 2.0.2 to 2.2.4-1+dev (Ubuntu 24.04 LTS).
Unfortunately the
rms
andpeak
operations do not work as expected any more, for both mono and stereo channels.Steps to reproduce
Install ubuntu 24.04 with liquidsoap from packages
Remove comments on
thread.run
to show one of the 4 issues (rms mono, rms stereo, peak mono, peak stereo).Test script
Results:
rms.stereo()
:uncaught error: index out of bounds
rms()
:-nan
forsine()
inputpeak.stereo()
:uncaught error: index out of bounds
peak()
:-nan
forsine()
inputdetailed log for
index out of bounds
Expected behavior
The defs
rms
,stereo.rms
,peak
andstereo.peak
results should return valid values.Liquidsoap version
Liquidsoap build config
Installation method
From distribution packages
Additional Info
As I prefer to use deb packages, it would be very helpful to get a fix / backport? package for Ubuntu 24.04 LTS (noble).
Thanks in advance and best regards!
Beta Was this translation helpful? Give feedback.
All reactions