From 9c19889309aa1f1c5820ed59214bfa0ff6f9b0a8 Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 10 Apr 2017 13:16:39 +0200 Subject: [PATCH] Remove trailing silence from audio files --- tools/nightly22/tts.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/nightly22/tts.py b/tools/nightly22/tts.py index 2829a2f8b..03780db49 100755 --- a/tools/nightly22/tts.py +++ b/tools/nightly22/tts.py @@ -27,7 +27,9 @@ sys.path.append(lib_path) def generate(str, filename): - command = "pico2wave -l=" + voice + " -w=" + filename + " \"" + str + "\"" + command = "pico2wave -l=" + voice + " -w=output.wav \"" + str + "\"" + os.system(command.encode('utf-8')) + command = "sox output.wav " + filename + " reverse silence 1 0.1 0.1% reverse" os.system(command.encode('utf-8')) ################################################################ @@ -64,7 +66,7 @@ if __name__ == "__main__": directory = "es" voice = "es-ES" - + else: print("which language?") exit() @@ -89,7 +91,7 @@ if __name__ == "__main__": l += u"SOUNDS/%s;" % directory l += f + u";" + s + u"\n" csvFile.write(l.encode("utf-8")) - + if "files" in sys.argv: path = "/tmp/SOUNDS/" + directory + "/SYSTEM/" if not os.path.exists(path): @@ -101,5 +103,4 @@ if __name__ == "__main__": os.chdir("..") for s, f in sounds: if s and f: - generate(s, f) - + generate(s, f)