Here is a quick prototype of the short time energy function in GNU Octave for a the speech sample “Mister Meryk”. The plot below shows the average magnitude of the phrase using a window size of 320 samples, calculated every 80 samples.
Here is the code that I used to generate the plot – just a quick prototype in GNU Octave:
# Create a vector with 4800 speech samples
samples = wavread("four_ways_linear.wav", [2700 7500]);
# absolute value function
function a = absv(b)
if(b < 0)
a = -b;
else
a = b;
endif
endfunction
# average magnitude function note that x must
# be a vector.
function y = avgmag(x)
v = arrayfun(@absv, x);
y = sum(v) / length(v);
endfunction
# Calculate the average magnituded for a window size
# of 320 samples every 80 samples
win_lngth = 320;
rate = win_lngth / 4;
j = 1;
for i = 1:(length(samples) / rate - 4)
win = samples(j : j + win_lngth);
mag(i) = avgmag(win);
j = j + rate;
endfor
plot(mag);








