[TTS] gTTS method added
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user