MPD: A versatile demon for music.

Hi good day. Let's talk about the versatile MPD: Music Player Daemon by its original name in English.

According to the ArchLinux Wiki, MPD is an audio player that handles a server-client architecture. MPD runs in the background as a daemon, manages playlists and a database, and uses very few resources. To use a graphical interface, an additional client is required.

Once it is explained what MPD is, I proceed to tell you how it is installed, and configured to be able to play your music. Personally, I think it is a great service, due to the breadth of forms of use, and above all because of its low consumption.

MPD Installation

This guide will be aimed at installing it in ArchLinux, which is the distribution I use. I imagine that although the names of the packages may differ, the installation and configuration is similar in any other distribution.

1 ° We proceed to update and install the necessary packages:

sudo pacman -Syu && sudo pacman -S mpd mpc ncmpcpp sonata

Clarification: I have chosen, other than my own mpd, a graphical client, Sonata (GTK) and ncmpcpp, via terminal.

2 ° Once installed we are going to configure and create some folders that we need.

sudo {su_editor} /etc/mpd.conf

We look for the following lines, and replace them with our configurations:

music_directory         "/home/tu_usuario/Music"
playlist_directory "/home/tu_usuario/.mpd/playlists"
db_file "/home/tu_usuario/.mpd/tag_cache"
log_file "/home/tu_usuario/.mpd/log"
error_file "/home/tu_usuario/.mpd/errors.log"
pid_file "/home/tu_usuario/.mpd/pid"
state_file "/home/tu_usuario/.mpd/state”

It is clear that they must change your user by your user.

Now it's time to configure the user. We only have to change the user line of the mpd.conf by the corresponding username.

If they are users of Alsa, they must uncomment the following lines:

audio_output {
type "alsa"
name "My ALSA Device"
options "dev=dmixer"
device "plug:dmix" # optional
format "44100:16:2" # optional
mixer_type "software" # optional
mixer_device "default" # optional
mixer_control "PCM" # optional
mixer_index "0" # optional
}

If they use PulseAudio, they should comment on all of the above and uncomment the PulseAudio section.

We save and close the mpd.conf and we assign the corresponding permissions:

sudo chmod 644 /etc/mpd.conf

3rd Touch create the required folders.

mkdir ~/.mpd
mkdir ~/.mpd/playlists

Then we create the necessary files so that MPD works correctly.

touch ~/.mpd/tag_cache
touch ~/.mpd/log
touch ~/.mpd/errors.log
touch ~/.mpd/pid
touch ~/.mpd/state

And finally, it's time to launch the mpd demon. Of course, it can then be added to rc.conf.

sudo rc.d start mpd

You can also do the following, instead of adding mpd to rc.conf, you can add it in your WM autostart, or maybe in the .xinitrc.

Sonata

Now with sonata it is very easy. We execute it, we right click on any site:

 

They should set up their Music folder, where applicable. And the same username that they used in the mpd.conf.
As you will see, I am using port 8888 in the capture, it is that at the time of taking that capture I was testing another port based on a conky configuration. I recommend that you use the 6600 that comes by default in all.

Once that is done, we save and close the configuration, go to the "Library" tab and you should see the music collection. If it is not seen, restart the program.

 

NCMPCPP

First of all, we need to configure the main ncmpcpp file:

sudo {su_editor} /usr/share/doc/ncmpcpp/config

And we just have to change the following lines

mpd_host “localhost”
mpd_port “6600”
mpd_music_dir “/home/tu_usuario/Music” ##Ejemplo

We save and close.

We create the corresponding folder in our home.

mkdir /home/tu_usuario/.ncmpcpp

touch /home/tu_usuario/.ncmpcpp/config

Where we will create the corresponding configuration file.

mpd_music_dir = "/home/tu_usuario/Music"
playlist_display_mode = "columns"
song_status_format = "%t{ - %a}{ - %b}{ (%y)}"
song_window_title_format = "MPD: {%a - }{%t}|{%f}"
song_columns_list_format = "(7)[green]{l} (35)[white]{t} (28)[green]{a} (28)[white]{b}"
user_interface = "alternative"
progressbar_look = "-|-"
display_screens_numbers_on_start = "no"
allow_physical_files_deletion = "no"
allow_physical_directories_deletion = "no"
colors_enabled = "yes"
progressbar_color = "green"
volume_color = "greeen"
header_window_color = "green"
main_window_color = "green"
#now_playing_prefix = "$b$u"
#now_playing_suffix = "$/b$/u"

Once the. You can change the configuration to your liking, we save and close.

Touch run ncmpcpp.. If you in the console, simply put the command:

ncmpcpp

Using ncmpcpp:

  1. First we clean the playlist with the «c» key (so that there are no repeated songs)
  2. Then we press «3» to go to the browser tab
  3. We press «v» to select all
  4. We press «shift + a» and it will open a new menu
  5. Then we give "current MPD playlist" (first option)
  6. Finally we select «At the end of playilst»

 

That is all for now. I hope you liked it and above all that it is useful to you. It will be until next time.

Ivan!

PS: This is my first installment and I hope you know how to apologize if I have done something wrong.


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

25 comments, leave yours

Leave a Comment

