4
$\begingroup$

Will someone be able to explain short time energy function for me in a simple way explaining all the variables in the formula?

The issue that I have is in the formula the summation varies m like,

m=n-(N-1) to n

from my research what I understood is that n is the center sample of the window, so if the center of the window is, lets say 80 and if the window size is 160. Then there is a situation where “m” get a negative value discontinuing a loop in a programming environment. Is my understanding incorrect or is there a reason? Thanks in advance.

$\endgroup$
  • 2
    $\begingroup$ You are computing the short-term average at each time $n$ over the current plus past $N-1$ symbols. For example, if $N=3$, then when $n = 10$, you are averaging over $x[8], x[9], x[10]$ , when $n=35$, you are averaging over $x[33], x[34], x[35]$ etc. And yes, when you start at $n=0$, you have to average over $x[-2], x[-1], x[0]$ and you may not know $x[-2]$ and $x[-1]$. You can set them to $0$, or what you think the long-term average might be working out to be in general, or the number that Excel stores when you enter your birthday or whatever. The effect of these disappears very soon. $\endgroup$ – Dilip Sarwate Jan 22 '12 at 12:07
  • $\begingroup$ thank you so much that was so helpful. one last thing, is it a good idea to use this technique to identify a sound region of a bird? $\endgroup$ – user1114638 Jan 22 '12 at 12:22
  • $\begingroup$ I suspect this technique will not be very helpful in identifying birds, or anything else, since you're only looking at energy and completely ignoring frequency information. $\endgroup$ – Paul R Jan 22 '12 at 17:09
  • $\begingroup$ Actually my plan was to identify the exact bird sound region from this method and then use FFT on the sample values that are related to the bird and get a pattern that I can use to identify birds. $\endgroup$ – user1114638 Jan 22 '12 at 17:55
2
$\begingroup$

If you're trying to identify birds, you should look into the Mel-frequency Cepstral Coefficients (MFCCs). They are commonly used in speech recognition, and there's actually a fair amount of academic papers on bird song recognition using the MFCCs and various other features.

Short-term energy is definitely useful to extract areas of bird sound, but it probably won't be sufficient to just take an FFT and look for coefficients. For example, imagine the same two bird sounds, but one is slightly higher pitch, or there is more/different noise present. The FFT coefficients will be significantly different. The MFCCs basically capture the shape of the spectrum, on a scale that emphasizes regions of the spectrum where more detail is needed, and discard some of the unimportant details.

$\endgroup$
2
$\begingroup$

Yes, you are correct.

First, "centering" is meaningless in a moving window as long as everything is "centered" it all works out. The point is that you can use centered values but it won't change anything since it's all relative.

Second, you will have negative values at the start of the data set. There are various ways to overcome this such as zero-extending the data set in the negative range, periodically extending the data, mirroring the data, using a forward looking window instead of a backwards or centered window(but this can cause problems).

Your problem is analogous and overlaps with taking the derivative of a function of a finite interval.

Let $f(x) = x$ only on the interval $[0,1]$

what is the derivative at $f(0)$ and $f(1)$? Well, it doesn't exist. But instead we could either continuously extrapolate $f(x)$ to some larger interval then figure out what $f(0)$ and $f(1)$ or use the left and right derivatives.

You'll have to figure out how you want to deal with these end cases.

For example, if you used a forward looking window through out the data set you'll then end up with issues when you reach the end. You could use a forward window for the first half of the data set then a backwards window for the last half but then you'll have issues in the middle.

You could use a gliding window which starts in a forward looking position and transitions to a backwards position(and it will be a centered window at about the center of the data set).

Another method is to use a window that expands and contracts. It starts off as a size of 1 for the first data point, 2 for the second, 3 for the third... until it reaches it's maximum... then near the end of the it shrinks.

If you "discontinue" the loop you'll throw away a lot of data for no reason. It's a simple method and works when the data set is large and the window is small. But in some cases you have a window comparable to your data set. In your example, you'll essentially be throwing away the first 80 data points(well, you will have no computation for those data points).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.