To make audio output actually work ensure that you have setup audio card and mixer correctly. See [[ALSA]]. Do not forget to unmute the required channels in alsamixer, raise the volume and save changes with alsactl store. See {{Filename|~/.mpd/error}} if it still doesn't work.

−

−

Make sure your card can do hardware mixing (most of them can, including onboard audio). Or else this could cause problems with multiple sound playback. For example, this can prevent Mplayer from playing back sound while the mpd daemon is running, returning an audio error message stating the device is busy.

−

−

===Editing {{Filename|mpd.conf}}===

−

−

To edit the file, as root:

−

# YOUREDITOR /etc/mpd.conf

−

−

'''Keeps the setup in /var and uses "mpd" as default user instead of cluttering up ~/. This is the way the arch package is installed.'''

* Keep user as "mpd", double check to make sure user "mpd" home directory is set to /var/lib/mpd

−

$ cat /etc/passwd | grep mpd

−

* Also make sure /var/lib/mpd is owned by mpd:mpd.

−

$ ls -l /var/lib/ | grep mpd

−

* Now as root create the files you specified in {{Filename|/etc/mpd.conf}}, if directories do not exist, create those as well. This is not required if you use the defaults in the arch package.

# touch /var/lib/mpd/db

# touch /var/lib/mpd/db

# touch /var/lib/mpd/mpdstate

# touch /var/lib/mpd/mpdstate

Line 85:

Line 69:

# touch /var/log/mpd/mpd.log

# touch /var/log/mpd/mpd.log

# touch /var/log/mpd/mpd.error

# touch /var/log/mpd/mpd.error

−

* Now change the ownership of the directories and files you created to user "mpd"

−

# chown -R mpd:mpd /var/{lib,run,log}/mpd

−

* If your music collection is contained under multiple dir. you can make symbolic link under /var/lib/mpd then set 'music_dir' in mpd.conf to the directory holding the symbolic links. Remember to set permissions accordingly on the directories being linked.

−

* Creating the database is now accomplished via the update feature of the client, for example if you were running ncmpcpp you would just enter 'U'.

MPD need not be started with root permissions. The only reason why MPD needs to be started as root (by being called from {{Filename|/etc/rc.conf}}) is because the default files and folders in the default configuration file points to directories owned by root (the /var directory). A less common, but perhaps more sensible, approach is to make MPD work with files and directories owned by a normal user. Running MPD as a normal user has several advantages:

+

cp /usr/share/doc/mpd/mpdconf.example ~/.mpdconf

−

# You can easily have a single directory ~/.mpd (or any other directory under /home/username) for all MPD configuration files

−

# No read/write permission errors

−

# More flexible calls to MPD by using {{Filename|~/.xinitrc}} instead of including 'mpd' in the {{Filename|/etc/rc.conf}} DAEMONS array.

−

The following steps shows how to run MPD as a normal user. '''Note''': this approach will not work if you want multiple users to have access to MPD.

* Copy the contents of the default MPD configuration file in {{Filename|/etc/mpd.conf.example}} to your home directory. A good place would be {{Filename|"/home/usr/.mpd/config"}}.

−

* Follow the 'old setup instructions' from above, ignoring the first part about copying the config to {{Filename|/etc/mpd.conf}}.

−

* Create all of the requisite files in {{filename|"/home/user/.mpd/"}}:

"~/.mpd/playlists"

"~/.mpd/playlists"

"~/.mpd/db"

"~/.mpd/db"

Line 109:

Line 95:

"~/.mpd/mpd.pid"

"~/.mpd/mpd.pid"

"~/.mpd/mpdstate"

"~/.mpd/mpdstate"

−

* Let MPD start on bootup by calling it from your {{Filename|~/.xinitrc}} as follows:

−

# this starts mpd as normal user

−

mpd /home/username/.mpd/config

−

