Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to batch split audio files wherever there is silence?

Tags:

I am using the following command in SoX to split many large audio files at each place where there is silence longer than 0.3 seconds:

sox -V3 input.wav output.wav silence 1 0.50 0.1% 1 0.3 0.1% : newfile : restart 

This however ends up occasionally creating files that are entirely silent and trimming the audio before each break.

I found better results with Audacity, but I need to split hundreds of WAV files and Audacity cannot even open 10 files simultaneously without freezing.

How can I use SoX or similar software to split the files at the end of the 0.3 second periods of silence, such that the silent portion is still affixed to the end of the speaking, but not before and there are no clips that are entirely silent, unless they come from the beginning of input.wav?

like image 462
Village Avatar asked Nov 16 '13 02:11

Village


People also ask

How do I split audio automatically?

Open an audio file in the Audio Editor. Select the Process tab. In the Split section, click Auto Split. In the Auto Split dialog, select Audio File in Active Window and click Next.

How can I detect silence in audio files?

To open the Detect Silence dialog, select one or several audio events in the Project window or the Audio Part Editor and select Audio > Advanced > Detect Silence.


2 Answers

if you change 0.5 to 3.0, it works fine:

sox -V3 input.wav output.wav silence 1 3.0 0.1% 1 0.3 0.1% : newfile : restart 
like image 73
user272651 Avatar answered Nov 03 '22 04:11

user272651


You didn't specify any programming language, so I assume that you're not especially looking for a way to program it yourself (which makes it a bit off-topic here). It wouldn't be very hard to do by the way.

Anyway, maybe this does the trick for you:

http://www.nch.com.au/splitter/

You can set a threshold in dB to split. I guess that when you set it to 0dB, you'll get all the audio that you need per slice.

like image 23
Wouter van Nifterick Avatar answered Nov 03 '22 05:11

Wouter van Nifterick