1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 00:35:18 +03:00

update to allow sox to be used as an option!

This commit is contained in:
rob@marotori.com 2012-07-13 10:03:05 +00:00
parent 7ca6a733c8
commit b86c0b4aaa

View file

@ -6,6 +6,8 @@
# Python 2.5 http://www.python.org/download/releases/2.5.4/
# Python 2.7 http://www.python.org/download/releases/2.7.3/
# PyTTS http://pypi.python.org/pypi/pyTTS
# PyWin32 http://sourceforge.net/projects/pywin32/files/pywin32/
#
# Note
# At the moment, pyTTS is only available for Python 2.3, 2.4 and 2.5. To use it for later versions without having to
@ -45,14 +47,22 @@ def generate(str, idx):
os.remove(temp)
else:
subprocess.Popen(["C:\Program Files\eSpeak\command_line\espeak.exe", "-z", "-w", "%04d.wav" % idx, str], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
#subprocess.Popen(["C:\Program Files\eSpeak\command_line\espeak.exe", "-z", "-w", "%04d.wav" % idx, str], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
subprocess.Popen(["espeak.exe", "-z", "-w", "%04d.wav" % idx, str], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
if not "speak" in sys.argv:
if 'ad4' in sys.argv:
subprocess.Popen(["D:\Perso\workspace\companion9x\AD4CONVERTER.EXE", "-E4", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
#subprocess.Popen(["D:\Perso\workspace\companion9x\AD4CONVERTER.EXE", "-E4", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
subprocess.Popen(["AD4CONVERTER.EXE", "-E4", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
result = result.replace(".wav", ".ad4")
elif 'sox' in sys.argv:
maxvolume=subprocess.Popen(["sox",result,"-n","stat","-v"],stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[1]
subprocess.Popen(["sox.exe", "--show-progress","-v",maxvolume,result,temp],stdout=subprocess.PIPE).communicate()[0];
subprocess.Popen(["sox.exe", "-twav", temp, "-b1600","-c1","-e","a-law",result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
os.remove(temp)
else:
os.rename(result, temp)
subprocess.Popen(["C:/Programs/ffmpeg/bin/ffmpeg.exe", "-y", "-i", temp, "-acodec", "pcm_alaw", "-ar", "16000", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
os.rename(result, temp)
#subprocess.Popen(["C:/Programs/ffmpeg/bin/ffmpeg.exe", "-y", "-i", temp, "-acodec", "pcm_alaw", "-ar", "16000", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
subprocess.Popen(["ffmpeg.exe", "-y", "-i", temp, "-acodec", "pcm_alaw", "-ar", "16000", result], stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
os.remove(temp)
if result: