You are here:
< Back

Original post here:

https://maker.pro/raspberry-pi/projects/how-to-build-an-internet-radio-station-with-raspberry-pi-darkice-and-icecast

Connect to the Raspberry Pi with SSH or use an HDMI display if you are unfamiliar with SSH. Enter and execute the following commands in the terminal:

wget https://github.com/x20mar/darkice-with-mp3-for-raspberry-pi/blob/master/darkice_1.0.1-999~mp3+1_armhf.deb?raw=true
mv darkice_1.0.1-999~mp3+1_armhf.deb?raw=true darkice_1.0.1-999~mp3+1_armhf.deb
sudo apt-get install libmp3lame0 libtwolame0
sudo dpkg -i darkice_1.0.1-999~mp3+1_armhf.deb

Darkice file on our server:

wget http://freefm.co.uk/Downloads/darkice_1.0.1-999_mp3+1_armhf.deb

How to Configure Darkice in Raspbian


After the Icecast2 installation, we need to make a Config file for DarkIce in Raspbian. Start by entering the following command in the terminal:

sudo nano /etc/darkice.cfg
I preffer this configuration, example is for Shoutcast and two Icecast streams:

[general]
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
#realtime        = yes       # run the encoder with POSIX realtime priority
#rtprio          = 3

# this section describes the audio input that will be streamed

[input]

device          = hw:1,0    # depends from your audio input
sampleRate      = 48000     #48000/44100
bitsPerSample   = 16        # bits per sample. try 16
channel         = 2         # channels. 1 = mono, 2 = stereo



[shoutcast-0]

format          = mp3
bitrateMode     = cbr
bitrate         = 128       #shoutcast streams can be up to 128k only , if for free
quality         = 1.0       #0.1-1.0
server          = yourserverip
port            = 8001
password        = *****
name            = My stream        # name of the stream
url             = http://stream.com  # URL related to the stream
genre           = dance        # genre of the stream
public          = yes           # advertise this stream? yes/no


# 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
 [icecast2-0]
 bitrateMode     = abr       # average bit rate  abr/vbr/cbr
 format          = vorbis    # format of the stream: ogg vorbis
 bitrate         = 256        # bitrate of the stream sent to the server
 server          = yourserverip
                            # host name of the server
 port            = 8020      # port of the IceCast2 server, usually 8000
 password        = *****    # source password to the IceCast2 server
 mountPoint      = stream  # mount point of this stream on the IceCast2 server
 name            = My stream
                            # name of the stream
 description     = Radio 1
                            # description of the stream
 url             = http://  # URL related to the stream
 genre           = Dance    # genre of the stream
 public          = yes       # advertise this stream?


# 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
 [icecast2-1]
 bitrateMode     = abr       # average bit rate
 format          = vorbis    # format of the stream: ogg vorbis
 bitrate         = 128        # bitrate of the stream sent to the server
 server          = yourserverip
                            # host name of the server
 port            = 8020      # port of the IceCast2 server, usually 8000
 password        = *****    # source password to the IceCast2 server
 mountPoint      = stream-128.ogg  # mount point of this stream on the IceCast2 server
 name            = My stream 128k
                            # name of the stream
 description     = Radio 1
                            # description of the stream
 url             = http://    # URL related to the stream
 genre           = Dance    # genre of the stream
 public          = yes       # advertise this stream?

Save and exit. Then Add following line in crontab: ( enter: crontab -e)

@reboot /usr/bin/darkice