I'm using the sox
tool and I would like to merge two audio files, let's say long.ogg
and short.ogg
to output a file output.ogg
.
This is very easy using $ sox -m long.ogg short.ogg output.ogg
.
Thing is, I would like the short.ogg
to be played after n seconds (while long.ogg
should start right from the beginning). To do so, I've found the pad effect. But I don't understand the syntax to delay only the short.ogg
input file, not the long.ogg
one.
I found a (dirty) way of doing so (with n=6):
$ sox short.ogg delayed.ogg pad 6
$ sox -m long.ogg delayed.ogg output.ogg
I would like not to have to create an intermediate file. Thanks in advance for your help.
You should be able to do something like:
sox short.ogg -p pad 0 6|sox - long.ogg output.ogg
-p
option to sox is used for piping - basically, it tells sox to use stdout as the output. Using -
as the input to the second sox is actually saying input is stdin (which happens to be the stdout of the previous sox, as we are piping with |
). pad 0 6
tells pad 0 seconds at the beginning and 6 seconds at the end.
Hope this helps.
Thanks to icyrock, I managed to find a solution. I'm using:
$ sox short.ogg -p pad 6 0 | sox - -m long.ogg output.ogg
For multi tracks (credits to Orlando):
$ sox starts-last.mp3 -p pad 2 0 | sox - -m starts-second.mp3 -p pad 2 0 | sox - -m starts-first.mp3 combined.mp3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With