mirror of https://github.com/coqui-ai/TTS.git
Merge pull request #406 from mittimithai/patch-6
small change for multispeaker
This commit is contained in:
commit
93cab61d80
|
@ -164,16 +164,20 @@ class Synthesizer(object):
|
||||||
sentences = list(filter(None, [s.strip() for s in sentences])) # remove empty sentences
|
sentences = list(filter(None, [s.strip() for s in sentences])) # remove empty sentences
|
||||||
return sentences
|
return sentences
|
||||||
|
|
||||||
def tts(self, text):
|
def tts(self, text, speaker_id=None):
|
||||||
wavs = []
|
wavs = []
|
||||||
sens = self.split_into_sentences(text)
|
sens = self.split_into_sentences(text)
|
||||||
print(sens)
|
print(sens)
|
||||||
|
speaker_id = id_to_torch(speaker_id)
|
||||||
|
if speaker_id is not None and self.use_cuda:
|
||||||
|
speaker_id = speaker_id.cuda()
|
||||||
|
|
||||||
for sen in sens:
|
for sen in sens:
|
||||||
# preprocess the given text
|
# preprocess the given text
|
||||||
inputs = text_to_seqvec(sen, self.tts_config, self.use_cuda)
|
inputs = text_to_seqvec(sen, self.tts_config, self.use_cuda)
|
||||||
# synthesize voice
|
# synthesize voice
|
||||||
decoder_output, postnet_output, alignments, _ = run_model(
|
decoder_output, postnet_output, alignments, _ = run_model(
|
||||||
self.tts_model, inputs, self.tts_config, False, None, None)
|
self.tts_model, inputs, self.tts_config, False, speaker_id, None)
|
||||||
# convert outputs to numpy
|
# convert outputs to numpy
|
||||||
postnet_output, decoder_output, _ = parse_outputs(
|
postnet_output, decoder_output, _ = parse_outputs(
|
||||||
postnet_output, decoder_output, alignments)
|
postnet_output, decoder_output, alignments)
|
||||||
|
|
Loading…
Reference in New Issue