LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-01-2004, 01:55 PM   #1
mipia
Member
 
Registered: May 2003
Location: lake michigan
Distribution: Debian, Mint, Slackware
Posts: 457

Rep: Reputation: 35
lame decoding to wav, entire /dir instead of one by one?


Ive just started playing around with lame to decode .mp3's to wav files and it works quite well.
I was wondering if there is a way to decode all *.mp3's in a directory with a single command, or if I have to continue one .mp3 at a time. I took a look at the man page but didnt find anything usefull (that I could see).

I tried lame --decode *.mp3 but that didnt work

just looking for a command with lame to be able to tell it to take all the mp3's in a directory and go ahead and decode them one after another.

Thanks in advance
 
Old 04-01-2004, 03:56 PM   #2
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
If the command you use is lame --decode filename.mp3 you could type for song in *.mp3; do lame --decode "$song"; done and that should do it.


Håkan
 
Old 04-01-2004, 06:21 PM   #3
mipia
Member
 
Registered: May 2003
Location: lake michigan
Distribution: Debian, Mint, Slackware
Posts: 457

Original Poster
Rep: Reputation: 35
thanks alot, that is exactly what I was looking for. And it works great. Im starting to slowly learn that the CLI does seem the way to go for alot of things!

Thanks again
 
Old 04-17-2005, 06:52 PM   #4
mipia
Member
 
Registered: May 2003
Location: lake michigan
Distribution: Debian, Mint, Slackware
Posts: 457

Original Poster
Rep: Reputation: 35
how about the other way around? Can this work as well in the situation of encoding the .wav files of an audio cd to .mp3 in lets say 256?
I tried messing a bit with grip, but I kept getting errors about the rip configuration ever since I attempted to install software to encode to ogg.
 
Old 04-17-2005, 08:06 PM   #5
mipia
Member
 
Registered: May 2003
Location: lake michigan
Distribution: Debian, Mint, Slackware
Posts: 457

Original Poster
Rep: Reputation: 35
bumpity bump
 
Old 04-17-2005, 08:18 PM   #6
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: 62
<you could type 'for song in *.mp3; do lame --decode "$song"; done' and that should do it.>

This is very nice, and I wonder if it could be explained briefly.

We're setting up a 'for' loop ... Is 'song' & '$song' some kind of internal variable in lame? ... and I'm not sure of the reason for the "s around '$song'.

... and I assume this would have to be executed from withinthe directory where the mp3s are located.

After thinking about it, I think I do understand it somewhat. If you had a directory of mixed .mp3 & .ogg files to decode, the script could as easily read for X in (*.ogg,*.mp3); do lame --decode "$X"; done

I still don't understand the "s, tho. What would I be looking for in a manual for this sort of thing?


Last edited by rickh; 04-17-2005 at 09:14 PM.
 
Old 04-19-2005, 03:52 AM   #7
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
mipia, doing it the other way around is just as simple:
for file in *.wav; do lame --alt-preset standard "$file"; done would encode all the files with a *.wav file extension in the current directory to mp3's using lame's very good standard VBR preset.

Bash loop basics: A for loop operates on a list of items. for file in *.wav will operate on all files with names that end with .wav in the current directory. I suggest you read the part on loops in the excellent Advanced BASH-scripting Guide. In fact, I always keep a copy of this guide on my laptop in case I would get bored or need to get something done quickly.

As for the quotation marks ("), they are needed for backwards compatibility with the "sh" shell (as opposed to the bash shell). If you program modern Bash, you would probably make sure you escape the variables like this instead: for file in *.wav; do lame --alt-preset standard ${file}; done


Håkan

Last edited by hw-tph; 04-19-2005 at 03:53 AM.
 
  


Reply



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
wav to mp3 using wavr and lame igimaster Linux - Software 7 11-11-2005 11:22 AM
Lame 3.96.1 killed when converting wav to mp3 sludink Linux - Software 0 01-14-2005 10:07 AM
.wav decoding sibtay Programming 2 09-30-2004 04:44 PM
Lame .ogg decoding r_jensen11 Linux - Software 2 06-12-2004 01:59 AM
Lame Decoding Length Specification trubkeeg Linux - Software 8 04-25-2004 10:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:49 AM.

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
Open Source Consulting | Domain Registration