Your email address will not be published.

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Josh said

    Very good tutorial, but I want to know what difference is there with other players (apart from being an mpd)?

    1.    ivanovblack said

      Well it is very very light. If you have a lot, really a lot of music, for example 100.000 songs or more, the execution of the program is fast.
      I think you just have to try it.
      Database search works fast, you can put all your music on the playlist without waiting.
      It works without a graphical environment, you can end your session and continue listening to music.
      You can use and test any client at the same time without finishing mpd and you don't have to add your music folder again and again as soon as you try another client.
      It has all the necessary codecs. It is also capable of streaming, you can use it as a music server and access it from another machine or with your Android etc.

      1.    Josh said

        I didn't know it had so many advantages, you convinced me, I'm going to try it and your tutorial is excellent. Thank you

  2.   KZKG ^ Gaara said

    In good time for the tutorial, very well explained 😀
    Really ... thanks for your help, welcome to the blog 😉

    Greetings and if you need something, you know ... here we are.

    PS: You already appear as "editor" in the comments 🙂

  3.   Leper_Ivan said

    Well, first of all thank you very much for stopping by. Well, if any doubt arises, I can help dispel it .. 😀

  4.   Mauritius said

    What a piece of player !! I used it a long time ago and it is great. I'm an avowed fan of Audacious though.

  5.   auroszx said

    I've been using it in Debian for about a month, Oyashiro-sama and conandoel helped me to configure it 🙂 As a client I use Xfmpc (from the Xfce team) and a plugin for the panel called xfce4-mpc-plugin that allows changing songs and raising / lowering volume 😛 And in LXDE / Openbox I use Sonata.
    The MPD is recommended, it is very light and works even with streaming.

    1.    Abel said

      Orale, that client did not know it and less the plugin, I have always been from ncmpcpp but I will have to try it now that I have been with XFCE for a while. xP

      Greetings.

  6.   vicky said

    I tried to install and configure it a thousand times, every time it failed miserably, I started to install it again, and the mpd.conf file does not exist !! I think that mpd with me is something personal 😛

    1.    Leper_Ivan said

      You should have it .. If not, you can export it from another folder. You can see on the Arch wiki where to copy it from.

    2.    invisible15 said

      I have been behind mpd for two years and I have finally managed to make it work, that if removing SELinux.

  7.   Algave said

    Very good, I'm already using it… thanks !! 🙂

  8.   b1tblu3 said

    Excellent, I'll try it.

  9.   ivanovblack said

    A bit of self-advertising but if someone fails to configure it on Debian-based systems, here:

    http://crunchbanglinux.org/forums/topic/17386/the-ultimate-mpd-guide/

    It's in English but I don't think it's that difficult.

    1.    anti said

      Until now that I saw the link I dropped the twenty. Thank you so much for that guide, on the Crunchbang forums.
      That saved me when I first set it up successfully and use it whenever I install from scratch. Thank you very much.

  10.   Abel said

    The best player I have used so far, I have been using it for almost a year and a half now, to be honest I was lazy to read the post but I did take a look at it. xP

    For the same reason that I gave it a slight look I have two small tips, first, I think it would be easier for everyone to handle MPD as a normal user creating all the configuration from a ~ / .mpdconfig loading it in the beginning and not necessarily in the demons, and second For those who use ncmpcpp as a client, they could install ncmpcpp-fftw for a few extra options including a good viewer, just add a few lines to the ncmpcpp configuration.

    visualizer_fifo_path = "/home/userl/.mpd/mpd.fifo"
    visualizer_output_name = "visual"
    visualizer_sync_interval = "30"
    visualizer_type = "spectrum" (wave / spectrum)
    visualizer_color = "cyan"

    Greetings.

  11.   Tavo said

    Mpd is very good, I used it with sonata. The only problem I had is that when starting the system the daemon sometimes did not load and what I did was disable the loading from init.d by editing the / etc / default / mpd file changing the value true for false. In this way mpd was not started with the other daemons. For both mpd and sonata to be launched, it is simple to link the mpd && sonata commands

  12.   koratsuki said

    I will try it, I have always used XMMS and I love it, although this one has to get your hands in a little, if it improves in performance, I think about it and maybe I'll change.

  13.   invisible15 said

    If you use fedora, disable selinux or else it won't let mpd write the log.
    Otherwise well.

  14.   Carlos-Riper said

    Congratulations on the post, a question how can I stream audio (radio) with ncmpcpp + mpd + icecast, I would appreciate it infinitely, go ahead. 😀

  15.   nemo said

    I was finally able to install it ... 😐 it's 1:20 in the morning, but I don't care because my mpd + ncmpcpp works after like 8 hours of fighting with thousands of wikis (also with this tutorial hahaha) but it served as a reference to understand certain things, thank you! 😀

  16.   mario hello said

    Hello everyone, cheers.
    Today I'm writing to ask for your help, I'm already so bored not being able to configure the MPD… I've already followed a lot of tutorials and I can't find the joke; everything is fine until reaching the last line before reaching sonata

    sudo rc.d start mpd

    and reading, I found that rc.d already removed it from archlinux; on the other hand when executing the mpd from the terminal it throws me the following

    [novatovich @ nvtvich-vd ~] $ mpd
    listen: bind to '0.0.0.0:6600' failed: Address already in use (continuing anyway, because binding to '[::]: 6600' succeeded)
    daemon: cannot init supplementary groups of user "novatovich": Operation not permitted

    then when executing the sonata it seems to be connected but I think the mpd has not created the playlists.

    I hope any comments that help me get the mpd working, I would really appreciate it.

  17.   NeHeMueL said

    Can you pass me the wallpaper

  18.   Wako said

    Another guide is urgent. I can't get it to work and I already checked the arch wiki and neither. Nothing ever appears in the library: c