-   Programming (
-   -   ALAC & Lame Script (

Soulful93 05-09-2005 11:01 PM

ALAC & Lame Script
I recently installed a ALAC decoder for my Apple Lossless audio file's. I'm using it to decode all of my .m4a file's into a .wav format. Then I'm planning on using Lame to encode all of my .wav files into .mp3 file's.

Still with me...:) ?

Ok, this is extremely redundant executing the .alac script over and over again and entering song name after song name. I haven't even started with the Lame portion of things yet.

I was wondering if someone could help me out with a script (maybe someone's already thought of this) for this task. I was thinking of something along the lines of pointing the script toward an entire directory and using variables for the song names.

I'm having problem's with the song name portion, I'm not good with variables.


./alac -f /home/soulful93/Documents/Conversion/example.wav (output) /home/soulful93/Documents/Conversion/example.m4a (input)
Any help or suggestions will be appreciated.

Harmaa Kettu 05-10-2005 01:10 AM



if [ -d "$1" ]; then
  cd $1

for file in *.m4a; do
  base=`basename $file .m4a`
  /path/to/alac -f $base.wav $file
  lame -h $base.wav $base.mp3
  rm $base.wav

Soulful93 05-10-2005 04:08 PM

Thank you very much. My finger were starting to get sore for a while there...

lloydsmart 06-03-2006 10:31 AM

Any way to make this recursive? I have a large iTunes hierachy to convert. Thanks.

rickh 06-03-2006 11:41 AM

I recently went thru a binge of this sort of thing, and got lots of help, here,... here,... and here.

You may find some of it helpful.

lloydsmart 06-03-2006 03:59 PM

Thanks for the links, but unfortunately they're no help to me. I don't have a load of numbered files to convert - they all have different names by which they're identified, and they're all in different folders.

The folder hierachy is: ~/iTunes/Artist/Album/Song

Any ideas?

davexthc 04-15-2009 07:24 PM

Better Alternetive
Use SoundJuicer or banshee to import CDs to FLAC
SoundJuicer ships with ubuntu...Banshee is available here

then use SoundKonverter to convert flac to mp3
it has a gui (its a frontend for many encoders such as LAME)
so you can convert multiple files at once
my assumption is that converting alac to flac then to mp3 will cause some serious quality loss
or just rip to mp3 direct from the cd with sound juicer

a good profile for getting hi quality VBR mp3s out of it is :
audio/x-raw-int,rate=44100,channels=2 ! lame name=enc mode=0 vbr=4 vbr-quality=0 vbr-min-bitrate=192 vbr-max-bitrate=320 ! xingmux ! id3v2mux

All times are GMT -5. The time now is 11:34 PM.