Skip to main content
 

Use your server to stream music

2 min read

My computer is an ultrabook shipped with a nice 120Gio SSD drive. Unfortunately, I don't have any room for music. I however still have an hard drive with dozens of Gio of nice music, but it's very unconvenient to carry it around (and it's not really useful to have an ultrabook if you have to carry what couldn't fit inside it).

The solution I found was to put all my music on a server (for example a RaspberryPi), and use it to stream the music using MPD (to control the music, have a database) and Icecast (to stream it).

First install both of them sudo aptitude install mpd icecast. You then have to configure mpd by editing the file /etc/mpd.conf. Replace in the following YOURDOMAIN by the domain name of your server (or its IP address) and PASSWORD1 and PASSWORD2 :

music_directory                 "/var/lib/mpd/music"
…
user                            "mpd"
bind_to_address                 "YOURDOMAIN.com"

auto_update "yes" follow_outside_symlinks "yes" follow_inside_symlinks "yes"

password "PASSWORD1@read,add,control,admin" … audio_output { type "shout" encoding "ogg" name "My Shout Stream" host "localhost" port "8000" mount "/mpd.ogg" password "PASSWORD2" quality "7.0" format "44100:16:1" protocol "icecast2" user "source" public "yes" timeout "2" } audio_output { type "shout" encoding "ogg" name "My Shout Stream - HD" host "localhost" port "8000" mount "/mpd_good.ogg" password "PASSWORD2" quality "10.0" format "44100:16:1" protocol "icecast2" user "source" public "yes"
timeout "2"
}


You then have to configure icecast to stream mpd to the internet. For this, edit /etc/icecast2/icecast.xml and modify the section . PASSWORD2 have to match PASSWORD2 defined before.

    

PASSWORD2

PASSWORD3


ADMINNAME
ADMINPASSWORD

Moreover, if you have a domain name, change the line containing "" to match it YOURDOMAIN.com.

Well this is pretty most it, you will then have access to your stream through http://YOURDOMAIN.com:8000/mpd.ogg and http://YOURDOMAIN.com:8000/mpd_good.ogg. If you want to access remotely your mpd, install a client like sonata, and do not forget to specify the password, which is PASSWORD1.