def _griffin_lim(S, n_fft, win_length, hop_length, num_iters):
angles = np.exp(2j * np.pi * np.random.rand(*S.shape))
S_complex = np.abs(S).astype(np.complex)
for i in range(num_iters):
if i > 0:
angles = np.exp(1j * np.angle(librosa.stft(y=y, n_fft=n_fft, hop_length=hop_length, win_length=win_length)))
y = librosa.istft(S_complex * angles, hop_length=hop_length, win_length=win_length)
return y
评论列表
文章目录