Hello-

I posted on here a couple of weeks ago and your tips helped a great deal but today I have another problem that I'm finding rather vexing, I have an array of ints from a wave file and I'd like to perform RMS on it, this would be easy if I were to do the entire array however the window size for the RMS is dynamic depending on the bit width of the wave file. I've got some psudeo code that I think would work (if I could work out how to implement it):

for(int i = 0; i <= array.size(); i++){
runningWindowCount = array[i];
runningWindowCount += array[i+1];
runningWindowCount += array[i+2];
runningWindowCount += array[i+3];
runningWindowCount += array[i+4]; // do this the amount required by the bit width
windowCountAverage = runningWindowCount / bitWidth;
RMSArray.push_back(sqrt(windowCountAverage));
}

now this should work right? however its possibly the least elegant piece of code ever plus it doesn't deal with a different bit width. any tips on how I could make this better? or make it work if it doesn't already?

thanks.