Online Jukebox

MPD and Cantata

Article from Issue 213/2018
Author(s):

The MPD server helps you manage your music collection flexibly and remotely and integrates external content.

For a long time, Linux had a reputation as not being suitable for multimedia applications because of a lack of appropriate codecs and applications. The tide has turned, and the package sources of most distributions contain more multimedia programs than many other operating systems. Almost every standard installation comes with audio players that play music files in all common formats. These programs usually only run locally on a desktop computer, where the audio files are also located. The players cannot be used on the web – or only to a very limited extent.

The Music Player Daemon (MPD) [1] lets users enjoy music far more flexibly and from any location: It acts as a music server on a standalone system or on the local network completely independent of the clients. On standalone systems, the advantages of MPD are less obvious than on the network, because the server and client run on the same machine and the function is thus similar to any conventional playback software for audio files. On your home network, for example, you can connect an MPD server to a hi-fi system and then control it with a notebook or smartphone. The streaming capabilities of the MPD server also let you play audio files on remote clients, if desired.

The MPD server can be found in the package sources of almost all major distributions, from Debian and Fedora to Mageia and from openSUSE to Slackware and Ubuntu. It can therefore be installed with just a few mouse clicks. However, configuring the service requires some manual work: As an administrative user, you will be concerned with the /etc/mpd.conf file, which you can open in an editor. This file groups all the important server settings.

Because MPD manages the audio files in a database, you need to change the path in the music_directory section in mpd.conf for where you want the service to search for music files. MPD can handle numerous file formats, from classic MP3s to the free Ogg Vorbis and FLAC formats. The software also stores individual playlists in a separate path on the server. Enter this in the playlist_directory section of the configuration file.

Architectural

Linux comes with several historically grown sound architectures, but not all of them support all applications. The MPD server shows its flexible side: It supports the most common sound architectures with OSS or ALSA and works in combination with PulseAudio. Furthermore, it gets on with the JACK audio server, which is more established in the professional sector.

Which sound architecture is used depends on the operating system and the hardware. You need to make the appropriate settings in the audio_output section of the server configuration file, where you will find preconfigured entries for the (default) ALSA subsystem and the older OSS sound architecture. You can enable them by deleting the hash sign (#) at the beginning of the corresponding lines. Conversely, you can disable entries by placing a hash sign at the start of the respective line (Figure 1).

Figure 1: The MPD server configuration takes place in a single file.

After changing the basic settings, launch the MPD server with:

sudo service mpd start

If the server was already active when the system rebooted, you can stop and reactivate it with the new settings by typing:

sudo service mpd restart

The server now waits for connection requests from the clients on the local network, default port 6600.

Clients

The many Linux MPD clients have different desktop-specific interfaces and ranges of functions. Cantata [2] is a relatively new but functionally mature front end based on the Qt5 libraries, although it also works under other graphics libraries.

Most popular distributions have Cantata in their repositories, so the program usually can be installed with a click of the mouse. The installation routine creates a starter in the Multimedia or Entertainment Media submenu. The program opens a clear-cut wizard for the configuration steps after the first start.

The first dialog gives some hints about the MPD server. In the second dialog, you define the operating mode: The function is available as a front end for an MPD server on the network or for use on the local system. For use as a client on the network, specify the IP address of the computer on which the MPD daemon is running (also see the "Static IP" box). If this requires authentication, enter the corresponding password in the dialog. You do not usually need to change the port number (Figure 2).

Static IP

On a home network, the router repeatedly assigns new IP addresses to the connected computers. Therefore, you will want either to talk to the MPD server in Cantata via the hostname or to configure the router interface so that the server always receives the same IP. Alternatively, enter a static IP address on the MPD server system itself. Be careful not to interfere with the router's DHCP server. This usually avoids a defined IP range, which you can then use for static assignments.

Figure 2: Cantata has a configuration wizard for easy setup.

You additionally need to define the directory where the music files are located. If the MPD server is running on the same system as Cantata, just enter localhost in the Host input field. Once the configuration is complete, click the Connect button to establish the connection between Cantata and the MPD server.

In the next step of the dialog, specify whether Cantata is allowed to download additional data from the Internet about the individual songs and albums and store them in the music folder. Data to be downloaded primarily includes lyrics and covers for albums. The configuration is now complete, and the wizard branches to the program window.

Settings

Cantata is somewhat reminiscent of the Rhythmbox audio player, which is often used on the Gnome desktop: On the left side of the window, you will find various buttons for managing audio files, playlists, and music sources. The center of the window is occupied by an empty list segment. On the right, in a large, at first still empty, area the individual tracks or sources appear in tabular form after selecting albums or lists.

Additionally, you will see a grayed out control bar at the top, which you can use later to play the individual tracks. On the far right next to the controls is a gear symbol, which opens another settings menu. Alternatively, you can access the configuration dialog by right-clicking on one of the buttons in the left sidebar of the software and then choosing the Settings option.

Pressing Ctrl+M displays a menubar at the top of the screen to facilitate individual operating steps. When you get there, you can also access the configuration menu from the Settings | Configure Cantata entries. This menu arranges the individual configuration groups in a sidebar on the left, and you can adjust the numerous options in a larger area on the right (Figure 3).

Figure 3: Granular adjustments of Cantata are made in a clear-cut dialog.

In the dialogs, you can configure settings for the individual groups in the sidebar of the main window as well as for the appearance of the application. For example, you can hide entire groups from the main window if you do not need them. Numerous sources for lyrics or cover images can be activated at this point. The modified options only take effect after pressing the Apply button at bottom right in the settings window. After entering all options, press OK to close the dialog.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Sockso

    The Sockso music server offers easy listening regardless of your system or location.

  • Sayonara Player

    For a simple audio player, check out Sayonara Player, a great choice for enjoying all your favorite music, Internet radio, and podcasts.

  • Darwin Streaming Server

    Apple’s Darwin Streaming Server is a free version of the commercial Quicktime server. It can handle the seminal MP3 and MPEG-4 formats, and it has a web front-end.

  • Replace Last.fm with VLC
  • Firefly Audio Streaming

    The Firefly Media Server makes streaming music and Internet radio onto your home network for iTunes or Banshee clients as easy as pie.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News