Search code examples
pythonaudiormsenergy

Average RMS value of an 3D audio signal in Python


I am quite new to programming and Python. I am working on a project in which I built an Auditory filterbank with two banks of Gammatone filters. Now I ended up with a 39x10x8545 matrix. I want to calculate the average of rms energy across the time axis (over the 8545) to reduce the dimensionality of the signal. Can anyone suggest me a better method to do it efficiently in Python because I cannot afford much memory due to the audio signal being very large. Thanks in advance.


Solution

  • The RMS of is signal is the root mean squared, which is not the same as the mean. So you need to perform the RMS calculation.

    math.sqrt(numpy.mean(x*x))
    

    There are several other pages on this site that discuss this in further: here, here, here