HydrogenAudio

Lossy Audio Compression => MP3 => MP3 - Tech => Topic started by: DotCom on 2005-12-09 18:14:54

Title: Lame4Dos.bat
Post by: DotCom on 2005-12-09 18:14:54
Hi,

I am trying ti use the Lame4Dos.bat file to convert many .wav phone recordings to .mp3 and save some space.  I have dowloaded the .bat file and edited the path to the Lame.exe and set my options.  When I attempt to execute the batch file, I receive:

Quote
>& was unexpected at this time.


Here is my .bat filefor those who have never looked at it:

Quote
@echo off
rem  ---------------------------------------------
rem  PURPOSE:
rem  - put this Batch-Command on your Desktop,
rem    so you can drag and drop wave files on it
rem    and LAME will encode them to mp3 format.
rem  - put this Batch-Command in a place mentioned
rem    in your PATH environment, start the DOS-BOX
rem    and change to a directory where your wave
rem    files are located. the following line will
rem    encode all your wave files to mp3
rem     "lame.bat *.wav"
rem  ---------------------------------------------
rem                         C2000  Robert Hegemann
rem  ---------------------------------------------
rem  Changes to support long filenames using 4DOS
rem  by Alexander Stumpf <dropdachalupa@gmx.net>
rem  ---------------------------------------------
rem  please set LAME and LAMEOPTS
rem  LAME - where the executeable is
rem  OPTS - options you like LAME to use

        set LAME=c:\lame\lame.exe
        set OPTS=-f

rem  ---------------------------------------------

   set thecmd=%LAME% %OPTS%
        for %%f in (%&) do (%thecmd% %@sfn[%%f]^(ren %@sfn[%%f].mp3 "%@lfn[%%f].mp_">NUL))
        ren *.mp3.mp_ *.new.mp3 >& NUL
        ren *.wav.mp_ *.mp3 >& NUL
        goto endmark
:errormark
   echo.
   echo.
   echo ERROR processing %1
   echo.
:endmark
rem
rem   finished
rem


I am using XP Professional.  Any help/suggestions is greatly appreciated.

Thanks,
Mark
Title: Lame4Dos.bat
Post by: Shade[ST] on 2005-12-09 19:51:54
Code: [Select]
@echo off
set LAME=c:\lame\lame.exe
set OPTS=-f

%LAME% %OPTS% %1 %1.mp3
ren *.wav.mp3 *.mp3


This will do the trick.
Title: Lame4Dos.bat
Post by: smok3 on 2005-12-09 20:08:54
didnt test but instead:

for %%f in (%&) do (%thecmd% %@sfn[%%f]^(ren %@sfn[%%f].mp3 "%@lfn[%%f].mp_">NUL))

things should probably be:

for %%f in (%1) do (%thecmd% %@sfn[%%f]^(ren %@sfn[%%f].mp3 "%@lfn[%%f].mp_">NUL))
Title: Lame4Dos.bat
Post by: Synthetic Soul on 2005-12-09 20:18:34
Quote
Code: [Select]
%LAME% %OPTS% %1 %1.mp3
ren *.wav.mp3 *.mp3

FYI: Minor improvement:

Code: [Select]
%LAME% %OPTS% %1 "%~dpn1.mp3"

If %1 is "C:\My Music\My File.wav" then %~dpn1 is C:\My Music\My File


Code: [Select]
%LAME% %OPTS% %1 %1.mp3

... is just the same as:

Code: [Select]
%LAME% %OPTS% %1
Title: Lame4Dos.bat
Post by: smok3 on 2005-12-09 20:22:25
shade, syntetic soul, yes but that wont work with 'lame4dos *.wav'.

minimum would be:
for /f "delims=++" %%i in (%1) DO lame --alt-preset standard "%%i"
Title: Lame4Dos.bat
Post by: robert on 2005-12-09 22:53:47
@mark
it's not clear from your post, are you using 4dos or the xp command shell?