Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-02-2001, 08:16 PM
|
#1
|
Member
Registered: Mar 2001
Location: FL
Posts: 257
Rep:
|
mp3 to wav conversion
Hi all,
Anyone know of a linux program that will convert mp3's to wav files?
Thanks,
Jon
|
|
|
07-03-2001, 03:45 AM
|
#2
|
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243
Rep:
|
I have a feelin' (but no 100% sure) that mpg123 will do this for you (from the command line), have a look at http://www.mpg123.org/
HTH
Jamie...
|
|
|
07-03-2001, 01:24 PM
|
#3
|
Senior Member
Registered: May 2001
Location: Left Coast - Canada
Distribution: s l a c k w a r e
Posts: 2,731
Rep:
|
Quote:
Originally posted by jharris
I have a feelin' (but no 100% sure) that mpg123 will do this for you (from the command line), have a look at http://www.mpg123.org/
HTH
Jamie...
|
Code:
mpg123 -v -w outfile.wav infile.mp3
The -v option shows the conversion stats, the -w tells it to write output to a file named outfile.wav. I did a bunch of this last weekend.
<sits back and waits for the cdburner questions...>
|
|
|
07-03-2001, 02:12 PM
|
#4
|
Member
Registered: Mar 2001
Location: FL
Posts: 257
Original Poster
Rep:
|
Awesome! Thanks guys.
Jon
|
|
|
06-14-2004, 05:43 PM
|
#5
|
Member
Registered: Mar 2004
Location: Ellsworth, Wisconsin
Distribution: Suse 9.0 Pro
Posts: 32
Rep:
|
mpg123 script
Hello,
I am trying to write a script to make it much less time consuming to convert mp3's to wav using mpg123. I would like to throw a bunch of mp3's into a folder and execute this script to convert all of the mp3's to wav's and throw the converted wav's into a folder called wav.
So for example: If my folder contained the following mp3's in it: x.mp3, xx.mp3, xxx.mp3 My script will iterate through something Like this: mpg123 -v -w ./wav/1.wav x.mp3;mpg123 -v -w ./wav/2.wav xx.mp3; mpg123 -v -w ./wav/3.wav xxx.mp3; .
I think I will somehow have to take the output of ls and input that into my for loop but Im not sure how to do that.
Does anyone out there know how I should script this? I am very new to linux shell scripting however I've wanted to learn it for along time and this is a good practice for me  .
|
|
|
06-27-2004, 05:45 PM
|
#6
|
Member
Registered: Jun 2004
Location: Wheaton, IL
Distribution: trying to get FC4 to work
Posts: 46
Rep:
|
WMA to MP3 friendly reminder
I was on Tucows and found several Windows software packages that convert WMA to MP3 that if you can transfer your WMAs to a Windows box, convert them and then move them back to your linux workstation, you can continue burning your newer disks to your Linux box to save some time and energy converting WMA to WAV and then WAV to MP3. Doing the long way on your linux box hoardes VALUABLE DISK SPACE and MIGHT be simpler in the long run. Attempt to burn the files on to CD-R or CD-RW and then more disks on the way back.
I know, I know,  tisk tisk to me for moving data to a windows box, but it may save you time and disk space.
After all I am a 
|
|
|
06-27-2004, 05:55 PM
|
#7
|
Member
Registered: Mar 2004
Location: Ellsworth, Wisconsin
Distribution: Suse 9.0 Pro
Posts: 32
Rep:
|
Thanks for replying to this thread,
I wanted to let you all know that I wrote a very simple script so that you can put all the mp3's, . .mpg's you want to convert to wav in a folder and convert them all to wav.
I am going to imporve this script some more, as its very simple right now, I call this script conv:
#!/bin/bash
for X in *m*
do
mpg123 -v -w "${X}.wav" "$X"
done
rm *.mp3 *.mpg;
It works for all mp3's and mpg's or any other file type you wanted. Eventually I would like to let the user input what type of file they are converting, and what type of file they want to convert to. For instance if the user wanted to convert wav to mp3 instead. I would also like to let the user choose files he, she wants to convert. Maybe I'll use ncurses for this. If anyone would like to help me with this please let me know, thanks,
Garrett
|
|
|
06-27-2004, 06:48 PM
|
#8
|
Senior Member
Registered: Nov 2002
Location: British Columbia, Canada
Distribution: Gentoo x86_64; FreeBSD; OS X
Posts: 3,764
Rep:
|
Two things with your script, first of all:
This will include every file with an 'm' in the title. Not exactly what you might want.
Also:
Code:
mpg123 -v -w "${X}.wav" "$X"
will name your wav files "foobarbax.mp3.wav", which isn't exactly desireable either. You can clean it up with globbing and sed:
Code:
#!/bin/bash
for i in {*.mp3,*.mpg}
do
x=`echo ${i} | sed -e 's/mp3/wav/'`
mpg123 -v -w "${x}" "${i}"
done
Now you can have any file in the directory and it will not be touched unless it is an mp3 or mpg
|
|
|
06-27-2004, 07:26 PM
|
#9
|
Member
Registered: Mar 2004
Location: Ellsworth, Wisconsin
Distribution: Suse 9.0 Pro
Posts: 32
Rep:
|
Yes you are correct  ,
I was just reading aliens bash tuitorial( http://subsignal.org/doc/AliensBashTutorial.html) and was just beginning to experiment with sed and ncurses. I find this very very helpful and you just made it easier for me to see how to do this. I meant to have *.m* before. Sorry for the mistake  . Thanks for the pointers.
How could I extend this so that it uses a menu system(preferably Ncurses)? I want to make it so that the user can pick his/her files he would like to convert, and then pick what to convert them to. Then he should be able to choose the output directory etc..
Thanks for your help,
Garrett
|
|
|
06-27-2004, 09:00 PM
|
#10
|
Member
Registered: Mar 2004
Location: Ellsworth, Wisconsin
Distribution: Suse 9.0 Pro
Posts: 32
Rep:
|
Actually,
I encountered a slight problem with the revised script now. The problem is on this line:
x=`echo ${i} | sed -e 's/mp3/wav/'`
This will not allow me to convert mpg files at the same time as mp3 files. I tried this:
x=`echo ${i} | sed -e 's/mp3/wav' || sed -e 's/mpg/wav'`
but that didnt seem to work either.
How can I make sed perform the same operation on both mpg files and mp3 files? As it is now, it can only do either mp3 or mpg, but not both. I tried this also with no luck:
for i in {*.mp3,*.mpg}
do
x=`echo ${i} | sed -e 's/mp3/wav/'`
y=`echo ${i} | sed -e 's/mpg/wav'`
mpg123 -v -w "${x}" "${i}"
mpg123 -v -w "${y}" "${i}"
done
rm *.mp3 *.mpg
I think I need some type of if statement here but Im not exactly sure where to go with it. Any help would be apreciated, thanks,
Garrett
|
|
|
06-27-2004, 09:26 PM
|
#11
|
Senior Member
Registered: Nov 2002
Location: British Columbia, Canada
Distribution: Gentoo x86_64; FreeBSD; OS X
Posts: 3,764
Rep:
|
k:
Code:
#!/bin/bash
for i in *.mp3
do
x=`echo ${i} | sed -e 's/mp3/wav/'`
mpg123 -v -w "${x}" "${i}"
done
for i in *.mpg
do
x=`echo ${i} | sed -e 's/mpg/wav/'`
mpg123 -v -w "${x}" "${i}"
done
I have never used an mpg file so I didn't think about that, sorry....
|
|
|
06-27-2004, 09:26 PM
|
#12
|
LQ Veteran
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642
Rep:
|
I'd suggest also taking a look at Audacity. I can't help with conversion scripts that operate on multiple files, but if it's a simple format conversion, Audacity is very cool. -- J.W.
|
|
|
All times are GMT -5. The time now is 01:06 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|