; ; lametwice.au3 ; ; 2006-May-04 by Micah Webner ; based on a script by Ben Jennings ; ; Use LAME encoder to convert sermon wav files to mp3. ; Create both lofi (for web) and hifi (for archive) versions ; ; This script assumes that the input file name is formatted as ; ; YYMMDD Title is here.wav ; ; and will fill the dialog boxes with the appropriate guesses. ; ; Adjust the following settings as needed ; $lameCmd="C:\WINDOWS\lame.exe" $defaultSpeaker="PLEASE EDIT DEFAULT SPEAKER" $lofiParams="-a --lowpass 6 --resample 11.035 -b 16" $hifiParams="-b 192" $message = "Select file to convert." $inputFile = FileOpenDialog($message, "", "Wav Files (*.wav)", 1+4 ) If @error Then Exit Else $inputFile = StringReplace($inputFile, "|", @CRLF) EndIf $basename=StringLeft($inputFile,StringInStr($inputFile,".wav")-1) $orgName=StringMid($basename,StringInStr($basename,"\",0,-1)+1) $basename=StringReplace($basename,"-","") $basename=StringStripWS($basename,7) $basename=StringReplace($basename," ","_") $date=StringMid($orgName,3,2) & "/" & StringMid($orgName,5,2) & "/" & StringLeft($orgName,2) $title=StringMid($orgName,8) $title = InputBox("Processing " & $orgName, "Sermon Title", $title, "", 250, 140) $date = InputBox("Processing " & $orgName, "Sermon Date", $date, "", 250, 140) $speaker = InputBox("Processing " & $orgName, "Speaker Name", $defaultSpeaker, "", 250, 140) $script = InputBox("Processing " & $orgName, "Scripture Reference", "", "", 250, 140) If StringLen($script) Then $mp3comment=$date & " " & $script Else $mp3comment=$date EndIf $info = "Date: " & $date & @CRLF & _ "Title: " & $title & @CRLF & _ "Speaker: " & $speaker & @CRLF & _ "Scripture: " & $script If MsgBox(1,$orgname,$info)=2 Then Exit ; ; Build LAME command lines ; $year=StringLeft($orgName,2) If Int($year)>85 Then $year="19" & $year Else $year="20" & $year EndIf $tags=" --id3v2-only --tt """ & $title & """ --ta """ & $speaker & _ """ --ty """ & $year & """ --tc """ & $mp3comment & """ --tg Speech " $loFile=$basename & ".mp3" $hiFile=$basename & "_hifi.mp3" $loCmd=$lameCmd & " " & $lofiParams & $tags & """" & $inputFile & """ " & $loFile $hiCmd=$lameCmd & " " & $hifiParams & $tags & """" & $inputFile & """ " & $hiFile ;MsgBox (4096,"",$loCmd) ; & @CRLF & $hiCmd) $val=RunWait($loCmd) If $val Then MsgBox(0, "Program returned with exit codes", "Error: " & $val) EndIf $val=RunWait($hiCmd) If $val Then MsgBox(0, "Program returned with exit codes", "Error: " & $val) EndIf