From 0dbed8fef7d257c3823301714c0cd9cd9cafac7a Mon Sep 17 00:00:00 2001 From: Eren Golge Date: Mon, 27 May 2019 14:41:59 +0200 Subject: [PATCH] New method to convert Tacotron output to mel psectrograms --- utils/audio.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/utils/audio.py b/utils/audio.py index 83b929cb..1a5c52a3 100644 --- a/utils/audio.py +++ b/utils/audio.py @@ -173,6 +173,14 @@ class AudioProcessor(object): else: return self._griffin_lim(S**self.power) + def out_linear_to_mel(self, linear_spec): + S = self._denormalize(linear_spec) + S = self._db_to_amp(S + self.ref_level_db) + S = self._linear_to_mel(np.abs(S)) + S = self._amp_to_db(S) - self.ref_level_db + mel = self._normalize(S) + return mel + def _griffin_lim(self, S): angles = np.exp(2j * np.pi * np.random.rand(*S.shape)) S_complex = np.abs(S).astype(np.complex)