article

It’s hard for me to believe that I used to be a Microsoft/Windows fanboy. I used all their products and signed up for all their beta programs. Now, I’m a full time Linux user and open source fanboy (which happens to be a bit of an understatement). In my transition from Windows to Linux though, one thing I delayed doing was converting my music library to a non-proprietary format (wma). A few months back though, I finally decided to make the jump. After investigating, I finally decided on using ogg as my final format. I went back and re-ripped all of my old CDs, but there were some I couldn’t find, so I needed to convert the wma files to ogg. Now, there is the unfortunate downside of converting a compressed format to a compressed format, so I converted to a very high quality ogg format in my script to hopefully not lose too much (so far everything sounds pretty good).

Requirements

All you need for this is oggenc and mplayer (yay).

The script

#!/bin/bash
for file in ./*.wma; do
        wavname=${file%.wma}.wav;
        wavname=${wavname:2};
        mplayer "$file" -ao pcm:file="$wavname";
        oggname=${wavname%.wav}.ogg;
        oggenc "$wavname" "$oggname";
        rm "$wavname";
done

What just happened?

So what we just did was start up a for loop for each file in the working directory that ends with wma (*). Once we’ve done that, we remove the ridiculously large wav file leaving us with only the original wma and the converted ogg for your (hopefully positive) comparison.

Category:Linux Category:Music