You are not logged in.

#1 2016-04-02 16:55:54

cloverskull
Member
Registered: 2015-10-01
Posts: 307

mpd / ncmpcpp installation

Hey guys,

I was following some of the older write-ups[1] for setting up and running mpd (the music player daemon) and ncmpcpp. Some of these were a bit outdated (pre-systemd, for example). So I'm going to do my best to do a brief write-up of installing and running it on BL Hydrogen (RC2). I am actually upgraded to sid, so if there are any discrepancies, please let me know.

Install mpd, mpc, and ncmpcpp from the repos (I also installed ncmpc and ncmpc-lyrics but don't think they're necessary)

sudo apt-get update && sudo apt-get install mpd mpc ncmpcc

Now, this will set mpd to run daemonized which is not really what I want. I prefer to run it on a per-user basis to respect home folder permissions and typical music library directories. Shutting this service down in systemd requires

sudo systemctl stop mpd.sock
sudo systemctl stop mpd
sudo systemctl disable mpd.service
sudo systemctl disable mpd

Confirm mpd is no longer running

ps -ef | grep mpd

Now, create some directories and files to move the mpd configuration to be localized

mkdir -p ~/.mpd/playlists
gunzip -c /usr/share/doc/mpd/mpdconf.example.gz > ~/.mpd/mpd.conf
touch ~/.mpd/{database,log,pid,state}

Edit the file ~/.mpd/mpd.conf. Locate the following lines (typically commented out) and make them look thusly (NOTE - case sensitive ~/Music default directory in BL conflicts with default configuration to look in ~/music):

music_directory                 "~/Music"
playlist_directory              "~/.mpd/playlists"
db_file                         "~/.mpd/database"
log_file                        "~/.mpd/log"
pid_file                        "~/.mpd/pid"
state_file                      "~/.mpd/state"
sticker_file                    "~/.mpd/sticker.sql"
bind_to_address                 "127.0.0.1"
bind_to_address                 "~/.mpd/socket"
port                            "6600"
log_level                       "default"
gapless_mp3_playback            "yes"
auto_update                     "yes"
follow_outside_symlinks         "no"

Now, scroll further down in mpd.conf and find the Audio Output section (default mpd.conf has it beginning on line 201). This may take a bit of configuration depending on your audio setup. For the sake of this tutorial, we're going to configure it to use Pulse Audio and to work with FIFO to generate some cool spectrograms.

Search for the pulse audio section and change it to look like this

audio_output {
        type            "pulse"
        name            "MPD"
        mixer_type      "software"
##      server          "remote_server"         # optional
##      sink            "remote_server_sink"    # optional
}

Just below that curly brace '}' character start a new line and copy the following text exactly to make it write to /tmp/fifo

audio_output {
        type                    "fifo"
        name                    "My FIFO"
        path                    "/tmp/mpd.fifo"
} 

Now from the command line, start mpd by simply typing 'mpd' on the command line. We'll automate this for future runs but for now just run it manually. You may get an error about the database file missing; don't worry, it'll create a fresh one.

Confirm it's running

ps -ef | grep mpd

If you'd like to force it to scan your music directory now, run 'mpc update' from the command line. It may take time.

Finally, add it somewhere to your autostart file

mpd &

To listen to music in your library, use 'ncmpcpp' from the command line. This post is already too long so I won't include a tutorial for that, but it's simple to use. Additionally, there are some gui clients, my favorite is ario. Enjoy!


[1] - Original #! write-up by ivanovnegro - http://crunchbang.org/forums/viewtopic.php?pid=182574

Last edited by cloverskull (2016-04-02 18:19:37)

Offline

#2 2016-04-02 18:15:32

Sector11
The Tpyo Knig Mod
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,666

Re: mpd / ncmpcpp installation

Good stuff!  Always nice to bring stuff up to date.


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: d67 Kernel: 4.9.0-9-amd64 x86_64 (64 bit gcc: 6.3.0)
Desktop: Openbox 3.6.1 Distro: Debian GNU/Linux 9 (stretch)

Offline

#3 2016-04-04 10:21:30

mtnspine
Member
Registered: 2015-10-02
Posts: 7

Re: mpd / ncmpcpp installation

Any advantages to mpd over mopidy?  I've been using mopidy for its spotify / soundcloud support, but I've been thinking of trying to set something up internet facing that I could stream my local library from outside the house.

Offline

#4 2016-04-04 11:09:24

cloverskull
Member
Registered: 2015-10-01
Posts: 307

Re: mpd / ncmpcpp installation

I've never used mopidy but mpd does have provisions for providing streams. Why not try both?

Offline

#5 2016-04-04 18:10:05

