mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 14:25:11 +03:00
gTTS (#4899)
* Release prep work * Add CZ support * Prep for release * No more need to prefix unicode strings (we use python3) Some fixes Italian fixes
This commit is contained in:
parent
53bb8bc6c3
commit
301e33a271
11 changed files with 591 additions and 525 deletions
|
@ -22,19 +22,27 @@ 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=" + filename + " \"" + str + "\""
|
||||
os.system(command.encode('utf-8'))
|
||||
if 0:
|
||||
output = "output.wav"
|
||||
command = 'pico2wave -l=%s -w=%s "%s"' % (voice, output, str)
|
||||
os.system(command.encode('utf-8'))
|
||||
command = "sox %s -r 32000 %s reverse silence 1 0.1 0.1%% reverse" % (output, filename)
|
||||
os.system(command.encode('utf-8'))
|
||||
else:
|
||||
output = "output.mp3"
|
||||
command = 'gtts-cli -l %s -o %s "%s"' % (voice[:2], output, str)
|
||||
os.system(command.encode('utf-8'))
|
||||
command = "sox %s -r 32000 %s" % (output, filename)
|
||||
os.system(command.encode('utf-8'))
|
||||
|
||||
################################################################
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
||||
if "en" in sys.argv:
|
||||
from tts_en import systemSounds, sounds
|
||||
|
||||
|
@ -65,6 +73,18 @@ if __name__ == "__main__":
|
|||
directory = "es"
|
||||
voice = "es-ES"
|
||||
|
||||
elif "cz" in sys.argv:
|
||||
from tts_cz import systemSounds, sounds
|
||||
|
||||
directory = "cz"
|
||||
voice = "cs-CZ"
|
||||
|
||||
elif "pt" in sys.argv:
|
||||
from tts_pt import systemSounds, sounds
|
||||
|
||||
directory = "pt"
|
||||
voice = "pt-PT"
|
||||
|
||||
else:
|
||||
print("which language?")
|
||||
exit()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue