mirror of https://github.com/coqui-ai/TTS.git
fix synthesize.py
This commit is contained in:
parent
f8ebf6abcd
commit
e540a54959
|
@ -25,14 +25,16 @@ def tts(model,
|
||||||
t_1 = time.time()
|
t_1 = time.time()
|
||||||
use_vocoder_model = vocoder_model is not None
|
use_vocoder_model = vocoder_model is not None
|
||||||
waveform, alignment, _, postnet_output, stop_tokens = synthesis(
|
waveform, alignment, _, postnet_output, stop_tokens = synthesis(
|
||||||
model, text, C, use_cuda, ap, speaker_id, False,
|
model, text, C, use_cuda, ap, speaker_id, style_wav=False,
|
||||||
C.enable_eos_bos_chars)
|
truncated=False, enable_eos_bos_chars=C.enable_eos_bos_chars,
|
||||||
|
use_griffin_lim=(not use_vocoder_model), do_trim_silence=True)
|
||||||
|
|
||||||
if C.model == "Tacotron" and use_vocoder_model:
|
if C.model == "Tacotron" and use_vocoder_model:
|
||||||
postnet_output = ap.out_linear_to_mel(postnet_output.T).T
|
postnet_output = ap.out_linear_to_mel(postnet_output.T).T
|
||||||
# correct if there is a scale difference b/w two models
|
# correct if there is a scale difference b/w two models
|
||||||
|
if use_vocoder_model:
|
||||||
postnet_output = ap._denormalize(postnet_output)
|
postnet_output = ap._denormalize(postnet_output)
|
||||||
postnet_output = ap_vocoder._normalize(postnet_output)
|
postnet_output = ap_vocoder._normalize(postnet_output)
|
||||||
if use_vocoder_model:
|
|
||||||
vocoder_input = torch.FloatTensor(postnet_output.T).unsqueeze(0)
|
vocoder_input = torch.FloatTensor(postnet_output.T).unsqueeze(0)
|
||||||
waveform = vocoder_model.generate(
|
waveform = vocoder_model.generate(
|
||||||
vocoder_input.cuda() if use_cuda else vocoder_input,
|
vocoder_input.cuda() if use_cuda else vocoder_input,
|
||||||
|
@ -58,7 +60,7 @@ if __name__ == "__main__":
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'out_path',
|
'out_path',
|
||||||
type=str,
|
type=str,
|
||||||
help='Path to save final wav file.',
|
help='Path to save final wav file. Wav file will be names as the text given.',
|
||||||
)
|
)
|
||||||
parser.add_argument('--use_cuda',
|
parser.add_argument('--use_cuda',
|
||||||
type=bool,
|
type=bool,
|
||||||
|
|
Loading…
Reference in New Issue