Added: scripts for nightly/rc/release builds (SD card content, Russian voice), Audio normalization, PSV files for TTSAutomate (#5469)

* Added: scripts for nightly build (SD card content, Russian voice), system sounds: done, other sounds: partially
Fixed: gTTS issue with unicode (Cyrillic) chars in command params (gTTS module instead of system command)

* Fixed: gTTS issue with Unicode (Cyrillic) chars in command params (gTTS module instead of system command), for release candidates and release
Changed: SOX params to normalize the audio
Added: "psv" parameter to export list of audio files into PSV format (see TTSAutomate https://github.com/CaffeineAU/TTSAutomate , to generate voice files using TTS engines from Microsoft, Amazon, Google etc)
Added: some extra voice files for RU
This commit is contained in:
Alexander Novikov
2017-12-20 18:30:44 +01:00
committed by Bertrand Songis
parent 63f6e0c43d
commit 14d5416616
7 changed files with 224 additions and 12 deletions
+1
View File
@@ -35,6 +35,7 @@ else
python3 -B ${workdir}/code/tools/nightly22/tts.py de csv files
python3 -B ${workdir}/code/tools/nightly22/tts.py cz csv files
python3 -B ${workdir}/code/tools/nightly22/tts.py pt csv files
python3 -B ${workdir}/code/tools/nightly22/tts.py ru csv psv files
# Create sdcards.zips for supported platforms
mv /tmp/SOUNDS ${workdir}/sdcard/horus/
+27 -4
View File
@@ -19,6 +19,7 @@ import os
import sys
import subprocess
import zipfile
from gtts import gTTS
from tts_common import *
board = "taranis"
@@ -34,10 +35,10 @@ def generate(str, filename):
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 tempo 1.2" % (output, filename)
output = u"output.mp3"
tts = gTTS(text=str, lang=voice[:2])
tts.save(output)
command = "sox --norm %s -r 32000 %s tempo 1.2" % (output, filename)
os.system(command.encode('utf-8'))
command = "rm -f output.mp3"
os.system(command.encode('utf-8'))
@@ -81,6 +82,12 @@ if __name__ == "__main__":
directory = "cz"
voice = "cs-CZ"
elif "ru" in sys.argv:
from tts_ru import systemSounds, sounds
directory = "ru"
voice = "ru-RU"
elif "pt" in sys.argv:
from tts_pt import systemSounds, sounds
@@ -112,6 +119,22 @@ if __name__ == "__main__":
l += f + u";" + s + u"\n"
csvFile.write(l.encode("utf-8"))
if "psv" in sys.argv:
path = "/tmp/SOUNDS/" + directory + "/"
if not os.path.exists(path):
os.makedirs(path)
os.chdir(path)
with open("%s-%s.psv" % (voice, board), "wb") as csvFile:
for s, f in systemSounds:
if s and f:
l = u"SYSTEM|" + f.replace(".wav", "") + u"|" + s + u"\r\n"
csvFile.write(l.encode("windows-1251"))
for s, f in sounds:
if s and f:
l = u"|" + f.replace(".wav", "") + u"|" + s + u"\r\n"
csvFile.write(l.encode("windows-1251"))
if "files" in sys.argv:
path = "/tmp/SOUNDS/" + directory + "/SYSTEM/"
if not os.path.exists(path):
+1
View File
@@ -45,6 +45,7 @@ else
python3 -B ${workdir}/code/tools/rc22/tts.py de csv files
python3 -B ${workdir}/code/tools/nightly22/tts.py cz csv files
python3 -B ${workdir}/code/tools/nightly22/tts.py pt csv files
python3 -B ${workdir}/code/tools/nightly22/tts.py ru csv psv files
# Create sdcards.zips for supported platforms
mv /tmp/SOUNDS ${workdir}/sdcard/horus/
+26 -4
View File
@@ -19,6 +19,7 @@ import os
import sys
import subprocess
import zipfile
from gtts import gTTS
from tts_common import *
board = "taranis"
@@ -34,10 +35,10 @@ def generate(str, filename):
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 tempo 1.2" % (output, filename)
output = u"output.mp3"
tts = gTTS(text=str, lang=voice[:2])
tts.save(output)
command = "sox --norm %s -r 32000 %s tempo 1.2" % (output, filename)
os.system(command.encode('utf-8'))
command = "rm -f output.mp3"
os.system(command.encode('utf-8'))
@@ -81,6 +82,12 @@ if __name__ == "__main__":
directory = "cz"
voice = "cs-CZ"
elif "ru" in sys.argv:
from tts_ru import systemSounds, sounds
directory = "ru"
voice = "ru-RU"
elif "pt" in sys.argv:
from tts_pt import systemSounds, sounds
@@ -112,6 +119,21 @@ if __name__ == "__main__":
l += f + u";" + s + u"\n"
csvFile.write(l.encode("utf-8"))
if "psv" in sys.argv:
path = "/tmp/SOUNDS/" + directory + "/"
if not os.path.exists(path):
os.makedirs(path)
os.chdir(path)
with open("%s-%s.psv" % (voice, board), "wb") as csvFile:
for s, f in systemSounds:
if s and f:
l = u"SYSTEM|" + f.replace(".wav", "") + u"|" + s + u"\r\n"
csvFile.write(l.encode("windows-1251"))
for s, f in sounds:
if s and f:
l = u"|" + f.replace(".wav", "") + u"|" + s + u"\r\n"
csvFile.write(l.encode("windows-1251"))
if "files" in sys.argv:
path = "/tmp/SOUNDS/" + directory + "/SYSTEM/"
if not os.path.exists(path):
+1
View File
@@ -39,6 +39,7 @@ else
python3 -B ${workdir}/code/tools/release22/tts.py de csv files
python3 -B ${workdir}/code/tools/nightly22/tts.py cz csv files
python3 -B ${workdir}/code/tools/nightly22/tts.py pt csv files
python3 -B ${workdir}/code/tools/nightly22/tts.py ru csv psv files
# Create sdcards.zips for supported platforms
mv /tmp/SOUNDS ${workdir}/sdcard/horus/
+26 -4
View File
@@ -19,6 +19,7 @@ import os
import sys
import subprocess
import zipfile
from gtts import gTTS
from tts_common import *
board = "taranis"
@@ -34,10 +35,10 @@ def generate(str, filename):
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 tempo 1.2" % (output, filename)
output = u"output.mp3"
tts = gTTS(text=str, lang=voice[:2])
tts.save(output)
command = "sox --norm %s -r 32000 %s tempo 1.2" % (output, filename)
os.system(command.encode('utf-8'))
command = "rm -f output.mp3"
os.system(command.encode('utf-8'))
@@ -81,6 +82,12 @@ if __name__ == "__main__":
directory = "cz"
voice = "cs-CZ"
elif "ru" in sys.argv:
from tts_ru import systemSounds, sounds
directory = "ru"
voice = "ru-RU"
elif "pt" in sys.argv:
from tts_pt import systemSounds, sounds
@@ -112,6 +119,21 @@ if __name__ == "__main__":
l += f + u";" + s + u"\n"
csvFile.write(l.encode("utf-8"))
if "psv" in sys.argv:
path = "/tmp/SOUNDS/" + directory + "/"
if not os.path.exists(path):
os.makedirs(path)
os.chdir(path)
with open("%s-%s.psv" % (voice, board), "wb") as csvFile:
for s, f in systemSounds:
if s and f:
l = u"SYSTEM|" + f.replace(".wav", "") + u"|" + s + u"\r\n"
csvFile.write(l.encode("windows-1251"))
for s, f in sounds:
if s and f:
l = u"|" + f.replace(".wav", "") + u"|" + s + u"\r\n"
csvFile.write(l.encode("windows-1251"))
if "files" in sys.argv:
path = "/tmp/SOUNDS/" + directory + "/SYSTEM/"
if not os.path.exists(path):