HCP #3 Turn your Raspberry Pi into a broadcasting audio stream
What I was attempting to do here, is to use my Pi to access the musics stored on my NAS (Synology), and play the music files, in order to stream the audio flux to an Icecast Server.
Now, you may of course need the Icecast Server, and I personally use an OVH dedicated server where I installed Icecast (which is really easy, just check online).
In the previous HCP tutorial, we already managed to access our files from the Pi. Now we need to play the songs and stream the flux on the web.
It seems to be a pretty common thing to do, but I spent hours to finally get to a working solution.
After being logged into your pi as root, here are the steps :
MPD is an audio player server. This application will manager all your configurations.
MPC is the client that will interact with MPD. MPC will manage your songs, playlists, and typical commands like 'play', 'stop', 'next', etc.
So quickly run
apt-get install mpd mpc
With your favorite editor, edit /etc/mpd.conf
There are a lot of things here, and you can let the default values for most of them. Just have a look at :
In Audio Outputs, you already have an example for Icecast. Simply uncomment the lines and set your configuration values, and it should be good :)
Now restart mpd with
From now on you can basically play with the mpc client and start playing songs, adding them to the playlist, etc.
All available commands are explained here : http://linux.die.net/man/1/mpc
Basically you will do :
mpc clearto clear anything in the list and get fresh
mpc add your_songs.mp3this will add a song into the playlist
mpc statusto check the playlist content
mpc playto start playing (now go to your Icecast stream and check it out !)
Note that I didn't find a way to read pre-created .m3u playlist yet. I think that the playlists generated by my Synology does not have the right content formatting and mpc can't read them well...
That's it ! Now if you enable the repeat option, you will have a non-stop playing radio, that will come from your pi !
Enjoy your local music anywhere in the world as a radio :)
I consider myself as an IT Business Artisan. Or Consultant CTO. I'm a self-taught Web Developper, coach and teacher. My main work is helping and guiding digital startups.more about me
2021 My Dynamic Production SPRL All rights Reserved.