0

I'm using Sox with Windows 10

I need to concatenate a large number of files. These are all wave files in identical format. The files need to be joined in pairs and saved.

An example might be the best way to explain. I have file1.wav, file2.wav, file3.wav... I also have firstfile.wav. I need to concatenate these files.

sox firstfile.wav file1.wav newfile.wav

sox firstfile.wav file2.wav newfile2.wav

Is it possible to automate the process of concatenating all of these files, creating a new file for each pair of files by a single line from the windows command line?

Any help would be appreciated!

randominstanceOfLivingThing
  • 16,873
  • 13
  • 49
  • 72
SandyS
  • 23
  • 4

2 Answers2

0

The algorithm I can think of is:

  1. Rename file1.wav to tempfile.wav.
  2. Run command sox firstfile.wav tempfile.wav file2.wav
  3. Rename firstfile.wav to tempfile.wav
  4. Repeat step 2 for the next file using the new file instead of file2.wav else rename tempfile.wav to firstfile.wav.
randominstanceOfLivingThing
  • 16,873
  • 13
  • 49
  • 72
  • While I can see how this would work to accomplish the goal, how would it work to automate the process? I've seen examples where *.wav has been used in Sox to indicate 'all files' within a folder. I've also seen the use of : newfile, restart and %n to direct Sox to create a new file for each time an effect runs. I'm just not clear on how I can use these to accomplish my goal of automating the task of concatenation of a pair of files as I indicated. – SandyS Nov 15 '16 at 23:43
0
@ECHO OFF &SETLOCAL
for /F %%x in ('dir /B audiotts*.wav') do  call set "Myvar=%%Myvar%% %%x"
sox  -S %Myvar% result-merged.wav
ECHO Done merge %Myvar%
pause