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.
Server diagram
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..
$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo reboot
install necessary packages. Note: The names can vary slightly according to Linux distribution
$ sudo apt-get install libxml2 libxslt1-dev curl vorbis-tools libogg-dev libvorbis-dev libshout3-dev
for IceCast2 I downloaded this version: icecast-2.4.3.tar.gz
untar and install
$ 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>
start icecast
$ icecast -c /usr/local/etc/icecast.xml
$ netstat -tnlp | grep 8003
and kill it
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 dependencies
install ices2
$ apt-get install ices2
$ sudo mkdir /var/log/ices
$ sudo mkdir /etc/ices2
$ sudo mkdir /etc/ices2/music
copy template config file
$ sudo cp /usr/share/doc/ices2/examples/ices-playlist.xml /etc/ices2
edit config file
$ sudo nano /etc/ices2/ices-playlist.xml
changes to run in background:
<background>0</background>
To
<background>1</background>
changes to log in console:
<console>0</console>
To
<console>1</console>
point to the playlist file:
<input>
<module>playlist</module>
...
<param name="/home/pi/Music/playlist.txt">
</input>
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
If you need some guidance in engineering field or you're seeking for some help don't hesitate to write me.