Trying to Split Wav file into two pieces with SoX

2019-07-03 18:12发布

问题:

I'm trying to split one .wav file into two pieces where there is a few seconds of silence. Based on the documentation I've found, the following should work:

 sox testfile.wav tester.wav silence 1 0.50 0.1% 1 1.0 0.1% : newfile : restart

"testfile.wav" is a voice recording and I put about 4 seconds of silence right in the middle of it to test. The expected result is that I would get "tester001.wav" and "tester002.wav" from running this. Instead I get one file - "tester.wav" which is the first part of the original file (right up to the silence). I'm wondering how to make it continue and make a new file from the part AFTER the silence.

I found this: sox fails to split files on StackOverflow, but the accepted answer to that question did not change it for me (changing the seconds to 3.0 gave me the same results, since I have a four second gap. It still didn't give me the second audio file.)

Any help would be appreciated!

回答1:

Ha! Well it turns out the version of SoX that was running on my server was ancient, which was the problem. After updating to the current version, all works as expected. :)



标签: split wav sox