scipy.signal.ShortTimeFFT.
nearest_k_p#
- ShortTimeFFT.nearest_k_p(k, left=True)[source]#
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) isp_k = k // hop. Ifhopis a divisor of k then k is returned. If left is set thenp_k * hopis 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.
- Parameters:
- kint
Sample index for which the nearest slice center index is sought.
- leftbool, optional
If
Truethen the nearest smaller index is returned, else the nearest larger index is returned. Defaults toTrue.
- Returns:
- int
Nearest sample index k_p for which
t[k_p] == t[p]holds.