How can I understand in which time position in STFT function output am I?

For example, if I have 3987 time frame in the output of STFT, my window length is 625 (hamming), my hop size is 125 and the length of signal is 2 second.

  • How can I estimate for example the first 5 milisecond or a window of 10 milisecond in the ouput of STFT? I know that the the number of time frames are calculated by

    coln = 1+fix((xlen-wlen)/h);

  • But how is the equation in my situation?

  • Can I say that each time frame has a length of hop size?

1 Answer 1


Assuming 0-based vectors, hop size $H$, and window size $M$, the frame number $N_f$ will contain the DFT of a window that starts on sample $n_1 = N_f \times H$ and ends on sample $n_2 = n_1 + M -1$.

That means that for each STFT frame, you shift the window by $H$ samples. Note that $H$ and $M$ not necessarily coincide.

  • $\begingroup$ Dear @Juancho, so, is it correct to say that each hop size equals the time frame lenght? $\endgroup$
    – reo
    Mar 21, 2017 at 10:11

Your Answer

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

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