Let the music play!

Jan 3, 2009 • alan


My friend Tim told me about a music service called “Pandora“, which is an internet radio station that runs in a flash applet in a web browser. You can suggest songs or artists, and vote songs up or down. It uses the the Music Genome Project to categorize music, and to add similar music to your playlists. It’s a pretty cool project.

However, I encountered problems when I ran it on my Asus Eee PC 900. Pandora seems to run fine by itself, but it pauses and skips if you are browsing in another window. I think it has to do with a combination of Firefox’s “AwesomeBar” and the Eee PC’s flash disk.

The Awesomebar is Firefox3’s new address bar that searches for matches among your bookmarks and the titles and URL’s from every web site you have visited recently. Since the Eee PC uses a solid state flash disk, disk writes are pretty slow. So when you are browsing, every time open a new page, Firefox 3 writes some stuff to its sqlite database of user history. It then calls fflush(), which flushes all writes (not just its own) to the disk. During this time, all browser activity halts until the writes are complete. Other applications keep running fine, but the browser rendering stops — often “graying out”, turning back-and-white until it starts responding again. The problem is, flash applets also pause, and that includes Pandora.

I considered a few solutions:

  • Run the Pandora applet in a different browser, and use Firefox for browsing.
  • Run the Pandora applet in a stand-alone flash player.
  • Run the Pandora applet on my server, while I browse on the Eee PC.
  • Run a different application for audio, like “audacious” (an xmms clone).

Combining a couple of these ideas, I wondered if I could run some sort of console-based streaming audio application on my server. It would be cool to hook up some speakers to bender and listen to internet radio.

It turns out that mplayer will do just that. For example:

mplayer http://wunc.org/about/listen.pls

And now we’re listening to our local NPR station!

Note – you’ll also want to install a utility to set the volume. I use alsamixer.

Of course, this does not solve the original problem of Pandora pausing. And there seems to be quite a frenzy on the Firefox bug tracker about flushing the history database.

But streaming audio from a headless server is a pretty neat idea, and one that may become a permanent fixture in my home office.