Music Player Daemon on Raspberry
In this post I will show how to install a music server on the Raspberry to play music. The objective of this post is installing MPD with MPC or another front end to be able to control the music player and let it play.

1) Introduction
I am going to show how to install MPD (Music Player Daemon) linked to the bluetooth speakers we set up before in the previous post.
2) MPD installation
First of all update all the system :
sudo apt-get update
sudo apt-get upgrade
After that install MPD and MPC that :
sudo apt-get install mpd mpc alsa-utils
As I showed in the previous post you have to install your bluetooth device as general user editing .asoundrc :
sudo nano .asoundrc
So in my case :
pcm.bluetooth {
type plug
slave {
pcm {
type bluetooth
device 00:11:67:8C:17:80
profile "auto"
}
}
hint {
show on
description "My bluetooth headset"
}
}
ctl.bluetooth {
type bluetooth
}
Now, once it is installed just type in the console this line to install mpd:
sudo gedit /etc/mpd.conf
And set up it like this, set up your music home directory in music_directory, remember to modify the permission to let MPD read and write there. audio_output set up the audio output and points to the bluetooth configured in .asoundrc .
music_directory "/home/gusa/musica"
bind_to_address "localhost"
audio_output {
type "alsa"
name "bluetooth"
device "bluetooth" # optional
format "22100:16:2" # optional
}
Allow the user mpd to access to the sound group :
gpasswd -a mpd audio
2.1) Audio Jack output
In case you want to set up the output to the jack speaker in the Raspberry load the driver:
sudo modprobe snd_bcm2835
sudo amixer cset numid=3 1
Load the module at the start of the system:
sudo nano /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
snd-bcm2835
And finally in the mpd.conf file :
audio_output {
type "alsa"
name "My ALSA Device"
device "hw:0,0" # optional
# format "44100:16:2" # optional
# mixer_device "default" # optional
# mixer_control "PCM" # optional
# mixer_index "0" # optional
}
3) MPC
MPC is a client for MPD. In order to kill mpd server just type :
sudo mpd kill
If you want to add new content to the playlist use this line where / is the path to the music folder:
mpc add /
In order to load a new playList type:
mpc load yourPlayList
And now play music with:
mpc play