Balance root-mean-square in audio clips

9 visualizaciones (últimos 30 días)
Tahariet Sharon
Tahariet Sharon el 24 de Nov. de 2017
Editada: Nuchto el 27 de Nov. de 2017
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 comentarios
Tahariet Sharon
Tahariet Sharon el 25 de Nov. de 2017
Editada: Tahariet Sharon el 25 de Nov. de 2017
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 el 25 de Nov. de 2017
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.

Iniciar sesión para comentar.

Respuesta aceptada

David Goodmanson
David Goodmanson el 26 de Nov. de 2017
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 comentarios
David Goodmanson
David Goodmanson el 27 de Nov. de 2017
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 el 27 de Nov. de 2017
Editada: Nuchto el 27 de Nov. de 2017
Thanks for noticing. Using
r=sqrt(mean(RMS(:,1).^2 + RMS(:,2).^2))
It gives .3157, still not quite, but close.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by