def frequency_phase_rotation(values, angle, deg=False):
window_size = 64
noverlap = 32
window = signal.hann(window_size, sym=False)
if not signal.check_COLA(window, len(window), noverlap):
raise Exception('check_COLA failed.')
f, t, Zxx = signal.stft(values, window=window, nperseg=window_size,
noverlap=noverlap
)
Zxx_rotated = np.zeros(Zxx.shape, dtype=np.complex)
for freq_idx in range(Zxx.shape[0]): # Loop over all frequencies
Zxx_rotated[freq_idx] = phase_rotation(Zxx[freq_idx], angle, deg)
t, x = signal.istft(Zxx_rotated, window=window, nperseg=window_size,
noverlap=noverlap
)
return t, x
评论列表
文章目录