diff Code/Descriptors/Matlab/MPEG7/calculate_audioPower.m @ 4:92ca03a8fa99 tip

Update to ICASSP 2013 benchmark
author Dawn Black
date Wed, 13 Feb 2013 11:02:39 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Code/Descriptors/Matlab/MPEG7/calculate_audioPower.m	Wed Feb 13 11:02:39 2013 +0000
@@ -0,0 +1,17 @@
+function AP = audioPower(s,fs,framelength,noOfFrame)
+totalTime = size(s) / fs;
+frameTime = totalTime/noOfFrame;
+y=buffer(s,framelength);  %the frame length is 10ms
+        
+for i = 1:noOfFrame
+
+    totalPower(i) = 0;
+    ap(i) = 0;
+    for j = 1: (framelength)
+        totalPower(i) = totalPower(i) + s(j + framelength*(i-1)) * s(j + framelength*(i-1));
+    end;     
+end;
+
+ap= totalPower / framelength;
+b = 0:frameTime:(totalTime-frameTime);
+AP = [ap' b'];
\ No newline at end of file