def test_trim_remove_zeros_frames():
fs, x = wavfile.read(example_audio_file())
frame_period = 5
x = x.astype(np.float64)
f0, timeaxis = pyworld.dio(x, fs, frame_period=frame_period)
spectrogram = pyworld.cheaptrick(x, f0, timeaxis, fs)
aperiodicity = pyworld.d4c(x, f0, timeaxis, fs)
for mat in [spectrogram, aperiodicity]:
trimmed = trim_zeros_frames(mat)
assert trimmed.shape[1] == mat.shape[1]
for mat in [spectrogram, aperiodicity]:
trimmed = remove_zeros_frames(mat)
assert trimmed.shape[1] == mat.shape[1]
评论列表
文章目录