Note for English Readers

If I write the articles in Indonesian, I will write a summary in English so that you can read my articles too. After you read the summary and you feel that you need more information about that, please do not hesitate to contact me via e-mail that can be found in my profile.

Thank you for reading my blogs.

Saturday, January 29, 2011

Converting wma to mp3

Hi Readers,

This week, I got a bunch of wma files from my friend and I want to convert all into mp3 format for a reason (if you are linux user, you have known what my reason is). After I search on internet, I found a simple script from Linux Questions that can be used for converting wma format to mp3 format. For making this script works in your system, you need mplayer (already in slackware package) and lame (you can find slackbuild scripts for lame on http://slackbuilds.org). In order to make me comfortable when using this script, I make a little modification on this script, that is:

#!/bin/bash

current_directory=$( pwd )

#remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done

#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader $i && lame -m s audiodump.wav -o $i; done

#convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.mp3"; done

#add spaces as origins (if there are spaces)
for i in *.mp3; do mv "$i" "`echo "$i" | tr '_' ' '`"; done

rm audiodump.wav



Just put this script on the same directory of your wma files then run it. All of your wma files will be converted to mp3 files.
I hope this script and my little modifications can help you converting your wma files to mp3 files.