From 5ff8544d6a2b94eb1bf6b6a14279a78b38555990 Mon Sep 17 00:00:00 2001 From: Eren Golge Date: Tue, 20 Aug 2019 13:22:04 +0200 Subject: [PATCH] force frame_length to be a multiple hop_length --- utils/audio.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/audio.py b/utils/audio.py index d4d9d67f..794520af 100644 --- a/utils/audio.py +++ b/utils/audio.py @@ -113,8 +113,10 @@ class AudioProcessor(object): def _stft_parameters(self, ): """Compute necessary stft parameters with given time values""" n_fft = (self.num_freq - 1) * 2 + factor = self.frame_length_ms / self.frame_shift_ms + assert (factor).is_integer(), " [!] frame_shift_ms should divide frame_length_ms" hop_length = int(self.frame_shift_ms / 1000.0 * self.sample_rate) - win_length = int(self.frame_length_ms / 1000.0 * self.sample_rate) + win_length = int(hop_length * factor) return n_fft, hop_length, win_length def _amp_to_db(self, x):