Balance root-mean-square in audio clips
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Tahariet Sharon
le 24 Nov 2017
Modifié(e) : Nuchto
le 27 Nov 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 commentaires
David Goodmanson
le 25 Nov 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.
Réponse acceptée
David Goodmanson
le 26 Nov 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 commentaires
David Goodmanson
le 27 Nov 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.
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!