diff --git a/utils/synthesis.py b/utils/synthesis.py index 58d3c433..df36438a 100644 --- a/utils/synthesis.py +++ b/utils/synthesis.py @@ -11,14 +11,19 @@ from matplotlib import pylab as plt def synthesis(m, s, CONFIG, use_cuda, ap): """ Given the text, synthesising the audio """ text_cleaner = [CONFIG.text_cleaner] - # print(phoneme_to_sequence(s, text_cleaner)) + # print(phoneme_to_sequence(s, text_cleaner))s # print(sequence_to_phoneme(phoneme_to_sequence(s, text_cleaner))) - seq = np.asarray( - phoneme_to_sequence(s, text_cleaner), dtype=np.int32) + if CONFIG.use_phonemes: + seq = np.asarray( + phoneme_to_sequence(s, text_cleaner, CONFIG.phoneme_language), + dtype=np.int32) + else: + seq = np.asarray(text_to_sequence(s, text_cleaner), dtype=np.int32) chars_var = torch.from_numpy(seq).unsqueeze(0) if use_cuda: chars_var = chars_var.cuda() - mel_spec, linear_spec, alignments, stop_tokens = m.forward(chars_var.long()) + mel_spec, linear_spec, alignments, stop_tokens = m.forward( + chars_var.long()) linear_spec = linear_spec[0].data.cpu().numpy() mel_spec = mel_spec[0].data.cpu().numpy() alignment = alignments[0].cpu().data.numpy()