Setting up an Internet Radio Station


Using icecast and darkice you can easily setup your own radio station and broadcast whatever is connected to the pisound input!

First let’s get the required software installed:

sudo apt-get install icecast2 darkice

Then we have to configure the darkice, feel free to customize to your liking.

Save the below contents to /etc/darkice.cfg

# this section describes general aspects of the live streaming session
duration      = 0                # duration of encoding, in seconds. 0 means forever
bufferSecs    = 2                # size of internal slip buffer, in seconds
reconnect     = yes              # reconnect to the server(s) if disconnected

# this section describes the audio input that will be streamed
device        = hw:1,0           # Alsa soundcard device for the audio input
sampleRate    = 48000            # sample rate in Hz. try 48000, 96000 or 192000
bitsPerSample = 16               # bits per sample. try 16
channel       = 2                # channels. 1 = mono, 2 = stereo.
                                 # Only stereo mode is supported by pisound.

# this section describes a streaming connection to an IceCast2 server
# there may be up to 8 of these sections, named [icecast2-0] ... [icecast2-7]
# these can be mixed with [icecast-x] and [shoutcast-x] sections
bitrateMode   = cbr              # variable bit rate
bitrate       = 128
format        = mp3              # format of the stream: mp3
quality       = 0.8              # quality of the stream sent to the server
server        = localhost        # host name of the server
port          = 8000             # port of the IceCast2 server, usually 8000
password      = hackme           # source password to the IceCast2 server
mountPoint    = pisound          # mount point of this stream on the IceCast2 server
name          = pisound          # name of the stream
description   = DarkIce on pisound # description of the stream
url           = http://localhost # URL related to the stream
genre         = my genre         # genre of the stream
public        = no               # advertise this stream?
#localDumpFile = recording.mp3   # Record also to a file

And finally, execute ‘darkice’ in a terminal or using Alt+F2:


Then from other devices you can connect to http://raspberrypi_ip:8000/ to see generic information about the station and http://raspberry_pi:8000/pisound to listen. (Replace raspberrypi_ip in the URLs using the IP of the Raspberry Pi)

For your station to be reachable outside of your local network, you need to have an externally accessible IP address provided by your ISP and you need to configure port forwarding on your router to forward requests on some port to port 8000 on Raspberry Pi. However, this is out of scope for this guide, there should be plenty of info around on how to set that up. :slight_smile: