[TTS] gTTS method added

This commit is contained in:
Bertrand Songis
2017-04-26 12:33:12 +02:00
parent b0183efaf1
commit 37155363ff
+9 -6
View File
@@ -22,21 +22,24 @@ import zipfile
from tts_common import *
board = "taranis"
lib_path = os.path.abspath(os.path.join('code', 'radio', 'util'))
SOURCE_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
lib_path = os.path.abspath(os.path.join(SOURCE_DIRECTORY, '..', '..', 'radio', 'util'))
sys.path.append(lib_path)
def generate(str, filename):
command = "pico2wave -l=" + voice + " -w=output.wav \"" + str + "\""
if 1:
output = "output.wav"
command = 'pico2wave -l=%s -w=%s ""' % (voice, output, str)
else:
output = "output.mp3"
command = 'gtts-cli -l %s -o %s "%s"' % (voice[:2], output, str)
os.system(command.encode('utf-8'))
command = "sox output.wav " + filename + " reverse silence 1 0.1 0.1% reverse"
command = "sox %s %s reverse silence 1 0.1 0.1% reverse" % (output, filename)
os.system(command.encode('utf-8'))
################################################################
if __name__ == "__main__":
if "en" in sys.argv:
from tts_en import systemSounds, sounds