One area of software in which Linux is particularly well-equipped is audio players. In this post we will look at the differences between MPD and traditional audio players.
Although most of us music consumers have switched to streaming True music lovers and privacy lovers, for different reasons, say they prefer playing locally stored music.The former because the quality is better, the latter because they don't share their preference data with anyone.
Differences between MPD and traditional audio players
Let's start by defining the D in MPD. A daemon was originally a helpful spirit, something like the genie in Aladdin's lamp. Someone mistranslated it into English as "demonio" (demon), and that's how it ended up. In computing, a daemon is a program that runs in the background and does not interact with the user.
As you might have guessed, the m and p stand for music player. From there, we can now define the differences.
While in traditional players the interface and the playback engine form a closed package, MPD can work with different programs, each with its own graphical or command line interface.s. Unlike traditional players, you don't need to have one of these programs open to listen to music. In fact, they don't even need to be on the same device.
Being a service and not a program, MPD can be used via scripts and run from a code editor. It also uses much less memory.
Of course, traditional players have their advantages, such as managing music collections, converting between formats, and a much more user-friendly graphical interface.
It will depend on each person's preferences and needs to decide which playback system to use.
How to install and configure MPD on Ubuntu
As we mentioned, there are several clients for MPD, both with graphical interfaces and for the terminal. Here we'll use MPC, a lightweight client for the latter.
We update the system
sudo apt update
We install the daemon and the client
sudo apt install mpd mpc
Next we are going to edit the configuration file
sudo nano /etc/mpd.conf
We check the configuration
music_directory "/var/lib/mpd/music" playlist_directory "/var/lib/mpd/playlists" db_file "/var/lib/mpd/database" log_file "/var/log/mpd/mpd.log" pid_file "/run/mpd/pid" state_file "/var/lib/mpd/state" sticker_file "/var/lib/mpd/sticker.sql"
audio_output { type «pulse» # OR «alsa»> depending on your system name «PulseAudio Sound Server» mixer_type «software» }
bind_to_address «localhost»
We give access permissions to the folder
sudo chown -R mpd:audio /var/lib/mpd /var/log/mpd
sudo chmod -R 755 /var/lib/mpd /var/log/mpd
We make MPD start when U starts
sudo systemctl daemon-reload
sudo systemctl enable mpd
sudo systemctl start mpd
We updated the music library
mpc update
Some useful commands
mpc listall # Lista toda la música encontrada por MPD
mpc play # Reproduce la primera canción
mpc status # Estado actual de la reproducción
In case we are interested in accessing from other devices connected to the network, we modify the bind parameters.
bind_to_address "0.0.0.0"
By default, Ubuntu configures this for all users. To configure your own settings:
Si hay varios usuarios del ordenador es posible que cada uno quiera tener su configuración personal.
We stop the operation of MPD
sudo systemctl stop mpd
sudo systemctl disable mpd
We configure it for the user
mkdir -p ~/.config/mpd/playlists
mkdir -p ~/Music # Tu música irá aquÃ, cámbialo si lo prefieres
We copy the configuration file and edit it
nano ~/.config/mpd/mpd.conf
music_directory "/home/TU_USUARIO/Música" playlist_directory "/home/TU_USUARIO/.config/mpd/playlists" db_file "/home/TU_USUARIO/.config/mpd/database" log_file "/home/TU_USUARIO/.config/mpd/log" pid_file "/home/TU_USUARIO/.config/mpd/pid" state_file "/home/TU_USUARIO/.config/mpd/state" sticker_file "/home/TU_USUARIO/.config/mpd/sticker.sql"
audio_output { type «pulse» name «PulseAudio Sound Server» mixer_type «software» }
bind_to_address «localhost»
We delete files
rm -rf ~/.config/mpd/{database,log,pid,state,sticker.sql}
We have the program ready to play music
Mpd
mpc update
mpc listall
In a future article, we'll cover a list of commands for listening to music with MPD and the MPC client, as well as a selection of graphical clients. Personally, I prefer to use a traditional audio and video player like VLC, but the great thing about Linux is that it offers a variety for all tastes.