Remove trailing silence from audio files
This commit is contained in:
@@ -27,7 +27,9 @@ sys.path.append(lib_path)
|
|||||||
|
|
||||||
def generate(str, filename):
|
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'))
|
os.system(command.encode('utf-8'))
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
@@ -64,7 +66,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
directory = "es"
|
directory = "es"
|
||||||
voice = "es-ES"
|
voice = "es-ES"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("which language?")
|
print("which language?")
|
||||||
exit()
|
exit()
|
||||||
@@ -89,7 +91,7 @@ if __name__ == "__main__":
|
|||||||
l += u"SOUNDS/%s;" % directory
|
l += u"SOUNDS/%s;" % directory
|
||||||
l += f + u";" + s + u"\n"
|
l += f + u";" + s + u"\n"
|
||||||
csvFile.write(l.encode("utf-8"))
|
csvFile.write(l.encode("utf-8"))
|
||||||
|
|
||||||
if "files" in sys.argv:
|
if "files" in sys.argv:
|
||||||
path = "/tmp/SOUNDS/" + directory + "/SYSTEM/"
|
path = "/tmp/SOUNDS/" + directory + "/SYSTEM/"
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
@@ -101,5 +103,4 @@ if __name__ == "__main__":
|
|||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
for s, f in sounds:
|
for s, f in sounds:
|
||||||
if s and f:
|
if s and f:
|
||||||
generate(s, f)
|
generate(s, f)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user