create a batch file to automate joining two mono wav files t

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
oxide54
Posts: 1
Joined: 18 Nov 2008 05:40

create a batch file to automate joining two mono wav files t

#1 Post by oxide54 » 18 Nov 2008 06:00

Hi I am trying to create a batch file to automate joining two mono wav files to a stereo one. I know i can do this manually but i have to do this 20-30 times a day so i thought it was about time to automate it slightly.

I'm using m2s.exe
-------------------------------------------------------------------------------
m2s - Compiled Jun 11 2004. Copyright (c) 2002 John Edwards
Usage: m2s -l left.wav -r right.wav -o output.wav
-------------------------------------------------------------------------------

My wave files are always named <FILENAME>.L.wav and <FILENAME>.R.wav

I would like a resulting name of <FILENAME>.wav


All i have is this so far and it doesn't work.

SET %S = %1:.L.=.STEREO.%
m2s.exe %1 %2 %S

I also need to add checking as i can't guarantee with %1 or %2 will be the mono file as I wanted to add it to a explorer context menu.

And my first line doesn't work. But i wanted it to do was replace the instance of .L. in %1 with .STEREO. and store the result in %S.

Below is psuedo code of what i want.

----------------------------------------------------------------------------
IF %1 CONTAINS .L. THEN %LEFT = %1
ELSE IF %2 CONTAINS .L. THEN %LEFT = %2

IF %1 CONTAINS .R. THEN %RIGHT = %1
ELSE IF %2 CONTAINS .R. THEN %RIGHT = %2

%S = STRINGREPLACE(%S, ".L.", ".STEREO.")

EXECUTE m2s.exe %LEFT %RIGHT %S

------------------------------------------------------------------------

Please help.

Thinking about it I probably could have coded it in C in the time its taken me to write this post. But i'd rather not install C on me music pc.


Many Thanks

Conrad

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

#2 Post by DosItHelp » 23 Nov 2008 01:25

oxide54,

How about this:

Code: Select all

@Echo Off

Set "Left=%~1"
if "%Left:.L.=%"=="%Left%" Set "Left=%~2"
if "%Left:.L.=%"=="%Left%" Set "Left="

Set "Right=%~1"
if "%Right:.R.=%"=="%Right%" Set "Right=%~2"
if "%Right:.R.=%"=="%Right%" Set "Right="

Set "S=%Left:.L.=.STEREO.%"

M2S.EXE "%Left%" %Right%" "%S%"

DosItHelp? :wink:

Post Reply