def __init__(self, window_size, segments_buf=None):
self._window_size = window_size
if segments_buf is None:
segments_buf = int(SAMPLE_RATE / window_size)
self._segments_buf = segments_buf
self._thresholding_window_size = THRESHOLD_WINDOW_SIZE
assert self._thresholding_window_size <= segments_buf
self._last_spectrum = np.zeros(window_size, dtype=np.int16)
self._last_flux = deque(
np.zeros(segments_buf, dtype=np.int16), segments_buf)
self._last_prunned_flux = 0
self._hanning_window = np.hanning(window_size)
# The zeros which will be used to double each segment size
self._inner_pad = np.zeros(window_size)
# To ignore the first peak just after starting the application
self._first_peak = True
评论列表
文章目录