MPD - How to setup on Raspberry

From Linux - Help
Jump to navigation Jump to search
raspberry

'A quick guide, how to setup your Raspberry and MPD as music client & server.'

  • Note: This should work on mostly Linux system (ex.: Debian, Ubuntu, Fedora or Gentoo / Funtoo).

Installing MPD & configuration

You will first need to install MPD with some MPD client's, like mpc or ncmpc:

 # apt update
 # apt install mpd && apt install mpc ncmpc

After the installation you need to create some folde (in this installation the MPD will work in user-level, this is possible to do it in system level too, but this guide will onlu show user-level configuration.

 $ mkdir ~/.mpd
 $ mkdir ~/.mpd/playlist
 $ touch ~/.mpd/database ~/.mpd/log ~/.mpd/mpd.conf ~/.mpd/mpd.db ~/.mpd/mpd.log ~/.mpd/mpd.pid ~/.mpd/mpdstate ~/.mpd/pid

Then you can copie from this conf example to ~/.mpd/mpd.conf

 $ vim ~/.mpd/mpd.conf   
 ## add this line before or reuse from the config (make needed changes) 
 music_directory	"/path/to/your/music"
 playlist_directory	"/home/USER/.mpd/playlist"
 db_file		"/home/USER/.mpd/mpd.db"
 log_file		"/home/USER/.mpd/mpd.log"
 pid_file		"/home/USER/.mpd/mpd.pid"
 state_file		"/home/USER/.mpd/mpdstate" 

Ready to try it?

Now this is it for the confirugation of MPD. we can now try the insallation with:

 $ mpd 
 $ mpc update

From here you need to wait because it can take some time, you can see that it works with:

 $ tail -f ~/.mpd/mpd.log
 ## You should see something like this: 
 May 20 04:13 : update: added Orelsan/2011 - Le Chant Des Sirenes/04. Orelsan - Mauvaise        Idee.flac
 May 20 04:13 : update: added Orelsan/2011 - Le Chant Des Sirenes/03. Orelsan - Plus Rien Ne M'Etonne.flac
 May 20 04:13 : update: added Orelsan/2011 - Le Chant Des Sirenes/07. Orelsan - Si Seul.flac
 May 20 04:13 : update: added Orelsan/2011 - Le Chant Des Sirenes/02. Orelsan - Le Chant Des Sirenes.flac

When it finished to update your database, you can use mpc or ncmpc to listen, edit playlist and more.

 $ ncmpc
 # when started hit 3
 # Choose a Music and added it to queue with a or play it with enter. 

For more information how to use it, press 1.

 You can add somethin like this on your .profile file if you want to start your music at startup: 
 $ vim .profile
 mpc load topmusic && mpc play && mpc repeat on && mpc random on && mpc volume 90
  • Note the topmusic here is a playlist, create one first and change it with whatever name you give it.

Troubleshooting

If any issue with MPD, try out this command:

 $ mpd --verbose --no-daemon --stdout

I will update here if make any more changes or improvement of the configuration.