Wednesday, January 26, 2005

WiFi radio..

It's 1:30 AM in the morning and I'm having fun. I've just setup a wireless radio station in my house. Ok, before you start to park your car outside my gate to tune in, take a deep breath and chill. Its awesome but no big deal!

All you do is install something called an icecast server, which is supposed to be better than the original Shoutcast server by the folks that brought you winAmp and then sold it to the devil (aOL) ;) Ice cast server version 2.x can stream both mp3s and ogg vorbis (better quality and patent free). A small vague run down of the steps keeping in mind this is a blog and not a howto!

First I installed icecast2 on debian
# apt-get install icecast2

You need to modify the configuration file, the main setting being setting a password and then start the server.

# /etc/init.d/icecast2 start

Next you need a client streaming application that will connect to the icecast server and stream a live feed such as from a mic / soundcard loopback or in my case using a simple play list. There are a couple of streaming clients, notably liveice and the xmms plugin for liveice seem popular for streaming mp3s, but my initial encounter with it was unsuccessful. Perhaps because it was originally written for icecast version 1, but the documentation mentions it works for version 2. So I ended up settling down with ices2 package which can stream ogg vorbis files to the server. I also installed mp32ogg package to help me convert some mp3 file to the ogg format.

# apt-get install ices2 mp32ogg

You can easily (but with patience) convert mp3 directories to ogg files by using mp32ogg. I then copied a sample xml configuration file required for ices2 from /usr/share/doc/ices2/examples/ices-playlist.xml and modified it slightly. You can then create a playlist file and launch ices2 from the command line with the xml config file as the only parameter.

~/mp3$ find . -name '*.ogg' > playlist.txt
~/mp3$ ices2 ices-playlist.xml

Thats it! I rushed over to my notebook which is connected to the streaming server over a WiFi wireless link, and launched the browser and typed the path to the streaming server as follows.

http://streamingserver_ip:8000/example1.ogg. m3u

This should launch your default media player and start playing the stream. Note that if you don't want to use the browse and would rather type the path to the stream directly on the media player then you should omit the .m3u extension. Currently I've got two notebooks in two different rooms playing the same song with a slight lag between the two. Now all I need is a couple of wireless speakers that are icecast/shoutcast compatible so I can leave one in each room, without having to sacrifice wireless notebooks for the job.

May be another day~ Happy streaming!


Steve Austin said...

Informative blog. I have a xml software blog.

Anonymous said...

I have been trying to do this, BUT *NO ONE* other than computer techies or linux freaks (which I am ) listensd to .ogg streams!
I want to stream MP#. It seems so STUPID that they took that option way in the newer version, how can i stream mp3's using 1 server running linux (ubuntu 7.10 ) Also I have debain on another computer. No windows, and I do not want ogg, (even .wma would be better many more people can listen, besides fringe group of people that use ogg_ if any one can help

Bud said...

I haven't looked into this for a long time but AFAIK there was mp3 support with icecast. Here is a script I was using at the time to stream mp3 to my PSP (pspRadio homebrew app)

muse -C /home/icecast/playlist.pls -o -e mp3 -b 128 -q 9.0 -c 2 --server localhost -m live.mp3 -p mysecretpassword