3
$\begingroup$

I am reading the documentation of scipy.signal.stft function. My question: is the 'noverlap' parameter of this function equivalent with STFT hop size?

$\endgroup$
2
  • 1
    $\begingroup$ You might want to check out this answer for a reasonably complete description of STFT and how FFT size, overlap %, and Hop size are all related. $\endgroup$ Commented Dec 2, 2021 at 5:32
  • 1
    $\begingroup$ This answer might also be useful, if you're using a rectangular window and doing fast convolution. $\endgroup$ Commented Dec 2, 2021 at 5:41

2 Answers 2

2
$\begingroup$

The hop size $M$ is the number of samples between each successive FFT. The 'noverlap' parameter is the number of samples $n$ to overlap between segments (and will default to $N/2$ where $N$ is the FFT frame size). The relationship between hop size, frame size and overlap is:

$M$ = $N - n$

If there is no overlap then this would simply be the total number of samples in the FFT frame. In certain uses the overlap is given as an "Overlap Factor", where a factor of 2 would refer to a 50% overlap (stated here in case that was a source of the OP's confusion; 'noverlap' is clearly stated in the documentation as the number of samples and does not represent "overlap factor").

$\endgroup$
1
$\begingroup$

For those ending up here, as stated in 'Notes' at the official SciPy documentation:

hop size = nperseg - noverlap

$\endgroup$

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.