I'm trying to calculate the short term energy of a digital signal in python, using a rectangular window, but don't understand the basics of how this works, a pointer to any good explanation would be great.

Specific things I'm confused about:

  • Where do I initialise the window? (at position 0,window_length, or -window_length,0, and then work through the signal? ...)

  • If I sum up the squares of all samples at every position inside the window, don't I end up with a 'square signal', where all the values are the same for the length of the window step?



1 Answer 1


For initializing window you need the start point would depend on your overlap. If the overlap is 50% then you would start at window_length/2 If you are using a rectangular window and with 50% overlap in that case you want to use a square root rectangular window on the input and output so that there are no scaling issues. so basically you window will be scaled also dependent on your overlap.

Also it would be worthwhile to consider using other windows dependent on your application. As in a lot of other windows the scaling is taking into account.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.