Link to home
Start Free TrialLog in
Avatar of Greg Watkins
Greg Watkins

asked on

Insert silence into audio file using SOX

I have the need to insert a specific duration of silence into an audio file at a specific point thus expanding the file length based upon the size of silence inserted. Is that possible using SOX?
Avatar of David Favor
David Favor
Flag of United States of America image

You can use sox for this + I normally use ffmpeg, as I can select any output codec - mp3, wav, whatever.

https://stackoverflow.com/questions/5276253/create-a-silent-mp3-from-the-command-line provides both a sox example + ffmpeg example, which are very clear.

I also prefer ffmpeg, as you can use a one liner to produce your null/silent audio clips.

With sox, you'll have to write a script.
Avatar of Greg Watkins
Greg Watkins

ASKER

I understand how to create the silence file. The real question is how can I insert that file into the existing file. As far as I can see I can't use mix as that would just overwrite some of the audio in the existing file and pad just adds it to the beginning or end. I need to insert it into the file at a specific point in effect expanding the file length.
Personally I'd use an audio editor i.e. audacity
otherwise the sequence of operations would be
1. copy the source file to the output file
2 seek the output file to silence start
3. set volume to 0 for remainder of file
4. cut output file length at original to silence start + silence curation length
5 seek original file to silence start and copy to output file appending
ASKER CERTIFIED SOLUTION
Avatar of Greg Watkins
Greg Watkins

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial