LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 05-10-2005, 12:01 AM   #1
Soulful93
Member
 
Registered: Dec 2003
Location: Denver, CO
Distribution: SuSE 9.2 Slackware 10.1
Posts: 137

Rep: Reputation: 15
Smile 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.

Code:
./alac -f /home/soulful93/Documents/Conversion/example.wav (output) /home/soulful93/Documents/Conversion/example.m4a (input)
Any help or suggestions will be appreciated.
 
Old 05-10-2005, 02:10 AM   #2
Harmaa Kettu
Member
 
Registered: Apr 2005
Location: Finland
Posts: 196

Rep: Reputation: 30
Code:
#!/bin/bash

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

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
done
 
Old 05-10-2005, 05:08 PM   #3
Soulful93
Member
 
Registered: Dec 2003
Location: Denver, CO
Distribution: SuSE 9.2 Slackware 10.1
Posts: 137

Original Poster
Rep: Reputation: 15
Thank you very much. My finger were starting to get sore for a while there...
 
Old 06-03-2006, 11:31 AM   #4
lloydsmart
LQ Newbie
 
Registered: Dec 2005
Posts: 29

Rep: Reputation: 15
Any way to make this recursive? I have a large iTunes hierachy to convert. Thanks.
 
Old 06-03-2006, 12:41 PM   #5
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 60
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.
 
Old 06-03-2006, 04:59 PM   #6
lloydsmart
LQ Newbie
 
Registered: Dec 2005
Posts: 29

Rep: Reputation: 15
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?
 
Old 04-15-2009, 08:24 PM   #7
davexthc
LQ Newbie
 
Registered: Apr 2009
Posts: 1

Rep: Reputation: Disabled
Better Alternetive

Use SoundJuicer or banshee to import CDs to FLAC
SoundJuicer ships with ubuntu...Banshee is available here banshee-project.org/

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
 
  


Reply

Tags
audio, bash, convert, lossless, music, script, shell script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Script: lame stumbles on spaces in filename browny_amiga Linux - General 5 05-14-2008 09:14 AM
Phục hồi dữ liệu bị mất???, cứ pollsite General 1 06-27-2005 01:39 PM
shell script + change shell && continue darkRoom Programming 6 02-25-2005 03:50 AM
Bash script for LAME LocoMojo Linux - Newbie 6 01-09-2005 07:41 PM
Guru = C & Lame = C++ gr33ndata Programming 25 02-22-2004 09:25 AM


All times are GMT -5. The time now is 03:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration