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?
* soxDigital Audio

Avatar of undefined
Last Comment
Greg Watkins
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


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
Avatar of Greg Watkins
Greg Watkins

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Digital Audio
Digital Audio

Digital audio is technology that can be used to record, store, generate, manipulate, and reproduce sound using audio signals encoded in digital form. Following significant advances in technology, digital rapidly replaced analog audio technology in most areas. Digital audio systems may include compression, storage, processing and transmission components. It is important to distinguish between the audio coding format, the codec performing the encoding and decoding of the raw audio data, and the container file. Common file formats include .wav, .aiff, .au, .m4a, .mp3, .wma, .ra and .raw.

Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews


IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo