mirror of https://github.com/coqui-ai/TTS.git
enable phoneme based synthesizing
This commit is contained in:
parent
72341ae22a
commit
915783e10e
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue