Pages

Sunday, January 30, 2005

Real to MP3

One frequent task I perform is a conversion from Real Audio to MP3. Most of my music content happens to be in real format, but I would prefer to listen to it on my discman, which plays MP3 disks. Hitherto, this required a trial version of StreamBox Ripper, an excellent conversion software, that also supports batch processing.

Now that windows is gone, I had to look for Linux alternatives. I didn't had many hopes, since real-audio is a proprietary format, but I was in for a surprise. Real Networks is paying real attention to the Linux Platform (with a community supported Helix Player, and Free/Closed Real Player). And mplayer does the job of conversion just very well. Here is a shell script that I use to do batch conversions

#!/bin/sh
INPUTFMTS='.ra .rm'

convert() {
for i in `find $1 -name '*'$3`
do
outfile=`basename $i $3`
outdir=`dirname $i`
if [ ! -e $2/$outdir ]; then
mkdir -p $2/$outdir;
fi
mplayer -vo null -vc dummy -af resample=44100 -ao pcm -waveheader $i && lame -m s audiodump.wav -o $2/$outdir/$outfile.mp3
done
}

case $# in
2)break;;
*) echo "Usage: $0 ";
exit 1;;
esac

if [ ! -e $2 ]; then
mkdir $2 || exit 1;
echo "$2: pathname created";
fi

if [ ! -d $2 ]; then
echo "Source directory invalid";
exit 1;
fi

for i in $INPUTFMTS
do
echo "Converting all $i files to mp3"
convert $1 $2 $i
done
rm -f audiodump.wav
-------------------------------------------------------------------------
I guess this script would also work for wma to mp3, you just need to add wma to INPUTFMTS variable.

If I had to write a similar script on Windows , how difficult it would have been. I know this because my last job involved some windows batch scripting and vbscripting. Reminds me of this saying (probably by Larry Wall), about a good programming language

Easy things should be easy, and difficult things should be possible.

Not quite windows.

A tryst with FreeBSD

Now that I have a lot of freespace on my hard-disk, (since removing windows), I decided to experiment with another OS. I use Solaris+Linux at work, and Linux at home, so the choice gets limited to
1) One of the BSDs (FreeBSD, NetBSD and OpenBSD)
2) GNU Hurd
3) Solaris 10
(BeOS & QNX I have already experimented with)

I downloaded HURD quite some time ago, but it could only be compiled from another Hurd natively, and cross-compilation didn't looked easy. In any case, Hurd isn't going to be usable any time soon, so I downloaded the latest stable FreeBSD (5.3).

Linux is no longer good enough. It has lost the exclusivity it had a few years back, so I needed something more uncommon to adorn my desktop. After all, every new kid on the block is running linux today ( or has run it at some point and given up), so you need something more to be accepted like a uber-geek, and thats where FreeBSD fits in very well. At least for the time being :)

Jokes apart, I thought I had get some idea of the BSD kernel, and see if I can port the work I am doing on Solaris to FreeBSD. The two are a lot similar, and as I wait for the Solaris sources to be opened, FreeBSD kernel sources are proving quite helpful. Sun has taken the first step with dtrace (http://opensolaris.org), but my guess is it would still take few more months.

This post, being made from

FreeBSD pluto.solar.com 5.3-RELEASE FreeBSD 5.3-RELEASE #0: Fri Nov 5 04:19:18 UTC 2004 root@harlow.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386

is a proof that I have got FreeBSD and one of my LAN cards working. (which connects to 24Online cable network) . The other one still needs to be configured.

BTW, Epiphany looks like a browser well done.

Wednesday, January 26, 2005

Adieu Windows

It has been more than a month since I last wrote. I would very much like to have an entry at least once a month.
I am a long time linux user, using linux at work and home, most of the time. Still I had my machine set up for dual boot, and had to go through the rigouros exercise of formatting Windows every few months. Years ago, I would format it to get a clean new shiny system, & after every format, it seemed like I had a hardware upgrade. Since an year or so, I am still following the ritual, but for a different reason; to get rid of all the spyware.

The problem became too bad since I opted for broadband. So last time I had to format, which was around 90 days back, I decided to say good bye to dual booting windows. Of course, I still own hardware devices that are unsupported on Linux, but I am firm in my new year resolution, no windows on my home pc from now on. Fortunately, I no longer need to document my code & other stuff in Microsoft Word, so my office pc is running linux as happily. I have begun converting my powerpoint presentations to OpenOffice formats.

Bye Bye Windows, may you never reside in my PCs RAM and disk ever again !!

Amen