Skip to main content
`Ctrl`+`K`

# scipy.signal.ShortTimeFFT.nearest_k_p

ShortTimeFFT.nearest_k_p(k, left=True)

  Return nearest sample index k_p for which t[k_p] == t[p] holds.

  The nearest next smaller time sample p (where t[p] is the center position of the window of the p-th slice) is p_k = k // `hop`. If `hop` is a divisor of k than k is returned. If left is set than p_k * `hop` is returned else (p_k+1) * `hop`.

  This method can be used to slice an input signal into chunks for calculating the STFT and iSTFT incrementally.

  See also

  `delta_t`

    Time increment of STFT (`hop*T`)

  `hop`

    Time increment in signal samples for sliding window.

  `T`

    Sampling interval of input signal and of the window (`1/fs`).

  `fs`

    Sampling frequency (being `1/T`)

  `t`

    Times of STFT for an input signal with n samples.

  `ShortTimeFFT`

    Class this method belongs to.