LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 07-02-2001, 07:16 PM   #1
jonfa
Member
 
Registered: Mar 2001
Location: FL
Posts: 257

Rep: Reputation: 30
mp3 to wav conversion


Hi all,

Anyone know of a linux program that will convert mp3's to wav files?

Thanks,

Jon
 
Old 07-03-2001, 02:45 AM   #2
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
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...
 
Old 07-03-2001, 12:24 PM   #3
mcleodnine
Senior Member
 
Registered: May 2001
Location: Left Coast - Canada
Distribution: s l a c k w a r e
Posts: 2,731

Rep: Reputation: 45
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...>
 
Old 07-03-2001, 01:12 PM   #4
jonfa
Member
 
Registered: Mar 2001
Location: FL
Posts: 257

Original Poster
Rep: Reputation: 30
Awesome! Thanks guys.

Jon
 
Old 06-14-2004, 04:43 PM   #5
gbb123
Member
 
Registered: Mar 2004
Location: Ellsworth, Wisconsin
Distribution: Suse 9.0 Pro
Posts: 32

Rep: Reputation: 15
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 .
 
Old 06-27-2004, 04:45 PM   #6
Slyder42
Member
 
Registered: Jun 2004
Location: Wheaton, IL
Distribution: trying to get FC4 to work
Posts: 46

Rep: Reputation: 15
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
 
Old 06-27-2004, 04:55 PM   #7
gbb123
Member
 
Registered: Mar 2004
Location: Ellsworth, Wisconsin
Distribution: Suse 9.0 Pro
Posts: 32

Rep: Reputation: 15
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
 
Old 06-27-2004, 05:48 PM   #8
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Two things with your script, first of all:
Code:
for X in *m*
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
 
Old 06-27-2004, 06:26 PM   #9
gbb123
Member
 
Registered: Mar 2004
Location: Ellsworth, Wisconsin
Distribution: Suse 9.0 Pro
Posts: 32

Rep: Reputation: 15
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
 
Old 06-27-2004, 08:00 PM   #10
gbb123
Member
 
Registered: Mar 2004
Location: Ellsworth, Wisconsin
Distribution: Suse 9.0 Pro
Posts: 32

Rep: Reputation: 15
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
 
Old 06-27-2004, 08:26 PM   #11
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
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....
 
Old 06-27-2004, 08:26 PM   #12
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

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


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Audio Conversion: FLAC to WAV timswim78 Linux - Software 4 12-06-2017 06:12 PM
shn to mp3/wav conversion linmix Linux - Software 3 06-15-2005 06:33 AM
ripping cds to mp3 (or wav to mp3) darkleaf Linux - Software 7 04-30-2005 07:23 AM
SIMPLE conversion MP3 to WAV + free source volleyballa Linux - Newbie 2 11-04-2003 11:04 AM
mpg123 and mp3 to wav conversion knmwt15000 Linux - Newbie 7 03-24-2003 04:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:52 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
Open Source Consulting | Domain Registration