Mp3 2 Wav

Sometimes ago, I asked my self how can I convert an entire directory of mp3 files into wave files. So, after a little search of something ad hoc on google, I opted to use the swiss knife of the multimedia: mplayer

for i in *.mp3; do mplayer -ao pcm:file="/home/your-user/Desktop/${i}.wav" "$i" ; done

This will generate the wave files in the directory specified. The filename will be mysongs.mp3.wav. If you would like you can make it a bit better by using sed in order to remove the .mp3 extension.

Advertisements

One thought on “Mp3 2 Wav

  1. Marcelo Magalhães says:

    Thanks for the tip!

    You can make ${i/%.mp3/.wav} for the extension, and you can use find . -name *.mp3 to go deep inside the directory structure. So, the complete command would be:

    for i in `find . -name *.mp3`; do mplayer -ao pcm:file=”${i/%.mp3/.wav}” “$i” ; done

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s