# Energy of audio signal

From audio file [y,FS]=something.wav

So the y is typically N cross 2 matrix

I want calculate energy so i.e sum(abs(y.^2))

So when I apply these I end with two answer for each column. So I want only one energy for whole signal what to do???

• Hi Rohith, what don't you act to your previous questions? You've got answers? Please clarify them before asking a new one. May 25, 2020 at 10:53
• Sounds like a stereo sound file to me. May 25, 2020 at 15:40
• @robert : Sounds like you are binaural, aren't you? May 25, 2020 at 16:12

That really depends on what you need to use the energy for and how exactly you define "energy" in your application.

You can either take the sum of the energies or do a more advanced mode taking into account the inter-channel correlation and the spectral correlation of stereo playback. If you want anything like "physical" energy, you need a calibration.

If you have two channels after reading a file then you probably have a stereo audio file. If both signals are similar then you can delete one of the channels:

x = x(:,1)


If both channels are important then it depends on what you want to do. You can sum both values and obtain the total energy

sum(sum(x.^2))


or calculate average

mean(sum(x.^2))


RMS = sqrt(mean(x.^2))

• you shouldn't delete either channel. you should just add their energies before the sqrt() May 25, 2020 at 23:41