1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-27 02:05:16 +03:00

sky9x and gruvin9x args (instead of arm and v4) in tts.py

This commit is contained in:
bsongis 2012-10-29 22:12:07 +00:00
parent 3875bf981d
commit 8144b42a6d

View file

@ -34,7 +34,7 @@ def generate(str, idx, alternate=0):
else: else:
if isinstance(idx, int): if isinstance(idx, int):
result = "%04d.wav" % idx result = "%04d.wav" % idx
elif board == 'arm': elif board == 'sky9x':
result = idx + ".wav" result = idx + ".wav"
else: else:
if alternate == 0: if alternate == 0:
@ -78,7 +78,7 @@ def generate(str, idx, alternate=0):
print "which speach engine?" print "which speach engine?"
return [] return []
if board == 'arm': if board == 'sky9x':
if 'sox' in sys.argv: if 'sox' in sys.argv:
maxvolume = subprocess.Popen(["sox",result,"-n","stat","-v"],stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[1] maxvolume = subprocess.Popen(["sox",result,"-n","stat","-v"],stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[1]
if "not sound" in maxvolume: if "not sound" in maxvolume:
@ -92,7 +92,7 @@ def generate(str, idx, alternate=0):
os.rename(result, temp) os.rename(result, temp)
subprocess.Popen(["ffmpeg", "-y", "-i", temp, "-acodec", "pcm_alaw", "-ar", "16000", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait() subprocess.Popen(["ffmpeg", "-y", "-i", temp, "-acodec", "pcm_alaw", "-ar", "16000", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
os.remove(temp) os.remove(temp)
elif board == 'v4': elif board == 'gruvin9x':
subprocess.Popen(["AD4CONVERTER", "-E4", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait() subprocess.Popen(["AD4CONVERTER", "-E4", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
os.remove(result) os.remove(result)
result = result.replace(".wav", ".ad4") result = result.replace(".wav", ".ad4")
@ -114,10 +114,10 @@ if __name__ == "__main__":
sounds = [] sounds = []
systemSounds = [] systemSounds = []
if "arm" in sys.argv: if "sky9x" in sys.argv:
board = "arm" board = "sky9x"
elif "v4" in sys.argv: elif "gruvin9x" in sys.argv:
board = "v4" board = "gruvin9x"
else: else:
board = "stock" board = "stock"
@ -425,13 +425,13 @@ if __name__ == "__main__":
csvFile = open(voice + ".csv", "w") csvFile = open(voice + ".csv", "w")
for f, s in systemSounds: for f, s in systemSounds:
l = u"" l = u""
if board == "arm": if board == "sky9x":
l += u"9XSOUNDS/SYSTEM;" l += u"9XSOUNDS/SYSTEM;"
l += f + u";" + s + u"\n" l += f + u";" + s + u"\n"
csvFile.write(l.encode("latin-1")) csvFile.write(l.encode("latin-1"))
for f, s in sounds: for f, s in sounds:
l = u"" l = u""
if board == "arm": if board == "sky9x":
l += u"9XSOUNDS;" l += u"9XSOUNDS;"
l += f + u";" + s + u"\n" l += f + u";" + s + u"\n"
csvFile.write(l.encode("latin-1")) csvFile.write(l.encode("latin-1"))
@ -441,13 +441,13 @@ if __name__ == "__main__":
zip_name = voice + ".zip" zip_name = voice + ".zip"
zip = zipfile.ZipFile(zip_name, "w", zipfile.ZIP_DEFLATED) zip = zipfile.ZipFile(zip_name, "w", zipfile.ZIP_DEFLATED)
for f, s in systemSounds: for f, s in systemSounds:
if board == "arm": if board == "sky9x":
zip.write(f, "9XSOUNDS/SYSTEM/" + f) zip.write(f, "9XSOUNDS/SYSTEM/" + f)
else: else:
zip.write(f, f) zip.write(f, f)
os.remove(f) os.remove(f)
for f, s in sounds: for f, s in sounds:
if board == "arm": if board == "sky9x":
zip.write(f, "9XSOUNDS/" + f) zip.write(f, "9XSOUNDS/" + f)
else: else:
zip.write(f, f) zip.write(f, f)