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
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.
-
Fedora 41 Released with New Features
If you're a Fedora fan or just looking for a Linux distribution to help you migrate from Windows, Fedora 41 might be just the ticket.
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.
-
System76 Unveils an Ampere-Powered Thelio Desktop
If you're looking for a new desktop system for developing autonomous driving and software-defined vehicle solutions. System76 has you covered.
-
VirtualBox 7.1.4 Includes Initial Support for Linux kernel 6.12
The latest version of VirtualBox has arrived and it not only adds initial support for kernel 6.12 but another feature that will make using the virtual machine tool much easier.
-
New Slimbook EVO with Raw AMD Ryzen Power
If you're looking for serious power in a 14" ultrabook that is powered by Linux, Slimbook has just the thing for you.
-
The Gnome Foundation Struggling to Stay Afloat
The foundation behind the Gnome desktop environment is having to go through some serious belt-tightening due to continued financial problems.
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.