mtnspine
Member
Registered: 2015-10-02
Posts: 7

Re: mpd / ncmpcpp installation

Guess I'll have to give it a try...

Offline

#6 2016-04-04 20:08:28

mrneilypops
The BL Scrot.Moe Guy
From: luxembourg
Registered: 2015-09-30
Posts: 577
Website

Re: mpd / ncmpcpp installation

@cloverskull
Great bookmark cool
Thanks!

Offline

#7 2016-04-05 05:46:08

earlybird
ほやほや
Registered: 2015-12-16
Posts: 736
Website

Re: mpd / ncmpcpp installation

mtnspine wrote:

Any advantages to mpd over mopidy?  I've been using mopidy for its spotify / soundcloud support, but I've been thinking of trying to set something up internet facing that I could stream my local library from outside the house.

mpd does support soundcloud too:here and also reads other kinds of streams (besides being able to stream by itself).

The problem is that mpd is a program that is distributed in a compiled form, and unlike most Python programs like mopidy, you configure what features you want to compile at build time -- Debian package maintainers are mostly conservative here and choose to omit some features if it means pulling in more dependencies. YOu need to check what your mpd can do by running

mpd --version

and if the feature is not present, compile your own (check out HoaS article on creating backports -- the process is similar; you just have to modify the package a bit more). Or compile from the upstream sources to begin with.

Offline

#8 2016-05-14 01:07:59

demifiend
Member
From: Harrisburg, PA
Registered: 2016-05-12
Posts: 25
Website

Re: mpd / ncmpcpp installation

Hi, @cloverskull. I'm following this HOWTO and I've noticed a couple of issues.

"ncmpcc" isn't in the Jessie repos, so the following install command fails.

sudo apt-get update && sudo apt-get install mpd mpc ncmpcc

If you use the following instead, it works.

sudo apt-get update && sudo apt-get install mpd mpc ncmpc

Here's another command that isn't quite right.

gunzip -c /usr/share/doc/mpd/mpdconf.example.gz > ~/.mpd/mpd.conf

It should be...

gunzip -c /usr/share/doc/mpd/examples/mpdconf.example.gz > ~/.mpd/mpd.conf

Thanks for writing this up, though. I'm just pointing these out for others who might follow your instructions.


matthewgraybosch.com | Lenovo ThinkPad T430s (astarte) | System76 panp9 (thagirion)

"It made me feel a touch Byronic. Sometimes a girl just wants to be mad, bad, and dangerous to know." --Naomi in Silent Clarion

Offline

#9 2016-05-14 04:33:44

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,553

Re: mpd / ncmpcpp installation

^ The program is called ncmpcpp, not ncmpc.


At the end of the river the sundown beams

Offline

#10 2016-05-14 12:11:25

demifiend
Member
From: Harrisburg, PA
Registered: 2016-05-12
Posts: 25
Website

Re: mpd / ncmpcpp installation

Believe it or not, there's also a MPD client called ncmpc. It's just more minimalist than ncmpcpp.


matthewgraybosch.com | Lenovo ThinkPad T430s (astarte) | System76 panp9 (thagirion)

"It made me feel a touch Byronic. Sometimes a girl just wants to be mad, bad, and dangerous to know." --Naomi in Silent Clarion

Offline

#11 2016-05-15 15:35:29

cloverskull
Member
Registered: 2015-10-01
Posts: 307

Re: mpd / ncmpcpp installation

Thanks @demifiend! I didn't realize that. Unfortunately I used sid to install everything so it looks like we lack parity for these packages in the repos. I'll install jessie in a vm and update the howto. Thanks for the help on this. smile

Offline

#12 2017-03-02 16:39:06

Choven
Member
Registered: 2015-10-20
Posts: 16

Re: mpd / ncmpcpp installation

I hate to resurrect a thread, but I had to reinstall my system, followed the steps, and still had a problem.  The issue was the ncmpcpp kept looking at / for my system library.  The config files were correct.  When running mpd from the command line, I was getting "address in use" errors.  I tried changing the bind_to_address to a few different addresses, then when I commented it out, mpd started.  However, ncmpcpp still showed / as my music library.  I then discovered that mpd wasn't starting properly because mpd.socket was active.  I guess this service listens for a request to connect to mpd's port, and if mpd isn't running, then mpd.socket starts it.  Disabling mpd.socket as a service fixed my problem and allowed me to start mpd at logon:

systemctl status mpd.socket
sudo systemctl disable mpd.socket

The first line tells me the status of mpd.socket.  The second disables it from starting.  mpd.sock isn't found, so I'm guessing that there was a typo in the original directions.

Offline

Board footer

Powered by FluxBB