combine multiple audio files with slience between each audio file in sox
16,338
Solution 1
You need to insert a silent track between each track as you specify them so you end up with something like:
sox track1.wav silence.wav track2.wav silence.wav ... output.wav
You can do that manually (as above), or we can loop the current directory with an inline for-loop. Something like this should work:
sox -n -r 44100 -c 2 /tmp/silence.wav trim 0.0 2
sox $(for f in *.wav; do echo -n "$f /tmp/silence.wav "; done) output.wav
The silence-generator is stolen from here.
Solution 2
Generate 2 seconds of (stereo) silence
sox -n -r 44100 -c 2 silence.wav trim 0.0 3.0
Combining the files
sox silence.wav filetopad.mp3 silence.wav output.wav
source http://activearchives.org/wiki/Padding_an_audio_file_with_silence_using_sox
Another possible solution
quoted from https://stackoverflow.com/questions/5587135/sox-merge-two-audio-files-with-a-pad
sox starts-last.mp3 -p pad 2 0 | sox - -m starts-second.mp3 -p pad 2 0 | sox - -m starts-first.mp3 combined.mp3
Related videos on Youtube
![zey](https://i.stack.imgur.com/ht97D.jpg?s=256&g=1)
Comments
-
zey almost 2 years
I have about 20 audio files(.wav) in a folder , this is how I combine this wave files
sox *.wav output.wav
I want to add delay or silence between each wave .
I have tried
pad
, but it's just put the silence only at the start and end ofoutput.wav
. -
Maythux about 9 yearsSry friend seems same solution in same time, lol, same stolen
-
zey about 9 yearsscript with
loop
works :) Thanks a lot