Setting Cantata and MPD to Play Music on Ubuntu
In the previous article, you have installed Cantata and MPD (Music Player Daemon) on Ubuntu as a music player application.
But in order to be able to use it to play music, you have to do a little configuration first on MPD (Music Player Daemon) and Cantata.
We assume you have successfully installed MPD and Cantata on your device, or if you haven’t installed the two applications, you can follow the tutorial to install them first here.
As we know that Cantata is just an app music clients, or Cantata is just a front-end or just a graphical display that serves to manage music lists and playlists to make it easy for users to use.
While MPD is a daemon or service which will be back end which will only run in the background.
In order to be able to play music, of course we will need both. All we need to do is configure a bit so that the two can connect and work with each other and play music.
MPD (Music Player Daemon) Configuration
MPD doesn’t have a GUI (Graphic User Interfaces), so to configure MPD, we will do it using text configuration using the application text editor.
In this tutorial I will use text editor nano and configure it via Terminal. Text editor nano already exists default on Linux.
You can use text editor this or use text editor anything else you want, all you need to do is adjust the steps in this tutorial a little bit with text editor that you use.
Before configuring, we have to turn off service from MPD by using systemd first. Open Terminal and turn it off service by using the following command:
sudo systemctl stop mpd
After successfully turning off the MPD, we can start configuring.
The main configuration of MPD is located in the file “/etc/mpd.conf”. Open the file to modify its contents by entering the following command in Terminal:
sudo nano /etc/mpd.conf
All major configurations are located in this file. Maybe the main configuration to do is already filled in by settings default automatically, but you can change according to what you want.
One of the most important configurations is music directories. This configuration serves to specify a directory to provide lists of music files. There is variable which is named “music_directory” and next to it there is a line where the music directory is located as follows:
music_directory "/home/sudoway/mpd/music"
Replace the script “/home/sudoway/mpd/music” in that line with the address of the directory you want to use as your music directory. Add music to the file directory so that the music can be loaded by the MPD.
Actually, just by configuring the music directory, MPD configuration is also enough, if you only use it for offline purposes. But you can also do other configurations if you want.
Then you can set where MPD will find and save the playlists you created. Same as music directoryyou just need to set the directory for playlists like the following line:
playlist_directory "/home/sudoway/mpd/playlist"
Don’t forget to replace “/home/sudoway/mpd/playlist” with directory playlists do you want.
Configuration defaultit’s good enough actually, but if you want to share playlists with other devices or with your friends, you can change the configuration defaultit and change directory playlists to the “/home” directory as above.
You must grant access rights to the two directories so that they can be accessed by MPD or other users. Grant permissions to the directory by using the following command:
chmod +x -R /home/sudoway/mpd/
chmod 755 -R /home/sudoway/mpd/
Don’t forget to match the directory “/home/sudoway/mpd/” with the directory you are using, if you are using a different directory.
You can also set user and group which can access the MPD server. To add or set user and groups, find and change the configuration section to something like this:
user "sudoway" group "nogroup"
You can replace the word “sudoway” with user anything else you want according to user that you have. As well as groups. You can also set access rights on users or group in more detail as you wish.
If you want MPD can be used in network. You have to arrange script “bind_to_address” with IP address or hostname your computer as an address for other devices to access.
But if you only want to use it locally, you can leave it with the following settings:
bind_to_address "localhost"
In addition, to be able to use MPD in the network you also have to set up port used for MPD is at port specific one.
by default, port used is 6600. Look for the line “#port “6600” in the file. Line script it is still a comment because it still uses a hash mark (#) at the beginning of the line.
Delete the hash line so that the settings port works, so that it looks like this:
port "6600"
To regulate password on the MPD, so that every user who wants to connect to the MPD must have passwords, you can set it on line script following:
password "sudowaypass"
Replace the word “sudowaypass” in that line with password that you want to use.
Actually, there are still many things that you can configure from this MPD according to the function you want. But for now as the main configuration, it should suffice for basic usage.
Don’t hesitate to do explore further yourself. Maybe next time we will make another tutorial for more configuration about MPD.
Cantata settings
After successfully configuring the MPD. You’ll also need to set up Cantata to connect to MPD.
After installing Cantata, you can directly open Cantata and Cantata will display interfaces like music players in general like Clementine and so on. The only difference is that Cantata uses MPD (Music Player Daemon) as a back end to serve music.
After opening Cantata, a window will appear asking you to set Cantata.
The first window will give you two options to choose mode which you will use between Standard and Single User Install. select “Standard” and then select next to advance to the next step.
The next step will guide you to connect Cantata with MPD (Music Player Daemon) servers. So adjust the configuration according to the configuration you have done on MPD.
by default the settings on Cantata will be filled with settings default from the MPD, such as localhost and port 6600. Please change the contents according to what you have done in the previous MPD, if you change default port on MPD, change it too port on the Cantata setting, as well as the others.
Don’t forget to set the music directory and playlists to the same directory as the directory you set in MPD. Set all these configurations with the exact same configuration as you did before.
If so, press the button connect to connect Cantata with MPD (Music Player Daemin) servers. If the settings are correct, the Cantata will be connected to the MPD.
You can already play music from Cantata and create playlists that you like. Cantata has many other features that you can use such as stream music by on line and others. Please explore Cantata to find and use the features you need.