{{Note| that you don't have to put a "&" at the end of the line here, since MPD will automatically daemonize itself.}}

−

−

Lastly, delete the entry 'mpd' from your DAEMONS array in {{Filename|/etc/rc.conf}}, as you are not running it as root anymore.

−

−

===Multi-MPD Setup===

−

'''Useful if you you want to run for example an icecast server.'''

−

If you want a second MPD daemon (e.g., with icecast output to share music over the network) to use the same music and playlist as the one above, simply copy the above configuration file and make a new file (e.g., {{Filename|/home/username/.mpd/config-icecast}}), and only change the log_file, error_file, pid_file, and state_file parameters (e.g., {{Filename|mpd-icecast.log}}, {{Filename|mpd-icecast.error}}, and so on); using the same directory paths for the music and playlist directories would ensure that this second MPD daemon would use the same music collection as your first one (e.g., creating and editing a playlist under the first daemon would affect the second daemon as well, so that you don't have to create the same playlists all over again for the second daemon). Then, call this second daemon the same way from your {{Filename|~/.xinitrc}} above. (Just be sure to have a different port number, so as to not conflict with your first MPD daemon).

−

−

==Troubleshooting==

−

=== Autodetection failed ===

+

{{Note| No se olvide de especificar el nombre de usuario y grupo}}

−

During the start of mpd, it tries to autodetect your set-up and configure output and volume control accordingly. Though this mostly goes well, it will fail for some systems. It may help to tell mpd specifically what to use as output and mixer control. If you copied {{Filename|/etc/mpd.conf}} over from {{Filename|/etc/mpd.conf.example}} as mentionned above, you can simply uncomment:

MPD needs to have +x permissions on '''ALL''' parent directories to your music collection (ie. if it's located outisde of "mpd" home directory /var/lib/mpd). By default useradd sets permissions on home dir to 1700 drwx------. So if your like me you will need to change permissions of /home/user. Example... my music collection is located /home/user/music.

+

Instálelos usando:

−

# chmod a+x /home/user

+

# pacman -S mpc

−

# chmod -R a+X /home/user/music

+

# pacman -S ncmpc

+

# pacman -S ncmpcpp

+

# pacman -S pms

+

# pacman -S ario

+

# pacman -S sonata

+

# pacman -S gmpc

+

# pacman -S qmpdclient

−

==== Alternative solution ====

+

==Extra stuff==

−

An alternative solution would be to use your group to share a selection of files, among them your music library. First remove all permissions for the group then add group permissions to read and execute home and music.

If you want to use another computer to control mpd over a network, the {{Codeline|bind_to_address}} option in {{Filename|mpd.conf}} will need to be set to either your IP address, or {{Codeline|any}} if your IP address changes frequently. Remember to add mpd to the {{Filename|/etc/hosts.allow}} file to enable external access.

* '''QMPDClient''' &ndash; Client written with Qt 4.x. [http://bitcheese.net/wiki/QMPDClient Official Website of QMPDClient]

−

−

Install with:

−

# pacman -Sy mpc

−

# pacman -Sy ncmpc

−

# pacman -Sy ncmpcpp

−

# pacman -Sy pms

−

# pacman -Sy ario

−

# pacman -Sy sonata

−

# pacman -Sy gmpc

−

# pacman -Sy qmpdclient

−

−

==Extra stuff==

−

−

===Last.fm scrobbling===

−

−

To scrobble your songs to [http://www.last.fm Last.fm] using MPD there are several alternatives.

−

====mpdscribble====

+

Por Ejemplo:

−

mpdscribble is another daemon, but is only available in the [http://aur.archlinux.org/packages.php?ID=22274 AUR]. This is arguably the best alternative, because it's the semi-official MPD scrobbler and uses the new "idle" feature in MPD for more accurate scrobbling. Also, you don't need root access to configure it, because it doesn't need any changes to <tt>/etc</tt> at all. Visit [http://mpd.wikia.com/wiki/Client:Mpdscribble the official website] for more information.

−

To install mpdscribble, just install it from the AUR and do the following (not as root):

+

{{bc|$ mpc load "lastfm://artist/Beatles"}}

−

* {{Codeline|$ mkdir ~/.mpdscribble}}

+

=====Reproducir Desde Last.fm con Lastfmproxy=====

−

* Create the file {{Filename|~/.mpdscribble/mpdscribble.conf}} and add the following:

The easiest way, if you don't care about having to have a program window open all the time, is using Sonata which is a graphical frontend to MPD. It has built-in support for Last.fm scrobbling in its preferences. The downside of this is that Sonata doesn't cache your songs if for some reason you don't happen to have an Internet connection at the time of playing.

lastfmsubmitd is a daemon which is available in the "community" repository. To install it, first edit {{Filename|/etc/lastfmsubmitd.conf}} and add both {{Codeline|lastfmsubmitd}} and {{Codeline|lastmp}} to the {{Codeline|DAEMONS}} array in {{Filename|/etc/rc.conf}}.

−

===Last.fm playback with lastfmproxy===

+

===Never play on start===

−

lastfmproxy is a python script that streams a last.fm music stream to another media player. To setup, install from AUR: {{Codeline|yaourt -S lastfmproxy}} and then edit {{Filename|/usr/share/lastfmproxy/config.py}}. If you plan to only stream to mpd on the same host, just edit the login info.

+

This feature has recently been added to mpd git by Martin Kellerman, see commits {{ic|b57330cf75bcb339e3f268f1019c63e40d305145}} and {{ic|2fb40fe728ac07574808c40034fc0f3d2254d49d}}. As of September 2011, this feature has not yet arrived in a mpd version in the official repositories. If support for this feature is still required, have a look at the following proposals.

−

{{Note | Since it installs to a read only directory but it requires read/write access for features like saving previously listened to stations, it would be wise to copy {{Filename|/usr/share/lastfmproxy}} to your home directory.}}

+

====Installing mpd from the AUR====

+

This is the best method currently available, but is only currently (as of April 2011) enabled in the git version. Install {{AUR|mpd-git}} from the [[AUR]] and add {{ic|restore_paused "yes"}} to your {{ic|mpd.conf}} file.

−

Start lastfmproxy with {{Codeline|lastfmproxy}} and visit http://localhost:1881/ in your web browser. To add a last.fm station navigate to http://localhost:1881/ followed by the lastfm:// url. Example: http://localhost:1881/lastfm://globaltags/punk . Navigate back to http://localhost:1881/ and download the m3u file by selecting the ''Start Listening'' link. Simply add it to your music library path.

+

If you have issues with connecting your client to {{AUR|mpd-git}}, see [[Music Player Daemon#Other issues when attempting to connect to mpd with a client]].

−

=== Never play on start ===

+

====Method 1====

−

If you don't want mpd to always play on your system start, but yet you want to preserve the other state information, add the following lines to your {{Filename|/etc/rc.d/mpd}} file:

+

If you do not want MPD to always play on your system start, but yet you want to preserve the other state information, add the following lines to your {{ic|/etc/rc.d/mpd}} file:

+

=====Method 1.1=====

+

Simpler, working method (disables playing on startup of mpd daemon):

+

start)

+

...

+

mpc -q pause #add this line only

+

add_daemon mpd

+

stat_done

+

=====Method 1.2=====

+

This method was described here before Method 1.1 and is much more complicated:

'' ...''

'' ...''

'' stat_busy "Starting Music Player Daemon"''

'' stat_busy "Starting Music Player Daemon"''

Line 272:

Line 223:

'' ...''

'' ...''

−

This will change the player status to "paused", if it was stopped while playing. Next, you want this file to be preserved, so mpd updates won't erase this edit. Add (or edit) this line to your {{Filename|/etc/pacman.conf}}:

+

This will change the player status to "paused", if it was stopped while playing. Next, you want this file to be preserved, so MPD updates won't erase this edit. Add (or edit) this line to your {{ic|/etc/pacman.conf}}:

NoUpgrade = etc/rc.d/mpd

NoUpgrade = etc/rc.d/mpd

−

Or Simple method add mpd to your rc.conf deamons array and add mpc stop to rc.local loacated in /etc (Remember you must got mpc installed to have this method working).

−

=== MPD & Alsa ===

+

====Method 2====

+

Another simpler method, would be to add mpd to your {{ic|[[rc.conf]]}} daemons array and add {{ic|mpc stop}} or {{ic|mpc pause}} to {{ic|/etc/rc.local.shutdown}} and to {{ic|/etc/rc.local}}. (Remember you must have mpc installed to use this method).

+

+

Adding only the order in {{ic|/etc/rc.local}} cannot assure that mpd will play absolutely nothing, since there may be a delay before the stop command is executed.

+

On the other hand, if you only add the order to {{ic|/etc/rc.local.shutdown}}, that will assure that mpd won't play at all, as long as you properly shutdown your system.

+

Even though they are redundant, adding it to {{ic|/etc/rc.local}} would serve as a safety for those, presumably, rare occasions when you do not shutdown the system properly.

+

+

====Method 3====

+

The general idea is to ask mdp to pause music when the user logs out, so that mdp will stick to the "pause" state after a reboot. Sending such command can be achieved using [https://www.archlinux.org/packages/extra/x86_64/mpc/ mpc], the command line interface to MPD.

+

+

GDM users can then add {{ic|/usr/bin/mpc pause}} to {{ic|/etc/gdm/PostSession/Default}} (be sure to add it before {{ic|exit 0}}):

+

+

Non-GDM users can use their own login manager's method to launch the line at logout.

When using MPD with ALSA, users may experience MPD taking up lots of CPU (around 20-30%). This is caused by most sound cards supporting 48kHz and most music being 44kHz, thus forcing MPD to resample it. This operation takes lots of CPU cycles and results into high usage.

−

For most users the problem should be solved by telling MPD not to use resampling by adding {{Codeline|auto_resample "no"}} into audio_output-part of {{Filename|/etc/mpd.conf}}.

There are already some clients designe for communications between lircd and mpd, however, as far as the practical use, they aren't very useful since their functions are limited.

+

# gpasswd -a mpd pulse-access

+

# gpasswd -a mpd pulse-rt

+

}}

−

It's recommended to use mpc with irexec. mpc is a command line player which only sends the command to mpd and exits immediately, which is perfect for irexec, the command runner included in lirc. What irexec does is that it runs a specified command once received a remote control button.

Since version 0.15 there is a built-in HTTP streaming daemon/server that comes with MPD. To activate this server simply set it as output device in mpd.conf:

−

First, install ([http://aur.archlinux.org/packages.php?ID=18722 mpd-pulse]) in the Arch User Repository as opposed to the regular mpd client in the Extra repository.

+

audio_output {

+

type "httpd"

+

name "My HTTP Stream"

+

encoder "vorbis" # optional, vorbis or lame

+

port "8000"

+

# quality "5.0" # do not define if bitrate is defined

+

bitrate "128" # do not define if quality is defined

+

format "44100:16:1"

+

}

−

Then, edit {{Filename|/etc/mpd.conf}}, and uncomment the audio_output section for the type "pulse". The server and sink lines of it should be commented unless you know what you're doing.

+

Then to listen to this stream simply open the URL of your mpd server (along with the specified port) in your favorite music player. Note: You may have to specify the file format of the stream using an appropriate file extension in the URL. For example, using Winamp 5.5, You would use http://192.168.1.2:8000/mpd.ogg rather than http://192.168.1.2:8000/.

−

Then, add the mpd user (and yours if you haven't done so already) to the necessary pulse groups. The pulse-access group should be sufficient but you may want to add pulse-rt as well. The group "pulse" doesn't appear to be necessary.

+

To use mpd to connect to the stream from another computer.

−

# gpasswd -a mpd pulse-access

−

# gpasswd -a mpd pulse-rt

−

Lastly, you may or may not need to copy {{Filename|~/.pulse-cookie}} from your current (pulse working) user's dir to your mpd user's home directory. It is likely to be {{Filename|/var/lib/mpd}} if you followed the first part of this wiki. This would probably only allow your current user to listen in on mpd's pulse. You may consider running pulse system-wide if that's insufficient.

'''Note:''' in case of permission problems when using ESD with MPD run this as root:

+

# chsh -s /bin/true mpd

+

+

===Avoiding timeouts===

+

To get rid of timeouts (i.e. when you paused music for long time) in gpmc and other clients uncomment and increase {{ic|connection_timeout}} option in {{ic|mpd.conf}}.

+

+

If files and/or titles are shown in wrong encoding, uncomment and change {{ic|filesystem_charset}} and {{ic|id3v1_encoding}} options.

+

Note that you cannot set encoding for ID3 v2 tags. To workaround this you may use [http://mpd.wikia.com/wiki/GenericDecoder#Generic_Tagreader external tag readers].

+

+

If you want to use another computer to control MPD over a network, the {{ic|bind_to_address}} option in {{ic|mpd.conf}} will need to be set to either your IP address, or {{ic|any}} if your IP address changes frequently.

+

+

'''Streaming'''<br>

+

With the latest version of MPD (0.15), built-in httpd streaming is now available.

+

+

To activate this feature, you'll just need to add a new output of type httpd in {{ic|mpd.conf}}:

+

audio_output {

+

type "httpd"

+

name "What you want"

+

encoder "lame" # vorbis or lame supported

+

port "8000"

+

bitrate "128"

+

format "44100:16:2" # change 2 to 1 for mono

+

}

+

+

Restart the mpd daemon and, from another computer, simply load the stream as any other url.

+

$ mplayer http://<server's IP>:8000

+

+

{{Note | You must open the port on your router / firewall for the stream to be connectible to from another computer.}}

+

+

Most players (i.e. vlc or xmms2) should also be able to load the stream via their "add url..." menu option.

+

+

This is a nice clean way to replace your current icecast setup with something natively supported within MPD.

The purpose of easytag here is that easytag detects the error in the tags, but like mpd it hangs and dies. The trick here is that easy tags actually tells you what file is causing the problem on the status bar.

Before starting easytag make sure to have a terminal close to be ready to kill easy tag to avoid a hang. Once you are ready, on the tree view select the directory where all your music is located. By default easytag starts to search all subdirectories for mp3 files. Once you notice that easytag stopped scanning for songs, make note of the culprit and kill easytag.

====KID3====

====KID3====

−

Here's where kid3 comes in handy. With kid3 go to the offending song and rewrite one of the tags. then save the file. This should force kid3 to rewrite the whole tag again fixing the problem with mpd and easy tag hanging.

===Cannot connect to mpd: host "localhost" not found: Temporary failure in name resolution===

===Cannot connect to mpd: host "localhost" not found: Temporary failure in name resolution===

−

Cannot connect to mpd (with ncmpcpp), if you are disconnected from network. Solution is [[IPv6 - Disabling the Module|disable IPv6]] or add line to /etc/hosts

+

Cannot connect to MPD (with ncmpcpp), if you are disconnected from network. Solution is [[IPv6 - Disabling the Module|disable IPv6]] or add line to /etc/hosts

−

::1 localhost.localdomain localhost

::1 localhost.localdomain localhost

−

===Port 6600 already in use===

+

===Other issues when attempting to connect to mpd with a client===

−

MPD needs to bind to port 6600 and cannot start if it's already in use. The most common reason for this is that the user has started mpd once and then subsequently tried mpd --create-db. New mpd behavior is the --create-db option also attempts to start the daemon; if it's already been started, this will fail. If this is the case, try the following:

+

Some have reported being unable to access mpd with various clients, for example seeing errors like these:

+

$ ncmpcpp

+

Cannot connect to mpd: Connection closed by the server

+

$ sonata

+

2011-02-13 18:33:05 Connection lost while reading MPD hello

+

2011-02-13 18:33:05 Not connected

+

2011-02-13 18:33:05 Not connected

−

$ mpd --kill

+

Please see posts on ncmpcpp on the Arch Forums [https://bbs.archlinux.org/viewtopic.php?id=109962 HERE] and [https://bbs.archlinux.org/viewtopic.php?id=113493 HERE]. Also see the Arch bug report on this issue [https://bugs.archlinux.org/task/22071 HERE].

−

$ mpd --create-db

−

A more brute-force approach:

+

====First fix====

+

Check {{ic|mpd.conf}} for a line like {{ic|mpd.error}} and remove it. The mpd error file is deprecated and has been removed.

−

$ killall mpd

+

====Second fix====

−

$ mpd --create-db

+

{{Note|I'm not so sure this is a good idea. There is a warning about changing the address to bind to in the default mpd.conf. If this does not help, you might want to comment out the changes.}}

+

If that doesn't help, add the following to {{ic|mpd.conf}}:

+

{{bc|

+

bind_to_address "127.0.0.1"

+

port "6600"

+

}}

−

{{Note| If you typically run mpd as root, you will need to run the above commands as root.}}

+

Afterwards, instruct your client to connect via 127.0.0.1. For example, add the following to the ncmpcpp config file:

+

{{bc|

+

mpd_host "127.0.0.1"

+

mpd_port "6600"

+

}}

−

In the git version of mpd, --create-db is completely deprecated. The database will be created automagically on first run and can subsequently be updated via your client (i.e. mpc update). Eventually, inotify support will offer fully automatic database updates as you add content to your music folders

+

===Port 6600 already in use===

+

MPD needs to bind to port 6600 and cannot start if it's already in use. The most common reason for this is that the user has started MPD once and then subsequently tried to start mpd again. In general, nothing should be done here.

If port 6600 is tied up for some other reason, one can use the following command to find the offending process:

If port 6600 is tied up for some other reason, one can use the following command to find the offending process:

+

# ss -tulpan | grep 6600

−

# netstat -tulpan | grep 6600

+

This will list IP:Port and the process name holding the connection (root privileges are required to see all processes).

−

This will list IP:Port and the process name holding the connection (root privileges are required to see all processes).

+

If you need to restart mpd for whatever reason, use:

+

{{bc|

+

$ mpd --kill

+

$ mpd

+

}}

+

A more brute-force approach:

+

{{bc|

+

$ killall mpd

+

$ mpd

+

}}

+

{{Note| If you typically run MPD as root, you will need to run the above commands as root.}}

+

+

In the latest version of MPD, --create-db is completely deprecated. The database will be created automagically on first run and can subsequently be updated via your client (i.e. mpc update). You can now use inotify support to automatically update your music database. Add the following to {{hc|mpd.conf|auto_update "yes"}} to enable it.

−

=== Crackling sound with some audio files ===

+

===Binding to IPV6 before IPV4===

+

If on startup, you see this message:

+

listen: bind to '0.0.0.0:6600' failed: Address already in use (continuing anyway, because binding to '[::]:6600' succeeded)

+

MPD is attempting to bind to the ipv6 interface before binding to ipv4. If you want to use your ipv4 interface, hardcode it in mpd.conf, like so:

+

bind_to_address "127.0.0.1"

+

Or, you could specify several binds, for example, to have MPD listen on localhost and the external IP of your network card:

+

bind_to_address "127.0.0.1"

+

bind_to_address "192.168.1.13"

+

===Crackling sound with some audio files===

This is usually a playback speed problem and can be fixed by uncommenting the audio_output_format line in:

This is usually a playback speed problem and can be fixed by uncommenting the audio_output_format line in:

−

{{File|name=/etc/mpd.conf|content=

+

{{hc|/etc/mpd.conf|

audio_output_format "44100:16:2"}}

audio_output_format "44100:16:2"}}

This is usually a sane value for most mp3 files.

This is usually a sane value for most mp3 files.

+

+

===daemon: cannot setgid for user "mpd": Operation not permitted ===

+

+

The error is stating that the user starting the process (you) does not have permissions to become another user (mpd) which the configuration has told that process to run as.

+

+

To solve the issue, simply start mpd as root.

+

{{bc|$ su -c "rc.d start mpd"}}

+

or

+

{{bc|# rc.d start mpd}}

==External links==

==External links==

−

+

* [http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki Official Web Site and wiki]

Never play on start

This feature has recently been added to mpd git by Martin Kellerman, see commits b57330cf75bcb339e3f268f1019c63e40d305145 and 2fb40fe728ac07574808c40034fc0f3d2254d49d. As of September 2011, this feature has not yet arrived in a mpd version in the official repositories. If support for this feature is still required, have a look at the following proposals.

Installing mpd from the AUR

This is the best method currently available, but is only currently (as of April 2011) enabled in the git version. Install mpd-gitAUR from the AUR and add restore_paused "yes" to your mpd.conf file.

This will change the player status to "paused", if it was stopped while playing. Next, you want this file to be preserved, so MPD updates won't erase this edit. Add (or edit) this line to your /etc/pacman.conf:

NoUpgrade = etc/rc.d/mpd

Method 2

Another simpler method, would be to add mpd to your rc.conf daemons array and add mpc stop or mpc pause to /etc/rc.local.shutdown and to /etc/rc.local. (Remember you must have mpc installed to use this method).

Adding only the order in /etc/rc.local cannot assure that mpd will play absolutely nothing, since there may be a delay before the stop command is executed.
On the other hand, if you only add the order to /etc/rc.local.shutdown, that will assure that mpd won't play at all, as long as you properly shutdown your system.
Even though they are redundant, adding it to /etc/rc.local would serve as a safety for those, presumably, rare occasions when you do not shutdown the system properly.

Method 3

The general idea is to ask mdp to pause music when the user logs out, so that mdp will stick to the "pause" state after a reboot. Sending such command can be achieved using mpc, the command line interface to MPD.

GDM users can then add /usr/bin/mpc pause to /etc/gdm/PostSession/Default (be sure to add it before exit 0):

Non-GDM users can use their own login manager's method to launch the line at logout.

audio_output {
type "alsa" # Use the ALSA output plugin.
name "HDA Intel" # Can be called anything or nothing tmk, but must be present.
options "dev=dmixer"
device "plug:dmix" # Both lines cause MPD to output to dmix.
format "44100:16:2" # the actual format
auto_resample "no" # This bypasses ALSA's own algorithms, which generally are inferior. See below how to choose a different one.
use_mmap "yes" # Minor speed improvement, should work with all modern cards.
}
samplerate_converter "0" # MPD's best, most CPU intensive algorithm. See 'man mpd.conf' for others — for anything other than the poorest "internal", libsamplerate must be installed.

Then to listen to this stream simply open the URL of your mpd server (along with the specified port) in your favorite music player. Note: You may have to specify the file format of the stream using an appropriate file extension in the URL. For example, using Winamp 5.5, You would use http://192.168.1.2:8000/mpd.ogg rather than http://192.168.1.2:8000/.

Note: in case of permission problems when using ESD with MPD run this as root:

# chsh -s /bin/true mpd

Avoiding timeouts

To get rid of timeouts (i.e. when you paused music for long time) in gpmc and other clients uncomment and increase connection_timeout option in mpd.conf.

If files and/or titles are shown in wrong encoding, uncomment and change filesystem_charset and id3v1_encoding options.
Note that you cannot set encoding for ID3 v2 tags. To workaround this you may use external tag readers.

If you want to use another computer to control MPD over a network, the bind_to_address option in mpd.conf will need to be set to either your IP address, or any if your IP address changes frequently.

Streaming
With the latest version of MPD (0.15), built-in httpd streaming is now available.

To activate this feature, you'll just need to add a new output of type httpd in mpd.conf:

Please see posts on ncmpcpp on the Arch Forums HERE and HERE. Also see the Arch bug report on this issue HERE.

First fix

Check mpd.conf for a line like mpd.error and remove it. The mpd error file is deprecated and has been removed.

Second fix

Note: I'm not so sure this is a good idea. There is a warning about changing the address to bind to in the default mpd.conf. If this does not help, you might want to comment out the changes.

If that doesn't help, add the following to mpd.conf:

bind_to_address "127.0.0.1"
port "6600"

Afterwards, instruct your client to connect via 127.0.0.1. For example, add the following to the ncmpcpp config file:

mpd_host "127.0.0.1"
mpd_port "6600"

Port 6600 already in use

MPD needs to bind to port 6600 and cannot start if it's already in use. The most common reason for this is that the user has started MPD once and then subsequently tried to start mpd again. In general, nothing should be done here.

If port 6600 is tied up for some other reason, one can use the following command to find the offending process:

# ss -tulpan | grep 6600

This will list IP:Port and the process name holding the connection (root privileges are required to see all processes).

If you need to restart mpd for whatever reason, use:

$ mpd --kill
$ mpd

A more brute-force approach:

$ killall mpd
$ mpd

Note: If you typically run MPD as root, you will need to run the above commands as root.

In the latest version of MPD, --create-db is completely deprecated. The database will be created automagically on first run and can subsequently be updated via your client (i.e. mpc update). You can now use inotify support to automatically update your music database. Add the following to

mpd.conf

auto_update "yes"

to enable it.

Binding to IPV6 before IPV4

If on startup, you see this message:

listen: bind to '0.0.0.0:6600' failed: Address already in use (continuing anyway, because binding to '[::]:6600' succeeded)

MPD is attempting to bind to the ipv6 interface before binding to ipv4. If you want to use your ipv4 interface, hardcode it in mpd.conf, like so:

bind_to_address "127.0.0.1"

Or, you could specify several binds, for example, to have MPD listen on localhost and the external IP of your network card:

bind_to_address "127.0.0.1"
bind_to_address "192.168.1.13"

Crackling sound with some audio files

This is usually a playback speed problem and can be fixed by uncommenting the audio_output_format line in:

/etc/mpd.conf

audio_output_format "44100:16:2"

This is usually a sane value for most mp3 files.

daemon: cannot setgid for user "mpd": Operation not permitted

The error is stating that the user starting the process (you) does not have permissions to become another user (mpd) which the configuration has told that process to run as.