Streaming Radio

Tonight it snowed a bunch in Portland, enough that the roads started getting super slippery and dangerous. I tuned in to K7RPT to see what people were talking about, and there was lots of traffic! People giving short traffic reports from wherever they happened to be at the time, reporting from the various Portland bridges and highway onramps.

The view out my window

I was mentioning that on the #pdxtech IRC channel, and someone asked if there was an Internet stream they could tune in to for the repeater. I couldn't find anything on the K7RPT web page about there also being an Internet gateway, so I started looking up how I could stream audio from my Baofeng receiver to the Internet through this Raspberry Pi.

It took a bit to understand the parts required, but I got it working in a few minutes.


DarkIce is responsible for reading audio from the Raspberry Pi sound card and pushing it to the Icecast streaming server. I installed DarkIce on the Raspberry Pi with apt-get install darkice. I made a config file darkice.cfg in my home directory with the following:

duration        = 0      # duration in s, 0 forever
bufferSecs      = 1      # buffer, in seconds
reconnect       = yes    # reconnect if disconnected

device          = plughw:1,0 # or `pulse' for Pulseaudio
sampleRate      = 22050   # sample rate 11025, 22050 or 44100
bitsPerSample   = 16      # bits
channel         = 1       # 2 = stereo

bitrateMode     = vbr       # variable bit rate (`cbr' constant, `abr' average)
quality         = 1.0       # 1.0 is best quality
format          = mp3       # format. Choose `vorbis' for OGG Vorbis
bitrate         = 128       # bitrate
server          = # IP address of the IceCast server
port            = 8000      # port for IceCast2 access
password        = ******    # source password to the IceCast2 server
mountPoint      = radio.mp3 # mount point on the IceCast2 server .mp3 or .ogg
name            = radio

You can then launch DarkIce with the following command:

darkice -c ~/darkice.cfg

I decided to run IceCast on a separate server at home, since I wasn't sure how well the Raspberry Pi could handle it. It is an Ubuntu server, so I installed IceCast with: sudo apt-get install icecast2. The installer walks you through setting up the necessary passwords, and writes the config file itself.

Start IceCast by running sudo service icecast2 start.

You can then visit the IceCast admin interface by opening your browser to the server's IP address and port 8000, e.g. There, you can see the status of any clients pushing audio to the server, and any clients streaming from the server.

Once you start both IceCast and DarkIce, you can then open the audio stream from a player like VLC! Just open from VLC and you will start hearing the audio!

Then all you need to do is forward a port from your router to this server, and you can share the URL with anyone, and they can hear whatever your hear on your radio!

Some useful links I used when figuring this out: