Balance root-mean-square in audio clips
조회 수: 10 (최근 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
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
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
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.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!