Radio streaming with OpenWrt

I have been doing a bit more playing around with USB sound cards and OpenWrt. I thought that a pretty good use for my HooToo HT-TM02 would be as an internet radio player. So I have been experimenting. I installed the following packages (I already had USB support working):

  • kmod-usb-audio
  • madplay
  • alsa-utils

Which enables me to play internet radio streams from the command line. I have been trying the stations listed on www.intenet-radio.com. If the station shows a PLS link, I found that you can download it as a playlist-file and extract the URL from inside using a text editor. In many cases, this seems to work very well (but not all streams worked). Then just use this command on OpenWrt and replace the URL:

wget -O - [URL] | madplay - -a-30 -o wave:- | aplay

Which will play the stream (I'm dropping the volume with -30 in that example). In reality, I've been using all the commands in quiet mode and in the background, like this:

wget -q -O - [URL] | madplay -Q - -a-30 -o wave:- | aplay -q &

...which just plays the stream in the background without any other output to the console. In addition, I also found the BBC radio station streams listed on this website which is pretty useful (and also the French station, Fip for good measure):

  • http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p
  • http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1xtra_mf_p
  • http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p
  • http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio3_mf_p
  • http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p
  • http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4lw_mf_p
  • http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4extra_mf_p
  • http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio5live_mf_p
  • http://bbcmedia.ic.llnwd.net/stream/bbcmedia_6music_mf_p
  • http://bbcmedia.ic.llnwd.net/stream/bbcmedia_asianet_mf_p
  • http://bbcmedia.ic.llnwd.net/stream/bbcmedia_nangaidheal_mf_p
  • http://audio.scdn.arkena.com/11016/fip-midfi128.mp3

A better way to set the volume from the command line, is to use the amixer command, I'm using something like this:

amixer sset Headphone 50%

Although the more fancy alsamixer command seems to work fine as well.

After using that for a while, I think it's a very good use for the HooToo, so I am building a simple front end and will keep it as a miniature internet radio player.