Balance root-mean-square in audio clips
Show older comments
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 Comments
David Goodmanson
on 25 Nov 2017
Hi Tahariet,
Have you calculated the rms value for each audio clip as yet? With those, you simply divide each clip by its rms value to produce a set of normalized audio clips.
Tahariet Sharon
on 25 Nov 2017
Tahariet Sharon
on 25 Nov 2017
David Goodmanson
on 25 Nov 2017
I had intended post the comment above as a comment rather than an answer as I did, so I added the comment and deleted the answer, not realizing that deleting the answer would also delete your second comment that went with it, about amplitude vs. rms.
Anyway, setting max amplitudes to be equal and setting rms power to be equal are two different things. For a simple sine or cosine wave, equal amplitude means equal power, but this is not true in general. For example, take
[1 0 0 -.6 0 0 0 .2 .4 -1] % a)
[1 -1 1 -1 1 -1 1 -1 1 -1] % b)
Both of these have mean value 0 and max amplitude 1. But b) has many more large-value excursions from the mean than does a), so b) has the larger rms power.
Max amplitude has some uses, such as comparison to a voltage threshold to see if you are in danger of shorting something out. But in general it is not the greatest of metrics for a wave.
Tahariet Sharon
on 25 Nov 2017
David Goodmanson
on 25 Nov 2017
Edited: David Goodmanson
on 25 Nov 2017
Kind of depends. If you divide each L by its rms value and each R by its rms value, then the power of the left and right channels are the same not just clip to clip, but the same as each other. That might be ok a lot of the time, but if you were investigating some phenomenon that depended on different signal strength in L and R, then making the the L and R channels the same would of course not be appropriate . If you want to preserve differences between L and R and have the total power in both channels be the same from clip to clip, then I believe you divide both L and R not by ( rms( L ) + rms( R ) ) / 2 or something similar, but rather divide them both by
sqrt(rms(L)^2 + rms(R)^2)
Tahariet Sharon
on 25 Nov 2017
Tahariet Sharon
on 25 Nov 2017
Edited: Tahariet Sharon
on 25 Nov 2017
David Goodmanson
on 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.
Accepted Answer
More Answers (0)
Categories
Find more on Direction of Arrival Estimation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!