Raspberry Pi internet streaming radio station

My partner has been overseas for a few months and was desperately missing a local radio station. It doesn’t have an online stream that she can listen to and so she asked me whether I could record the station for ten hours – this just sounded like a hassle, so I set up an internet streaming station to permanently re-stream the local broadcast over the internet using my Raspberry Pi, a cheap USB sound card, a cheap DAB digial radio, and darkice/icecast to run the streaming server.

The output of lsusb showed the cheap USB sound card to be a “C-Media Electronics, Inc. CM108 Audio Controller”. I found that I could access the device using ALSA and the arecord utility (as long as I didn’t specify 2 channels):

Next, I tried to set up icecast2 with darkice. I’m using Raspbian and the standard raspbian-distributed package for darkice is not compiled with ALSA support, and I nearly fell down a rabbit-hole trying to get OSS-compatible emulation working.

In the end, I was able to compile and install darkice with ALSA and mp3 support by following the excellent instructions here:

http://mattkaar.com/blog/2013/05/26/web-streaming-with-the-raspberry-pi-baby-monitor/

My darkice.cfg file looks like this:

The setup works beautifully and CPU (original rPi) hits around 25% per streaming client. Since I only expect to stream to one client, this is fine.

As AM has quite a limited bandwidth I expect I could drastically lower the bitrate that darkice is encoding at, and also add a highpass parameter to filter out any noise.

To round off the project I also made the rPi serve a little webpage, with a link to .m3u file plus an embedded HTML5 player:

Hear it here: radio.jeremyhall.com.au

Finally, I made darkice run as a service using daemontools using the instructions on this stackexchange post: http://unix.stackexchange.com/questions/92545/starting-darkice-automatically-via-daemontools

Update: It’s still running strong a few months later. Having now joined my partner overseas, we listen to it every day!

Second update (June 2017): The radio station that was being re-streamed has now started their own official stream, so my stream is no longer running.

Previous Post

Modbus TCP Temperature Sensor with Arduino and LM335

I used to hate on Arduino a bit, but have recently come around. I was having a conversation with a work colleague along the lines of how super easy it would be ... Read more

Next Post

Monitoring and reporting 3G radio signal-strength (RSSI, dBm) on Mikrotik Routerboards

Monitoring a large number of Mikrotik Routerboards is easy using software and tools like LibreNMS and Oxidized, but it is unfortunately not possible to retrieve values for 3G/4G/etc signal-strength RSSI (in dBm) ... Read more

Leave a Comment