The project's scope is to have your own radio station broadcasting live audio streams, either live, streamed via a UDP socket or just simple mp3 files.
I stumbled upon the problem of broadcasting sound(live, prerecorded or just music) over IP on a one-to-many network topology and setup a nice solution that works on a generic server machine.
You can do this by hosting a digital radio server and broadcasting the sound; to get external access you'll need a real IP address or static DNS, you can get it from your ISP; in case you want to go public, a licence to stream audio will be required.
What you need to set this up wll be a audio server - I used IceCast2 - , you'll also need an audio feeder that will feed audio to this server, I used Ices2. Ices2 can either read audio data from disk (Ogg Vorbis files), or sample live audio from a sound card and encode it on the fly. I deployed everything to a RaspeberryPi 3+ running Raspbian..
install necessary packages. Note: The names can vary slightly according to Linux distribution
$ sudo apt-get update $ sudo apt-get dist-upgrade $ sudo reboot
for IceCast2 I downloaded this version: icecast-2.4.3.tar.gz untar and install
$ sudo apt-get install libxml2 libxslt1-dev curl vorbis-tools libogg-dev libvorbis-dev libshout3-dev
$ tar -xvf icecast-2.4.3.tar.gz $ cd icecast-2.4.3 $ ./configure $ make $ sudo make install
$ sudo nano /usr/local/etc/icecast.xml edit location tag: replace 'Earth' with something else change port: <listensocket> <port>8003</port> </listensocket>
$ icecast -c /usr/local/etc/icecast.xml
and kill it
$ netstat -tnlp | grep 8003
IceCast2 server UI
Ok, now we have the radio server up and running and waiting for some audio streams. To get the audio streams we have several options. I choose IceS2 which is a source client for Icecast streaming server. It's purpose is to provide an audio stream to IceCast. IceS can run on the same machine or a different one, so we can steam the data from the network.
Now we'll install IceS2 and all dependenciesinstall ices2
$ apt-get install ices2
copy template config file
$ sudo mkdir /var/log/ices $ sudo mkdir /etc/ices2 $ sudo mkdir /etc/ices2/music
edit config file
$ sudo cp /usr/share/doc/ices2/examples/ices-playlist.xml /etc/ices2
$ sudo nano /etc/ices2/ices-playlist.xml
changes to run in background:
changes to log in console:
point to the playlist file:
Note: IceS2 doaes not support mp3, so the playlist should contain for eg .ogg files.
$ ices2 /etc/ices2/ices-playlist.xml
If there are no errors it should look like this:
IceCast2 server UI