Music and Playlists Folders
We'll store music and playlist files in the default pi users home directory. Use mkdir to create these folders. An initial cd is done to make sure the current directory is the pi user's home directory (/home/pi).
Run these commands:
cd mkdir music playlists
Nothing exciting should happen.
- The /home/pi/music directory will contain the actual music files, like MP3s, etc.
- The /home/pi/playlists directory will contain playlists.
MPD Configuration
The main file that controls the mpd configuration is located in /etc/mpd.conf. A default file is added during the installation of mpd. There is a lot of content in this file, however the vast majority is commented out and is just there for reference. For this guide, it is possible to use a very minimal configuration.
First, let's move (rename) the original file so it's still available as a backup:
sudo mv /etc/mpd.conf /etc/mpd_orig.conf
Now use a text editor to add the contents below to a new empty /etc/mpd.conf.
music_directory "/home/pi/music" playlist_directory "/home/pi/playlists" audio_output { type "alsa" name "USB Audio Adapter" device "hw:2,0" }
This sets the following:
- Sets the music_directory and playlist_directory to the locations we created previously.
- The audio_output lines enable using the USB audio adapter. Actually selecting this output is done later.
Adding this content to /etc/mpd.conf can be done using the nano text editor as shown below.
The contents should initially be empty. If not, make sure a backup was made, and then just delete everything.
Restart MPD Server
For the configuration changes to take effect, the mpd server needs to be restarted. Use the following command:
sudo systemctl restart mpd
This should not generate any additional output. So running mpc status
as a quick sanity check can help to make sure the mpd server actually did restart.
For comparison, here is what mpc status
will output if the mpd server is not running:
Text editor powered by tinymce.