3

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 of output.wav .

andrew.46
  • 39,359
zey
  • 133

2 Answers2

5

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.

Oli
  • 299,380
5

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
Maythux
  • 87,123