Online Jukebox
MPD and Cantata
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).
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.
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).
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
(incl. VAT)
Buy Linux Magazine
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.
News
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.