RMS, moving average or envelope on an Array or Signal?

I’ve seen a few threads here about the issue of array.plot aliasing badly on large data sets like sound files, mostly containing complaints or suggestions to use external programs like ocenaudio.

I’m thinking that a some basic processing like RMS extraction over a moving window etc. could be easily done, but I’m a bit stumped that I can’t find ready made functions for these client-side, neither in ArrayedCollection, nor in SoundFile nor in Signal. Am I missing some class where these functions might be or nobody needed them?

Actually, I see there is SoundFileView which has drawRMS (on by default). I guess the only “issue” is that it wasn’t so easy to find. Nor is there a convenience method in SoundFile to plot itself like this, i.e. via SoundFileView (but that’s easily remedied).

Here’s a funny RMS using patterns (though for very large datasets it would be subject to precision errors).

f = { |array, windowSize = 512|
	var seq = Pseq(array, 1);
	var pad = Pn(0, windowSize);
			Pseries(0, Pseq([seq, pad]).squared)
			Pseries(0, Pseq([pad, seq]).squared)
		/ windowSize