tags:

views:

15

answers:

2

Hi I am am wanting to send many different mp3's like an array to SOX for example

sox 1.mp3 2.mp3 N.mp3 out.mp3
sox num1.mp3 num2.mp3 numN.mp3 out2.mp3
sox n1.mp3 n2.mp3 nN.mp3 out3.mp3

How could I send all those at one time?Or Can I not do that?

A: 

If you are using bash:

for f in *.mp3; { sox $f out$f; }
Paulo Scardine
Nay way to do this in php via exec()
james
A: 

For a short list:

sox {1,2,N}.mp3 out.mp3
sox num{1,2,N}.mp3 out2.mp3
sox n{1,2,N}.mp3 out3.mp3

For a range:

sox File{1..42}.mp3 out4.mp3
Dennis Williamson
This seems to work pretty good.
james
Is there any way to do this with php by using exec().I have exec working very simply by doing this exec("./sox 1.wav 2.wav out.wav");
james
@james: The brace expansion is performed by the shell. You could probably get PHP to tell the shell to run the command and thus it would do the expansion. I would recommend, however, that you build a string using a loop in PHP and just pass it to `exec`. You probably should have said in your question that you're really trying to do this in PHP rather than tagging the question `[shell]`.
Dennis Williamson