Take the 2-minute tour ×

I am trying to output the begin-timestamps of periods of silence (since there is background noise, by silence I mean a threshold) in a given audio file. Eventually, I want to split the audio file into smaller audio files, given these timestamps. It is important that no part of the original file be discarded.

I tried

sox in.wav out.wav silence 1 0.5 1% 1 2.0 1% : newfile : restart

(courtesy http://digitalcardboard.com/blog/2009/08/25/the-sox-of-silence/)

Although, it somewhat did the job, it also trimmed and discarded the periods of silence, which I do not want happening.

Is 'silence' the right option, or is there a simpler way to accomplish what I need to do?


share|improve this question
add comment

2 Answers

There is (currently, at least) no way to make the silence effect output the position where it has detected silence, or to retain all of the silent audio.

If you are able to recompile SoX yourself, you could add an output statement yourself to find out about the cut positions, then use trim in a separate invocation to split the file. With the stock version, you are out of luck.

share|improve this answer
Hi chirlu, I was hoping that wasn't true. I'll see what can do. –  progfan Aug 9 '13 at 6:20
add comment

necroposting: You can run a separate script that iterates all of the sox output files, (for f in *.wav), and use the command; [code]soxi -D $f[/code] to obtain the DURATION of the sound clip. Then, get the system time in seconds [code]date "+%s"[/code], then subtract to find the time the recording starts.

share|improve this answer
add comment

Your Answer


