Balance root-mean-square in audio clips

8 次查看(过去 30 天)
I read in a paper that audio fragments were energy balanced "so that the root-mean-square power value was equal across clips". How does one balance the RMS power value across audio clips? Thanks.
  9 个评论
Tahariet Sharon
Tahariet Sharon 2017-11-25
编辑:Tahariet Sharon 2017-11-25
I tried your approach but it doesn't seem to maintain the ratio between left and right. For instance, the RMS= 0.1334 0.1265 (L and R), so the sqrt(rms(L)^2 + rms®^2) = 0.1838. When I plug this into the denominator to divide both L and R, the rms of this resulting quantity is 0.7256 0.0057.
David Goodmanson
David Goodmanson 2017-11-25
Something must have gone wrong, because it does work
% make two channels with rms value .1334, .1265
a = rand(1,1000);
b = rand(1,1000);
a = .1334*a/rms(a);
b = .1265*b/rms(b);
rms_ab = [rms(a) rms(b)]
% normalize
anorm = a/sqrt(rms(a)^2 + rms(b)^2);
bnorm = b/sqrt(rms(a)^2 + rms(b)^2);
rmsnorm_ab = [rms(anorm) rms(bnorm)]
% same ratio for these two
rat = [rms(a)/rms(b) rms(anorm)/rms(bnorm)]
I shall comment on sum of squares, but right now lunch is calling.

请先登录,再进行评论。

采纳的回答

David Goodmanson
David Goodmanson 2017-11-26
Hi Tahariet,
You would like to normalize R and L so that the sum of R power and L power does not change from clip to clip. The ratio between R power and L power stays the same before and after normalization. Calling the channels a and b rather than R and L, then
anorm = a / sqrt(rms(a)^2 + rms(b)^2);
bnorm = b / sqrt(rms(a)^2 + rms(b)^2);
This works because, first, although people say it all the time (including in your question), the phrase "rms power" is a misnomer. rms is an amplitude.
In terms of voltage, assuming a signal with mean 0 for simplicity (and dropping the factor of 1/R since keeping it around does not change the conclusion), the average power is P = mean(V.^2). Root mean square = sqrt(mean(V.^2)) is linear in V, so it's an amplitude. And
P = rms^2.
You want to normalize so that Panorm + Pbnorm is the same from clip to clip, so
Panorm = Pa/(Pa+Pb)
Pbnorm = Pb/(Pa+Pb)
When you take the square root of both sides and use P = rms^2 everywhere, then you get the anorm and bnorm expressions.
  5 个评论
David Goodmanson
David Goodmanson 2017-11-27
Hi Nuchto, Well it does not quite make sense. In the expression for r there should be no inner sqrt function. One sqrt on the outside, as in the expression for rms_clip_ave, that's it. Not that the result is going to agree with .156, but at least it will be smaller. The expression for r is not a confidence builder so I hope that in the main calculations you will go back and make sure that there are no extra sqrts floating around. I hope your experiment turns out well.
Nuchto
Nuchto 2017-11-27
编辑:Nuchto 2017-11-27
Thanks for noticing. Using
r=sqrt(mean(RMS(:,1).^2 + RMS(:,2).^2))
It gives .3157, still not quite, but close.

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by