Setting up MPD

The last step is setting up mpd.  This is the service that loads the music files, processes them and sends them to ALSA to play. It also listens to ports so that it can be controlled remotely.   I use "MPDroid" on my Android phone, but as I write this I see it has been discontinued, so I might migrate to another application.   

I'm using the LUbuntu install of mpd, which sets it up as a system service and creates an "mpd" user and "audio" group.  In my install, I put my music library in /home/Music and made it owned by the mpd user and in the audio group. I similarly put all the other mpd files (playlists, database, etc) in various subdirectories of the music library. 

I use the "bind_to_address" line of the configuration file.  I had to use my internet router to fix the address of the music server.  You then put this address (whatever you've chosen) in the bind_to_address field. 

Setting the log_level to "verbose" is useful when debugging problems, but you might as well keep it at "default" if you are not experiencing troubles. 

The audio_output is the most important part of the file -- making sure MPD can communicate with ALSA. For my alsa setup, all I have to do is:

audio_output {
        type            "alsa"
        name            "USB Streamer - LX521.4"

and MPD is smart enough to use the "default" ALSA device, which has the channel remapping.  the "name" field is completely arbitrary and has nothing to do with the ALSA settings.  As far as I can tell this is mostly seen in the mpd log file.  But if I set up ALSA without remapping the default device, I would have to specify a "device" here in audio_output and possibly a "mixer_type" and "mixer_device" if mpd or ALSA had trouble finding mixer controls for the device. 

Once its set up, restart mpd and check to see if it works.

Restarting mpd:

sudo systemctl restart mpd

Stopping mpd:

sudo service mpd stop

Starting mpd:

sudo service mpd start