Print this Page

Home Server Music Player Daemon

Index.

09-Dec-2011: initial release.

 

Introduction.

If you have stored your music collection on the Home Server and maybe have installed a DLNA server, then you could also use your server to play music. It’s almost certain that your server has a soundcard on the motherboard so all you need to do is add some speakers. Or, just connect some USB speakers.

The Music Player Daemon, or in short MPD, is ideally for this purpose. It runs on the server and can be controlled from a workstation, a web interface, or from your phone.

 

Installation.

Make sure your server has alsa-utils installed and that you can play mp3 files with a command line player like mpg123. With alsamixer you can set the mixer levels from the console. When this works you can install mpd:

[root@homsrv ~]# pacman -S mpd
resolving dependencies...
looking for inter-conflicts...

Targets (18): libao-1.1.0-1  libmodplug-0.8.8.3-1  audiofile-0.3.2-1
              libshout-1:2.2.2-4  libmad-0.15.1b-5  faad2-2.7-2
              libsndfile-1.0.25-1  libsamplerate-0.1.8-1  jack-0.121.3-4
              libmms-0.6.2-1  wavpack-4.60.1-1  libmpcdec-1.2.6-3
              libasyncns-0.8-3  recordproto-1.14.1-1  libxtst-1.2.0-1
              json-c-0.9-1  libpulse-1.1-1  mpd-0.16.6-1

Total Download Size:    3.11 MB
Total Installed Size:   17.46 MB

Proceed with installation? [Y/n]
:: Retrieving packages from extra...
 libao-1.1.0-1-i686       40.6K  230.1K/s 00:00:00 [######################] 100%
 libmodplug-0.8.8.3...   147.1K  422.1K/s 00:00:00 [######################] 100%
 audiofile-0.3.2-1-i686  149.6K  427.6K/s 00:00:00 [######################] 100%
 libshout-1:2.2.2-4...    51.6K  220.2K/s 00:00:00 [######################] 100%
 libmad-0.15.1b-5-i686    73.9K  296.9K/s 00:00:00 [######################] 100%
 faad2-2.7-2-i686        179.4K  475.3K/s 00:00:00 [######################] 100%
 libsndfile-1.0.25-...   312.7K  636.5K/s 00:00:00 [######################] 100%
 libsamplerate-0.1....   959.8K  887.8K/s 00:00:01 [######################] 100%
 jack-0.121.3-4-i686     309.6K  626.1K/s 00:00:00 [######################] 100%
 libmms-0.6.2-1-i686      26.7K  154.4K/s 00:00:00 [######################] 100%
 wavpack-4.60.1-1-i686   136.6K  426.9K/s 00:00:00 [######################] 100%
 libmpcdec-1.2.6-3-i686   22.1K  125.2K/s 00:00:00 [######################] 100%
 libasyncns-0.8-3-i686    17.2K  144.6K/s 00:00:00 [######################] 100%
 recordproto-1.14.1...    13.7K  111.9K/s 00:00:00 [######################] 100%
 libxtst-1.2.0-1-i686     24.0K  136.6K/s 00:00:00 [######################] 100%
 json-c-0.9-1-i686        24.5K  139.6K/s 00:00:00 [######################] 100%
 libpulse-1.1-1-i686     265.3K  587.0K/s 00:00:00 [######################] 100%
 mpd-0.16.6-1-i686       431.1K  692.6K/s 00:00:01 [######################] 100%
(18/18) checking package integrity                 [######################] 100%
(18/18) checking for file conflicts                [######################] 100%
( 1/18) installing libao                           [######################] 100%
( 2/18) installing libmodplug                      [######################] 100%
( 3/18) installing audiofile                       [######################] 100%
( 4/18) installing libshout                        [######################] 100%
( 5/18) installing libmad                          [######################] 100%
( 6/18) installing faad2                           [######################] 100%
( 7/18) installing libsndfile                      [######################] 100%
( 8/18) installing libsamplerate                   [######################] 100%
( 9/18) installing jack                            [######################] 100%
Optional dependencies for jack
    libffado: FireWire support
    celt: NetJACK driver
(10/18) installing libmms                          [######################] 100%
(11/18) installing wavpack                         [######################] 100%
(12/18) installing libmpcdec                       [######################] 100%
(13/18) installing libasyncns                      [######################] 100%
(14/18) installing recordproto                     [######################] 100%
(15/18) installing libxtst                         [######################] 100%
(16/18) installing json-c                          [######################] 100%
(17/18) installing libpulse                        [######################] 100%
Optional dependencies for libpulse
    alsa-plugins: ALSA support
    avahi: zeroconf support
(18/18) installing mpd                             [######################] 100%
==> Create a configuration file /etc/mpd.conf before using MPD (example: /usr/sh
are/mpd/mpd.conf.example)
[root@homsrv ~]# cp /usr/share/mpd/mpd.conf.example /etc/mpd.conf
[root@homsrv ~]#

Edit /etc/mpd.conf , for example like this:

music_directory    "/mnt/media/Audio"
playlist_directory "/var/lib/mpd/playlists"
db_file            "/var/lib/mpd/mpd.db"
log_file           "/var/log/mpd/mpd.log"
pid_file           "/var/run/mpd/mpd.pid"
state_file         "/var/lib/mpd/mpdstate"
user               "mpd"
zeroconf_enabled   "no"

input {
        plugin     "curl"
}

audio_output {
        type       "alsa"
        name       "My ALSA Device"
}

It is possible to add more output devices like the httpd or shout server outputs. From the client (not all support that) you can toggle each output on or off. Default they are all on.

Now start the daemon and don’t forget to add it to /etc/rc.conf:

[root@homsrv ~]# rc.d start mpd
:: Starting Music Player Daemon                                          [DONE]
[root@homsrv ~]#

 

Clients.

On the server you can install the mpc package. This is a very simple command line client. For all other clients I don’t give any advice, there are too many choices, try “pacman -Ss mpd” to see several clients available for ArchLinux.

 

Download.

Linux Home Server complete package
Linux Home Server complete package
homeserver-complete.tar.gz
2.6 MiB
7 Downloads
Details...

 

Permanent link to this article: http://www.mbse.eu/linux/homeserver/extra/mpd/