user2860668
user2860668

Reputation: 45

SOX or other method to trim silence in wav without cutting into audio

I need to run a script that processes recorded wav files in this way:

1) Identifies markers in the file (beginning and end) where silence is detected

2) Adds +.2 seconds of audio to these points (-.2 seconds at the beginning and .2 at the end for example)

3) Then trims these points.

This is to automatically process WAV files to remove silence at the beginning and end without cutting off the very beginning and end of the audio. Adding a small amount of silence before/after hasn't helped and changing the DB threshold hasn't worked either. In both cases recordings can sound abruptly chopped off.

I've tried doing this in SOX and a few programs but no such luck.

Upvotes: 3

Views: 1911

Answers (1)

Alexylem
Alexylem

Reputation: 83

Here is the closest I could come up with: sox input.wav output.wav silence 1 0.1 0.1% 1 0.5 0.1% pad 0.2 0.2

Details:

  • silence effect to detect noise (>0.1% for 0.1sec) and cut when silence detected (<0.1% for 0.5sec)
  • pad effect to add 0.2 secs of silence around

Upvotes: 4

Related Questions