mirror of https://github.com/coqui-ai/TTS.git
set an output_sample_rate in synthesizer and use it for writing the wav
file
This commit is contained in:
parent
0c52d27d65
commit
8aa6a0decb
|
@ -45,8 +45,10 @@ class Synthesizer(object):
|
||||||
assert torch.cuda.is_available(), "CUDA is not availabe on this machine."
|
assert torch.cuda.is_available(), "CUDA is not availabe on this machine."
|
||||||
self.load_tts(tts_checkpoint, tts_config,
|
self.load_tts(tts_checkpoint, tts_config,
|
||||||
use_cuda)
|
use_cuda)
|
||||||
|
self.output_sample_rate = self.tts_config.audio['sample_rate']
|
||||||
if vocoder_checkpoint:
|
if vocoder_checkpoint:
|
||||||
self.load_vocoder(vocoder_checkpoint, vocoder_config, use_cuda)
|
self.load_vocoder(vocoder_checkpoint, vocoder_config, use_cuda)
|
||||||
|
self.output_sample_rate = self.vocoder_config.audio['sample_rate']
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_segmenter(lang):
|
def get_segmenter(lang):
|
||||||
|
@ -75,6 +77,7 @@ class Synthesizer(object):
|
||||||
|
|
||||||
def load_tts(self, tts_checkpoint, tts_config, use_cuda):
|
def load_tts(self, tts_checkpoint, tts_config, use_cuda):
|
||||||
# pylint: disable=global-statement
|
# pylint: disable=global-statement
|
||||||
|
|
||||||
global symbols, phonemes
|
global symbols, phonemes
|
||||||
|
|
||||||
self.tts_config = load_config(tts_config)
|
self.tts_config = load_config(tts_config)
|
||||||
|
@ -104,7 +107,7 @@ class Synthesizer(object):
|
||||||
|
|
||||||
def save_wav(self, wav, path):
|
def save_wav(self, wav, path):
|
||||||
wav = np.array(wav)
|
wav = np.array(wav)
|
||||||
self.ap.save_wav(wav, path)
|
self.ap.save_wav(wav, path, self.output_sample_rate)
|
||||||
|
|
||||||
def split_into_sentences(self, text):
|
def split_into_sentences(self, text):
|
||||||
return self.seg.segment(text)
|
return self.seg.segment(text)
|
||||||
|
|
Loading…
Reference in New Issue