{"id":109005,"date":"2020-02-10T08:00:00","date_gmt":"2020-02-10T08:00:00","guid":{"rendered":"https:\/\/fedoramagazine.org\/?p=30252"},"modified":"2020-02-10T08:00:00","modified_gmt":"2020-02-10T08:00:00","slug":"playing-music-on-your-fedora-terminal-with-mpd-and-ncmpcpp","status":"publish","type":"post","link":"https:\/\/sickgaming.net\/blog\/2020\/02\/10\/playing-music-on-your-fedora-terminal-with-mpd-and-ncmpcpp\/","title":{"rendered":"Playing Music on your Fedora Terminal with MPD and ncmpcpp"},"content":{"rendered":"<p>MPD, as the name implies, is a Music Playing Daemon. It can play music but, being a daemon, any piece of software can interface with it and play sounds, including some CLI clients.<\/p>\n<p>One of them is called <em>ncmpcpp<\/em>, which is an improvement over the pre-existing <em>ncmpc<\/em> tool. The name change doesn&#8217;t have much to do with the language they&#8217;re written in: they&#8217;re both C++, but <em>ncmpcpp<\/em> is called that because it&#8217;s the <em>NCurses Music Playing Client<\/em> <em>Plus Plus<\/em>. <\/p>\n<p> <span id=\"more-30252\"><\/span> <\/p>\n<h2>Installing MPD and ncmpcpp<\/h2>\n<p>The <em>ncmpmpcc<\/em> client can be installed from the official Fedora repositories with DNF directly with<\/p>\n<pre class=\"wp-block-preformatted\">$ sudo dnf install ncmpcpp<\/pre>\n<p>On the other hand, MPD has to be installed from the RPMFusion <em>free<\/em> repositories, which you can enable, <a href=\"https:\/\/rpmfusion.org\/Configuration\">as per the official installation instructions<\/a>, by running<\/p>\n<pre class=\"wp-block-preformatted\">$ sudo dnf install https:\/\/download1.rpmfusion.org\/free\/fedora\/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm<\/pre>\n<p>and then you can install MPD by running<\/p>\n<pre class=\"wp-block-preformatted\">$ sudo dnf install mpd<\/pre>\n<h2>Configuring and Starting MPD<\/h2>\n<p>The most painless way to set up MPD is to run it as a regular user. The default is to run it as the dedicated <em>mpd<\/em> user, but that causes all sorts of issues with permissions.<\/p>\n<p>Before we can run it, we need to create a local config file that will allow it to run as a regular user.<\/p>\n<p>To do that, create a subdirectory called <em>mpd<\/em> in <em>~\/.config<\/em>:<\/p>\n<pre class=\"wp-block-preformatted\">$ mkdir ~\/.config\/mpd<\/pre>\n<p>copy the default config file into this directory:<\/p>\n<pre class=\"wp-block-preformatted\">$ cp \/etc\/mpd.conf ~\/.config\/mpd<\/pre>\n<p>and then edit it with a text editor like <em>vim<\/em>, <em>nano<\/em> or <em>gedit<\/em>:<\/p>\n<pre class=\"wp-block-preformatted\">$ nano ~\/.config\/mpd\/mpd.conf<\/pre>\n<p>I recommend you read through all of it to check if there&#8217;s anything you need to do, but for most setups you can delete everything and just leave the following:<\/p>\n<pre class=\"wp-block-preformatted\">db_file \"~\/.config\/mpd\/mpd.db\" log_file \"syslog\"<\/pre>\n<p>At this point you should be able to just run<\/p>\n<pre class=\"wp-block-preformatted\">$ mpd<\/pre>\n<p>with no errors, which will start the MPD daemon in the background.<\/p>\n<h2>Using ncmpcpp<\/h2>\n<p>Simply run<\/p>\n<pre class=\"wp-block-preformatted\">$ ncmpcpp<\/pre>\n<p>and you&#8217;ll see a ncurses-powered graphical user interface in your terminal.<\/p>\n<p>Press <em>4<\/em> and you should see your local music library, be able to change the selection using the arrow keys and press <em>Enter<\/em> to play a song.<\/p>\n<p>Doing this multiple times will create a <em>playlist<\/em>, which allows you to move to the next track using the <em>&gt;<\/em> button (not the right arrow, the <em>&gt;<\/em> closing angle bracket character) and go back to the previous track with <em>&lt;<\/em>. The + and &#8211; buttons increase and decrease volume. The <em>Q<\/em> button quits ncmpcpp but it doesn&#8217;t stop the music. You can play and pause with <em>P<\/em>.<\/p>\n<p>You can see the current playlist by pressing the <em>1<\/em> button (this is the default view). From this view you can press <em>i<\/em> to look at the information (tags) about the current song. You can change the tags of the currently playing (or paused) song by pressing <em>6<\/em>.<\/p>\n<p>Pressing the \\ button will add (or remove) an informative panel at the top of the view. In the top left, you should see something that looks like this:<\/p>\n<pre class=\"wp-block-preformatted\">[------]<\/pre>\n<p>Pressing the <em>r<\/em>, <em>z<\/em>, <em>y<\/em>, <em>R<\/em>, <em>x<\/em> buttons will respectively toggle the <em>repeat<\/em>, <em>random<\/em>, <em>single<\/em>, <em>consume<\/em> and <em>crossfade<\/em> playback modes and will replace one of the <em>&#8211;<\/em> characters in that little indicator to the initial of the selected mode.<\/p>\n<p>Pressing the <em>F1<\/em> button will display some help text, which contains a list of keybindings, so there&#8217;s no need to write a complete list here. So now go on, be geeky, and play all your music from your terminal!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MPD, as the name implies, is a Music Playing Daemon. It can play music but, being a daemon, any piece of software can interface with it and play sounds, including some CLI clients. One of them is called ncmpcpp, which is an improvement over the pre-existing ncmpc tool. The name change doesn&#8217;t have much to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[606,45,46,524,47,93,44],"class_list":["post-109005","post","type-post","status-publish","format-standard","hentry","category-fedora-os","tag-faqs-and-guides","tag-fedora","tag-magazine","tag-music","tag-news","tag-terminal","tag-using-software"],"_links":{"self":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/109005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/comments?post=109005"}],"version-history":[{"count":0,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/109005\/revisions"}],"wp:attachment":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media?parent=109005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/categories?post=109005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/tags?post=109005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}