update comments

master
Malar Kannan 2019-07-05 14:33:04 +05:30
parent 9413fb73b9
commit 755362518a
1 changed files with 5 additions and 14 deletions

19
tts.py
View File

@ -20,6 +20,7 @@ from .model import Tacotron2
TTS_SAMPLE_RATE = 22050 TTS_SAMPLE_RATE = 22050
OUTPUT_SAMPLE_RATE = 16000 OUTPUT_SAMPLE_RATE = 16000
# config from
# https://github.com/NVIDIA/waveglow/blob/master/config.json # https://github.com/NVIDIA/waveglow/blob/master/config.json
WAVEGLOW_CONFIG = { WAVEGLOW_CONFIG = {
"n_mel_channels": 80, "n_mel_channels": 80,
@ -55,7 +56,7 @@ class TTSModel(object):
self.synth_speech = klepto.safe.inf_cache(cache=self.k_cache)( self.synth_speech = klepto.safe.inf_cache(cache=self.k_cache)(
self.synth_speech self.synth_speech
) )
# workaround from
# https://github.com/NVIDIA/waveglow/issues/127 # https://github.com/NVIDIA/waveglow/issues/127
for m in self.waveglow.modules(): for m in self.waveglow.modules():
if "Conv" in str(type(m)): if "Conv" in str(type(m)):
@ -81,17 +82,7 @@ class TTSModel(object):
return data.tobytes() return data.tobytes()
# def convert(array): # adapted from
# sf.write('sample.wav', array, TTS_SAMPLE_RATE)
# # convert to $OUTPUT_SAMPLE_RATE
# os.system('ffmpeg -i {0} -filter:a "atempo=0.80" -ar 16k {1}'.format(
# 'sample.wav', 'sample0.wav'))
# data, rate = sf.read('sample0.wav', dtype='int16')
# os.remove('sample.wav')
# os.remove('sample0.wav')
# return data
# https://github.com/mgeier/python-audio/blob/master/audio-files/utility.py # https://github.com/mgeier/python-audio/blob/master/audio-files/utility.py
def float2pcm(sig, dtype="int16"): def float2pcm(sig, dtype="int16"):
"""Convert floating point signal with a range from -1 to 1 to PCM. """Convert floating point signal with a range from -1 to 1 to PCM.
@ -171,9 +162,9 @@ def play_corpus(corpus_synths):
def main(): def main():
corpus_synth_data = synthesize_corpus() corpus_synth_data = synthesize_corpus()
play_corpus(corpus_synth_data) play_corpus(corpus_synth_data)
import ipdb import pdb
ipdb.set_trace() pdb.set_trace()
if __name__ == "__main__": if __name__ == "__main__":