I'm trying to calculate the loudness of an audio track I have stored in a buffer. The buffer contains PCM data of the signal and I want to get how 'loud' it is by using Root Mean Squared. I assume I can do this in the time-domain instead of having to switch to the frequency domain. What would be the pseudo-code for doing this?
Would I simply sample for one second (audio[0] - audio[44099], audio[44099] - audio[88199] etc..) and calculate the RMS of those values? So, for example, would I do this:
$$RMS = \sqrt{\frac{\text{audio}[0]^2 + \text{audio}[1]^2 + \text{audio}[2]^2.....\text{audio}[44099]^2}{44100}}$$
for each second?

<!-- html comment -->to work around the character restriction in the rare case that an otherwise perfect post has a tiny but very important error. This need occurs very rarely: there's usually more than 6 characters of improvement to be done. For example, when there are missing brackets, it's usually better to use the\sqrt{}and\frac{}{}constructs in TeX. – Kevin Vermeer Sep 22 '11 at 12:12