mirror of https://github.com/coqui-ai/TTS.git
Allow init_from_config from model or audio config
This commit is contained in:
parent
a71a013276
commit
9397a56b13
|
@ -381,7 +381,10 @@ class AudioProcessor(object):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def init_from_config(config: "Coqpit"):
|
def init_from_config(config: "Coqpit"):
|
||||||
|
if "audio" in config:
|
||||||
return AudioProcessor(**config.audio)
|
return AudioProcessor(**config.audio)
|
||||||
|
else:
|
||||||
|
return AudioProcessor(**config)
|
||||||
|
|
||||||
### setting up the parameters ###
|
### setting up the parameters ###
|
||||||
def _build_mel_basis(
|
def _build_mel_basis(
|
||||||
|
@ -729,6 +732,7 @@ class AudioProcessor(object):
|
||||||
>>> wav = ap.load_wav(WAV_FILE, sr=22050)[:5 * 22050]
|
>>> wav = ap.load_wav(WAV_FILE, sr=22050)[:5 * 22050]
|
||||||
>>> pitch = ap.compute_f0(wav)
|
>>> 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
|
# align F0 length to the spectrogram length
|
||||||
if len(x) % self.hop_length == 0:
|
if len(x) % self.hop_length == 0:
|
||||||
x = np.pad(x, (0, self.hop_length // 2), mode="reflect")
|
x = np.pad(x, (0, self.hop_length // 2), mode="reflect")
|
||||||
|
|
Loading…
Reference in New Issue