- Eg.
SOURCE
- SoundfilesWAV
- A
- ant.wav
apple.wav
- banana.wav
- ant.wav
- A
- SoundfilesWAV
- DESTINATION
- SoundfilesMP3
- A
- ant.mp3
apple.mp3
- banana.mp3
- ant.mp3
- A
- SoundfilesMP3
Larry
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Code: Select all
on mouseUp
answer folder "please choose the WAV folder"
if it is empty then exit mouseUp
put the defaultfolder into origDefaultFolder
put it into tWAVFolder
set the defaultfolder to tWAVFolder
put the folders into tWAVSubFolders
-- filter out operating system folders on mac (like "..", or starting with "." to make it invisible)
filter tWAVSubFolders without ".*"
-- filter without application folders, on the mac application may be packages that look like folders to Rev
filter tWAVSubFolders without "*.app"
put "" into tmyWAVListWithPath
repeat for each line aFolder in tWAVSubFolders
put tWAVFolder & "/" & aFolder & "/" into tActualFolder
set the defaultfolder to tActualFolder
put the files into tallFiles
-- filter for macStyle ".xyz" files
filter tallFiles without ".*"
if tallFiles <> "" then
repeat for each line aSingleFile in tallFiles
put tActualFolder & aSingleFile & return after tmyWAVListWithPath
end repeat
end if
end repeat
delete last char of tmyWAVListWithPath -- the last return
put tmyWAVListWithPath -- goes to the message box now, could go into a field
set the defaultfolder to origDefaultFolder -- be nice and restore the original defaultfolder
end mouseUp
Code: Select all
function getAllFiles foName
put the defaultfolder into oldFolder
set the defaultfolder to foName
repeat for each line L in the files
if char 1 of L is "." then next repeat
put foName & "/" & L & cr after theFiles
end repeat
repeat for each line L in the folders
if char 1 of L is "." then next repeat
put getAllFiles(foName & "/" & L) & cr after theFiles
end repeat
filter theFiles without empty
set the defaultfolder to oldFolder
return theFiles
end getAllFiles
Code: Select all
on createPath pPath
set the itemDelimiter to "/"
repeat with n = 1 to the number of items in pPath - 1
if there is no folder (item 1 to n of pPath) then
create folder (item 1 to n of pPath)
end if
end repeat
end createPath
Code: Select all
function q pString
return quote & pString & quote
end q
Code: Select all
on makeMp3s pSourceFolder, pTargetFolder
put getAllFiles(pSourceFolder) into tWavList
filter tWavList with "*.wav" -- remove all the non-wav files
repeat for each line tWav in tWavList
-- build the target file path
put tWav into tMp3
replace pSourceFolder with pTargetFolder in tMp3
replace ".wav" with ".mp3" in tMp3
createPath tMp3
get shell("flac" && q(tWav) && "-o" && q(tMp3))
end repeat
end makeMp3s