Analysis of the ratio of two moving average filters
This depends a bit on what you want to get our of the analysis
Step 1: Instantaneous  power
You square the signal. That changes the spectrum considerably. In particularly you need to watch out for aliasing. Let's say your signal is a 15kHz sine wave sampled at 48 kHz. If you square this you get one component at DC (0 Hz) and another at 30 kHz. However, the 30 kHz component will alias down to 18 kHz, so your squared spectrum is outright wrong in this case. To be safe, you should either up-sample the signal by a factor of 2 before squaring OR lowpass filter it at a quarter of the sample rate. Many &quot;natural&quot; audio signals don't have a lot of energy at high frequencies, so could also choose to just live with the aliasing error, but that's an application specific decision.
The physical interpretation of instantaneous power is complicated. Let's say your input signal is the voltage at the terminals of a loudspeaker: Squaring it does NOT represent the instantaneous power. The actual instantaneous power is the product of the voltage and the current waveform. Since a loudspeaker is a reactive load, this will be quite different from the squared voltage. For example, it's perfectly normal for the instantaneous power to be negative which the square of a signal can never be. Negative instantaneous power simple means that the load has energy storage and that at times it can feed stored energy back into the source.
Going back to the sine wave example. A squared sine creates a component at DC and one at double the frequency. One possible interpretation: the DC component reflects the actual power consumed, the double frequency component represents power that gets exchanged between the source and the load but not consumed: it just gets shoved back and forth.
Provided that the signal is the &quot;actual&quot; instantaneous power, than the mean of it will represent the average power and the integral will represent the real energy consumed (exactly).
Step 2: Moving average
Moving average is just a low pass filter where the length of the averaging window determines the &quot;cutoff&quot; frequency. Unfortunately it's a rather poor one. It attenuates the &quot;higher&quot; frequency in the spectrum but very unevenly. Personally I would assume that in most cases a simple IIR filter would work much better.
A low pass filter will eliminate the &quot;back and forth components&quot; of the power signal but keep the &quot;actual consumption&quot;. The choice of cutoff frequency (or time constant) should be tied to the physical process you want to observe. I.e. could be to time constant of the power supply storage or the thermal time constant of the system.
Step 3: Dividing averages for different time constants
This creates the ratio of &quot;short term power &quot; vs &quot;long term power&quot; where you can define &quot;short&quot; and &quot;long&quot; by the cutoff frequencies of your low pass filter. Whether that's useful or not depends on your application. It's a relative metric: it shows how &quot;spikey&quot; your energy consumption is.
Since real instantaneous power can be negative, it's conceivable that the lowpass filtered version can be negative or zero as well, which can make the division problematic.