Sox - couple actions at once

时间:2016-04-15 11:09:22

标签: sox audio-processing

Let's begin with an example. Assume that we have 3 audiofiles: first.mp3, second.mp3, third.mp3. I would like to merge first with second and then concatenate 3.mp3 to merged audio. Is it possible to make with one command?

I tried to invoke such command:

sox --combine mix first.mp3 second.mp3 --combine concatenate third.mp3 output.mp3

but then output.mp3 is result of concatenation all three audio files, so it is equivalent to

sox --combine concatenate first.mp3 second.mp3 third.mp3 output.mp3

My general question is whether is it possible to make couple of actions in one sox command?

1 个答案:

答案 0 :(得分:0)

I found answer.

We have to use "-p" to save first process to stdout and "-" to read from stdin in second process.

Example:

sox --combine mix first.mp3 second.mp3 -p | sox - --combine concatenate third.mp3 output.mp3

We can have multiple nesting also:

sox --combine mix first.mp3 second.mp3 -p | sox - --combine concatenate third.mp3 -p | sox - --combine concatenate fourth.mp3 output.mp3