Install the MPD Music Server & Configure audio service in Raspberry Pi
Installation
MPD ( Music Player Daemon ) is a lightweight server for sharing a music library both locally and over a network. The MPD allows not only the music to be shared and played over the network, but also allows for numerous different front end clients.
Installing MPD is very easy and lightweight. Just update your system and install using the package manager. For Ubuntu :
sudo apt-get update sudo apt-get install mpd --no-install-recommends
Disable automatic recommendations Disable recommendations temporally (for single package installation), adding the --no-install-recommends option:sudo apt-get install package --no-install-recommends Disable recommendations permanently, using apt.conf file:echo -e 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' | sudo tee /etc/apt/apt.conf |
That's all. Now you can check the status of mpd by using

Start MPD service automatically on bootsudo systemctl enable mpd |
Configuration
MPD uses a text configuration file. If you are working from the command line , open the following file with Vim, Nano or any favourite editor. For GUI, you can use multiple editors.
sudo vim /etc/mpd.conf
As a reference, you can use this file :
Sound Problem
The Raspberry Pi has two audio output modes: HDMI and headphone jack. You can switch between these modes at any time.
Idea 1
The following command, entered in the command line, will switch the audio output to headphone:amixer cset numid=3 2
Here the output is being set to 2
, which is HDMI. Setting the output to 1
switches to analogue (headphone jack). The default setting is 0
which is automatic.
Idea 2
Open up raspi-config by entering the following into the command line:
sudo raspi-config
Select Option 7 Advanced Options
and press Enter
, then select Option A6: Audio
and press Enter
.
If you're still not getting sound via HDMI
In some rare cases, it is necessary to edit config.txt
to force HDMI mode (as opposed to DVI mode, which does not send sound). You can do this by editing /boot/config.txt
and setting hdmi_drive=2
, then rebooting for the change to take effect. -Source: https://www.raspberrypi.org