From 9397a56b1325f18ad4e017d1fe81b7293a820e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eren=20G=C3=B6lge?= Date: Tue, 30 Nov 2021 15:53:00 +0100 Subject: [PATCH] Allow init_from_config from model or audio config --- TTS/utils/audio.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TTS/utils/audio.py b/TTS/utils/audio.py index ee255f44..bdee8615 100644 --- a/TTS/utils/audio.py +++ b/TTS/utils/audio.py @@ -381,7 +381,10 @@ class AudioProcessor(object): @staticmethod def init_from_config(config: "Coqpit"): - return AudioProcessor(**config.audio) + if "audio" in config: + return AudioProcessor(**config.audio) + else: + return AudioProcessor(**config) ### setting up the parameters ### def _build_mel_basis( @@ -729,6 +732,7 @@ class AudioProcessor(object): >>> wav = ap.load_wav(WAV_FILE, sr=22050)[:5 * 22050] >>> pitch = ap.compute_f0(wav) """ + assert self.mel_fmax is not None, " [!] Set `mel_fmax` before caling `compute_f0`." # align F0 length to the spectrogram length if len(x) % self.hop_length == 0: x = np.pad(x, (0, self.hop_length // 2), mode="reflect")