I have a raspberry pi B+ and a hifiberry amp+ and I would like to be able to play music with it. Is it possible to do so only by a shell script? Or do I have to install something like OSMC or Volumio?

I managed to play music on the audio jack of the board with mpg321. But either I connect the big speaker wrong or I have to do something else.

Thank you for helping me.

  • It certainly does. Could you check support.hifiberry.com/hc/en-us/articles/… for the configuration and support.hifiberry.com/hc/en-us/articles/… for testing sound using mplayer. If your audio output is still on the analogue jack there probably just something configured that way. You need to check the relevant config files (see first link) and if it will still be not working provide your config to help answer the question.
    – Ghanima
    Jun 1, 2016 at 18:20

1 Answer 1


You certainly can approach it that way, but it's much harder. Using something like runeaudio or Volumio makes the process much easier. However, I understand why you would not want to. In this case, I think you can just install MPD (the music player daemon) Here is an article which details turning a Raspberry pi into a headless player: https://www.lesbonscomptes.com/pages/raspmpd.html From that article, how to install MPD:

Installing MPD


I have been told that alsa-utils was not always pre- or auto-installed, and is needed. (In my experience it’s always already there). In any case, requesting it again won’t hurt:

sudo apt-get install alsa-utils As we want MPD 0.19, we need to get it from an alternate repository. I maintain the repository in question, and you’ll have to trust that I did not introduce a Trojan in the MPD source. If you don’t, you could also rebuild from the debian source package, also available there, which would be reasonably safe as you would check the MPD source tarfile against the official depot. If the leap of faith is not too much for you, here how the simple approach goes:

cd /etc/apt/sources.list.d
sudo nano mpd.list

Insert the following lines:

deb http://www.lesbonscomptes.com/upmpdcli/downloads/mpd-debian/  unstable main
deb-src http://www.lesbonscomptes.com/upmpdcli/downloads/mpd-debian/ unstable main

Then save and exit.

Install MPD:

sudo apt-get update
sudo apt-get install mpd

This should list the MPD version as 0.19.x and Will probably display a few ipv6-related and other errors when starting up, ignore them.

Configure MPD by editing mpd.conf

sudo nano /etc/mpd.conf

If you chose to have MPD access the files directly (which would be my default choice now), change the following lines. You will need to substitute the IP address or DNS name for your samba/NAS server, and the volume name and path to where your music is stored.

 music_directory        "smb://MyServerNameOrAddress/path/to/Music"
 bind_to_address         "any"
 audio_output {
     device          "hw:1,0"    # optional usb output. Keep 0,0 if using the Pi audio
 mixer_type                      "software"

If you chose to mount the server volume instead, the music_directory line will look something like the following (NFS case):

 music_directory         "/net/servername/path/to/music"

If you have a doubt about your card number, use the aplay -l command to list the cards. The internal audio is bcm2835.

Restart mpd:

sudo service mpd restart

Install any of the music play daemon clients (ipad/Android/phpmp whatever…) on your remote, use it to tell mpd to update its tags database, and you should be good to go ! I quite like MPDroid on my Nook tablet as a client … If you did not perform the DNS dance linked above, you will need to use the IP address to connect, and if you also skipped the fixed address part, it might change one day (unlikely in most circumstances in fact).

One approach to avoid these names and addresses issues is to use an UPnP front-end to MPD instead. The main purpose of UPnP is to free you from these trivial matters.

Hope it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.