https://wiki.archlinux.org/api.php?action=feedcontributions&user=MGu3l&feedformat=atomArchWiki - User contributions [en]2024-03-29T11:26:41ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Music_Player_Daemon_(Espa%C3%B1ol)&diff=89102Music Player Daemon (Español)2009-12-28T07:39:39Z<p>MGu3l: /* External links */</p>
<hr />
<div>[[Category: Audio/Video (Español)]]<br />
[[Category:CÓMOs (Español)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|Español|MPD (Español)}}<br />
{{i18n_entry|English|MPD}}<br />
{{i18n_entry|Français|MPD (Français)}}<br />
{{i18n_entry|Polski|mpd (polski)}}<br />
{{i18n_entry|Nederlands|Music Player Daemon (Nederlands)}}<br />
{{i18n_entry|Русский|MPD - Music Player Daemon (Русский)}}<br />
{{i18n_entry|简体中文|MPD(简体中文)}}<br />
{{i18n_entry|Türkçe|MPD (Türkçe)}}<br />
{{i18n_links_end}}<br />
<br />
<br />
{{stub}}<br />
{{Note|Este artículo está incompleto. Ahora mismo está siendo traducido desde [[MPD|su versión en ingles]]}}<br />
==¿Qué es MPD?==<br />
'''MPD''' (Music Player Daemon) es un reproductor de audio que maneja una arquitectura servidor-cliente. mpd se ejecuta en el fondo como un daemon, gestiona listas de reproducción y una base de datos, y hace uso de muy pocos recursos. Para hacer uso de una interfaz gráfica, es necesario un cliente adicional. Más información puede obtenerse en su [http://www.musicpd.org/ página web].<br />
<br />
==Procedimiento de Instalación del Daemon==<br />
<br />
Actualice e instale con pacman:<br />
# pacman -S mpd<br />
<br />
Ahora, añada el usuario mpd al grupo users:<br />
# gpasswd -a mpd users<br />
<br />
==Instrucciones de Configuración ==<br />
<br />
Para más información de la configuración de mpd, por favor visite http://mpd.wikia.com/wiki/Configuration<br />
<br />
===Linea de Tiempo del comportamiento habitual de mpd===<br />
* mpd es iniciado al cargar el sistema operativo por medio de {{Filename|/etc/rc.conf}}, incluyéndole en el apartado DAEMONS. (O, esto puede ser hecho manualmente ejecutando {{Codeline|/etc/rc.d/mpd start}} con privilegios de root).<br />
* Al ser iniciado mpd como root, leerá el archivo {{Filename|/etc/mpd.conf}}.<br />
* mpd lee la variable usuario en el archivo {{Filename|/etc/mpd.conf}}, y cambia de root a este usuario.<br />
* mpd continúa leyendo el contenido del archivo {{Filename|/etc/mpd.conf}} y se configura de acuerdo a este.<br />
<br />
Recuerde que mpd cambia el usuario de root a aquel mencionado en el archivo {{Filename|/etc/mpd.conf}}. Siendo asi, el uso de "~" en el archivo de configuracion hace referencia al directorio home del usuario, y no al directorio de root. Podria ser de utilidad cambiar todos los "~" a "/home/username" para prevenir cualquier confusion sobre este aspecto del comportamineto de mpd.<br />
<br />
===Un Archivo de Configuracion Limpio===<br />
<br />
* Como root, verifique si {{Filename|/etc/mpd.conf}} existe y elimine el archivo en caso de que exista. Esto es hecho por seguridad.<br />
<br />
Mpd viene con un ejemplo del archivo de configuracion, disponible en {{Filename|/etc/mpd.conf.example}}. Este archivo contiene abundante informacion acerca de la configuracion de mpd, y contiene valores predeterminados para el mixer, que simplemente pueden ser descomentados.<br />
<br />
* Como root, copie este archivo de ejemplo a {{Filename|/etc/mpd.conf}}.<br />
# cp /etc/mpd.conf.example /etc/mpd.conf<br />
<br />
Nunca ponga este archivo en su directorio home como algunos tutoriales sugieren. Esto podria complicarlo todo, y la mayoria de las veces no tendra ningun sentido (recuerde que esta es una guia corta de instalacion y configuracion). Si creó con anterioridad un archivo {{Filename|.mpdconf}} en su directorio home, eliminelo ahora. Esto es importante para evitar conflictos. Cuando está ubicado en /etc, como se indica aqui, mpd podra ser ejecutado como daemon al inicio. De otro modo, un script sería necesario para ejecutar mpd LUEGO de que el usuario inicie sesion (Como kdm o ~/.fluxbox/startup), o tambien sera necesario una ejecucion manual. Para una coleccion musical unica, el metodo utilizado aqui es mejor, aún si la coleccion es compartida entre multiples usuarios. Además, no se preocupe por los privilegios de root: aunque mpd es ejecutado como daemon, nunca lo hace completamente como root puesto que automaticamente pierde sus privilegios luego de ser ejecutado.<br />
<br />
===Correcta Configuración de Sonido===<br />
<br />
Para que la salido de audio funcione, asegúrese de haber configurado la tarjeta de sonido y el mixer correctamente. Vea [[ALSA]]. No olvide activar los canales requeridos en alsamixer, incrementar el volumen y guardar los cambios con alsactl store. Vea {{Filename|~/.mpd/error}} si aún no funciona.<br />
<br />
Asegúrese que su tarjeta pueda hacer mezclas por hardware (la mayoría de ellas pueden, incluidas aquellas integradas de la board), si no, esto podría traer problemas con múltiples reproducciones de sonido. Por ejemplo, Mplayer no podría reproducir sonido mientras el daemon se esté ejecutando, mostrando un mensaje de error indicando que el dispositivo se encuentra ocupado.<br />
<br />
===Editando {{Filename|mpd.conf}}===<br />
<br />
Para editar el archivo, como root:<br />
# SUEDITOR /etc/mpd.conf<br />
<br />
'''Mantiene la configuración en /var y usa "mpd" como usuario por defecto en vez de atestar ~/. Este es el modo en que el paquete es instalado en Arch.'''<br />
<br />
Edite {{Filename|/etc/mpd.conf}} para verse de la siguiente manera.<br />
<br />
music_directory "/home/usuario/música" # Su directorio de música.<br />
playlist_directory "/var/lib/mpd/playlists"<br />
db_file "/var/lib/mpd/db"<br />
log_file "/var/log/mpd/mpd.log"<br />
error_file "/var/log/mpd/mpd.error"<br />
pid_file "/var/run/mpd/mpd.pid"<br />
state_file "/var/lib/mpd/mpdstate"<br />
user "mpd"<br />
# Ediciones a la dirección y el puerto causan problemas en mpd-0.14.2 es preferible dejarlos<br />
# comentados.<br />
# bind_to_address "127.0.0.1"<br />
# port "6600"<br />
<br />
Lea con cuidado los pasos a continuación, los permisos deben ser otorgados correctamente.<br />
<br />
* Mantenga el usuario como "mpd", asegúrese que el directorio home del usuario "mpd" sea /var/lib/mpd <br />
$ cat /etc/passwd | grep mpd<br />
* Además asegúrese que el directorio /var/lib/mpd sea propiedad de mpd:mpd.<br />
$ ls -l /var/lib/ | grep mpd<br />
* Ahora como root, cree los archivos especificados en {Filename|/etc/mpd.conf}}, si los directorios no existen también deben ser creados. Esto no es necesario si hace uso de los predeterminados por el paquete de Arch.<br />
# touch /var/lib/mpd/db<br />
# touch /var/lib/mpd/mpdstate<br />
# touch /var/run/mpd/mpd.pid<br />
# touch /var/log/mpd/mpd.log<br />
# touch /var/log/mpd/mpd.error<br />
* Ahora cambie el propietario de los directorios y archivos que ha creado, al usuario "mpd"<br />
# chown -R mpd:mpd /var/{lib,run,log}/mpd<br />
* Si su colección musical está contenida en múltiples directorios, puede crear enlaces simbólicos en /var/lib/mpd y luego dirigir la variable 'music_dir' en mpd.conf a el directorio que contiene los enlaces. Recuerde asignar los permisos correctamente en los directorios enlazados.<br />
* Crear la base de datos ahora es realizado por medio de la opción "update" del cliente, por ejemplo, si ejecuta ncmpcpp, por medio de la tecla 'U'. <br />
**El método anterior, crear la base de datos de mpd como root (# mpd --create-db), es obsoleto.<br />
<br />
== Configuración Alterna ==<br />
<br />
MPD no necesita ser iniciado con permiso de root. La única razón por la cual MPD necesita ser iniciado como root (siendo llamado por medio de {{Filename|/etc/rc.conf}}) es porque los archivos y directorios mencionados por defecto en el archivo de configuración son propiedad de root (el directorio /var). Una menos común, pero quizás mas sensible configuración, consiste en hacer que MPD trabaje con archivos y directorios que sean propiedad de un usuario normal. Ejecutar MPD como un usuario normal tiene varias ventajas:<br />
# Puede manejar un solo directorio ~/.mpd (o cualquier otro directorio bajo /home/usuario) para todos los archivos de configuración de MPD<br />
# No hay errores de lectura/escritura<br />
# llamado más flexible a MPD haciendo uso de {{Filename|~/.xinitrc}} en vez de incluir 'mpd' en la sección de DAEMONS en {{Filename|/etc/rc.conf}}.<br />
<br />
Los siguientes pasos indican como iniciar MPD com oun usuario normal. '''Nota''': este método no funcionará si múltiples usuarios desean acceder a MPD.<br />
<br />
* Copie el contenido del archivo de configuración por defecto de MPD, ubicado en {{Filename|/etc/mpd.conf.example}} a su directorio home. Un buen lugar sería {{Filename|"/home/usr/.mpd/config"}}.<br />
* Siga los pasos de la configuración anterior, ignorando la primer parte, que hace referencia a copiar el archivo de configuración a {{Filename|/etc/mpd.conf}}. <br />
* Cree todos los archivos necesarios en {{filename|"/home/user/.mpd/"}}:<br />
"~/.mpd/playlists"<br />
"~/.mpd/db"<br />
"~/.mpd/mpd.log"<br />
"~/.mpd/mpd.error"<br />
"~/.mpd/mpd.pid"<br />
"~/.mpd/mpdstate"<br />
* Haga que MPD inicie al arranque por medio de su {{Filename|~/.xinitrc}} asi:<br />
# esto inicia MPD como un usuario normal<br />
mpd /home/username/.mpd/config<br />
{{Note| no tiene que poner un "&" al final de la linea, dado que MPD automáticamente se daemonizará.}}<br />
<br />
Finalmente, elimine mpd de la sección de DAEMONS en {{Filename|/etc/rc.conf}}, ya que no será ejecutado como root nunca más.<br />
<br />
=== Configuración Multi-MPD===<br />
'''Útil si desea ejecutar un servidor icecast, por ejemplo.'''<br />
Si desea un segundo daemon MPD (ej., con una salida icecast para compartir su música a través de una red) que haga uso de la música y listas de reproducción del primero, simplemente copie el archivo de configuración anterior y cree uno nuevo (ej., {{Filename|/home/username/.mpd/config-icecast}}), y solo cambie los parámetros de log_file, error_file, pid_file, y state_file (ej., {{Filename|mpd-icecast.log}}, {{Filename|mpd-icecast.error}}, y demás); hacer uso de los mismos directorios de música y listas de reproducción asegurará que este segundo daemon MPD hará uso de la misma colección musical del primero (ej., crear y editar una lista de reproducción bajo el primer daemon afectará también al segundo daemon, de modo que no sea necesario crear la misma lista de nuevo para el segundo daemon). Finalmente, ejecute este segundo daemon por medio de su archivo {{Filename|~/.xinitrc}}. (Asegúrese de utilizar un numero de puerto diferente, para evitar conflictos con su primer daemon MPD).<br />
<br />
== Solución de Problemas==<br />
<br />
=== Autodetección Fallida ===<br />
<br />
Durante el inicio de mpd, el intentará detectar automaticamente y configurar su salida de audio y control de volumen. Aunque en la mayoria de los casos esto suele funcionar, en otros sistemas puede fallar. Podria ser de ayuda para mpd especificar que utilizar como salida y mixer de sonido. Si su archivo {{Filename|/etc/mpd.conf}} es una copia de {{Filename|/etc/mpd.conf.example}} como se menciono anteriormente, simplemente descomente estas lineas:<br />
<br />
Ejemplo de una salida tipo ALSA:<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
device "hw:0,0" # optional<br />
format "44100:16:2" # optional<br />
}<br />
<br />
Ejemplo del mixer ALSA:<br />
mixer_type "alsa"<br />
mixer_device "default"<br />
mixer_control "PCM"<br />
<br />
'''Nota:''' en caso de problemas con los permisos cuando utilize ESD, ejecute esto como root:<br />
# chsh -s /bin/true mpd<br />
<br />
=== Permisos de archivos y directorios ===<br />
{{Warning|Estas direcciones se prestan a problemas de seguridad.}}<br />
<br />
MPD necesita tener permiso para ejecutar los directorios que conforman la coleccion de musica. Ademaz, el comando {{codeline|useradd}} asigna permisos 1700 drwx------ para el directorio principal de el usuario, significando que tendras que cambiar el acceso designado a {{filename|/home/$USER}} para que MPD pueda funcionar correctamente. Suponiendo que la coleccion en cuestion se ubica en:<br />
$ /home/usuario/musica<br />
los comandos correctos serian:<br />
$ chmod a+x /home/usuario<br />
$ chmod -R g+X /home/usuario/musica<br />
<br />
==== Solucion alternativa ====<br />
Otra opcion seria usar el grupo 'users' como forma para compartir archivos selectos, entre ellos la coleccion de musica. Primero quita todos los permisos de grupo actualmente asignados para luego establecer el nuevo esquema:<br />
$ chmod -R g-rwx /home/user<br />
$ chmod g+rx /home/user<br />
$ chmod -R g+rX /home/user/music<br />
<br />
===Tips===<br />
<br />
To get rid of timeouts (i.e. when you paused music for long time) in gpmc and other clients uncomment and increase {{Codeline|connection_timeout}} option in {{Filename|mpd.conf}}.<br />
<br />
If files and/or titles are shown in wrong encoding, uncomment and change {{Codeline|filesystem_charset}} and {{Codeline|id3v1_encoding}} options.<br />
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].<br />
<br />
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.<br />
<br />
'''Streaming'''<br />
<br />
With the latest version of mpd (0.15), built-in httpd streaming is now available.<br />
<br />
To activate this feature, you'll just need to add a new output of type httpd in {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "httpd"<br />
name "What you want"<br />
encoder "lame" # vorbis or lame supported<br />
port "8000"<br />
bitrate "128"<br />
format "44100:16:2" # change 2 to 1 for mono<br />
}<br />
<br />
Restart the mpd deamon and, from another computer, simply load the stream as any other url. <br />
<br />
mplayer http://<server's IP>:8000<br />
<br />
Most players (i.e. vlc or xmms2) should also be able to load the stream via their "add url..." menu option.<br />
<br />
This is a nice clean way to replace your current icecast setup with something natively supported within MPD.<br />
<br />
==Instalando clientes para MPD==<br />
Los mas populares son:<br />
* '''mpc''' &ndash; Cliente para linea de comandos. Lo mas comun es instalar este en paralelo a otro cliente mas avanzado.<br />
* '''ncmpc''' &ndash; Cliente usando la libreria ncurses. Muy util para usar en consola. [http://hem.bredband.net/kaw/ncmpc/ Pagina oficial de ncmpc]<br />
* '''ncmpcpp''' &ndash; Clon de ncmpc con algunas nuevas opciones escrito en C++. [http://unkart.ovh.org/ncmpcpp/ Sitio oficial de ncmpcpp]<br />
* '''pms''' &ndash; Otro cliente usando ncurses. Altamente configurable y accesible. [http://pms.sourceforge.net/ Pagina Sourceforge de pms]<br />
* '''ario''' &ndash; Cliente GTK+ con un manejo de libreria similar a la de Rythmbox. [http://ario-player.sourceforge.net Sitio oficial de Ario]<br />
* '''sonata''' &ndash; Cliente Python GTK+. [http://sonata.berlios.de/ Sitio oficial de Sonata]<br />
* '''gmpc''' &ndash; Cliente GNOME. [http://gmpcwiki.sarine.nl/index.php?title=GMPC Sitio oficial de gmpc]<br />
* '''QMPDClient''' &ndash; Cliente escrito en Qt 4. [http://bitcheese.net/wiki/QMPDClient Sitio oficial de QMPDClient]<br />
<br />
Instalelos usando:<br />
# pacman -Sy mpc<br />
# pacman -Sy ncmpc<br />
# pacman -Sy ncmpcpp<br />
# pacman -Sy pms<br />
# pacman -Sy ario<br />
# pacman -Sy sonata<br />
# pacman -Sy gmpc<br />
# pacman -Sy qmpdclient<br />
<br />
==Extra stuff==<br />
<br />
===Last.fm scrobbling===<br />
<br />
To scrobble your songs to [http://www.last.fm Last.fm] using MPD there are several alternatives.<br />
<br />
====mpdscribble====<br />
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.<br />
<br />
To install mpdscribble, just install it from the AUR and do the following (not as root):<br />
<br />
* {{Codeline|$ mkdir ~/.mpdscribble}}<br />
* Create the file {{Filename|~/.mpdscribble/mpdscribble.conf}} and add the following:<br />
username = <your last.fm username><br />
password = <md5 sum of your last.fm password> # Generated using "echo -n password | md5sum"<br />
host = <your mpd host> # defaults to $MPD_HOST or localhost<br />
port = <your mpd port> # defaults to $MPD_PORT or 6600<br />
log = ~/.mpdscribble/mpdscribble.log<br />
journal = ~/.mpdscribble/mpdscribble.cache<br />
verbose = 2<br />
sleep = 1<br />
musicdir = <your music directory><br />
* Add {{Codeline|mpdscribble}} to your {{Filename|~/.xinitrc}}.<br />
<br />
====Sonata====<br />
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.<br />
<br />
====lastfmsubmitd====<br />
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}}.<br />
<br />
===Last.fm playback with lastfmproxy===<br />
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.<br />
<br />
{{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.}}<br />
<br />
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.<br />
<br />
=== Never play on start ===<br />
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:<br />
'' ...''<br />
'' stat_busy "Starting Music Player Daemon"''<br />
<br />
# always start in paused state<br />
awk '/^state_file[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
sfile = substr($0, RSTART + 1, RLENGTH - 2)<br />
} /^user[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
user = substr($0, RSTART + 1, RLENGTH - 2)<br />
} END {<br />
if (sfile == "")<br />
exit;<br />
if (user != "")<br />
sub(/^~/, "/home/" user, sfile)<br />
system("sed -i \x27s|^\\(state:[ \\t]\\{1,\\}\\)play$|\\1pause|\x27 \x27" sfile "\x27")<br />
}' /etc/mpd.conf<br />
<br />
'' /usr/bin/mpd /etc/mpd.conf &> /dev/null''<br />
'' ...''<br />
<br />
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}}:<br />
NoUpgrade = etc/rc.d/mpd<br />
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).<br />
<br />
=== MPD & Alsa ===<br />
<br />
Sometimes, when you use other audio output, e.g: some web pages containing Flash applets, mpd cannot reproduce anything anymore (until you restart). The error looks something like: (if you search the file {{Filename|/var/log/mpd/mpd.error}})<br />
<br />
Error opening alsa device "hw:0,0": Device or resource busy<br />
<br />
And here is the solution (dmix saving our life again). Apply these lines in your {{Filename|/etc/mpd.conf}}:<br />
<br />
<pre><br />
audio_output {<br />
type "alsa"<br />
name "Sound Card"<br />
options "dev=dmixer"<br />
device "plug:dmix"<br />
}<br />
</pre><br />
<br />
And then restart with {{Codeline|/etc/rc.d/mpd restart}}.<br />
<br />
Searching on Internet I found the reason for why that happens in Gentoo's wiki:<br />
* The sound card does not support hardware mixing (uses '''dmix''' plugin)<br />
* An application does not work with ALSA with it's default settings<br />
<br />
====High CPU usage with ALSA====<br />
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.<br />
<br />
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}}.<br />
<br />
Example from {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
auto_resample "no"<br />
}<br />
<br />
Some users might also want to tell dmix to use 44kHz as well. More info about tuning performance of your MPD can be found from: [http://mpd.wikia.com/wiki/Tuning MPD wiki]<br />
<br />
=== Control mpd with lirc ===<br />
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.<br />
<br />
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.<br />
<br />
First of all, please setup your remotes as referred to the '''[[Lirc]]''' article.<br />
<br />
Edit your favored lirc startup configuration file, default location is {{Filename|~/.lircrc}}.<br />
<br />
Fill the file with the following pattern:<br />
<br />
begin<br />
prog = irexec<br />
button = <button_name><br />
config = <command_to_run><br />
repeat = <0 or 1><br />
end<br />
<br />
An useful example:<br />
<br />
## irexec<br />
begin<br />
prog = irexec<br />
button = play_pause<br />
config = mpc toggle<br />
repeat = 0<br />
end<br />
<br />
begin<br />
prog = irexec<br />
button = stop<br />
config = mpc stop<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = previous<br />
config = mpc prev<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = next<br />
config = mpc next<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = volup<br />
config = mpc volume +2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = voldown<br />
config = mpc volume -2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = pbc<br />
config = mpc random<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = pdvd<br />
config = mpc update<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = right<br />
config = mpc seek +00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = left<br />
config = mpc seek -00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = up<br />
config = mpc seek +1%<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = down<br />
config = mpc seek -1%<br />
repeat = 0<br />
end<br />
<br />
There are more functions for mpc, run {{Codeline|man mpc}} for more info.<br />
<br />
=== Control mpd with bluetooth phone ===<br />
You can also control mpd (to a certain extent) using a bluetooth enabled phone. You need to do the following:<br />
<br />
* install [http://remuco.sourceforge.net/index.php/Remuco remuco] -- a wireless remote control for several Linux media players ([http://aur.archlinux.org/packages.php?ID=25072 aur])<br />
* transfer remuco client -- jar/jad files from {{Filename|/usr/share/remuco/client/}} to your phone and install it<br />
* run {{Codeline|remuco-mpd}} (as current user)<br />
* run remuco on your phone, define a new bluetooth remuco connection (pair first if you haven't done this previously) and explore its capabilities<br />
<br />
More information about remuco including troubleshooting to be found at its [http://remuco.sourceforge.net/index.php/Remuco homepage]<br />
<br />
=== MPD & PulseAudio ===<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
# gpasswd -a mpd pulse-access<br />
# gpasswd -a mpd pulse-rt<br />
<br />
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.<br />
<br />
==Troubleshooting==<br />
===mpd --create-db hangs===<br />
This is a common error that's caused by corrupt mp3 tags.<br />
Here is an experimental way to solve this issue.<br />
Requirements:<br />
* kid3<br />
* easytag<br />
<br />
This method is very tedious, expecially with a huge database. Just as a baseline it took 2.5h to fix a 16Gb DB.<br />
<br />
====Easy Tag====<br />
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.<br />
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.<br />
<br />
====KID3====<br />
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.<br />
<br />
Repeat this procedure until your music library is done.<br />
<br />
===Cannot connect to mpd: host "localhost" not found: Temporary failure in name resolution===<br />
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<br />
<br />
::1 localhost.localdomain localhost<br />
<br />
===Port 6600 already in use===<br />
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:<br />
<br />
$ mpd --kill<br />
$ mpd --create-db<br />
<br />
A more brute-force approach:<br />
<br />
$ killall mpd<br />
$ mpd --create-db<br />
<br />
{{Note| If you typically run mpd as root, you will need to run the above commands as root.}}<br />
<br />
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<br />
<br />
If port 6600 is tied up for some other reason, one can use the following command to find the offending process:<br />
<br />
# netstat -tulpan | grep 6600<br />
<br />
This will list IP:Port and the process name holding the connection (root privileges are required to see all processes).<br />
<br />
=== Crackling sound with some audio files ===<br />
<br />
This is usually a playback speed problem and can be fixed by uncommenting the audio_output_format line in:<br />
<br />
{{File|name=/etc/mpd.conf|content=<br />
audio_output_format "44100:16:2"}}<br />
<br />
This is usually a sane value for most mp3 files.<br />
<br />
==Enlaces Externos==<br />
<br />
* [http://www.musicpd.org/ Web site Oficial]<br />
* [http://mpd.wikia.com/wiki/Main_Page Wiki Oficial]<br />
* [http://mpd.wikia.com/wiki/Clients Lista de clientes para MPD]<br />
* [http://www.musicpd.org/forum/ Foro de MPD]</div>MGu3lhttps://wiki.archlinux.org/index.php?title=Music_Player_Daemon_(Espa%C3%B1ol)&diff=89101Music Player Daemon (Español)2009-12-28T07:34:09Z<p>MGu3l: /* Sound Setup Correctly */</p>
<hr />
<div>[[Category: Audio/Video (Español)]]<br />
[[Category:CÓMOs (Español)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|Español|MPD (Español)}}<br />
{{i18n_entry|English|MPD}}<br />
{{i18n_entry|Français|MPD (Français)}}<br />
{{i18n_entry|Polski|mpd (polski)}}<br />
{{i18n_entry|Nederlands|Music Player Daemon (Nederlands)}}<br />
{{i18n_entry|Русский|MPD - Music Player Daemon (Русский)}}<br />
{{i18n_entry|简体中文|MPD(简体中文)}}<br />
{{i18n_entry|Türkçe|MPD (Türkçe)}}<br />
{{i18n_links_end}}<br />
<br />
<br />
{{stub}}<br />
{{Note|Este artículo está incompleto. Ahora mismo está siendo traducido desde [[MPD|su versión en ingles]]}}<br />
==¿Qué es MPD?==<br />
'''MPD''' (Music Player Daemon) es un reproductor de audio que maneja una arquitectura servidor-cliente. mpd se ejecuta en el fondo como un daemon, gestiona listas de reproducción y una base de datos, y hace uso de muy pocos recursos. Para hacer uso de una interfaz gráfica, es necesario un cliente adicional. Más información puede obtenerse en su [http://www.musicpd.org/ página web].<br />
<br />
==Procedimiento de Instalación del Daemon==<br />
<br />
Actualice e instale con pacman:<br />
# pacman -S mpd<br />
<br />
Ahora, añada el usuario mpd al grupo users:<br />
# gpasswd -a mpd users<br />
<br />
==Instrucciones de Configuración ==<br />
<br />
Para más información de la configuración de mpd, por favor visite http://mpd.wikia.com/wiki/Configuration<br />
<br />
===Linea de Tiempo del comportamiento habitual de mpd===<br />
* mpd es iniciado al cargar el sistema operativo por medio de {{Filename|/etc/rc.conf}}, incluyéndole en el apartado DAEMONS. (O, esto puede ser hecho manualmente ejecutando {{Codeline|/etc/rc.d/mpd start}} con privilegios de root).<br />
* Al ser iniciado mpd como root, leerá el archivo {{Filename|/etc/mpd.conf}}.<br />
* mpd lee la variable usuario en el archivo {{Filename|/etc/mpd.conf}}, y cambia de root a este usuario.<br />
* mpd continúa leyendo el contenido del archivo {{Filename|/etc/mpd.conf}} y se configura de acuerdo a este.<br />
<br />
Recuerde que mpd cambia el usuario de root a aquel mencionado en el archivo {{Filename|/etc/mpd.conf}}. Siendo asi, el uso de "~" en el archivo de configuracion hace referencia al directorio home del usuario, y no al directorio de root. Podria ser de utilidad cambiar todos los "~" a "/home/username" para prevenir cualquier confusion sobre este aspecto del comportamineto de mpd.<br />
<br />
===Un Archivo de Configuracion Limpio===<br />
<br />
* Como root, verifique si {{Filename|/etc/mpd.conf}} existe y elimine el archivo en caso de que exista. Esto es hecho por seguridad.<br />
<br />
Mpd viene con un ejemplo del archivo de configuracion, disponible en {{Filename|/etc/mpd.conf.example}}. Este archivo contiene abundante informacion acerca de la configuracion de mpd, y contiene valores predeterminados para el mixer, que simplemente pueden ser descomentados.<br />
<br />
* Como root, copie este archivo de ejemplo a {{Filename|/etc/mpd.conf}}.<br />
# cp /etc/mpd.conf.example /etc/mpd.conf<br />
<br />
Nunca ponga este archivo en su directorio home como algunos tutoriales sugieren. Esto podria complicarlo todo, y la mayoria de las veces no tendra ningun sentido (recuerde que esta es una guia corta de instalacion y configuracion). Si creó con anterioridad un archivo {{Filename|.mpdconf}} en su directorio home, eliminelo ahora. Esto es importante para evitar conflictos. Cuando está ubicado en /etc, como se indica aqui, mpd podra ser ejecutado como daemon al inicio. De otro modo, un script sería necesario para ejecutar mpd LUEGO de que el usuario inicie sesion (Como kdm o ~/.fluxbox/startup), o tambien sera necesario una ejecucion manual. Para una coleccion musical unica, el metodo utilizado aqui es mejor, aún si la coleccion es compartida entre multiples usuarios. Además, no se preocupe por los privilegios de root: aunque mpd es ejecutado como daemon, nunca lo hace completamente como root puesto que automaticamente pierde sus privilegios luego de ser ejecutado.<br />
<br />
===Correcta Configuración de Sonido===<br />
<br />
Para que la salido de audio funcione, asegúrese de haber configurado la tarjeta de sonido y el mixer correctamente. Vea [[ALSA]]. No olvide activar los canales requeridos en alsamixer, incrementar el volumen y guardar los cambios con alsactl store. Vea {{Filename|~/.mpd/error}} si aún no funciona.<br />
<br />
Asegúrese que su tarjeta pueda hacer mezclas por hardware (la mayoría de ellas pueden, incluidas aquellas integradas de la board), si no, esto podría traer problemas con múltiples reproducciones de sonido. Por ejemplo, Mplayer no podría reproducir sonido mientras el daemon se esté ejecutando, mostrando un mensaje de error indicando que el dispositivo se encuentra ocupado.<br />
<br />
===Editando {{Filename|mpd.conf}}===<br />
<br />
Para editar el archivo, como root:<br />
# SUEDITOR /etc/mpd.conf<br />
<br />
'''Mantiene la configuración en /var y usa "mpd" como usuario por defecto en vez de atestar ~/. Este es el modo en que el paquete es instalado en Arch.'''<br />
<br />
Edite {{Filename|/etc/mpd.conf}} para verse de la siguiente manera.<br />
<br />
music_directory "/home/usuario/música" # Su directorio de música.<br />
playlist_directory "/var/lib/mpd/playlists"<br />
db_file "/var/lib/mpd/db"<br />
log_file "/var/log/mpd/mpd.log"<br />
error_file "/var/log/mpd/mpd.error"<br />
pid_file "/var/run/mpd/mpd.pid"<br />
state_file "/var/lib/mpd/mpdstate"<br />
user "mpd"<br />
# Ediciones a la dirección y el puerto causan problemas en mpd-0.14.2 es preferible dejarlos<br />
# comentados.<br />
# bind_to_address "127.0.0.1"<br />
# port "6600"<br />
<br />
Lea con cuidado los pasos a continuación, los permisos deben ser otorgados correctamente.<br />
<br />
* Mantenga el usuario como "mpd", asegúrese que el directorio home del usuario "mpd" sea /var/lib/mpd <br />
$ cat /etc/passwd | grep mpd<br />
* Además asegúrese que el directorio /var/lib/mpd sea propiedad de mpd:mpd.<br />
$ ls -l /var/lib/ | grep mpd<br />
* Ahora como root, cree los archivos especificados en {Filename|/etc/mpd.conf}}, si los directorios no existen también deben ser creados. Esto no es necesario si hace uso de los predeterminados por el paquete de Arch.<br />
# touch /var/lib/mpd/db<br />
# touch /var/lib/mpd/mpdstate<br />
# touch /var/run/mpd/mpd.pid<br />
# touch /var/log/mpd/mpd.log<br />
# touch /var/log/mpd/mpd.error<br />
* Ahora cambie el propietario de los directorios y archivos que ha creado, al usuario "mpd"<br />
# chown -R mpd:mpd /var/{lib,run,log}/mpd<br />
* Si su colección musical está contenida en múltiples directorios, puede crear enlaces simbólicos en /var/lib/mpd y luego dirigir la variable 'music_dir' en mpd.conf a el directorio que contiene los enlaces. Recuerde asignar los permisos correctamente en los directorios enlazados.<br />
* Crear la base de datos ahora es realizado por medio de la opción "update" del cliente, por ejemplo, si ejecuta ncmpcpp, por medio de la tecla 'U'. <br />
**El método anterior, crear la base de datos de mpd como root (# mpd --create-db), es obsoleto.<br />
<br />
== Configuración Alterna ==<br />
<br />
MPD no necesita ser iniciado con permiso de root. La única razón por la cual MPD necesita ser iniciado como root (siendo llamado por medio de {{Filename|/etc/rc.conf}}) es porque los archivos y directorios mencionados por defecto en el archivo de configuración son propiedad de root (el directorio /var). Una menos común, pero quizás mas sensible configuración, consiste en hacer que MPD trabaje con archivos y directorios que sean propiedad de un usuario normal. Ejecutar MPD como un usuario normal tiene varias ventajas:<br />
# Puede manejar un solo directorio ~/.mpd (o cualquier otro directorio bajo /home/usuario) para todos los archivos de configuración de MPD<br />
# No hay errores de lectura/escritura<br />
# llamado más flexible a MPD haciendo uso de {{Filename|~/.xinitrc}} en vez de incluir 'mpd' en la sección de DAEMONS en {{Filename|/etc/rc.conf}}.<br />
<br />
Los siguientes pasos indican como iniciar MPD com oun usuario normal. '''Nota''': este método no funcionará si múltiples usuarios desean acceder a MPD.<br />
<br />
* Copie el contenido del archivo de configuración por defecto de MPD, ubicado en {{Filename|/etc/mpd.conf.example}} a su directorio home. Un buen lugar sería {{Filename|"/home/usr/.mpd/config"}}.<br />
* Siga los pasos de la configuración anterior, ignorando la primer parte, que hace referencia a copiar el archivo de configuración a {{Filename|/etc/mpd.conf}}. <br />
* Cree todos los archivos necesarios en {{filename|"/home/user/.mpd/"}}:<br />
"~/.mpd/playlists"<br />
"~/.mpd/db"<br />
"~/.mpd/mpd.log"<br />
"~/.mpd/mpd.error"<br />
"~/.mpd/mpd.pid"<br />
"~/.mpd/mpdstate"<br />
* Haga que MPD inicie al arranque por medio de su {{Filename|~/.xinitrc}} asi:<br />
# esto inicia MPD como un usuario normal<br />
mpd /home/username/.mpd/config<br />
{{Note| no tiene que poner un "&" al final de la linea, dado que MPD automáticamente se daemonizará.}}<br />
<br />
Finalmente, elimine mpd de la sección de DAEMONS en {{Filename|/etc/rc.conf}}, ya que no será ejecutado como root nunca más.<br />
<br />
=== Configuración Multi-MPD===<br />
'''Útil si desea ejecutar un servidor icecast, por ejemplo.'''<br />
Si desea un segundo daemon MPD (ej., con una salida icecast para compartir su música a través de una red) que haga uso de la música y listas de reproducción del primero, simplemente copie el archivo de configuración anterior y cree uno nuevo (ej., {{Filename|/home/username/.mpd/config-icecast}}), y solo cambie los parámetros de log_file, error_file, pid_file, y state_file (ej., {{Filename|mpd-icecast.log}}, {{Filename|mpd-icecast.error}}, y demás); hacer uso de los mismos directorios de música y listas de reproducción asegurará que este segundo daemon MPD hará uso de la misma colección musical del primero (ej., crear y editar una lista de reproducción bajo el primer daemon afectará también al segundo daemon, de modo que no sea necesario crear la misma lista de nuevo para el segundo daemon). Finalmente, ejecute este segundo daemon por medio de su archivo {{Filename|~/.xinitrc}}. (Asegúrese de utilizar un numero de puerto diferente, para evitar conflictos con su primer daemon MPD).<br />
<br />
== Solución de Problemas==<br />
<br />
=== Autodetección Fallida ===<br />
<br />
Durante el inicio de mpd, el intentará detectar automaticamente y configurar su salida de audio y control de volumen. Aunque en la mayoria de los casos esto suele funcionar, en otros sistemas puede fallar. Podria ser de ayuda para mpd especificar que utilizar como salida y mixer de sonido. Si su archivo {{Filename|/etc/mpd.conf}} es una copia de {{Filename|/etc/mpd.conf.example}} como se menciono anteriormente, simplemente descomente estas lineas:<br />
<br />
Ejemplo de una salida tipo ALSA:<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
device "hw:0,0" # optional<br />
format "44100:16:2" # optional<br />
}<br />
<br />
Ejemplo del mixer ALSA:<br />
mixer_type "alsa"<br />
mixer_device "default"<br />
mixer_control "PCM"<br />
<br />
'''Nota:''' en caso de problemas con los permisos cuando utilize ESD, ejecute esto como root:<br />
# chsh -s /bin/true mpd<br />
<br />
=== Permisos de archivos y directorios ===<br />
{{Warning|Estas direcciones se prestan a problemas de seguridad.}}<br />
<br />
MPD necesita tener permiso para ejecutar los directorios que conforman la coleccion de musica. Ademaz, el comando {{codeline|useradd}} asigna permisos 1700 drwx------ para el directorio principal de el usuario, significando que tendras que cambiar el acceso designado a {{filename|/home/$USER}} para que MPD pueda funcionar correctamente. Suponiendo que la coleccion en cuestion se ubica en:<br />
$ /home/usuario/musica<br />
los comandos correctos serian:<br />
$ chmod a+x /home/usuario<br />
$ chmod -R g+X /home/usuario/musica<br />
<br />
==== Solucion alternativa ====<br />
Otra opcion seria usar el grupo 'users' como forma para compartir archivos selectos, entre ellos la coleccion de musica. Primero quita todos los permisos de grupo actualmente asignados para luego establecer el nuevo esquema:<br />
$ chmod -R g-rwx /home/user<br />
$ chmod g+rx /home/user<br />
$ chmod -R g+rX /home/user/music<br />
<br />
===Tips===<br />
<br />
To get rid of timeouts (i.e. when you paused music for long time) in gpmc and other clients uncomment and increase {{Codeline|connection_timeout}} option in {{Filename|mpd.conf}}.<br />
<br />
If files and/or titles are shown in wrong encoding, uncomment and change {{Codeline|filesystem_charset}} and {{Codeline|id3v1_encoding}} options.<br />
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].<br />
<br />
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.<br />
<br />
'''Streaming'''<br />
<br />
With the latest version of mpd (0.15), built-in httpd streaming is now available.<br />
<br />
To activate this feature, you'll just need to add a new output of type httpd in {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "httpd"<br />
name "What you want"<br />
encoder "lame" # vorbis or lame supported<br />
port "8000"<br />
bitrate "128"<br />
format "44100:16:2" # change 2 to 1 for mono<br />
}<br />
<br />
Restart the mpd deamon and, from another computer, simply load the stream as any other url. <br />
<br />
mplayer http://<server's IP>:8000<br />
<br />
Most players (i.e. vlc or xmms2) should also be able to load the stream via their "add url..." menu option.<br />
<br />
This is a nice clean way to replace your current icecast setup with something natively supported within MPD.<br />
<br />
==Instalando clientes para MPD==<br />
Los mas populares son:<br />
* '''mpc''' &ndash; Cliente para linea de comandos. Lo mas comun es instalar este en paralelo a otro cliente mas avanzado.<br />
* '''ncmpc''' &ndash; Cliente usando la libreria ncurses. Muy util para usar en consola. [http://hem.bredband.net/kaw/ncmpc/ Pagina oficial de ncmpc]<br />
* '''ncmpcpp''' &ndash; Clon de ncmpc con algunas nuevas opciones escrito en C++. [http://unkart.ovh.org/ncmpcpp/ Sitio oficial de ncmpcpp]<br />
* '''pms''' &ndash; Otro cliente usando ncurses. Altamente configurable y accesible. [http://pms.sourceforge.net/ Pagina Sourceforge de pms]<br />
* '''ario''' &ndash; Cliente GTK+ con un manejo de libreria similar a la de Rythmbox. [http://ario-player.sourceforge.net Sitio oficial de Ario]<br />
* '''sonata''' &ndash; Cliente Python GTK+. [http://sonata.berlios.de/ Sitio oficial de Sonata]<br />
* '''gmpc''' &ndash; Cliente GNOME. [http://gmpcwiki.sarine.nl/index.php?title=GMPC Sitio oficial de gmpc]<br />
* '''QMPDClient''' &ndash; Cliente escrito en Qt 4. [http://bitcheese.net/wiki/QMPDClient Sitio oficial de QMPDClient]<br />
<br />
Instalelos usando:<br />
# pacman -Sy mpc<br />
# pacman -Sy ncmpc<br />
# pacman -Sy ncmpcpp<br />
# pacman -Sy pms<br />
# pacman -Sy ario<br />
# pacman -Sy sonata<br />
# pacman -Sy gmpc<br />
# pacman -Sy qmpdclient<br />
<br />
==Extra stuff==<br />
<br />
===Last.fm scrobbling===<br />
<br />
To scrobble your songs to [http://www.last.fm Last.fm] using MPD there are several alternatives.<br />
<br />
====mpdscribble====<br />
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.<br />
<br />
To install mpdscribble, just install it from the AUR and do the following (not as root):<br />
<br />
* {{Codeline|$ mkdir ~/.mpdscribble}}<br />
* Create the file {{Filename|~/.mpdscribble/mpdscribble.conf}} and add the following:<br />
username = <your last.fm username><br />
password = <md5 sum of your last.fm password> # Generated using "echo -n password | md5sum"<br />
host = <your mpd host> # defaults to $MPD_HOST or localhost<br />
port = <your mpd port> # defaults to $MPD_PORT or 6600<br />
log = ~/.mpdscribble/mpdscribble.log<br />
journal = ~/.mpdscribble/mpdscribble.cache<br />
verbose = 2<br />
sleep = 1<br />
musicdir = <your music directory><br />
* Add {{Codeline|mpdscribble}} to your {{Filename|~/.xinitrc}}.<br />
<br />
====Sonata====<br />
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.<br />
<br />
====lastfmsubmitd====<br />
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}}.<br />
<br />
===Last.fm playback with lastfmproxy===<br />
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.<br />
<br />
{{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.}}<br />
<br />
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.<br />
<br />
=== Never play on start ===<br />
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:<br />
'' ...''<br />
'' stat_busy "Starting Music Player Daemon"''<br />
<br />
# always start in paused state<br />
awk '/^state_file[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
sfile = substr($0, RSTART + 1, RLENGTH - 2)<br />
} /^user[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
user = substr($0, RSTART + 1, RLENGTH - 2)<br />
} END {<br />
if (sfile == "")<br />
exit;<br />
if (user != "")<br />
sub(/^~/, "/home/" user, sfile)<br />
system("sed -i \x27s|^\\(state:[ \\t]\\{1,\\}\\)play$|\\1pause|\x27 \x27" sfile "\x27")<br />
}' /etc/mpd.conf<br />
<br />
'' /usr/bin/mpd /etc/mpd.conf &> /dev/null''<br />
'' ...''<br />
<br />
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}}:<br />
NoUpgrade = etc/rc.d/mpd<br />
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).<br />
<br />
=== MPD & Alsa ===<br />
<br />
Sometimes, when you use other audio output, e.g: some web pages containing Flash applets, mpd cannot reproduce anything anymore (until you restart). The error looks something like: (if you search the file {{Filename|/var/log/mpd/mpd.error}})<br />
<br />
Error opening alsa device "hw:0,0": Device or resource busy<br />
<br />
And here is the solution (dmix saving our life again). Apply these lines in your {{Filename|/etc/mpd.conf}}:<br />
<br />
<pre><br />
audio_output {<br />
type "alsa"<br />
name "Sound Card"<br />
options "dev=dmixer"<br />
device "plug:dmix"<br />
}<br />
</pre><br />
<br />
And then restart with {{Codeline|/etc/rc.d/mpd restart}}.<br />
<br />
Searching on Internet I found the reason for why that happens in Gentoo's wiki:<br />
* The sound card does not support hardware mixing (uses '''dmix''' plugin)<br />
* An application does not work with ALSA with it's default settings<br />
<br />
====High CPU usage with ALSA====<br />
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.<br />
<br />
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}}.<br />
<br />
Example from {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
auto_resample "no"<br />
}<br />
<br />
Some users might also want to tell dmix to use 44kHz as well. More info about tuning performance of your MPD can be found from: [http://mpd.wikia.com/wiki/Tuning MPD wiki]<br />
<br />
=== Control mpd with lirc ===<br />
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.<br />
<br />
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.<br />
<br />
First of all, please setup your remotes as referred to the '''[[Lirc]]''' article.<br />
<br />
Edit your favored lirc startup configuration file, default location is {{Filename|~/.lircrc}}.<br />
<br />
Fill the file with the following pattern:<br />
<br />
begin<br />
prog = irexec<br />
button = <button_name><br />
config = <command_to_run><br />
repeat = <0 or 1><br />
end<br />
<br />
An useful example:<br />
<br />
## irexec<br />
begin<br />
prog = irexec<br />
button = play_pause<br />
config = mpc toggle<br />
repeat = 0<br />
end<br />
<br />
begin<br />
prog = irexec<br />
button = stop<br />
config = mpc stop<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = previous<br />
config = mpc prev<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = next<br />
config = mpc next<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = volup<br />
config = mpc volume +2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = voldown<br />
config = mpc volume -2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = pbc<br />
config = mpc random<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = pdvd<br />
config = mpc update<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = right<br />
config = mpc seek +00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = left<br />
config = mpc seek -00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = up<br />
config = mpc seek +1%<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = down<br />
config = mpc seek -1%<br />
repeat = 0<br />
end<br />
<br />
There are more functions for mpc, run {{Codeline|man mpc}} for more info.<br />
<br />
=== Control mpd with bluetooth phone ===<br />
You can also control mpd (to a certain extent) using a bluetooth enabled phone. You need to do the following:<br />
<br />
* install [http://remuco.sourceforge.net/index.php/Remuco remuco] -- a wireless remote control for several Linux media players ([http://aur.archlinux.org/packages.php?ID=25072 aur])<br />
* transfer remuco client -- jar/jad files from {{Filename|/usr/share/remuco/client/}} to your phone and install it<br />
* run {{Codeline|remuco-mpd}} (as current user)<br />
* run remuco on your phone, define a new bluetooth remuco connection (pair first if you haven't done this previously) and explore its capabilities<br />
<br />
More information about remuco including troubleshooting to be found at its [http://remuco.sourceforge.net/index.php/Remuco homepage]<br />
<br />
=== MPD & PulseAudio ===<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
# gpasswd -a mpd pulse-access<br />
# gpasswd -a mpd pulse-rt<br />
<br />
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.<br />
<br />
==Troubleshooting==<br />
===mpd --create-db hangs===<br />
This is a common error that's caused by corrupt mp3 tags.<br />
Here is an experimental way to solve this issue.<br />
Requirements:<br />
* kid3<br />
* easytag<br />
<br />
This method is very tedious, expecially with a huge database. Just as a baseline it took 2.5h to fix a 16Gb DB.<br />
<br />
====Easy Tag====<br />
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.<br />
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.<br />
<br />
====KID3====<br />
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.<br />
<br />
Repeat this procedure until your music library is done.<br />
<br />
===Cannot connect to mpd: host "localhost" not found: Temporary failure in name resolution===<br />
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<br />
<br />
::1 localhost.localdomain localhost<br />
<br />
===Port 6600 already in use===<br />
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:<br />
<br />
$ mpd --kill<br />
$ mpd --create-db<br />
<br />
A more brute-force approach:<br />
<br />
$ killall mpd<br />
$ mpd --create-db<br />
<br />
{{Note| If you typically run mpd as root, you will need to run the above commands as root.}}<br />
<br />
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<br />
<br />
If port 6600 is tied up for some other reason, one can use the following command to find the offending process:<br />
<br />
# netstat -tulpan | grep 6600<br />
<br />
This will list IP:Port and the process name holding the connection (root privileges are required to see all processes).<br />
<br />
=== Crackling sound with some audio files ===<br />
<br />
This is usually a playback speed problem and can be fixed by uncommenting the audio_output_format line in:<br />
<br />
{{File|name=/etc/mpd.conf|content=<br />
audio_output_format "44100:16:2"}}<br />
<br />
This is usually a sane value for most mp3 files.<br />
<br />
==External links==<br />
<br />
* [http://www.musicpd.org/ Official Web Site]<br />
* [http://mpd.wikia.com/wiki/Main_Page Official Wiki]<br />
* [http://mpd.wikia.com/wiki/Clients Sorted List of MPD Clients]<br />
* [http://www.musicpd.org/forum/ MPD forum]</div>MGu3lhttps://wiki.archlinux.org/index.php?title=Music_Player_Daemon_(Espa%C3%B1ol)&diff=89069Music Player Daemon (Español)2009-12-27T23:10:42Z<p>MGu3l: /* Configuración Alterna */</p>
<hr />
<div>[[Category: Audio/Video (Español)]]<br />
[[Category:CÓMOs (Español)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|MPD}}<br />
{{i18n_entry|Français|MPD (Français)}}<br />
{{i18n_entry|Polski|mpd (polski)}}<br />
{{i18n_entry|Nederlands|Music Player Daemon (Nederlands)}}<br />
{{i18n_entry|Русский|MPD - Music Player Daemon (Русский)}}<br />
{{i18n_entry|简体中文|MPD(简体中文)}}<br />
{{i18n_entry|Türkçe|MPD (Türkçe)}}<br />
{{i18n_entry|Español|MPD (Español)}}<br />
{{i18n_links_end}}<br />
<br />
<br />
{{stub}}<br />
{{Note|Este artículo está incompleto. Ahora mismo está siendo traducido desde [[MPD|su versión en ingles]]}}<br />
==¿Qué es MPD?==<br />
'''MPD''' (Music Player Daemon) es un reproductor de audio que maneja una arquitectura servidor-cliente. mpd se ejecuta en el fondo como un daemon, gestiona listas de reproducción y una base de datos, y hace uso de muy pocos recursos. Para hacer uso de una interfaz gráfica, es necesario un cliente adicional. Más información puede obtenerse en su [http://www.musicpd.org/ página web].<br />
<br />
==Procedimiento de Instalación del Daemon==<br />
<br />
Actualice e instale con pacman:<br />
# pacman -S mpd<br />
<br />
Ahora, añada el usuario mpd al grupo users:<br />
# gpasswd -a mpd users<br />
<br />
==Instrucciones de Configuración ==<br />
<br />
Para más información de la configuración de mpd, por favor visite http://mpd.wikia.com/wiki/Configuration<br />
<br />
===Linea de Tiempo del comportamiento habitual de mpd===<br />
* mpd es iniciado al cargar el sistema operativo por medio de {{Filename|/etc/rc.conf}}, incluyéndole en el apartado DAEMONS. (O, esto puede ser hecho manualmente ejecutando {{Codeline|/etc/rc.d/mpd start}} con privilegios de root).<br />
* Al ser iniciado mpd como root, leerá el archivo {{Filename|/etc/mpd.conf}}.<br />
* mpd lee la variable usuario en el archivo {{Filename|/etc/mpd.conf}}, y cambia de root a este usuario.<br />
* mpd continúa leyendo el contenido del archivo {{Filename|/etc/mpd.conf}} y se configura de acuerdo a este.<br />
<br />
Recuerde que mpd cambia el usuario de root a aquel mencionado en el archivo {{Filename|/etc/mpd.conf}}. Siendo asi, el uso de "~" en el archivo de configuracion hace referencia al directorio home del usuario, y no al directorio de root. Podria ser de utilidad cambiar todos los "~" a "/home/username" para prevenir cualquier confusion sobre este aspecto del comportamineto de mpd.<br />
<br />
===Un Archivo de Configuracion Limpio===<br />
<br />
* Como root, verifique si {{Filename|/etc/mpd.conf}} existe y elimine el archivo en caso de que exista. Esto es hecho por seguridad.<br />
<br />
Mpd viene con un ejemplo del archivo de configuracion, disponible en {{Filename|/etc/mpd.conf.example}}. Este archivo contiene abundante informacion acerca de la configuracion de mpd, y contiene valores predeterminados para el mixer, que simplemente pueden ser descomentados.<br />
<br />
* Como root, copie este archivo de ejemplo a {{Filename|/etc/mpd.conf}}.<br />
# cp /etc/mpd.conf.example /etc/mpd.conf<br />
<br />
Nunca ponga este archivo en su directorio home como algunos tutoriales sugieren. Esto podria complicarlo todo, y la mayoria de las veces no tendra ningun sentido (recuerde que esta es una guia corta de instalacion y configuracion). Si creó con anterioridad un archivo {{Filename|.mpdconf}} en su directorio home, eliminelo ahora. Esto es importante para evitar conflictos. Cuando está ubicado en /etc, como se indica aqui, mpd podra ser ejecutado como daemon al inicio. De otro modo, un script sería necesario para ejecutar mpd LUEGO de que el usuario inicie sesion (Como kdm o ~/.fluxbox/startup), o tambien sera necesario una ejecucion manual. Para una coleccion musical unica, el metodo utilizado aqui es mejor, aún si la coleccion es compartida entre multiples usuarios. Además, no se preocupe por los privilegios de root: aunque mpd es ejecutado como daemon, nunca lo hace completamente como root puesto que automaticamente pierde sus privilegios luego de ser ejecutado.<br />
<br />
===Sound Setup Correctly===<br />
<br />
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.<br />
<br />
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.<br />
<br />
===Editando {{Filename|mpd.conf}}===<br />
<br />
Para editar el archivo, como root:<br />
# SUEDITOR /etc/mpd.conf<br />
<br />
'''Mantiene la configuración en /var y usa "mpd" como usuario por defecto en vez de atestar ~/. Este es el modo en que el paquete es instalado en Arch.'''<br />
<br />
Edite {{Filename|/etc/mpd.conf}} para verse de la siguiente manera.<br />
<br />
music_directory "/home/usuario/música" # Su directorio de música.<br />
playlist_directory "/var/lib/mpd/playlists"<br />
db_file "/var/lib/mpd/db"<br />
log_file "/var/log/mpd/mpd.log"<br />
error_file "/var/log/mpd/mpd.error"<br />
pid_file "/var/run/mpd/mpd.pid"<br />
state_file "/var/lib/mpd/mpdstate"<br />
user "mpd"<br />
# Ediciones a la dirección y el puerto causan problemas en mpd-0.14.2 es preferible dejarlos<br />
# comentados.<br />
# bind_to_address "127.0.0.1"<br />
# port "6600"<br />
<br />
Lea con cuidado los pasos a continuación, los permisos deben ser otorgados correctamente.<br />
<br />
* Mantenga el usuario como "mpd", asegúrese que el directorio home del usuario "mpd" sea /var/lib/mpd <br />
$ cat /etc/passwd | grep mpd<br />
* Además asegúrese que el directorio /var/lib/mpd sea propiedad de mpd:mpd.<br />
$ ls -l /var/lib/ | grep mpd<br />
* Ahora como root, cree los archivos especificados en {Filename|/etc/mpd.conf}}, si los directorios no existen también deben ser creados. Esto no es necesario si hace uso de los predeterminados por el paquete de Arch.<br />
# touch /var/lib/mpd/db<br />
# touch /var/lib/mpd/mpdstate<br />
# touch /var/run/mpd/mpd.pid<br />
# touch /var/log/mpd/mpd.log<br />
# touch /var/log/mpd/mpd.error<br />
* Ahora cambie el propietario de los directorios y archivos que ha creado, al usuario "mpd"<br />
# chown -R mpd:mpd /var/{lib,run,log}/mpd<br />
* Si su colección musical está contenida en múltiples directorios, puede crear enlaces simbólicos en /var/lib/mpd y luego dirigir la variable 'music_dir' en mpd.conf a el directorio que contiene los enlaces. Recuerde asignar los permisos correctamente en los directorios enlazados.<br />
* Crear la base de datos ahora es realizado por medio de la opción "update" del cliente, por ejemplo, si ejecuta ncmpcpp, por medio de la tecla 'U'. <br />
**El método anterior, crear la base de datos de mpd como root (# mpd --create-db), es obsoleto.<br />
<br />
== Configuración Alterna ==<br />
<br />
MPD no necesita ser iniciado con permiso de root. La única razón por la cual MPD necesita ser iniciado como root (siendo llamado por medio de {{Filename|/etc/rc.conf}}) es porque los archivos y directorios mencionados por defecto en el archivo de configuración son propiedad de root (el directorio /var). Una menos común, pero quizás mas sensible configuración, consiste en hacer que MPD trabaje con archivos y directorios que sean propiedad de un usuario normal. Ejecutar MPD como un usuario normal tiene varias ventajas:<br />
# Puede manejar un solo directorio ~/.mpd (o cualquier otro directorio bajo /home/usuario) para todos los archivos de configuración de MPD<br />
# No hay errores de lectura/escritura<br />
# llamado más flexible a MPD haciendo uso de {{Filename|~/.xinitrc}} en vez de incluir 'mpd' en la sección de DAEMONS en {{Filename|/etc/rc.conf}}.<br />
<br />
Los siguientes pasos indican como iniciar MPD com oun usuario normal. '''Nota''': este método no funcionará si múltiples usuarios desean acceder a MPD.<br />
<br />
* Copie el contenido del archivo de configuración por defecto de MPD, ubicado en {{Filename|/etc/mpd.conf.example}} a su directorio home. Un buen lugar sería {{Filename|"/home/usr/.mpd/config"}}.<br />
* Siga los pasos de la configuración anterior, ignorando la primer parte, que hace referencia a copiar el archivo de configuración a {{Filename|/etc/mpd.conf}}. <br />
* Cree todos los archivos necesarios en {{filename|"/home/user/.mpd/"}}:<br />
"~/.mpd/playlists"<br />
"~/.mpd/db"<br />
"~/.mpd/mpd.log"<br />
"~/.mpd/mpd.error"<br />
"~/.mpd/mpd.pid"<br />
"~/.mpd/mpdstate"<br />
* Haga que MPD inicie al arranque por medio de su {{Filename|~/.xinitrc}} asi:<br />
# esto inicia MPD como un usuario normal<br />
mpd /home/username/.mpd/config<br />
{{Note| no tiene que poner un "&" al final de la linea, dado que MPD automáticamente se daemonizará.}}<br />
<br />
Finalmente, elimine mpd de la sección de DAEMONS en {{Filename|/etc/rc.conf}}, ya que no será ejecutado como root nunca más.<br />
<br />
=== Configuración Multi-MPD===<br />
'''Útil si desea ejecutar un servidor icecast, por ejemplo.'''<br />
Si desea un segundo daemon MPD (ej., con una salida icecast para compartir su música a través de una red) que haga uso de la música y listas de reproducción del primero, simplemente copie el archivo de configuración anterior y cree uno nuevo (ej., {{Filename|/home/username/.mpd/config-icecast}}), y solo cambie los parámetros de log_file, error_file, pid_file, y state_file (ej., {{Filename|mpd-icecast.log}}, {{Filename|mpd-icecast.error}}, y demás); hacer uso de los mismos directorios de música y listas de reproducción asegurará que este segundo daemon MPD hará uso de la misma colección musical del primero (ej., crear y editar una lista de reproducción bajo el primer daemon afectará también al segundo daemon, de modo que no sea necesario crear la misma lista de nuevo para el segundo daemon). Finalmente, ejecute este segundo daemon por medio de su archivo {{Filename|~/.xinitrc}}. (Asegúrese de utilizar un numero de puerto diferente, para evitar conflictos con su primer daemon MPD).<br />
<br />
== Solución de Problemas==<br />
<br />
=== Autodetección Fallida ===<br />
<br />
Durante el inicio de mpd, el intentará detectar automaticamente y configurar su salida de audio y control de volumen. Aunque en la mayoria de los casos esto suele funcionar, en otros sistemas puede fallar. Podria ser de ayuda para mpd especificar que utilizar como salida y mixer de sonido. Si su archivo {{Filename|/etc/mpd.conf}} es una copia de {{Filename|/etc/mpd.conf.example}} como se menciono anteriormente, simplemente descomente estas lineas:<br />
<br />
Ejemplo de una salida tipo ALSA:<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
device "hw:0,0" # optional<br />
format "44100:16:2" # optional<br />
}<br />
<br />
Ejemplo del mixer ALSA:<br />
mixer_type "alsa"<br />
mixer_device "default"<br />
mixer_control "PCM"<br />
<br />
'''Nota:''' en caso de problemas con los permisos cuando utilize ESD, ejecute esto como root:<br />
# chsh -s /bin/true mpd<br />
<br />
=== Executable Permissions ===<br />
<br />
{{Warning|This is not good security practice and may be unnecessary.}}<br />
<br />
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. <br />
# chmod a+x /home/user<br />
# chmod -R a+X /home/user/music<br />
<br />
==== Alternative solution ====<br />
<br />
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.<br />
# chmod -R g-rwx /home/user<br />
# chmod g+rx /home/user<br />
# chmod -R g+rX /home/user/music<br />
<br />
===Tips===<br />
<br />
To get rid of timeouts (i.e. when you paused music for long time) in gpmc and other clients uncomment and increase {{Codeline|connection_timeout}} option in {{Filename|mpd.conf}}.<br />
<br />
If files and/or titles are shown in wrong encoding, uncomment and change {{Codeline|filesystem_charset}} and {{Codeline|id3v1_encoding}} options.<br />
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].<br />
<br />
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.<br />
<br />
'''Streaming'''<br />
<br />
With the latest version of mpd (0.15), built-in httpd streaming is now available.<br />
<br />
To activate this feature, you'll just need to add a new output of type httpd in {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "httpd"<br />
name "What you want"<br />
encoder "lame" # vorbis or lame supported<br />
port "8000"<br />
bitrate "128"<br />
format "44100:16:2" # change 2 to 1 for mono<br />
}<br />
<br />
Restart the mpd deamon and, from another computer, simply load the stream as any other url. <br />
<br />
mplayer http://<server's IP>:8000<br />
<br />
Most players (i.e. vlc or xmms2) should also be able to load the stream via their "add url..." menu option.<br />
<br />
This is a nice clean way to replace your current icecast setup with something natively supported within MPD.<br />
<br />
==Client Install Procedure==<br />
<br />
Install a client program for mpd. Popular options are:<br />
<br />
* '''mpc''' &ndash; Command Line Client (you'll probably want this one no matter what)<br />
* '''ncmpc''' &ndash; NCurses Client (this one is very handy for running in a console) [http://hem.bredband.net/kaw/ncmpc/ Official Website of ncmpc]<br />
* '''ncmpcpp''' &ndash; Clone of ncmpc with some new features written in C++ [http://unkart.ovh.org/ncmpcpp/ Official website of ncmpcpp]<br />
* '''pms''' &ndash; NCurses Client (highly configurable and accessible) [http://pms.sourceforge.net/ Sourceforge Website of pms]<br />
* '''ario''' &ndash; GTK+ Client with a Rhythmbox like library browser [http://ario-player.sourceforge.net Official Website of Ario]<br />
* '''sonata''' &ndash; Python GTK+ Client [http://sonata.berlios.de/ Official Website of Sonata]<br />
* '''gmpc''' &ndash; GNOME Client [http://gmpcwiki.sarine.nl/index.php?title=GMPC Official Website of gmpc]<br />
* '''QMPDClient''' &ndash; Client written with Qt 4.x. [http://bitcheese.net/wiki/QMPDClient Official Website of QMPDClient]<br />
<br />
Install with:<br />
# pacman -Sy mpc<br />
# pacman -Sy ncmpc<br />
# pacman -Sy ncmpcpp<br />
# pacman -Sy pms<br />
# pacman -Sy ario<br />
# pacman -Sy sonata<br />
# pacman -Sy gmpc<br />
# pacman -Sy qmpdclient<br />
<br />
==Extra stuff==<br />
<br />
===Last.fm scrobbling===<br />
<br />
To scrobble your songs to [http://www.last.fm Last.fm] using MPD there are several alternatives.<br />
<br />
====mpdscribble====<br />
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.<br />
<br />
To install mpdscribble, just install it from the AUR and do the following (not as root):<br />
<br />
* {{Codeline|$ mkdir ~/.mpdscribble}}<br />
* Create the file {{Filename|~/.mpdscribble/mpdscribble.conf}} and add the following:<br />
username = <your last.fm username><br />
password = <md5 sum of your last.fm password> # Generated using "echo -n password | md5sum"<br />
host = <your mpd host> # defaults to $MPD_HOST or localhost<br />
port = <your mpd port> # defaults to $MPD_PORT or 6600<br />
log = ~/.mpdscribble/mpdscribble.log<br />
journal = ~/.mpdscribble/mpdscribble.cache<br />
verbose = 2<br />
sleep = 1<br />
musicdir = <your music directory><br />
* Add {{Codeline|mpdscribble}} to your {{Filename|~/.xinitrc}}.<br />
<br />
====Sonata====<br />
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.<br />
<br />
====lastfmsubmitd====<br />
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}}.<br />
<br />
===Last.fm playback with lastfmproxy===<br />
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.<br />
<br />
{{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.}}<br />
<br />
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.<br />
<br />
=== Never play on start ===<br />
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:<br />
'' ...''<br />
'' stat_busy "Starting Music Player Daemon"''<br />
<br />
# always start in paused state<br />
awk '/^state_file[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
sfile = substr($0, RSTART + 1, RLENGTH - 2)<br />
} /^user[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
user = substr($0, RSTART + 1, RLENGTH - 2)<br />
} END {<br />
if (sfile == "")<br />
exit;<br />
if (user != "")<br />
sub(/^~/, "/home/" user, sfile)<br />
system("sed -i \x27s|^\\(state:[ \\t]\\{1,\\}\\)play$|\\1pause|\x27 \x27" sfile "\x27")<br />
}' /etc/mpd.conf<br />
<br />
'' /usr/bin/mpd /etc/mpd.conf &> /dev/null''<br />
'' ...''<br />
<br />
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}}:<br />
NoUpgrade = etc/rc.d/mpd<br />
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).<br />
<br />
=== MPD & Alsa ===<br />
<br />
Sometimes, when you use other audio output, e.g: some web pages containing Flash applets, mpd cannot reproduce anything anymore (until you restart). The error looks something like: (if you search the file {{Filename|/var/log/mpd/mpd.error}})<br />
<br />
Error opening alsa device "hw:0,0": Device or resource busy<br />
<br />
And here is the solution (dmix saving our life again). Apply these lines in your {{Filename|/etc/mpd.conf}}:<br />
<br />
<pre><br />
audio_output {<br />
type "alsa"<br />
name "Sound Card"<br />
options "dev=dmixer"<br />
device "plug:dmix"<br />
}<br />
</pre><br />
<br />
And then restart with {{Codeline|/etc/rc.d/mpd restart}}.<br />
<br />
Searching on Internet I found the reason for why that happens in Gentoo's wiki:<br />
* The sound card does not support hardware mixing (uses '''dmix''' plugin)<br />
* An application does not work with ALSA with it's default settings<br />
<br />
====High CPU usage with ALSA====<br />
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.<br />
<br />
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}}.<br />
<br />
Example from {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
auto_resample "no"<br />
}<br />
<br />
Some users might also want to tell dmix to use 44kHz as well. More info about tuning performance of your MPD can be found from: [http://mpd.wikia.com/wiki/Tuning MPD wiki]<br />
<br />
=== Control mpd with lirc ===<br />
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.<br />
<br />
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.<br />
<br />
First of all, please setup your remotes as referred to the '''[[Lirc]]''' article.<br />
<br />
Edit your favored lirc startup configuration file, default location is {{Filename|~/.lircrc}}.<br />
<br />
Fill the file with the following pattern:<br />
<br />
begin<br />
prog = irexec<br />
button = <button_name><br />
config = <command_to_run><br />
repeat = <0 or 1><br />
end<br />
<br />
An useful example:<br />
<br />
## irexec<br />
begin<br />
prog = irexec<br />
button = play_pause<br />
config = mpc toggle<br />
repeat = 0<br />
end<br />
<br />
begin<br />
prog = irexec<br />
button = stop<br />
config = mpc stop<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = previous<br />
config = mpc prev<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = next<br />
config = mpc next<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = volup<br />
config = mpc volume +2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = voldown<br />
config = mpc volume -2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = pbc<br />
config = mpc random<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = pdvd<br />
config = mpc update<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = right<br />
config = mpc seek +00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = left<br />
config = mpc seek -00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = up<br />
config = mpc seek +1%<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = down<br />
config = mpc seek -1%<br />
repeat = 0<br />
end<br />
<br />
There are more functions for mpc, run {{Codeline|man mpc}} for more info.<br />
<br />
=== Control mpd with bluetooth phone ===<br />
You can also control mpd (to a certain extent) using a bluetooth enabled phone. You need to do the following:<br />
<br />
* install [http://remuco.sourceforge.net/index.php/Remuco remuco] -- a wireless remote control for several Linux media players ([http://aur.archlinux.org/packages.php?ID=25072 aur])<br />
* transfer remuco client -- jar/jad files from {{Filename|/usr/share/remuco/client/}} to your phone and install it<br />
* run {{Codeline|remuco-mpd}} (as current user)<br />
* run remuco on your phone, define a new bluetooth remuco connection (pair first if you haven't done this previously) and explore its capabilities<br />
<br />
More information about remuco including troubleshooting to be found at its [http://remuco.sourceforge.net/index.php/Remuco homepage]<br />
<br />
=== MPD & PulseAudio ===<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
# gpasswd -a mpd pulse-access<br />
# gpasswd -a mpd pulse-rt<br />
<br />
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.<br />
<br />
==Troubleshooting==<br />
===mpd --create-db hangs===<br />
This is a common error that's caused by corrupt mp3 tags.<br />
Here is an experimental way to solve this issue.<br />
Requirements:<br />
* kid3<br />
* easytag<br />
<br />
This method is very tedious, expecially with a huge database. Just as a baseline it took 2.5h to fix a 16Gb DB.<br />
<br />
====Easy Tag====<br />
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.<br />
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.<br />
<br />
====KID3====<br />
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.<br />
<br />
Repeat this procedure until your music library is done.<br />
<br />
===Cannot connect to mpd: host "localhost" not found: Temporary failure in name resolution===<br />
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<br />
<br />
::1 localhost.localdomain localhost<br />
<br />
===Port 6600 already in use===<br />
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:<br />
<br />
$ mpd --kill<br />
$ mpd --create-db<br />
<br />
A more brute-force approach:<br />
<br />
$ killall mpd<br />
$ mpd --create-db<br />
<br />
{{Note| If you typically run mpd as root, you will need to run the above commands as root.}}<br />
<br />
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<br />
<br />
If port 6600 is tied up for some other reason, one can use the following command to find the offending process:<br />
<br />
# netstat -tulpan | grep 6600<br />
<br />
This will list IP:Port and the process name holding the connection (root privileges are required to see all processes).<br />
<br />
=== Crackling sound with some audio files ===<br />
<br />
This is usually a playback speed problem and can be fixed by uncommenting the audio_output_format line in:<br />
<br />
{{File|name=/etc/mpd.conf|content=<br />
audio_output_format "44100:16:2"}}<br />
<br />
This is usually a sane value for most mp3 files.<br />
<br />
==External links==<br />
<br />
* [http://www.musicpd.org/ Official Web Site]<br />
* [http://mpd.wikia.com/wiki/Main_Page Official Wiki]<br />
* [http://mpd.wikia.com/wiki/Clients Sorted List of MPD Clients]<br />
* [http://www.musicpd.org/forum/ MPD forum]</div>MGu3lhttps://wiki.archlinux.org/index.php?title=Music_Player_Daemon_(Espa%C3%B1ol)&diff=89068Music Player Daemon (Español)2009-12-27T23:08:40Z<p>MGu3l: /* Troubleshooting */</p>
<hr />
<div>[[Category: Audio/Video (Español)]]<br />
[[Category:CÓMOs (Español)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|MPD}}<br />
{{i18n_entry|Français|MPD (Français)}}<br />
{{i18n_entry|Polski|mpd (polski)}}<br />
{{i18n_entry|Nederlands|Music Player Daemon (Nederlands)}}<br />
{{i18n_entry|Русский|MPD - Music Player Daemon (Русский)}}<br />
{{i18n_entry|简体中文|MPD(简体中文)}}<br />
{{i18n_entry|Türkçe|MPD (Türkçe)}}<br />
{{i18n_entry|Español|MPD (Español)}}<br />
{{i18n_links_end}}<br />
<br />
<br />
{{stub}}<br />
{{Note|Este artículo está incompleto. Ahora mismo está siendo traducido desde [[MPD|su versión en ingles]]}}<br />
==¿Qué es MPD?==<br />
'''MPD''' (Music Player Daemon) es un reproductor de audio que maneja una arquitectura servidor-cliente. mpd se ejecuta en el fondo como un daemon, gestiona listas de reproducción y una base de datos, y hace uso de muy pocos recursos. Para hacer uso de una interfaz gráfica, es necesario un cliente adicional. Más información puede obtenerse en su [http://www.musicpd.org/ página web].<br />
<br />
==Procedimiento de Instalación del Daemon==<br />
<br />
Actualice e instale con pacman:<br />
# pacman -S mpd<br />
<br />
Ahora, añada el usuario mpd al grupo users:<br />
# gpasswd -a mpd users<br />
<br />
==Instrucciones de Configuración ==<br />
<br />
Para más información de la configuración de mpd, por favor visite http://mpd.wikia.com/wiki/Configuration<br />
<br />
===Linea de Tiempo del comportamiento habitual de mpd===<br />
* mpd es iniciado al cargar el sistema operativo por medio de {{Filename|/etc/rc.conf}}, incluyéndole en el apartado DAEMONS. (O, esto puede ser hecho manualmente ejecutando {{Codeline|/etc/rc.d/mpd start}} con privilegios de root).<br />
* Al ser iniciado mpd como root, leerá el archivo {{Filename|/etc/mpd.conf}}.<br />
* mpd lee la variable usuario en el archivo {{Filename|/etc/mpd.conf}}, y cambia de root a este usuario.<br />
* mpd continúa leyendo el contenido del archivo {{Filename|/etc/mpd.conf}} y se configura de acuerdo a este.<br />
<br />
Recuerde que mpd cambia el usuario de root a aquel mencionado en el archivo {{Filename|/etc/mpd.conf}}. Siendo asi, el uso de "~" en el archivo de configuracion hace referencia al directorio home del usuario, y no al directorio de root. Podria ser de utilidad cambiar todos los "~" a "/home/username" para prevenir cualquier confusion sobre este aspecto del comportamineto de mpd.<br />
<br />
===Un Archivo de Configuracion Limpio===<br />
<br />
* Como root, verifique si {{Filename|/etc/mpd.conf}} existe y elimine el archivo en caso de que exista. Esto es hecho por seguridad.<br />
<br />
Mpd viene con un ejemplo del archivo de configuracion, disponible en {{Filename|/etc/mpd.conf.example}}. Este archivo contiene abundante informacion acerca de la configuracion de mpd, y contiene valores predeterminados para el mixer, que simplemente pueden ser descomentados.<br />
<br />
* Como root, copie este archivo de ejemplo a {{Filename|/etc/mpd.conf}}.<br />
# cp /etc/mpd.conf.example /etc/mpd.conf<br />
<br />
Nunca ponga este archivo en su directorio home como algunos tutoriales sugieren. Esto podria complicarlo todo, y la mayoria de las veces no tendra ningun sentido (recuerde que esta es una guia corta de instalacion y configuracion). Si creó con anterioridad un archivo {{Filename|.mpdconf}} en su directorio home, eliminelo ahora. Esto es importante para evitar conflictos. Cuando está ubicado en /etc, como se indica aqui, mpd podra ser ejecutado como daemon al inicio. De otro modo, un script sería necesario para ejecutar mpd LUEGO de que el usuario inicie sesion (Como kdm o ~/.fluxbox/startup), o tambien sera necesario una ejecucion manual. Para una coleccion musical unica, el metodo utilizado aqui es mejor, aún si la coleccion es compartida entre multiples usuarios. Además, no se preocupe por los privilegios de root: aunque mpd es ejecutado como daemon, nunca lo hace completamente como root puesto que automaticamente pierde sus privilegios luego de ser ejecutado.<br />
<br />
===Sound Setup Correctly===<br />
<br />
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.<br />
<br />
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.<br />
<br />
===Editando {{Filename|mpd.conf}}===<br />
<br />
Para editar el archivo, como root:<br />
# SUEDITOR /etc/mpd.conf<br />
<br />
'''Mantiene la configuración en /var y usa "mpd" como usuario por defecto en vez de atestar ~/. Este es el modo en que el paquete es instalado en Arch.'''<br />
<br />
Edite {{Filename|/etc/mpd.conf}} para verse de la siguiente manera.<br />
<br />
music_directory "/home/usuario/música" # Su directorio de música.<br />
playlist_directory "/var/lib/mpd/playlists"<br />
db_file "/var/lib/mpd/db"<br />
log_file "/var/log/mpd/mpd.log"<br />
error_file "/var/log/mpd/mpd.error"<br />
pid_file "/var/run/mpd/mpd.pid"<br />
state_file "/var/lib/mpd/mpdstate"<br />
user "mpd"<br />
# Ediciones a la dirección y el puerto causan problemas en mpd-0.14.2 es preferible dejarlos<br />
# comentados.<br />
# bind_to_address "127.0.0.1"<br />
# port "6600"<br />
<br />
Lea con cuidado los pasos a continuación, los permisos deben ser otorgados correctamente.<br />
<br />
* Mantenga el usuario como "mpd", asegúrese que el directorio home del usuario "mpd" sea /var/lib/mpd <br />
$ cat /etc/passwd | grep mpd<br />
* Además asegúrese que el directorio /var/lib/mpd sea propiedad de mpd:mpd.<br />
$ ls -l /var/lib/ | grep mpd<br />
* Ahora como root, cree los archivos especificados en {Filename|/etc/mpd.conf}}, si los directorios no existen también deben ser creados. Esto no es necesario si hace uso de los predeterminados por el paquete de Arch.<br />
# touch /var/lib/mpd/db<br />
# touch /var/lib/mpd/mpdstate<br />
# touch /var/run/mpd/mpd.pid<br />
# touch /var/log/mpd/mpd.log<br />
# touch /var/log/mpd/mpd.error<br />
* Ahora cambie el propietario de los directorios y archivos que ha creado, al usuario "mpd"<br />
# chown -R mpd:mpd /var/{lib,run,log}/mpd<br />
* Si su colección musical está contenida en múltiples directorios, puede crear enlaces simbólicos en /var/lib/mpd y luego dirigir la variable 'music_dir' en mpd.conf a el directorio que contiene los enlaces. Recuerde asignar los permisos correctamente en los directorios enlazados.<br />
* Crear la base de datos ahora es realizado por medio de la opción "update" del cliente, por ejemplo, si ejecuta ncmpcpp, por medio de la tecla 'U'. <br />
**El método anterior, crear la base de datos de mpd como root (# mpd --create-db), es obsoleto.<br />
<br />
== Configuración Alterna ==<br />
<br />
MPD no necesita ser iniciado con permiso de root. La única razón por la cual MPD necesita ser iniciado como root (siendo llamado por medio de {{Filename|/etc/rc.conf}}) es porque los archivos y directorios mencionados por defecto en el archivo de configuración son propiedad de root (el directorio /var). Una menos común, pero quizás mas sensible configuración, consiste en hacer que MPD trabaje con archivos y directorios que sean propiedad de un usuario normal. Ejecutar MPD como un usuario normal tiene varias ventajas:<br />
# Puede manejar un solo directorio ~/.mpd (o cualquier otro directorio bajo /home/usuario) para todos los archivos de configuración de MPD<br />
# No hay errores de lectura/escritura<br />
# llamado más flexible a MPD haciendo uso de {{Filename|~/.xinitrc}} en vez de incluir 'mpd' en la sección de DAEMONS en {{Filename|/etc/rc.conf}}.<br />
<br />
Los siguientes pasos indican como iniciar MPD com oun usuario normal. '''Nota''': este método no funcionará si múltiples usuarios desean acceder a MPD.<br />
<br />
* Copie el contenido del archivo de configuración por defecto de MPD, ubicado en {{Filename|/etc/mpd.conf.example}} a su directorio home. Un buen lugar sería {{Filename|"/home/usr/.mpd/config"}}.<br />
* Siga los pasos de la configuración anterior, ignorando la primer parte, que hace referencia a copiar el archivo de configuración a {{Filename|/etc/mpd.conf}}. <br />
* Cree todos los archivos necesarios en {{filename|"/home/user/.mpd/"}}:<br />
"~/.mpd/playlists"<br />
"~/.mpd/db"<br />
"~/.mpd/mpd.log"<br />
"~/.mpd/mpd.error"<br />
"~/.mpd/mpd.pid"<br />
"~/.mpd/mpdstate"<br />
* Haga que MPD inicie al arranque por medio de su {{Filename|~/.xinitrc}} asi:<br />
# esto inicia MPD como un usuario normal<br />
mpd /home/username/.mpd/config<br />
{{Nota| no tiene que poner un "&" al final de la linea, dado que MPD automáticamente se daemonizará.}}<br />
<br />
Finalmente, elimine mpd de la sección de DAEMONS en {{Filename|/etc/rc.conf}}, ya que no será ejecutado como root nunca más.<br />
<br />
=== Configuración Multi-MPD===<br />
'''Útil si desea ejecutar un servidor icecast, por ejemplo.'''<br />
Si desea un segundo daemon MPD (ej., con una salida icecast para compartir su música a través de una red) que haga uso de la música y listas de reproducción del primero, simplemente copie el archivo de configuración anterior y cree uno nuevo (ej., {{Filename|/home/username/.mpd/config-icecast}}), y solo cambie los parámetros de log_file, error_file, pid_file, y state_file (ej., {{Filename|mpd-icecast.log}}, {{Filename|mpd-icecast.error}}, y demás); hacer uso de los mismos directorios de música y listas de reproducción asegurará que este segundo daemon MPD hará uso de la misma colección musical del primero (ej., crear y editar una lista de reproducción bajo el primer daemon afectará también al segundo daemon, de modo que no sea necesario crear la misma lista de nuevo para el segundo daemon). Finalmente, ejecute este segundo daemon por medio de su archivo {{Filename|~/.xinitrc}}. (Asegúrese de utilizar un numero de puerto diferente, para evitar conflictos con su primer daemon MPD).<br />
<br />
== Solución de Problemas==<br />
<br />
=== Autodetección Fallida ===<br />
<br />
Durante el inicio de mpd, el intentará detectar automaticamente y configurar su salida de audio y control de volumen. Aunque en la mayoria de los casos esto suele funcionar, en otros sistemas puede fallar. Podria ser de ayuda para mpd especificar que utilizar como salida y mixer de sonido. Si su archivo {{Filename|/etc/mpd.conf}} es una copia de {{Filename|/etc/mpd.conf.example}} como se menciono anteriormente, simplemente descomente estas lineas:<br />
<br />
Ejemplo de una salida tipo ALSA:<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
device "hw:0,0" # optional<br />
format "44100:16:2" # optional<br />
}<br />
<br />
Ejemplo del mixer ALSA:<br />
mixer_type "alsa"<br />
mixer_device "default"<br />
mixer_control "PCM"<br />
<br />
'''Nota:''' en caso de problemas con los permisos cuando utilize ESD, ejecute esto como root:<br />
# chsh -s /bin/true mpd<br />
<br />
=== Executable Permissions ===<br />
<br />
{{Warning|This is not good security practice and may be unnecessary.}}<br />
<br />
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. <br />
# chmod a+x /home/user<br />
# chmod -R a+X /home/user/music<br />
<br />
==== Alternative solution ====<br />
<br />
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.<br />
# chmod -R g-rwx /home/user<br />
# chmod g+rx /home/user<br />
# chmod -R g+rX /home/user/music<br />
<br />
===Tips===<br />
<br />
To get rid of timeouts (i.e. when you paused music for long time) in gpmc and other clients uncomment and increase {{Codeline|connection_timeout}} option in {{Filename|mpd.conf}}.<br />
<br />
If files and/or titles are shown in wrong encoding, uncomment and change {{Codeline|filesystem_charset}} and {{Codeline|id3v1_encoding}} options.<br />
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].<br />
<br />
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.<br />
<br />
'''Streaming'''<br />
<br />
With the latest version of mpd (0.15), built-in httpd streaming is now available.<br />
<br />
To activate this feature, you'll just need to add a new output of type httpd in {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "httpd"<br />
name "What you want"<br />
encoder "lame" # vorbis or lame supported<br />
port "8000"<br />
bitrate "128"<br />
format "44100:16:2" # change 2 to 1 for mono<br />
}<br />
<br />
Restart the mpd deamon and, from another computer, simply load the stream as any other url. <br />
<br />
mplayer http://<server's IP>:8000<br />
<br />
Most players (i.e. vlc or xmms2) should also be able to load the stream via their "add url..." menu option.<br />
<br />
This is a nice clean way to replace your current icecast setup with something natively supported within MPD.<br />
<br />
==Client Install Procedure==<br />
<br />
Install a client program for mpd. Popular options are:<br />
<br />
* '''mpc''' &ndash; Command Line Client (you'll probably want this one no matter what)<br />
* '''ncmpc''' &ndash; NCurses Client (this one is very handy for running in a console) [http://hem.bredband.net/kaw/ncmpc/ Official Website of ncmpc]<br />
* '''ncmpcpp''' &ndash; Clone of ncmpc with some new features written in C++ [http://unkart.ovh.org/ncmpcpp/ Official website of ncmpcpp]<br />
* '''pms''' &ndash; NCurses Client (highly configurable and accessible) [http://pms.sourceforge.net/ Sourceforge Website of pms]<br />
* '''ario''' &ndash; GTK+ Client with a Rhythmbox like library browser [http://ario-player.sourceforge.net Official Website of Ario]<br />
* '''sonata''' &ndash; Python GTK+ Client [http://sonata.berlios.de/ Official Website of Sonata]<br />
* '''gmpc''' &ndash; GNOME Client [http://gmpcwiki.sarine.nl/index.php?title=GMPC Official Website of gmpc]<br />
* '''QMPDClient''' &ndash; Client written with Qt 4.x. [http://bitcheese.net/wiki/QMPDClient Official Website of QMPDClient]<br />
<br />
Install with:<br />
# pacman -Sy mpc<br />
# pacman -Sy ncmpc<br />
# pacman -Sy ncmpcpp<br />
# pacman -Sy pms<br />
# pacman -Sy ario<br />
# pacman -Sy sonata<br />
# pacman -Sy gmpc<br />
# pacman -Sy qmpdclient<br />
<br />
==Extra stuff==<br />
<br />
===Last.fm scrobbling===<br />
<br />
To scrobble your songs to [http://www.last.fm Last.fm] using MPD there are several alternatives.<br />
<br />
====mpdscribble====<br />
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.<br />
<br />
To install mpdscribble, just install it from the AUR and do the following (not as root):<br />
<br />
* {{Codeline|$ mkdir ~/.mpdscribble}}<br />
* Create the file {{Filename|~/.mpdscribble/mpdscribble.conf}} and add the following:<br />
username = <your last.fm username><br />
password = <md5 sum of your last.fm password> # Generated using "echo -n password | md5sum"<br />
host = <your mpd host> # defaults to $MPD_HOST or localhost<br />
port = <your mpd port> # defaults to $MPD_PORT or 6600<br />
log = ~/.mpdscribble/mpdscribble.log<br />
journal = ~/.mpdscribble/mpdscribble.cache<br />
verbose = 2<br />
sleep = 1<br />
musicdir = <your music directory><br />
* Add {{Codeline|mpdscribble}} to your {{Filename|~/.xinitrc}}.<br />
<br />
====Sonata====<br />
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.<br />
<br />
====lastfmsubmitd====<br />
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}}.<br />
<br />
===Last.fm playback with lastfmproxy===<br />
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.<br />
<br />
{{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.}}<br />
<br />
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.<br />
<br />
=== Never play on start ===<br />
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:<br />
'' ...''<br />
'' stat_busy "Starting Music Player Daemon"''<br />
<br />
# always start in paused state<br />
awk '/^state_file[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
sfile = substr($0, RSTART + 1, RLENGTH - 2)<br />
} /^user[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
user = substr($0, RSTART + 1, RLENGTH - 2)<br />
} END {<br />
if (sfile == "")<br />
exit;<br />
if (user != "")<br />
sub(/^~/, "/home/" user, sfile)<br />
system("sed -i \x27s|^\\(state:[ \\t]\\{1,\\}\\)play$|\\1pause|\x27 \x27" sfile "\x27")<br />
}' /etc/mpd.conf<br />
<br />
'' /usr/bin/mpd /etc/mpd.conf &> /dev/null''<br />
'' ...''<br />
<br />
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}}:<br />
NoUpgrade = etc/rc.d/mpd<br />
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).<br />
<br />
=== MPD & Alsa ===<br />
<br />
Sometimes, when you use other audio output, e.g: some web pages containing Flash applets, mpd cannot reproduce anything anymore (until you restart). The error looks something like: (if you search the file {{Filename|/var/log/mpd/mpd.error}})<br />
<br />
Error opening alsa device "hw:0,0": Device or resource busy<br />
<br />
And here is the solution (dmix saving our life again). Apply these lines in your {{Filename|/etc/mpd.conf}}:<br />
<br />
<pre><br />
audio_output {<br />
type "alsa"<br />
name "Sound Card"<br />
options "dev=dmixer"<br />
device "plug:dmix"<br />
}<br />
</pre><br />
<br />
And then restart with {{Codeline|/etc/rc.d/mpd restart}}.<br />
<br />
Searching on Internet I found the reason for why that happens in Gentoo's wiki:<br />
* The sound card does not support hardware mixing (uses '''dmix''' plugin)<br />
* An application does not work with ALSA with it's default settings<br />
<br />
====High CPU usage with ALSA====<br />
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.<br />
<br />
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}}.<br />
<br />
Example from {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
auto_resample "no"<br />
}<br />
<br />
Some users might also want to tell dmix to use 44kHz as well. More info about tuning performance of your MPD can be found from: [http://mpd.wikia.com/wiki/Tuning MPD wiki]<br />
<br />
=== Control mpd with lirc ===<br />
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.<br />
<br />
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.<br />
<br />
First of all, please setup your remotes as referred to the '''[[Lirc]]''' article.<br />
<br />
Edit your favored lirc startup configuration file, default location is {{Filename|~/.lircrc}}.<br />
<br />
Fill the file with the following pattern:<br />
<br />
begin<br />
prog = irexec<br />
button = <button_name><br />
config = <command_to_run><br />
repeat = <0 or 1><br />
end<br />
<br />
An useful example:<br />
<br />
## irexec<br />
begin<br />
prog = irexec<br />
button = play_pause<br />
config = mpc toggle<br />
repeat = 0<br />
end<br />
<br />
begin<br />
prog = irexec<br />
button = stop<br />
config = mpc stop<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = previous<br />
config = mpc prev<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = next<br />
config = mpc next<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = volup<br />
config = mpc volume +2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = voldown<br />
config = mpc volume -2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = pbc<br />
config = mpc random<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = pdvd<br />
config = mpc update<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = right<br />
config = mpc seek +00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = left<br />
config = mpc seek -00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = up<br />
config = mpc seek +1%<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = down<br />
config = mpc seek -1%<br />
repeat = 0<br />
end<br />
<br />
There are more functions for mpc, run {{Codeline|man mpc}} for more info.<br />
<br />
=== Control mpd with bluetooth phone ===<br />
You can also control mpd (to a certain extent) using a bluetooth enabled phone. You need to do the following:<br />
<br />
* install [http://remuco.sourceforge.net/index.php/Remuco remuco] -- a wireless remote control for several Linux media players ([http://aur.archlinux.org/packages.php?ID=25072 aur])<br />
* transfer remuco client -- jar/jad files from {{Filename|/usr/share/remuco/client/}} to your phone and install it<br />
* run {{Codeline|remuco-mpd}} (as current user)<br />
* run remuco on your phone, define a new bluetooth remuco connection (pair first if you haven't done this previously) and explore its capabilities<br />
<br />
More information about remuco including troubleshooting to be found at its [http://remuco.sourceforge.net/index.php/Remuco homepage]<br />
<br />
=== MPD & PulseAudio ===<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
# gpasswd -a mpd pulse-access<br />
# gpasswd -a mpd pulse-rt<br />
<br />
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.<br />
<br />
==Troubleshooting==<br />
===mpd --create-db hangs===<br />
This is a common error that's caused by corrupt mp3 tags.<br />
Here is an experimental way to solve this issue.<br />
Requirements:<br />
* kid3<br />
* easytag<br />
<br />
This method is very tedious, expecially with a huge database. Just as a baseline it took 2.5h to fix a 16Gb DB.<br />
<br />
====Easy Tag====<br />
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.<br />
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.<br />
<br />
====KID3====<br />
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.<br />
<br />
Repeat this procedure until your music library is done.<br />
<br />
===Cannot connect to mpd: host "localhost" not found: Temporary failure in name resolution===<br />
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<br />
<br />
::1 localhost.localdomain localhost<br />
<br />
===Port 6600 already in use===<br />
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:<br />
<br />
$ mpd --kill<br />
$ mpd --create-db<br />
<br />
A more brute-force approach:<br />
<br />
$ killall mpd<br />
$ mpd --create-db<br />
<br />
{{Note| If you typically run mpd as root, you will need to run the above commands as root.}}<br />
<br />
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<br />
<br />
If port 6600 is tied up for some other reason, one can use the following command to find the offending process:<br />
<br />
# netstat -tulpan | grep 6600<br />
<br />
This will list IP:Port and the process name holding the connection (root privileges are required to see all processes).<br />
<br />
=== Crackling sound with some audio files ===<br />
<br />
This is usually a playback speed problem and can be fixed by uncommenting the audio_output_format line in:<br />
<br />
{{File|name=/etc/mpd.conf|content=<br />
audio_output_format "44100:16:2"}}<br />
<br />
This is usually a sane value for most mp3 files.<br />
<br />
==External links==<br />
<br />
* [http://www.musicpd.org/ Official Web Site]<br />
* [http://mpd.wikia.com/wiki/Main_Page Official Wiki]<br />
* [http://mpd.wikia.com/wiki/Clients Sorted List of MPD Clients]<br />
* [http://www.musicpd.org/forum/ MPD forum]</div>MGu3lhttps://wiki.archlinux.org/index.php?title=Music_Player_Daemon_(Espa%C3%B1ol)&diff=89067Music Player Daemon (Español)2009-12-27T23:03:48Z<p>MGu3l: /* Alternative Setup */</p>
<hr />
<div>[[Category: Audio/Video (Español)]]<br />
[[Category:CÓMOs (Español)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|MPD}}<br />
{{i18n_entry|Français|MPD (Français)}}<br />
{{i18n_entry|Polski|mpd (polski)}}<br />
{{i18n_entry|Nederlands|Music Player Daemon (Nederlands)}}<br />
{{i18n_entry|Русский|MPD - Music Player Daemon (Русский)}}<br />
{{i18n_entry|简体中文|MPD(简体中文)}}<br />
{{i18n_entry|Türkçe|MPD (Türkçe)}}<br />
{{i18n_entry|Español|MPD (Español)}}<br />
{{i18n_links_end}}<br />
<br />
<br />
{{stub}}<br />
{{Note|Este artículo está incompleto. Ahora mismo está siendo traducido desde [[MPD|su versión en ingles]]}}<br />
==¿Qué es MPD?==<br />
'''MPD''' (Music Player Daemon) es un reproductor de audio que maneja una arquitectura servidor-cliente. mpd se ejecuta en el fondo como un daemon, gestiona listas de reproducción y una base de datos, y hace uso de muy pocos recursos. Para hacer uso de una interfaz gráfica, es necesario un cliente adicional. Más información puede obtenerse en su [http://www.musicpd.org/ página web].<br />
<br />
==Procedimiento de Instalación del Daemon==<br />
<br />
Actualice e instale con pacman:<br />
# pacman -S mpd<br />
<br />
Ahora, añada el usuario mpd al grupo users:<br />
# gpasswd -a mpd users<br />
<br />
==Instrucciones de Configuración ==<br />
<br />
Para más información de la configuración de mpd, por favor visite http://mpd.wikia.com/wiki/Configuration<br />
<br />
===Linea de Tiempo del comportamiento habitual de mpd===<br />
* mpd es iniciado al cargar el sistema operativo por medio de {{Filename|/etc/rc.conf}}, incluyéndole en el apartado DAEMONS. (O, esto puede ser hecho manualmente ejecutando {{Codeline|/etc/rc.d/mpd start}} con privilegios de root).<br />
* Al ser iniciado mpd como root, leerá el archivo {{Filename|/etc/mpd.conf}}.<br />
* mpd lee la variable usuario en el archivo {{Filename|/etc/mpd.conf}}, y cambia de root a este usuario.<br />
* mpd continúa leyendo el contenido del archivo {{Filename|/etc/mpd.conf}} y se configura de acuerdo a este.<br />
<br />
Recuerde que mpd cambia el usuario de root a aquel mencionado en el archivo {{Filename|/etc/mpd.conf}}. Siendo asi, el uso de "~" en el archivo de configuracion hace referencia al directorio home del usuario, y no al directorio de root. Podria ser de utilidad cambiar todos los "~" a "/home/username" para prevenir cualquier confusion sobre este aspecto del comportamineto de mpd.<br />
<br />
===Un Archivo de Configuracion Limpio===<br />
<br />
* Como root, verifique si {{Filename|/etc/mpd.conf}} existe y elimine el archivo en caso de que exista. Esto es hecho por seguridad.<br />
<br />
Mpd viene con un ejemplo del archivo de configuracion, disponible en {{Filename|/etc/mpd.conf.example}}. Este archivo contiene abundante informacion acerca de la configuracion de mpd, y contiene valores predeterminados para el mixer, que simplemente pueden ser descomentados.<br />
<br />
* Como root, copie este archivo de ejemplo a {{Filename|/etc/mpd.conf}}.<br />
# cp /etc/mpd.conf.example /etc/mpd.conf<br />
<br />
Nunca ponga este archivo en su directorio home como algunos tutoriales sugieren. Esto podria complicarlo todo, y la mayoria de las veces no tendra ningun sentido (recuerde que esta es una guia corta de instalacion y configuracion). Si creó con anterioridad un archivo {{Filename|.mpdconf}} en su directorio home, eliminelo ahora. Esto es importante para evitar conflictos. Cuando está ubicado en /etc, como se indica aqui, mpd podra ser ejecutado como daemon al inicio. De otro modo, un script sería necesario para ejecutar mpd LUEGO de que el usuario inicie sesion (Como kdm o ~/.fluxbox/startup), o tambien sera necesario una ejecucion manual. Para una coleccion musical unica, el metodo utilizado aqui es mejor, aún si la coleccion es compartida entre multiples usuarios. Además, no se preocupe por los privilegios de root: aunque mpd es ejecutado como daemon, nunca lo hace completamente como root puesto que automaticamente pierde sus privilegios luego de ser ejecutado.<br />
<br />
===Sound Setup Correctly===<br />
<br />
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.<br />
<br />
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.<br />
<br />
===Editando {{Filename|mpd.conf}}===<br />
<br />
Para editar el archivo, como root:<br />
# SUEDITOR /etc/mpd.conf<br />
<br />
'''Mantiene la configuración en /var y usa "mpd" como usuario por defecto en vez de atestar ~/. Este es el modo en que el paquete es instalado en Arch.'''<br />
<br />
Edite {{Filename|/etc/mpd.conf}} para verse de la siguiente manera.<br />
<br />
music_directory "/home/usuario/música" # Su directorio de música.<br />
playlist_directory "/var/lib/mpd/playlists"<br />
db_file "/var/lib/mpd/db"<br />
log_file "/var/log/mpd/mpd.log"<br />
error_file "/var/log/mpd/mpd.error"<br />
pid_file "/var/run/mpd/mpd.pid"<br />
state_file "/var/lib/mpd/mpdstate"<br />
user "mpd"<br />
# Ediciones a la dirección y el puerto causan problemas en mpd-0.14.2 es preferible dejarlos<br />
# comentados.<br />
# bind_to_address "127.0.0.1"<br />
# port "6600"<br />
<br />
Lea con cuidado los pasos a continuación, los permisos deben ser otorgados correctamente.<br />
<br />
* Mantenga el usuario como "mpd", asegúrese que el directorio home del usuario "mpd" sea /var/lib/mpd <br />
$ cat /etc/passwd | grep mpd<br />
* Además asegúrese que el directorio /var/lib/mpd sea propiedad de mpd:mpd.<br />
$ ls -l /var/lib/ | grep mpd<br />
* Ahora como root, cree los archivos especificados en {Filename|/etc/mpd.conf}}, si los directorios no existen también deben ser creados. Esto no es necesario si hace uso de los predeterminados por el paquete de Arch.<br />
# touch /var/lib/mpd/db<br />
# touch /var/lib/mpd/mpdstate<br />
# touch /var/run/mpd/mpd.pid<br />
# touch /var/log/mpd/mpd.log<br />
# touch /var/log/mpd/mpd.error<br />
* Ahora cambie el propietario de los directorios y archivos que ha creado, al usuario "mpd"<br />
# chown -R mpd:mpd /var/{lib,run,log}/mpd<br />
* Si su colección musical está contenida en múltiples directorios, puede crear enlaces simbólicos en /var/lib/mpd y luego dirigir la variable 'music_dir' en mpd.conf a el directorio que contiene los enlaces. Recuerde asignar los permisos correctamente en los directorios enlazados.<br />
* Crear la base de datos ahora es realizado por medio de la opción "update" del cliente, por ejemplo, si ejecuta ncmpcpp, por medio de la tecla 'U'. <br />
**El método anterior, crear la base de datos de mpd como root (# mpd --create-db), es obsoleto.<br />
<br />
== Configuración Alterna ==<br />
<br />
MPD no necesita ser iniciado con permiso de root. La única razón por la cual MPD necesita ser iniciado como root (siendo llamado por medio de {{Filename|/etc/rc.conf}}) es porque los archivos y directorios mencionados por defecto en el archivo de configuración son propiedad de root (el directorio /var). Una menos común, pero quizás mas sensible configuración, consiste en hacer que MPD trabaje con archivos y directorios que sean propiedad de un usuario normal. Ejecutar MPD como un usuario normal tiene varias ventajas:<br />
# Puede manejar un solo directorio ~/.mpd (o cualquier otro directorio bajo /home/usuario) para todos los archivos de configuración de MPD<br />
# No hay errores de lectura/escritura<br />
# llamado más flexible a MPD haciendo uso de {{Filename|~/.xinitrc}} en vez de incluir 'mpd' en la sección de DAEMONS en {{Filename|/etc/rc.conf}}.<br />
<br />
Los siguientes pasos indican como iniciar MPD com oun usuario normal. '''Nota''': este método no funcionará si múltiples usuarios desean acceder a MPD.<br />
<br />
* Copie el contenido del archivo de configuración por defecto de MPD, ubicado en {{Filename|/etc/mpd.conf.example}} a su directorio home. Un buen lugar sería {{Filename|"/home/usr/.mpd/config"}}.<br />
* Siga los pasos de la configuración anterior, ignorando la primer parte, que hace referencia a copiar el archivo de configuración a {{Filename|/etc/mpd.conf}}. <br />
* Cree todos los archivos necesarios en {{filename|"/home/user/.mpd/"}}:<br />
"~/.mpd/playlists"<br />
"~/.mpd/db"<br />
"~/.mpd/mpd.log"<br />
"~/.mpd/mpd.error"<br />
"~/.mpd/mpd.pid"<br />
"~/.mpd/mpdstate"<br />
* Haga que MPD inicie al arranque por medio de su {{Filename|~/.xinitrc}} asi:<br />
# esto inicia MPD como un usuario normal<br />
mpd /home/username/.mpd/config<br />
{{Nota| no tiene que poner un "&" al final de la linea, dado que MPD automáticamente se daemonizará.}}<br />
<br />
Finalmente, elimine mpd de la sección de DAEMONS en {{Filename|/etc/rc.conf}}, ya que no será ejecutado como root nunca más.<br />
<br />
=== Configuración Multi-MPD===<br />
'''Útil si desea ejecutar un servidor icecast, por ejemplo.'''<br />
Si desea un segundo daemon MPD (ej., con una salida icecast para compartir su música a través de una red) que haga uso de la música y listas de reproducción del primero, simplemente copie el archivo de configuración anterior y cree uno nuevo (ej., {{Filename|/home/username/.mpd/config-icecast}}), y solo cambie los parámetros de log_file, error_file, pid_file, y state_file (ej., {{Filename|mpd-icecast.log}}, {{Filename|mpd-icecast.error}}, y demás); hacer uso de los mismos directorios de música y listas de reproducción asegurará que este segundo daemon MPD hará uso de la misma colección musical del primero (ej., crear y editar una lista de reproducción bajo el primer daemon afectará también al segundo daemon, de modo que no sea necesario crear la misma lista de nuevo para el segundo daemon). Finalmente, ejecute este segundo daemon por medio de su archivo {{Filename|~/.xinitrc}}. (Asegúrese de utilizar un numero de puerto diferente, para evitar conflictos con su primer daemon MPD).<br />
<br />
==Troubleshooting==<br />
<br />
=== Autodetection failed ===<br />
<br />
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:<br />
<br />
Example for alsa output type:<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
device "hw:0,0" # optional<br />
format "44100:16:2" # optional<br />
}<br />
<br />
Example for alsa mixer:<br />
mixer_type "alsa"<br />
mixer_device "default"<br />
mixer_control "PCM"<br />
<br />
'''Note:''' in case of permission problems when using ESD with mpd run this as root:<br />
# chsh -s /bin/true mpd<br />
<br />
=== Executable Permissions ===<br />
<br />
{{Warning|This is not good security practice and may be unnecessary.}}<br />
<br />
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. <br />
# chmod a+x /home/user<br />
# chmod -R a+X /home/user/music<br />
<br />
==== Alternative solution ====<br />
<br />
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.<br />
# chmod -R g-rwx /home/user<br />
# chmod g+rx /home/user<br />
# chmod -R g+rX /home/user/music<br />
<br />
===Tips===<br />
<br />
To get rid of timeouts (i.e. when you paused music for long time) in gpmc and other clients uncomment and increase {{Codeline|connection_timeout}} option in {{Filename|mpd.conf}}.<br />
<br />
If files and/or titles are shown in wrong encoding, uncomment and change {{Codeline|filesystem_charset}} and {{Codeline|id3v1_encoding}} options.<br />
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].<br />
<br />
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.<br />
<br />
'''Streaming'''<br />
<br />
With the latest version of mpd (0.15), built-in httpd streaming is now available.<br />
<br />
To activate this feature, you'll just need to add a new output of type httpd in {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "httpd"<br />
name "What you want"<br />
encoder "lame" # vorbis or lame supported<br />
port "8000"<br />
bitrate "128"<br />
format "44100:16:2" # change 2 to 1 for mono<br />
}<br />
<br />
Restart the mpd deamon and, from another computer, simply load the stream as any other url. <br />
<br />
mplayer http://<server's IP>:8000<br />
<br />
Most players (i.e. vlc or xmms2) should also be able to load the stream via their "add url..." menu option.<br />
<br />
This is a nice clean way to replace your current icecast setup with something natively supported within MPD.<br />
<br />
==Client Install Procedure==<br />
<br />
Install a client program for mpd. Popular options are:<br />
<br />
* '''mpc''' &ndash; Command Line Client (you'll probably want this one no matter what)<br />
* '''ncmpc''' &ndash; NCurses Client (this one is very handy for running in a console) [http://hem.bredband.net/kaw/ncmpc/ Official Website of ncmpc]<br />
* '''ncmpcpp''' &ndash; Clone of ncmpc with some new features written in C++ [http://unkart.ovh.org/ncmpcpp/ Official website of ncmpcpp]<br />
* '''pms''' &ndash; NCurses Client (highly configurable and accessible) [http://pms.sourceforge.net/ Sourceforge Website of pms]<br />
* '''ario''' &ndash; GTK+ Client with a Rhythmbox like library browser [http://ario-player.sourceforge.net Official Website of Ario]<br />
* '''sonata''' &ndash; Python GTK+ Client [http://sonata.berlios.de/ Official Website of Sonata]<br />
* '''gmpc''' &ndash; GNOME Client [http://gmpcwiki.sarine.nl/index.php?title=GMPC Official Website of gmpc]<br />
* '''QMPDClient''' &ndash; Client written with Qt 4.x. [http://bitcheese.net/wiki/QMPDClient Official Website of QMPDClient]<br />
<br />
Install with:<br />
# pacman -Sy mpc<br />
# pacman -Sy ncmpc<br />
# pacman -Sy ncmpcpp<br />
# pacman -Sy pms<br />
# pacman -Sy ario<br />
# pacman -Sy sonata<br />
# pacman -Sy gmpc<br />
# pacman -Sy qmpdclient<br />
<br />
==Extra stuff==<br />
<br />
===Last.fm scrobbling===<br />
<br />
To scrobble your songs to [http://www.last.fm Last.fm] using MPD there are several alternatives.<br />
<br />
====mpdscribble====<br />
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.<br />
<br />
To install mpdscribble, just install it from the AUR and do the following (not as root):<br />
<br />
* {{Codeline|$ mkdir ~/.mpdscribble}}<br />
* Create the file {{Filename|~/.mpdscribble/mpdscribble.conf}} and add the following:<br />
username = <your last.fm username><br />
password = <md5 sum of your last.fm password> # Generated using "echo -n password | md5sum"<br />
host = <your mpd host> # defaults to $MPD_HOST or localhost<br />
port = <your mpd port> # defaults to $MPD_PORT or 6600<br />
log = ~/.mpdscribble/mpdscribble.log<br />
journal = ~/.mpdscribble/mpdscribble.cache<br />
verbose = 2<br />
sleep = 1<br />
musicdir = <your music directory><br />
* Add {{Codeline|mpdscribble}} to your {{Filename|~/.xinitrc}}.<br />
<br />
====Sonata====<br />
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.<br />
<br />
====lastfmsubmitd====<br />
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}}.<br />
<br />
===Last.fm playback with lastfmproxy===<br />
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.<br />
<br />
{{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.}}<br />
<br />
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.<br />
<br />
=== Never play on start ===<br />
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:<br />
'' ...''<br />
'' stat_busy "Starting Music Player Daemon"''<br />
<br />
# always start in paused state<br />
awk '/^state_file[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
sfile = substr($0, RSTART + 1, RLENGTH - 2)<br />
} /^user[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
user = substr($0, RSTART + 1, RLENGTH - 2)<br />
} END {<br />
if (sfile == "")<br />
exit;<br />
if (user != "")<br />
sub(/^~/, "/home/" user, sfile)<br />
system("sed -i \x27s|^\\(state:[ \\t]\\{1,\\}\\)play$|\\1pause|\x27 \x27" sfile "\x27")<br />
}' /etc/mpd.conf<br />
<br />
'' /usr/bin/mpd /etc/mpd.conf &> /dev/null''<br />
'' ...''<br />
<br />
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}}:<br />
NoUpgrade = etc/rc.d/mpd<br />
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).<br />
<br />
=== MPD & Alsa ===<br />
<br />
Sometimes, when you use other audio output, e.g: some web pages containing Flash applets, mpd cannot reproduce anything anymore (until you restart). The error looks something like: (if you search the file {{Filename|/var/log/mpd/mpd.error}})<br />
<br />
Error opening alsa device "hw:0,0": Device or resource busy<br />
<br />
And here is the solution (dmix saving our life again). Apply these lines in your {{Filename|/etc/mpd.conf}}:<br />
<br />
<pre><br />
audio_output {<br />
type "alsa"<br />
name "Sound Card"<br />
options "dev=dmixer"<br />
device "plug:dmix"<br />
}<br />
</pre><br />
<br />
And then restart with {{Codeline|/etc/rc.d/mpd restart}}.<br />
<br />
Searching on Internet I found the reason for why that happens in Gentoo's wiki:<br />
* The sound card does not support hardware mixing (uses '''dmix''' plugin)<br />
* An application does not work with ALSA with it's default settings<br />
<br />
====High CPU usage with ALSA====<br />
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.<br />
<br />
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}}.<br />
<br />
Example from {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
auto_resample "no"<br />
}<br />
<br />
Some users might also want to tell dmix to use 44kHz as well. More info about tuning performance of your MPD can be found from: [http://mpd.wikia.com/wiki/Tuning MPD wiki]<br />
<br />
=== Control mpd with lirc ===<br />
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.<br />
<br />
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.<br />
<br />
First of all, please setup your remotes as referred to the '''[[Lirc]]''' article.<br />
<br />
Edit your favored lirc startup configuration file, default location is {{Filename|~/.lircrc}}.<br />
<br />
Fill the file with the following pattern:<br />
<br />
begin<br />
prog = irexec<br />
button = <button_name><br />
config = <command_to_run><br />
repeat = <0 or 1><br />
end<br />
<br />
An useful example:<br />
<br />
## irexec<br />
begin<br />
prog = irexec<br />
button = play_pause<br />
config = mpc toggle<br />
repeat = 0<br />
end<br />
<br />
begin<br />
prog = irexec<br />
button = stop<br />
config = mpc stop<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = previous<br />
config = mpc prev<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = next<br />
config = mpc next<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = volup<br />
config = mpc volume +2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = voldown<br />
config = mpc volume -2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = pbc<br />
config = mpc random<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = pdvd<br />
config = mpc update<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = right<br />
config = mpc seek +00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = left<br />
config = mpc seek -00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = up<br />
config = mpc seek +1%<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = down<br />
config = mpc seek -1%<br />
repeat = 0<br />
end<br />
<br />
There are more functions for mpc, run {{Codeline|man mpc}} for more info.<br />
<br />
=== Control mpd with bluetooth phone ===<br />
You can also control mpd (to a certain extent) using a bluetooth enabled phone. You need to do the following:<br />
<br />
* install [http://remuco.sourceforge.net/index.php/Remuco remuco] -- a wireless remote control for several Linux media players ([http://aur.archlinux.org/packages.php?ID=25072 aur])<br />
* transfer remuco client -- jar/jad files from {{Filename|/usr/share/remuco/client/}} to your phone and install it<br />
* run {{Codeline|remuco-mpd}} (as current user)<br />
* run remuco on your phone, define a new bluetooth remuco connection (pair first if you haven't done this previously) and explore its capabilities<br />
<br />
More information about remuco including troubleshooting to be found at its [http://remuco.sourceforge.net/index.php/Remuco homepage]<br />
<br />
=== MPD & PulseAudio ===<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
# gpasswd -a mpd pulse-access<br />
# gpasswd -a mpd pulse-rt<br />
<br />
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.<br />
<br />
==Troubleshooting==<br />
===mpd --create-db hangs===<br />
This is a common error that's caused by corrupt mp3 tags.<br />
Here is an experimental way to solve this issue.<br />
Requirements:<br />
* kid3<br />
* easytag<br />
<br />
This method is very tedious, expecially with a huge database. Just as a baseline it took 2.5h to fix a 16Gb DB.<br />
<br />
====Easy Tag====<br />
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.<br />
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.<br />
<br />
====KID3====<br />
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.<br />
<br />
Repeat this procedure until your music library is done.<br />
<br />
===Cannot connect to mpd: host "localhost" not found: Temporary failure in name resolution===<br />
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<br />
<br />
::1 localhost.localdomain localhost<br />
<br />
===Port 6600 already in use===<br />
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:<br />
<br />
$ mpd --kill<br />
$ mpd --create-db<br />
<br />
A more brute-force approach:<br />
<br />
$ killall mpd<br />
$ mpd --create-db<br />
<br />
{{Note| If you typically run mpd as root, you will need to run the above commands as root.}}<br />
<br />
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<br />
<br />
If port 6600 is tied up for some other reason, one can use the following command to find the offending process:<br />
<br />
# netstat -tulpan | grep 6600<br />
<br />
This will list IP:Port and the process name holding the connection (root privileges are required to see all processes).<br />
<br />
=== Crackling sound with some audio files ===<br />
<br />
This is usually a playback speed problem and can be fixed by uncommenting the audio_output_format line in:<br />
<br />
{{File|name=/etc/mpd.conf|content=<br />
audio_output_format "44100:16:2"}}<br />
<br />
This is usually a sane value for most mp3 files.<br />
<br />
==External links==<br />
<br />
* [http://www.musicpd.org/ Official Web Site]<br />
* [http://mpd.wikia.com/wiki/Main_Page Official Wiki]<br />
* [http://mpd.wikia.com/wiki/Clients Sorted List of MPD Clients]<br />
* [http://www.musicpd.org/forum/ MPD forum]</div>MGu3lhttps://wiki.archlinux.org/index.php?title=Music_Player_Daemon_(Espa%C3%B1ol)&diff=89063Music Player Daemon (Español)2009-12-27T21:14:31Z<p>MGu3l: /* Editing {{Filename|mpd.conf}} */</p>
<hr />
<div>[[Category: Audio/Video (Español)]]<br />
[[Category:CÓMOs (Español)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|MPD}}<br />
{{i18n_entry|Français|MPD (Français)}}<br />
{{i18n_entry|Polski|mpd (polski)}}<br />
{{i18n_entry|Nederlands|Music Player Daemon (Nederlands)}}<br />
{{i18n_entry|Русский|MPD - Music Player Daemon (Русский)}}<br />
{{i18n_entry|简体中文|MPD(简体中文)}}<br />
{{i18n_entry|Türkçe|MPD (Türkçe)}}<br />
{{i18n_entry|Español|MPD (Español)}}<br />
{{i18n_links_end}}<br />
<br />
<br />
{{stub}}<br />
{{Note|Este artículo está incompleto. Ahora mismo está siendo traducido desde [[MPD|su versión en ingles]]}}<br />
==¿Qué es MPD?==<br />
'''MPD''' (Music Player Daemon) es un reproductor de audio que maneja una arquitectura servidor-cliente. mpd se ejecuta en el fondo como un daemon, gestiona listas de reproducción y una base de datos, y hace uso de muy pocos recursos. Para hacer uso de una interfaz gráfica, es necesario un cliente adicional. Más información puede obtenerse en su [http://www.musicpd.org/ página web].<br />
<br />
==Procedimiento de Instalación del Daemon==<br />
<br />
Actualice e instale con pacman:<br />
# pacman -S mpd<br />
<br />
Ahora, añada el usuario mpd al grupo users:<br />
# gpasswd -a mpd users<br />
<br />
==Instrucciones de Configuración ==<br />
<br />
Para más información de la configuración de mpd, por favor visite http://mpd.wikia.com/wiki/Configuration<br />
<br />
===Linea de Tiempo del comportamiento habitual de mpd===<br />
* mpd es iniciado al cargar el sistema operativo por medio de {{Filename|/etc/rc.conf}}, incluyéndole en el apartado DAEMONS. (O, esto puede ser hecho manualmente ejecutando {{Codeline|/etc/rc.d/mpd start}} con privilegios de root).<br />
* Al ser iniciado mpd como root, leerá el archivo {{Filename|/etc/mpd.conf}}.<br />
* mpd lee la variable usuario en el archivo {{Filename|/etc/mpd.conf}}, y cambia de root a este usuario.<br />
* mpd continúa leyendo el contenido del archivo {{Filename|/etc/mpd.conf}} y se configura de acuerdo a este.<br />
<br />
Recuerde que mpd cambia el usuario de root a aquel mencionado en el archivo {{Filename|/etc/mpd.conf}}. Siendo asi, el uso de "~" en el archivo de configuracion hace referencia al directorio home del usuario, y no al directorio de root. Podria ser de utilidad cambiar todos los "~" a "/home/username" para prevenir cualquier confusion sobre este aspecto del comportamineto de mpd.<br />
<br />
===Un Archivo de Configuracion Limpio===<br />
<br />
* Como root, verifique si {{Filename|/etc/mpd.conf}} existe y elimine el archivo en caso de que exista. Esto es hecho por seguridad.<br />
<br />
Mpd viene con un ejemplo del archivo de configuracion, disponible en {{Filename|/etc/mpd.conf.example}}. Este archivo contiene abundante informacion acerca de la configuracion de mpd, y contiene valores predeterminados para el mixer, que simplemente pueden ser descomentados.<br />
<br />
* Como root, copie este archivo de ejemplo a {{Filename|/etc/mpd.conf}}.<br />
# cp /etc/mpd.conf.example /etc/mpd.conf<br />
<br />
Nunca ponga este archivo en su directorio home como algunos tutoriales sugieren. Esto podria complicarlo todo, y la mayoria de las veces no tendra ningun sentido (recuerde que esta es una guia corta de instalacion y configuracion). Si creó con anterioridad un archivo {{Filename|.mpdconf}} en su directorio home, eliminelo ahora. Esto es importante para evitar conflictos. Cuando está ubicado en /etc, como se indica aqui, mpd podra ser ejecutado como daemon al inicio. De otro modo, un script sería necesario para ejecutar mpd LUEGO de que el usuario inicie sesion (Como kdm o ~/.fluxbox/startup), o tambien sera necesario una ejecucion manual. Para una coleccion musical unica, el metodo utilizado aqui es mejor, aún si la coleccion es compartida entre multiples usuarios. Además, no se preocupe por los privilegios de root: aunque mpd es ejecutado como daemon, nunca lo hace completamente como root puesto que automaticamente pierde sus privilegios luego de ser ejecutado.<br />
<br />
===Sound Setup Correctly===<br />
<br />
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.<br />
<br />
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.<br />
<br />
===Editando {{Filename|mpd.conf}}===<br />
<br />
Para editar el archivo, como root:<br />
# SUEDITOR /etc/mpd.conf<br />
<br />
'''Mantiene la configuración en /var y usa "mpd" como usuario por defecto en vez de atestar ~/. Este es el modo en que el paquete es instalado en Arch.'''<br />
<br />
Edite {{Filename|/etc/mpd.conf}} para verse de la siguiente manera.<br />
<br />
music_directory "/home/usuario/música" # Su directorio de música.<br />
playlist_directory "/var/lib/mpd/playlists"<br />
db_file "/var/lib/mpd/db"<br />
log_file "/var/log/mpd/mpd.log"<br />
error_file "/var/log/mpd/mpd.error"<br />
pid_file "/var/run/mpd/mpd.pid"<br />
state_file "/var/lib/mpd/mpdstate"<br />
user "mpd"<br />
# Ediciones a la dirección y el puerto causan problemas en mpd-0.14.2 es preferible dejarlos<br />
# comentados.<br />
# bind_to_address "127.0.0.1"<br />
# port "6600"<br />
<br />
Lea con cuidado los pasos a continuación, los permisos deben ser otorgados correctamente.<br />
<br />
* Mantenga el usuario como "mpd", asegúrese que el directorio home del usuario "mpd" sea /var/lib/mpd <br />
$ cat /etc/passwd | grep mpd<br />
* Además asegúrese que el directorio /var/lib/mpd sea propiedad de mpd:mpd.<br />
$ ls -l /var/lib/ | grep mpd<br />
* Ahora como root, cree los archivos especificados en {Filename|/etc/mpd.conf}}, si los directorios no existen también deben ser creados. Esto no es necesario si hace uso de los predeterminados por el paquete de Arch.<br />
# touch /var/lib/mpd/db<br />
# touch /var/lib/mpd/mpdstate<br />
# touch /var/run/mpd/mpd.pid<br />
# touch /var/log/mpd/mpd.log<br />
# touch /var/log/mpd/mpd.error<br />
* Ahora cambie el propietario de los directorios y archivos que ha creado, al usuario "mpd"<br />
# chown -R mpd:mpd /var/{lib,run,log}/mpd<br />
* Si su colección musical está contenida en múltiples directorios, puede crear enlaces simbólicos en /var/lib/mpd y luego dirigir la variable 'music_dir' en mpd.conf a el directorio que contiene los enlaces. Recuerde asignar los permisos correctamente en los directorios enlazados.<br />
* Crear la base de datos ahora es realizado por medio de la opción "update" del cliente, por ejemplo, si ejecuta ncmpcpp, por medio de la tecla 'U'. <br />
**El método anterior, crear la base de datos de mpd como root (# mpd --create-db), es obsoleto.<br />
<br />
== Alternative Setup ==<br />
<br />
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: <br />
# You can easily have a single directory ~/.mpd (or any other directory under /home/username) for all MPD configuration files<br />
# No read/write permission errors<br />
# More flexible calls to MPD by using {{Filename|~/.xinitrc}} instead of including 'mpd' in the {{Filename|/etc/rc.conf}} DAEMONS array.<br />
<br />
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.<br />
<br />
* 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"}}.<br />
* Follow the 'old setup instructions' from above, ignoring the first part about copying the config to {{Filename|/etc/mpd.conf}}. <br />
* Create all of the requisite files in {{filename|"/home/user/.mpd/"}}:<br />
"~/.mpd/playlists"<br />
"~/.mpd/db"<br />
"~/.mpd/mpd.log"<br />
"~/.mpd/mpd.error"<br />
"~/.mpd/mpd.pid"<br />
"~/.mpd/mpdstate"<br />
* Let MPD start on bootup by calling it from your {{Filename|~/.xinitrc}} as follows:<br />
# this starts mpd as normal user<br />
mpd /home/username/.mpd/config<br />
{{Note| that you don't have to put a "&" at the end of the line here, since MPD will automatically daemonize itself.}}<br />
<br />
Lastly, delete the entry 'mpd' from your DAEMONS array in {{Filename|/etc/rc.conf}}, as you are not running it as root anymore.<br />
<br />
===Multi-MPD Setup===<br />
'''Useful if you you want to run for example an icecast server.'''<br />
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).<br />
<br />
==Troubleshooting==<br />
<br />
=== Autodetection failed ===<br />
<br />
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:<br />
<br />
Example for alsa output type:<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
device "hw:0,0" # optional<br />
format "44100:16:2" # optional<br />
}<br />
<br />
Example for alsa mixer:<br />
mixer_type "alsa"<br />
mixer_device "default"<br />
mixer_control "PCM"<br />
<br />
'''Note:''' in case of permission problems when using ESD with mpd run this as root:<br />
# chsh -s /bin/true mpd<br />
<br />
=== Executable Permissions ===<br />
<br />
{{Warning|This is not good security practice and may be unnecessary.}}<br />
<br />
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. <br />
# chmod a+x /home/user<br />
# chmod -R a+X /home/user/music<br />
<br />
==== Alternative solution ====<br />
<br />
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.<br />
# chmod -R g-rwx /home/user<br />
# chmod g+rx /home/user<br />
# chmod -R g+rX /home/user/music<br />
<br />
===Tips===<br />
<br />
To get rid of timeouts (i.e. when you paused music for long time) in gpmc and other clients uncomment and increase {{Codeline|connection_timeout}} option in {{Filename|mpd.conf}}.<br />
<br />
If files and/or titles are shown in wrong encoding, uncomment and change {{Codeline|filesystem_charset}} and {{Codeline|id3v1_encoding}} options.<br />
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].<br />
<br />
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.<br />
<br />
'''Streaming'''<br />
<br />
With the latest version of mpd (0.15), built-in httpd streaming is now available.<br />
<br />
To activate this feature, you'll just need to add a new output of type httpd in {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "httpd"<br />
name "What you want"<br />
encoder "lame" # vorbis or lame supported<br />
port "8000"<br />
bitrate "128"<br />
format "44100:16:2" # change 2 to 1 for mono<br />
}<br />
<br />
Restart the mpd deamon and, from another computer, simply load the stream as any other url. <br />
<br />
mplayer http://<server's IP>:8000<br />
<br />
Most players (i.e. vlc or xmms2) should also be able to load the stream via their "add url..." menu option.<br />
<br />
This is a nice clean way to replace your current icecast setup with something natively supported within MPD.<br />
<br />
==Client Install Procedure==<br />
<br />
Install a client program for mpd. Popular options are:<br />
<br />
* '''mpc''' &ndash; Command Line Client (you'll probably want this one no matter what)<br />
* '''ncmpc''' &ndash; NCurses Client (this one is very handy for running in a console) [http://hem.bredband.net/kaw/ncmpc/ Official Website of ncmpc]<br />
* '''ncmpcpp''' &ndash; Clone of ncmpc with some new features written in C++ [http://unkart.ovh.org/ncmpcpp/ Official website of ncmpcpp]<br />
* '''pms''' &ndash; NCurses Client (highly configurable and accessible) [http://pms.sourceforge.net/ Sourceforge Website of pms]<br />
* '''ario''' &ndash; GTK+ Client with a Rhythmbox like library browser [http://ario-player.sourceforge.net Official Website of Ario]<br />
* '''sonata''' &ndash; Python GTK+ Client [http://sonata.berlios.de/ Official Website of Sonata]<br />
* '''gmpc''' &ndash; GNOME Client [http://gmpcwiki.sarine.nl/index.php?title=GMPC Official Website of gmpc]<br />
* '''QMPDClient''' &ndash; Client written with Qt 4.x. [http://bitcheese.net/wiki/QMPDClient Official Website of QMPDClient]<br />
<br />
Install with:<br />
# pacman -Sy mpc<br />
# pacman -Sy ncmpc<br />
# pacman -Sy ncmpcpp<br />
# pacman -Sy pms<br />
# pacman -Sy ario<br />
# pacman -Sy sonata<br />
# pacman -Sy gmpc<br />
# pacman -Sy qmpdclient<br />
<br />
==Extra stuff==<br />
<br />
===Last.fm scrobbling===<br />
<br />
To scrobble your songs to [http://www.last.fm Last.fm] using MPD there are several alternatives.<br />
<br />
====mpdscribble====<br />
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.<br />
<br />
To install mpdscribble, just install it from the AUR and do the following (not as root):<br />
<br />
* {{Codeline|$ mkdir ~/.mpdscribble}}<br />
* Create the file {{Filename|~/.mpdscribble/mpdscribble.conf}} and add the following:<br />
username = <your last.fm username><br />
password = <md5 sum of your last.fm password> # Generated using "echo -n password | md5sum"<br />
host = <your mpd host> # defaults to $MPD_HOST or localhost<br />
port = <your mpd port> # defaults to $MPD_PORT or 6600<br />
log = ~/.mpdscribble/mpdscribble.log<br />
journal = ~/.mpdscribble/mpdscribble.cache<br />
verbose = 2<br />
sleep = 1<br />
musicdir = <your music directory><br />
* Add {{Codeline|mpdscribble}} to your {{Filename|~/.xinitrc}}.<br />
<br />
====Sonata====<br />
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.<br />
<br />
====lastfmsubmitd====<br />
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}}.<br />
<br />
===Last.fm playback with lastfmproxy===<br />
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.<br />
<br />
{{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.}}<br />
<br />
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.<br />
<br />
=== Never play on start ===<br />
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:<br />
'' ...''<br />
'' stat_busy "Starting Music Player Daemon"''<br />
<br />
# always start in paused state<br />
awk '/^state_file[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
sfile = substr($0, RSTART + 1, RLENGTH - 2)<br />
} /^user[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
user = substr($0, RSTART + 1, RLENGTH - 2)<br />
} END {<br />
if (sfile == "")<br />
exit;<br />
if (user != "")<br />
sub(/^~/, "/home/" user, sfile)<br />
system("sed -i \x27s|^\\(state:[ \\t]\\{1,\\}\\)play$|\\1pause|\x27 \x27" sfile "\x27")<br />
}' /etc/mpd.conf<br />
<br />
'' /usr/bin/mpd /etc/mpd.conf &> /dev/null''<br />
'' ...''<br />
<br />
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}}:<br />
NoUpgrade = etc/rc.d/mpd<br />
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).<br />
<br />
=== MPD & Alsa ===<br />
<br />
Sometimes, when you use other audio output, e.g: some web pages containing Flash applets, mpd cannot reproduce anything anymore (until you restart). The error looks something like: (if you search the file {{Filename|/var/log/mpd/mpd.error}})<br />
<br />
Error opening alsa device "hw:0,0": Device or resource busy<br />
<br />
And here is the solution (dmix saving our life again). Apply these lines in your {{Filename|/etc/mpd.conf}}:<br />
<br />
<pre><br />
audio_output {<br />
type "alsa"<br />
name "Sound Card"<br />
options "dev=dmixer"<br />
device "plug:dmix"<br />
}<br />
</pre><br />
<br />
And then restart with {{Codeline|/etc/rc.d/mpd restart}}.<br />
<br />
Searching on Internet I found the reason for why that happens in Gentoo's wiki:<br />
* The sound card does not support hardware mixing (uses '''dmix''' plugin)<br />
* An application does not work with ALSA with it's default settings<br />
<br />
====High CPU usage with ALSA====<br />
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.<br />
<br />
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}}.<br />
<br />
Example from {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
auto_resample "no"<br />
}<br />
<br />
Some users might also want to tell dmix to use 44kHz as well. More info about tuning performance of your MPD can be found from: [http://mpd.wikia.com/wiki/Tuning MPD wiki]<br />
<br />
=== Control mpd with lirc ===<br />
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.<br />
<br />
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.<br />
<br />
First of all, please setup your remotes as referred to the '''[[Lirc]]''' article.<br />
<br />
Edit your favored lirc startup configuration file, default location is {{Filename|~/.lircrc}}.<br />
<br />
Fill the file with the following pattern:<br />
<br />
begin<br />
prog = irexec<br />
button = <button_name><br />
config = <command_to_run><br />
repeat = <0 or 1><br />
end<br />
<br />
An useful example:<br />
<br />
## irexec<br />
begin<br />
prog = irexec<br />
button = play_pause<br />
config = mpc toggle<br />
repeat = 0<br />
end<br />
<br />
begin<br />
prog = irexec<br />
button = stop<br />
config = mpc stop<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = previous<br />
config = mpc prev<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = next<br />
config = mpc next<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = volup<br />
config = mpc volume +2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = voldown<br />
config = mpc volume -2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = pbc<br />
config = mpc random<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = pdvd<br />
config = mpc update<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = right<br />
config = mpc seek +00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = left<br />
config = mpc seek -00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = up<br />
config = mpc seek +1%<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = down<br />
config = mpc seek -1%<br />
repeat = 0<br />
end<br />
<br />
There are more functions for mpc, run {{Codeline|man mpc}} for more info.<br />
<br />
=== Control mpd with bluetooth phone ===<br />
You can also control mpd (to a certain extent) using a bluetooth enabled phone. You need to do the following:<br />
<br />
* install [http://remuco.sourceforge.net/index.php/Remuco remuco] -- a wireless remote control for several Linux media players ([http://aur.archlinux.org/packages.php?ID=25072 aur])<br />
* transfer remuco client -- jar/jad files from {{Filename|/usr/share/remuco/client/}} to your phone and install it<br />
* run {{Codeline|remuco-mpd}} (as current user)<br />
* run remuco on your phone, define a new bluetooth remuco connection (pair first if you haven't done this previously) and explore its capabilities<br />
<br />
More information about remuco including troubleshooting to be found at its [http://remuco.sourceforge.net/index.php/Remuco homepage]<br />
<br />
=== MPD & PulseAudio ===<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
# gpasswd -a mpd pulse-access<br />
# gpasswd -a mpd pulse-rt<br />
<br />
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.<br />
<br />
==Troubleshooting==<br />
===mpd --create-db hangs===<br />
This is a common error that's caused by corrupt mp3 tags.<br />
Here is an experimental way to solve this issue.<br />
Requirements:<br />
* kid3<br />
* easytag<br />
<br />
This method is very tedious, expecially with a huge database. Just as a baseline it took 2.5h to fix a 16Gb DB.<br />
<br />
====Easy Tag====<br />
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.<br />
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.<br />
<br />
====KID3====<br />
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.<br />
<br />
Repeat this procedure until your music library is done.<br />
<br />
===Cannot connect to mpd: host "localhost" not found: Temporary failure in name resolution===<br />
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<br />
<br />
::1 localhost.localdomain localhost<br />
<br />
===Port 6600 already in use===<br />
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:<br />
<br />
$ mpd --kill<br />
$ mpd --create-db<br />
<br />
A more brute-force approach:<br />
<br />
$ killall mpd<br />
$ mpd --create-db<br />
<br />
{{Note| If you typically run mpd as root, you will need to run the above commands as root.}}<br />
<br />
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<br />
<br />
If port 6600 is tied up for some other reason, one can use the following command to find the offending process:<br />
<br />
# netstat -tulpan | grep 6600<br />
<br />
This will list IP:Port and the process name holding the connection (root privileges are required to see all processes).<br />
<br />
=== Crackling sound with some audio files ===<br />
<br />
This is usually a playback speed problem and can be fixed by uncommenting the audio_output_format line in:<br />
<br />
{{File|name=/etc/mpd.conf|content=<br />
audio_output_format "44100:16:2"}}<br />
<br />
This is usually a sane value for most mp3 files.<br />
<br />
==External links==<br />
<br />
* [http://www.musicpd.org/ Official Web Site]<br />
* [http://mpd.wikia.com/wiki/Main_Page Official Wiki]<br />
* [http://mpd.wikia.com/wiki/Clients Sorted List of MPD Clients]<br />
* [http://www.musicpd.org/forum/ MPD forum]</div>MGu3lhttps://wiki.archlinux.org/index.php?title=Music_Player_Daemon_(Espa%C3%B1ol)&diff=89062Music Player Daemon (Español)2009-12-27T21:13:54Z<p>MGu3l: /* Editing {{Filename|mpd.conf}} */</p>
<hr />
<div>[[Category: Audio/Video (Español)]]<br />
[[Category:CÓMOs (Español)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|MPD}}<br />
{{i18n_entry|Français|MPD (Français)}}<br />
{{i18n_entry|Polski|mpd (polski)}}<br />
{{i18n_entry|Nederlands|Music Player Daemon (Nederlands)}}<br />
{{i18n_entry|Русский|MPD - Music Player Daemon (Русский)}}<br />
{{i18n_entry|简体中文|MPD(简体中文)}}<br />
{{i18n_entry|Türkçe|MPD (Türkçe)}}<br />
{{i18n_entry|Español|MPD (Español)}}<br />
{{i18n_links_end}}<br />
<br />
<br />
{{stub}}<br />
{{Note|Este artículo está incompleto. Ahora mismo está siendo traducido desde [[MPD|su versión en ingles]]}}<br />
==¿Qué es MPD?==<br />
'''MPD''' (Music Player Daemon) es un reproductor de audio que maneja una arquitectura servidor-cliente. mpd se ejecuta en el fondo como un daemon, gestiona listas de reproducción y una base de datos, y hace uso de muy pocos recursos. Para hacer uso de una interfaz gráfica, es necesario un cliente adicional. Más información puede obtenerse en su [http://www.musicpd.org/ página web].<br />
<br />
==Procedimiento de Instalación del Daemon==<br />
<br />
Actualice e instale con pacman:<br />
# pacman -S mpd<br />
<br />
Ahora, añada el usuario mpd al grupo users:<br />
# gpasswd -a mpd users<br />
<br />
==Instrucciones de Configuración ==<br />
<br />
Para más información de la configuración de mpd, por favor visite http://mpd.wikia.com/wiki/Configuration<br />
<br />
===Linea de Tiempo del comportamiento habitual de mpd===<br />
* mpd es iniciado al cargar el sistema operativo por medio de {{Filename|/etc/rc.conf}}, incluyéndole en el apartado DAEMONS. (O, esto puede ser hecho manualmente ejecutando {{Codeline|/etc/rc.d/mpd start}} con privilegios de root).<br />
* Al ser iniciado mpd como root, leerá el archivo {{Filename|/etc/mpd.conf}}.<br />
* mpd lee la variable usuario en el archivo {{Filename|/etc/mpd.conf}}, y cambia de root a este usuario.<br />
* mpd continúa leyendo el contenido del archivo {{Filename|/etc/mpd.conf}} y se configura de acuerdo a este.<br />
<br />
Recuerde que mpd cambia el usuario de root a aquel mencionado en el archivo {{Filename|/etc/mpd.conf}}. Siendo asi, el uso de "~" en el archivo de configuracion hace referencia al directorio home del usuario, y no al directorio de root. Podria ser de utilidad cambiar todos los "~" a "/home/username" para prevenir cualquier confusion sobre este aspecto del comportamineto de mpd.<br />
<br />
===Un Archivo de Configuracion Limpio===<br />
<br />
* Como root, verifique si {{Filename|/etc/mpd.conf}} existe y elimine el archivo en caso de que exista. Esto es hecho por seguridad.<br />
<br />
Mpd viene con un ejemplo del archivo de configuracion, disponible en {{Filename|/etc/mpd.conf.example}}. Este archivo contiene abundante informacion acerca de la configuracion de mpd, y contiene valores predeterminados para el mixer, que simplemente pueden ser descomentados.<br />
<br />
* Como root, copie este archivo de ejemplo a {{Filename|/etc/mpd.conf}}.<br />
# cp /etc/mpd.conf.example /etc/mpd.conf<br />
<br />
Nunca ponga este archivo en su directorio home como algunos tutoriales sugieren. Esto podria complicarlo todo, y la mayoria de las veces no tendra ningun sentido (recuerde que esta es una guia corta de instalacion y configuracion). Si creó con anterioridad un archivo {{Filename|.mpdconf}} en su directorio home, eliminelo ahora. Esto es importante para evitar conflictos. Cuando está ubicado en /etc, como se indica aqui, mpd podra ser ejecutado como daemon al inicio. De otro modo, un script sería necesario para ejecutar mpd LUEGO de que el usuario inicie sesion (Como kdm o ~/.fluxbox/startup), o tambien sera necesario una ejecucion manual. Para una coleccion musical unica, el metodo utilizado aqui es mejor, aún si la coleccion es compartida entre multiples usuarios. Además, no se preocupe por los privilegios de root: aunque mpd es ejecutado como daemon, nunca lo hace completamente como root puesto que automaticamente pierde sus privilegios luego de ser ejecutado.<br />
<br />
===Sound Setup Correctly===<br />
<br />
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.<br />
<br />
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.<br />
<br />
===Editing {{Filename|mpd.conf}}===<br />
<br />
Para editar el archivo, como root:<br />
# SUEDITOR /etc/mpd.conf<br />
<br />
'''Mantiene la configuración en /var y usa "mpd" como usuario por defecto en vez de atestar ~/. Este es el modo en que el paquete es instalado en Arch.'''<br />
<br />
Edite {{Filename|/etc/mpd.conf}} para verse de la siguiente manera.<br />
<br />
music_directory "/home/usuario/música" # Su directorio de música.<br />
playlist_directory "/var/lib/mpd/playlists"<br />
db_file "/var/lib/mpd/db"<br />
log_file "/var/log/mpd/mpd.log"<br />
error_file "/var/log/mpd/mpd.error"<br />
pid_file "/var/run/mpd/mpd.pid"<br />
state_file "/var/lib/mpd/mpdstate"<br />
user "mpd"<br />
# Ediciones a la dirección y el puerto causan problemas en mpd-0.14.2 es preferible dejarlos<br />
# comentados.<br />
# bind_to_address "127.0.0.1"<br />
# port "6600"<br />
<br />
Lea con cuidado los pasos a continuación, los permisos deben ser otorgados correctamente.<br />
<br />
* Mantenga el usuario como "mpd", asegúrese que el directorio home del usuario "mpd" sea /var/lib/mpd <br />
$ cat /etc/passwd | grep mpd<br />
* Además asegúrese que el directorio /var/lib/mpd sea propiedad de mpd:mpd.<br />
$ ls -l /var/lib/ | grep mpd<br />
* Ahora como root, cree los archivos especificados en {Filename|/etc/mpd.conf}}, si los directorios no existen también deben ser creados. Esto no es necesario si hace uso de los predeterminados por el paquete de Arch.<br />
# touch /var/lib/mpd/db<br />
# touch /var/lib/mpd/mpdstate<br />
# touch /var/run/mpd/mpd.pid<br />
# touch /var/log/mpd/mpd.log<br />
# touch /var/log/mpd/mpd.error<br />
* Ahora cambie el propietario de los directorios y archivos que ha creado, al usuario "mpd"<br />
# chown -R mpd:mpd /var/{lib,run,log}/mpd<br />
* Si su colección musical está contenida en múltiples directorios, puede crear enlaces simbólicos en /var/lib/mpd y luego dirigir la variable 'music_dir' en mpd.conf a el directorio que contiene los enlaces. Recuerde asignar los permisos correctamente en los directorios enlazados.<br />
* Crear la base de datos ahora es realizado por medio de la opción "update" del cliente, por ejemplo, si ejecuta ncmpcpp, por medio de la tecla 'U'. <br />
**El método anterior, crear la base de datos de mpd como root (# mpd --create-db), es obsoleto.<br />
<br />
== Alternative Setup ==<br />
<br />
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: <br />
# You can easily have a single directory ~/.mpd (or any other directory under /home/username) for all MPD configuration files<br />
# No read/write permission errors<br />
# More flexible calls to MPD by using {{Filename|~/.xinitrc}} instead of including 'mpd' in the {{Filename|/etc/rc.conf}} DAEMONS array.<br />
<br />
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.<br />
<br />
* 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"}}.<br />
* Follow the 'old setup instructions' from above, ignoring the first part about copying the config to {{Filename|/etc/mpd.conf}}. <br />
* Create all of the requisite files in {{filename|"/home/user/.mpd/"}}:<br />
"~/.mpd/playlists"<br />
"~/.mpd/db"<br />
"~/.mpd/mpd.log"<br />
"~/.mpd/mpd.error"<br />
"~/.mpd/mpd.pid"<br />
"~/.mpd/mpdstate"<br />
* Let MPD start on bootup by calling it from your {{Filename|~/.xinitrc}} as follows:<br />
# this starts mpd as normal user<br />
mpd /home/username/.mpd/config<br />
{{Note| that you don't have to put a "&" at the end of the line here, since MPD will automatically daemonize itself.}}<br />
<br />
Lastly, delete the entry 'mpd' from your DAEMONS array in {{Filename|/etc/rc.conf}}, as you are not running it as root anymore.<br />
<br />
===Multi-MPD Setup===<br />
'''Useful if you you want to run for example an icecast server.'''<br />
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).<br />
<br />
==Troubleshooting==<br />
<br />
=== Autodetection failed ===<br />
<br />
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:<br />
<br />
Example for alsa output type:<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
device "hw:0,0" # optional<br />
format "44100:16:2" # optional<br />
}<br />
<br />
Example for alsa mixer:<br />
mixer_type "alsa"<br />
mixer_device "default"<br />
mixer_control "PCM"<br />
<br />
'''Note:''' in case of permission problems when using ESD with mpd run this as root:<br />
# chsh -s /bin/true mpd<br />
<br />
=== Executable Permissions ===<br />
<br />
{{Warning|This is not good security practice and may be unnecessary.}}<br />
<br />
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. <br />
# chmod a+x /home/user<br />
# chmod -R a+X /home/user/music<br />
<br />
==== Alternative solution ====<br />
<br />
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.<br />
# chmod -R g-rwx /home/user<br />
# chmod g+rx /home/user<br />
# chmod -R g+rX /home/user/music<br />
<br />
===Tips===<br />
<br />
To get rid of timeouts (i.e. when you paused music for long time) in gpmc and other clients uncomment and increase {{Codeline|connection_timeout}} option in {{Filename|mpd.conf}}.<br />
<br />
If files and/or titles are shown in wrong encoding, uncomment and change {{Codeline|filesystem_charset}} and {{Codeline|id3v1_encoding}} options.<br />
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].<br />
<br />
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.<br />
<br />
'''Streaming'''<br />
<br />
With the latest version of mpd (0.15), built-in httpd streaming is now available.<br />
<br />
To activate this feature, you'll just need to add a new output of type httpd in {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "httpd"<br />
name "What you want"<br />
encoder "lame" # vorbis or lame supported<br />
port "8000"<br />
bitrate "128"<br />
format "44100:16:2" # change 2 to 1 for mono<br />
}<br />
<br />
Restart the mpd deamon and, from another computer, simply load the stream as any other url. <br />
<br />
mplayer http://<server's IP>:8000<br />
<br />
Most players (i.e. vlc or xmms2) should also be able to load the stream via their "add url..." menu option.<br />
<br />
This is a nice clean way to replace your current icecast setup with something natively supported within MPD.<br />
<br />
==Client Install Procedure==<br />
<br />
Install a client program for mpd. Popular options are:<br />
<br />
* '''mpc''' &ndash; Command Line Client (you'll probably want this one no matter what)<br />
* '''ncmpc''' &ndash; NCurses Client (this one is very handy for running in a console) [http://hem.bredband.net/kaw/ncmpc/ Official Website of ncmpc]<br />
* '''ncmpcpp''' &ndash; Clone of ncmpc with some new features written in C++ [http://unkart.ovh.org/ncmpcpp/ Official website of ncmpcpp]<br />
* '''pms''' &ndash; NCurses Client (highly configurable and accessible) [http://pms.sourceforge.net/ Sourceforge Website of pms]<br />
* '''ario''' &ndash; GTK+ Client with a Rhythmbox like library browser [http://ario-player.sourceforge.net Official Website of Ario]<br />
* '''sonata''' &ndash; Python GTK+ Client [http://sonata.berlios.de/ Official Website of Sonata]<br />
* '''gmpc''' &ndash; GNOME Client [http://gmpcwiki.sarine.nl/index.php?title=GMPC Official Website of gmpc]<br />
* '''QMPDClient''' &ndash; Client written with Qt 4.x. [http://bitcheese.net/wiki/QMPDClient Official Website of QMPDClient]<br />
<br />
Install with:<br />
# pacman -Sy mpc<br />
# pacman -Sy ncmpc<br />
# pacman -Sy ncmpcpp<br />
# pacman -Sy pms<br />
# pacman -Sy ario<br />
# pacman -Sy sonata<br />
# pacman -Sy gmpc<br />
# pacman -Sy qmpdclient<br />
<br />
==Extra stuff==<br />
<br />
===Last.fm scrobbling===<br />
<br />
To scrobble your songs to [http://www.last.fm Last.fm] using MPD there are several alternatives.<br />
<br />
====mpdscribble====<br />
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.<br />
<br />
To install mpdscribble, just install it from the AUR and do the following (not as root):<br />
<br />
* {{Codeline|$ mkdir ~/.mpdscribble}}<br />
* Create the file {{Filename|~/.mpdscribble/mpdscribble.conf}} and add the following:<br />
username = <your last.fm username><br />
password = <md5 sum of your last.fm password> # Generated using "echo -n password | md5sum"<br />
host = <your mpd host> # defaults to $MPD_HOST or localhost<br />
port = <your mpd port> # defaults to $MPD_PORT or 6600<br />
log = ~/.mpdscribble/mpdscribble.log<br />
journal = ~/.mpdscribble/mpdscribble.cache<br />
verbose = 2<br />
sleep = 1<br />
musicdir = <your music directory><br />
* Add {{Codeline|mpdscribble}} to your {{Filename|~/.xinitrc}}.<br />
<br />
====Sonata====<br />
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.<br />
<br />
====lastfmsubmitd====<br />
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}}.<br />
<br />
===Last.fm playback with lastfmproxy===<br />
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.<br />
<br />
{{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.}}<br />
<br />
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.<br />
<br />
=== Never play on start ===<br />
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:<br />
'' ...''<br />
'' stat_busy "Starting Music Player Daemon"''<br />
<br />
# always start in paused state<br />
awk '/^state_file[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
sfile = substr($0, RSTART + 1, RLENGTH - 2)<br />
} /^user[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
user = substr($0, RSTART + 1, RLENGTH - 2)<br />
} END {<br />
if (sfile == "")<br />
exit;<br />
if (user != "")<br />
sub(/^~/, "/home/" user, sfile)<br />
system("sed -i \x27s|^\\(state:[ \\t]\\{1,\\}\\)play$|\\1pause|\x27 \x27" sfile "\x27")<br />
}' /etc/mpd.conf<br />
<br />
'' /usr/bin/mpd /etc/mpd.conf &> /dev/null''<br />
'' ...''<br />
<br />
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}}:<br />
NoUpgrade = etc/rc.d/mpd<br />
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).<br />
<br />
=== MPD & Alsa ===<br />
<br />
Sometimes, when you use other audio output, e.g: some web pages containing Flash applets, mpd cannot reproduce anything anymore (until you restart). The error looks something like: (if you search the file {{Filename|/var/log/mpd/mpd.error}})<br />
<br />
Error opening alsa device "hw:0,0": Device or resource busy<br />
<br />
And here is the solution (dmix saving our life again). Apply these lines in your {{Filename|/etc/mpd.conf}}:<br />
<br />
<pre><br />
audio_output {<br />
type "alsa"<br />
name "Sound Card"<br />
options "dev=dmixer"<br />
device "plug:dmix"<br />
}<br />
</pre><br />
<br />
And then restart with {{Codeline|/etc/rc.d/mpd restart}}.<br />
<br />
Searching on Internet I found the reason for why that happens in Gentoo's wiki:<br />
* The sound card does not support hardware mixing (uses '''dmix''' plugin)<br />
* An application does not work with ALSA with it's default settings<br />
<br />
====High CPU usage with ALSA====<br />
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.<br />
<br />
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}}.<br />
<br />
Example from {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
auto_resample "no"<br />
}<br />
<br />
Some users might also want to tell dmix to use 44kHz as well. More info about tuning performance of your MPD can be found from: [http://mpd.wikia.com/wiki/Tuning MPD wiki]<br />
<br />
=== Control mpd with lirc ===<br />
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.<br />
<br />
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.<br />
<br />
First of all, please setup your remotes as referred to the '''[[Lirc]]''' article.<br />
<br />
Edit your favored lirc startup configuration file, default location is {{Filename|~/.lircrc}}.<br />
<br />
Fill the file with the following pattern:<br />
<br />
begin<br />
prog = irexec<br />
button = <button_name><br />
config = <command_to_run><br />
repeat = <0 or 1><br />
end<br />
<br />
An useful example:<br />
<br />
## irexec<br />
begin<br />
prog = irexec<br />
button = play_pause<br />
config = mpc toggle<br />
repeat = 0<br />
end<br />
<br />
begin<br />
prog = irexec<br />
button = stop<br />
config = mpc stop<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = previous<br />
config = mpc prev<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = next<br />
config = mpc next<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = volup<br />
config = mpc volume +2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = voldown<br />
config = mpc volume -2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = pbc<br />
config = mpc random<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = pdvd<br />
config = mpc update<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = right<br />
config = mpc seek +00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = left<br />
config = mpc seek -00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = up<br />
config = mpc seek +1%<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = down<br />
config = mpc seek -1%<br />
repeat = 0<br />
end<br />
<br />
There are more functions for mpc, run {{Codeline|man mpc}} for more info.<br />
<br />
=== Control mpd with bluetooth phone ===<br />
You can also control mpd (to a certain extent) using a bluetooth enabled phone. You need to do the following:<br />
<br />
* install [http://remuco.sourceforge.net/index.php/Remuco remuco] -- a wireless remote control for several Linux media players ([http://aur.archlinux.org/packages.php?ID=25072 aur])<br />
* transfer remuco client -- jar/jad files from {{Filename|/usr/share/remuco/client/}} to your phone and install it<br />
* run {{Codeline|remuco-mpd}} (as current user)<br />
* run remuco on your phone, define a new bluetooth remuco connection (pair first if you haven't done this previously) and explore its capabilities<br />
<br />
More information about remuco including troubleshooting to be found at its [http://remuco.sourceforge.net/index.php/Remuco homepage]<br />
<br />
=== MPD & PulseAudio ===<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
# gpasswd -a mpd pulse-access<br />
# gpasswd -a mpd pulse-rt<br />
<br />
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.<br />
<br />
==Troubleshooting==<br />
===mpd --create-db hangs===<br />
This is a common error that's caused by corrupt mp3 tags.<br />
Here is an experimental way to solve this issue.<br />
Requirements:<br />
* kid3<br />
* easytag<br />
<br />
This method is very tedious, expecially with a huge database. Just as a baseline it took 2.5h to fix a 16Gb DB.<br />
<br />
====Easy Tag====<br />
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.<br />
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.<br />
<br />
====KID3====<br />
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.<br />
<br />
Repeat this procedure until your music library is done.<br />
<br />
===Cannot connect to mpd: host "localhost" not found: Temporary failure in name resolution===<br />
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<br />
<br />
::1 localhost.localdomain localhost<br />
<br />
===Port 6600 already in use===<br />
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:<br />
<br />
$ mpd --kill<br />
$ mpd --create-db<br />
<br />
A more brute-force approach:<br />
<br />
$ killall mpd<br />
$ mpd --create-db<br />
<br />
{{Note| If you typically run mpd as root, you will need to run the above commands as root.}}<br />
<br />
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<br />
<br />
If port 6600 is tied up for some other reason, one can use the following command to find the offending process:<br />
<br />
# netstat -tulpan | grep 6600<br />
<br />
This will list IP:Port and the process name holding the connection (root privileges are required to see all processes).<br />
<br />
=== Crackling sound with some audio files ===<br />
<br />
This is usually a playback speed problem and can be fixed by uncommenting the audio_output_format line in:<br />
<br />
{{File|name=/etc/mpd.conf|content=<br />
audio_output_format "44100:16:2"}}<br />
<br />
This is usually a sane value for most mp3 files.<br />
<br />
==External links==<br />
<br />
* [http://www.musicpd.org/ Official Web Site]<br />
* [http://mpd.wikia.com/wiki/Main_Page Official Wiki]<br />
* [http://mpd.wikia.com/wiki/Clients Sorted List of MPD Clients]<br />
* [http://www.musicpd.org/forum/ MPD forum]</div>MGu3lhttps://wiki.archlinux.org/index.php?title=Music_Player_Daemon_(Espa%C3%B1ol)&diff=89039Music Player Daemon (Español)2009-12-27T08:09:15Z<p>MGu3l: </p>
<hr />
<div>[[Category: Audio/Video (Español)]]<br />
[[Category:CÓMOs (Español)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|MPD}}<br />
{{i18n_entry|Français|MPD (Français)}}<br />
{{i18n_entry|Polski|mpd (polski)}}<br />
{{i18n_entry|Nederlands|Music Player Daemon (Nederlands)}}<br />
{{i18n_entry|Русский|MPD - Music Player Daemon (Русский)}}<br />
{{i18n_entry|简体中文|MPD(简体中文)}}<br />
{{i18n_entry|Türkçe|MPD (Türkçe)}}<br />
{{i18n_entry|Español|MPD (Español)}}<br />
{{i18n_links_end}}<br />
<br />
<br />
{{stub}}<br />
{{Note|Este artículo está incompleto. Ahora mismo está siendo traducido desde [[MPD|su versión en ingles]]}}<br />
==¿Qué es MPD?==<br />
'''MPD''' (Music Player Daemon) es un reproductor de audio que maneja una arquitectura servidor-cliente. mpd se ejecuta en el fondo como un daemon, gestiona listas de reproducción y una base de datos, y hace uso de muy pocos recursos. Para hacer uso de una interfaz gráfica, es necesario un cliente adicional. Más información puede obtenerse en su [http://www.musicpd.org/ página web].<br />
<br />
==Procedimiento de Instalación del Daemon==<br />
<br />
Actualice e instale con pacman:<br />
# pacman -S mpd<br />
<br />
Ahora, añada el usuario mpd al grupo users:<br />
# gpasswd -a mpd users<br />
<br />
==Instrucciones de Configuración ==<br />
<br />
Para más información de la configuración de mpd, por favor visite http://mpd.wikia.com/wiki/Configuration<br />
<br />
===Linea de Tiempo del comportamiento habitual de mpd===<br />
* mpd es iniciado al cargar el sistema operativo por medio de {{Filename|/etc/rc.conf}}, incluyéndole en el apartado DAEMONS. (O, esto puede ser hecho manualmente ejecutando {{Codeline|/etc/rc.d/mpd start}} con privilegios de root).<br />
* Al ser iniciado mpd como root, leerá el archivo {{Filename|/etc/mpd.conf}}.<br />
* mpd lee la variable usuario en el archivo {{Filename|/etc/mpd.conf}}, y cambia de root a este usuario.<br />
* mpd continúa leyendo el contenido del archivo {{Filename|/etc/mpd.conf}} y se configura de acuerdo a este.<br />
<br />
Recuerde que mpd cambia el usuario de root a aquel mencionado en el archivo {{Filename|/etc/mpd.conf}}. Siendo asi, el uso de "~" en el archivo de configuracion hace referencia al directorio home del usuario, y no al directorio de root. Podria ser de utilidad cambiar todos los "~" a "/home/username" para prevenir cualquier confusion sobre este aspecto del comportamineto de mpd.<br />
<br />
===Un Archivo de Configuracion Limpio===<br />
<br />
* Como root, verifique si {{Filename|/etc/mpd.conf}} existe y elimine el archivo en caso de que exista. Esto es hecho por seguridad.<br />
<br />
Mpd viene con un ejemplo del archivo de configuracion, disponible en {{Filename|/etc/mpd.conf.example}}. Este archivo contiene abundante informacion acerca de la configuracion de mpd, y contiene valores predeterminados para el mixer, que simplemente pueden ser descomentados.<br />
<br />
* Como root, copie este archivo de ejemplo a {{Filename|/etc/mpd.conf}}.<br />
# cp /etc/mpd.conf.example /etc/mpd.conf<br />
<br />
Nunca ponga este archivo en su directorio home como algunos tutoriales sugieren. Esto podria complicarlo todo, y la mayoria de las veces no tendra ningun sentido (recuerde que esta es una guia corta de instalacion y configuracion). Si creó con anterioridad un archivo {{Filename|.mpdconf}} en su directorio home, eliminelo ahora. Esto es importante para evitar conflictos. Cuando está ubicado en /etc, como se indica aqui, mpd podra ser ejecutado como daemon al inicio. De otro modo, un script sería necesario para ejecutar mpd LUEGO de que el usuario inicie sesion (Como kdm o ~/.fluxbox/startup), o tambien sera necesario una ejecucion manual. Para una coleccion musical unica, el metodo utilizado aqui es mejor, aún si la coleccion es compartida entre multiples usuarios. Además, no se preocupe por los privilegios de root: aunque mpd es ejecutado como daemon, nunca lo hace completamente como root puesto que automaticamente pierde sus privilegios luego de ser ejecutado.<br />
<br />
===Sound Setup Correctly===<br />
<br />
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.<br />
<br />
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.<br />
<br />
===Editing {{Filename|mpd.conf}}===<br />
<br />
To edit the file, as root:<br />
# YOUREDITOR /etc/mpd.conf<br />
<br />
'''Keeps the setup in /var and uses "mpd" as default user instead of cluttering up ~/. This is the way the arch package is installed.'''<br />
<br />
Edit {{Filename|/etc/mpd.conf}} to reflect as such.<br />
<br />
music_directory "/home/user/music" # Your music dir.<br />
playlist_directory "/var/lib/mpd/playlists"<br />
db_file "/var/lib/mpd/db"<br />
log_file "/var/log/mpd/mpd.log"<br />
error_file "/var/log/mpd/mpd.error"<br />
pid_file "/var/run/mpd/mpd.pid"<br />
state_file "/var/lib/mpd/mpdstate"<br />
user "mpd"<br />
# Binding to address and port causing problems in mpd-0.14.2 best to leave<br />
# commented.<br />
# bind_to_address "127.0.0.1"<br />
# port "6600"<br />
<br />
Read steps below carefully, permissions need to be set correctly.<br />
<br />
* Keep user as "mpd", double check to make sure user "mpd" home directory is set to /var/lib/mpd <br />
$ cat /etc/passwd | grep mpd<br />
* Also make sure /var/lib/mpd is owned by mpd:mpd.<br />
$ ls -l /var/lib/ | grep mpd<br />
* 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.<br />
# touch /var/lib/mpd/db<br />
# touch /var/lib/mpd/mpdstate<br />
# touch /var/run/mpd/mpd.pid<br />
# touch /var/log/mpd/mpd.log<br />
# touch /var/log/mpd/mpd.error<br />
* Now change the ownership of the directories and files you created to user "mpd"<br />
# chown -R mpd:mpd /var/{lib,run,log}/mpd<br />
* 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. <br />
* 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'. <br />
**The previous method, creating the mpd database as root (# mpd --create-db), is deprecated.<br />
<br />
== Alternative Setup ==<br />
<br />
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: <br />
# You can easily have a single directory ~/.mpd (or any other directory under /home/username) for all MPD configuration files<br />
# No read/write permission errors<br />
# More flexible calls to MPD by using {{Filename|~/.xinitrc}} instead of including 'mpd' in the {{Filename|/etc/rc.conf}} DAEMONS array.<br />
<br />
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.<br />
<br />
* 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"}}.<br />
* Follow the 'old setup instructions' from above, ignoring the first part about copying the config to {{Filename|/etc/mpd.conf}}. <br />
* Create all of the requisite files in {{filename|"/home/user/.mpd/"}}:<br />
"~/.mpd/playlists"<br />
"~/.mpd/db"<br />
"~/.mpd/mpd.log"<br />
"~/.mpd/mpd.error"<br />
"~/.mpd/mpd.pid"<br />
"~/.mpd/mpdstate"<br />
* Let MPD start on bootup by calling it from your {{Filename|~/.xinitrc}} as follows:<br />
# this starts mpd as normal user<br />
mpd /home/username/.mpd/config<br />
{{Note| that you don't have to put a "&" at the end of the line here, since MPD will automatically daemonize itself.}}<br />
<br />
Lastly, delete the entry 'mpd' from your DAEMONS array in {{Filename|/etc/rc.conf}}, as you are not running it as root anymore.<br />
<br />
===Multi-MPD Setup===<br />
'''Useful if you you want to run for example an icecast server.'''<br />
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).<br />
<br />
==Troubleshooting==<br />
<br />
=== Autodetection failed ===<br />
<br />
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:<br />
<br />
Example for alsa output type:<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
device "hw:0,0" # optional<br />
format "44100:16:2" # optional<br />
}<br />
<br />
Example for alsa mixer:<br />
mixer_type "alsa"<br />
mixer_device "default"<br />
mixer_control "PCM"<br />
<br />
'''Note:''' in case of permission problems when using ESD with mpd run this as root:<br />
# chsh -s /bin/true mpd<br />
<br />
=== Executable Permissions ===<br />
<br />
{{Warning|This is not good security practice and may be unnecessary.}}<br />
<br />
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. <br />
# chmod a+x /home/user<br />
# chmod -R a+X /home/user/music<br />
<br />
==== Alternative solution ====<br />
<br />
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.<br />
# chmod -R g-rwx /home/user<br />
# chmod g+rx /home/user<br />
# chmod -R g+rX /home/user/music<br />
<br />
===Tips===<br />
<br />
To get rid of timeouts (i.e. when you paused music for long time) in gpmc and other clients uncomment and increase {{Codeline|connection_timeout}} option in {{Filename|mpd.conf}}.<br />
<br />
If files and/or titles are shown in wrong encoding, uncomment and change {{Codeline|filesystem_charset}} and {{Codeline|id3v1_encoding}} options.<br />
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].<br />
<br />
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.<br />
<br />
'''Streaming'''<br />
<br />
With the latest version of mpd (0.15), built-in httpd streaming is now available.<br />
<br />
To activate this feature, you'll just need to add a new output of type httpd in {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "httpd"<br />
name "What you want"<br />
encoder "lame" # vorbis or lame supported<br />
port "8000"<br />
bitrate "128"<br />
format "44100:16:2" # change 2 to 1 for mono<br />
}<br />
<br />
Restart the mpd deamon and, from another computer, simply load the stream as any other url. <br />
<br />
mplayer http://<server's IP>:8000<br />
<br />
Most players (i.e. vlc or xmms2) should also be able to load the stream via their "add url..." menu option.<br />
<br />
This is a nice clean way to replace your current icecast setup with something natively supported within MPD.<br />
<br />
==Client Install Procedure==<br />
<br />
Install a client program for mpd. Popular options are:<br />
<br />
* '''mpc''' &ndash; Command Line Client (you'll probably want this one no matter what)<br />
* '''ncmpc''' &ndash; NCurses Client (this one is very handy for running in a console) [http://hem.bredband.net/kaw/ncmpc/ Official Website of ncmpc]<br />
* '''ncmpcpp''' &ndash; Clone of ncmpc with some new features written in C++ [http://unkart.ovh.org/ncmpcpp/ Official website of ncmpcpp]<br />
* '''pms''' &ndash; NCurses Client (highly configurable and accessible) [http://pms.sourceforge.net/ Sourceforge Website of pms]<br />
* '''ario''' &ndash; GTK+ Client with a Rhythmbox like library browser [http://ario-player.sourceforge.net Official Website of Ario]<br />
* '''sonata''' &ndash; Python GTK+ Client [http://sonata.berlios.de/ Official Website of Sonata]<br />
* '''gmpc''' &ndash; GNOME Client [http://gmpcwiki.sarine.nl/index.php?title=GMPC Official Website of gmpc]<br />
* '''QMPDClient''' &ndash; Client written with Qt 4.x. [http://bitcheese.net/wiki/QMPDClient Official Website of QMPDClient]<br />
<br />
Install with:<br />
# pacman -Sy mpc<br />
# pacman -Sy ncmpc<br />
# pacman -Sy ncmpcpp<br />
# pacman -Sy pms<br />
# pacman -Sy ario<br />
# pacman -Sy sonata<br />
# pacman -Sy gmpc<br />
# pacman -Sy qmpdclient<br />
<br />
==Extra stuff==<br />
<br />
===Last.fm scrobbling===<br />
<br />
To scrobble your songs to [http://www.last.fm Last.fm] using MPD there are several alternatives.<br />
<br />
====mpdscribble====<br />
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.<br />
<br />
To install mpdscribble, just install it from the AUR and do the following (not as root):<br />
<br />
* {{Codeline|$ mkdir ~/.mpdscribble}}<br />
* Create the file {{Filename|~/.mpdscribble/mpdscribble.conf}} and add the following:<br />
username = <your last.fm username><br />
password = <md5 sum of your last.fm password> # Generated using "echo -n password | md5sum"<br />
host = <your mpd host> # defaults to $MPD_HOST or localhost<br />
port = <your mpd port> # defaults to $MPD_PORT or 6600<br />
log = ~/.mpdscribble/mpdscribble.log<br />
journal = ~/.mpdscribble/mpdscribble.cache<br />
verbose = 2<br />
sleep = 1<br />
musicdir = <your music directory><br />
* Add {{Codeline|mpdscribble}} to your {{Filename|~/.xinitrc}}.<br />
<br />
====Sonata====<br />
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.<br />
<br />
====lastfmsubmitd====<br />
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}}.<br />
<br />
===Last.fm playback with lastfmproxy===<br />
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.<br />
<br />
{{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.}}<br />
<br />
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.<br />
<br />
=== Never play on start ===<br />
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:<br />
'' ...''<br />
'' stat_busy "Starting Music Player Daemon"''<br />
<br />
# always start in paused state<br />
awk '/^state_file[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
sfile = substr($0, RSTART + 1, RLENGTH - 2)<br />
} /^user[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
user = substr($0, RSTART + 1, RLENGTH - 2)<br />
} END {<br />
if (sfile == "")<br />
exit;<br />
if (user != "")<br />
sub(/^~/, "/home/" user, sfile)<br />
system("sed -i \x27s|^\\(state:[ \\t]\\{1,\\}\\)play$|\\1pause|\x27 \x27" sfile "\x27")<br />
}' /etc/mpd.conf<br />
<br />
'' /usr/bin/mpd /etc/mpd.conf &> /dev/null''<br />
'' ...''<br />
<br />
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}}:<br />
NoUpgrade = etc/rc.d/mpd<br />
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).<br />
<br />
=== MPD & Alsa ===<br />
<br />
Sometimes, when you use other audio output, e.g: some web pages containing Flash applets, mpd cannot reproduce anything anymore (until you restart). The error looks something like: (if you search the file {{Filename|/var/log/mpd/mpd.error}})<br />
<br />
Error opening alsa device "hw:0,0": Device or resource busy<br />
<br />
And here is the solution (dmix saving our life again). Apply these lines in your {{Filename|/etc/mpd.conf}}:<br />
<br />
<pre><br />
audio_output {<br />
type "alsa"<br />
name "Sound Card"<br />
options "dev=dmixer"<br />
device "plug:dmix"<br />
}<br />
</pre><br />
<br />
And then restart with {{Codeline|/etc/rc.d/mpd restart}}.<br />
<br />
Searching on Internet I found the reason for why that happens in Gentoo's wiki:<br />
* The sound card does not support hardware mixing (uses '''dmix''' plugin)<br />
* An application does not work with ALSA with it's default settings<br />
<br />
====High CPU usage with ALSA====<br />
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.<br />
<br />
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}}.<br />
<br />
Example from {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
auto_resample "no"<br />
}<br />
<br />
Some users might also want to tell dmix to use 44kHz as well. More info about tuning performance of your MPD can be found from: [http://mpd.wikia.com/wiki/Tuning MPD wiki]<br />
<br />
=== Control mpd with lirc ===<br />
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.<br />
<br />
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.<br />
<br />
First of all, please setup your remotes as referred to the '''[[Lirc]]''' article.<br />
<br />
Edit your favored lirc startup configuration file, default location is {{Filename|~/.lircrc}}.<br />
<br />
Fill the file with the following pattern:<br />
<br />
begin<br />
prog = irexec<br />
button = <button_name><br />
config = <command_to_run><br />
repeat = <0 or 1><br />
end<br />
<br />
An useful example:<br />
<br />
## irexec<br />
begin<br />
prog = irexec<br />
button = play_pause<br />
config = mpc toggle<br />
repeat = 0<br />
end<br />
<br />
begin<br />
prog = irexec<br />
button = stop<br />
config = mpc stop<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = previous<br />
config = mpc prev<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = next<br />
config = mpc next<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = volup<br />
config = mpc volume +2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = voldown<br />
config = mpc volume -2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = pbc<br />
config = mpc random<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = pdvd<br />
config = mpc update<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = right<br />
config = mpc seek +00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = left<br />
config = mpc seek -00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = up<br />
config = mpc seek +1%<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = down<br />
config = mpc seek -1%<br />
repeat = 0<br />
end<br />
<br />
There are more functions for mpc, run {{Codeline|man mpc}} for more info.<br />
<br />
=== Control mpd with bluetooth phone ===<br />
You can also control mpd (to a certain extent) using a bluetooth enabled phone. You need to do the following:<br />
<br />
* install [http://remuco.sourceforge.net/index.php/Remuco remuco] -- a wireless remote control for several Linux media players ([http://aur.archlinux.org/packages.php?ID=25072 aur])<br />
* transfer remuco client -- jar/jad files from {{Filename|/usr/share/remuco/client/}} to your phone and install it<br />
* run {{Codeline|remuco-mpd}} (as current user)<br />
* run remuco on your phone, define a new bluetooth remuco connection (pair first if you haven't done this previously) and explore its capabilities<br />
<br />
More information about remuco including troubleshooting to be found at its [http://remuco.sourceforge.net/index.php/Remuco homepage]<br />
<br />
=== MPD & PulseAudio ===<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
# gpasswd -a mpd pulse-access<br />
# gpasswd -a mpd pulse-rt<br />
<br />
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.<br />
<br />
==Troubleshooting==<br />
===mpd --create-db hangs===<br />
This is a common error that's caused by corrupt mp3 tags.<br />
Here is an experimental way to solve this issue.<br />
Requirements:<br />
* kid3<br />
* easytag<br />
<br />
This method is very tedious, expecially with a huge database. Just as a baseline it took 2.5h to fix a 16Gb DB.<br />
<br />
====Easy Tag====<br />
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.<br />
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.<br />
<br />
====KID3====<br />
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.<br />
<br />
Repeat this procedure until your music library is done.<br />
<br />
===Cannot connect to mpd: host "localhost" not found: Temporary failure in name resolution===<br />
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<br />
<br />
::1 localhost.localdomain localhost<br />
<br />
===Port 6600 already in use===<br />
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:<br />
<br />
$ mpd --kill<br />
$ mpd --create-db<br />
<br />
A more brute-force approach:<br />
<br />
$ killall mpd<br />
$ mpd --create-db<br />
<br />
{{Note| If you typically run mpd as root, you will need to run the above commands as root.}}<br />
<br />
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<br />
<br />
If port 6600 is tied up for some other reason, one can use the following command to find the offending process:<br />
<br />
# netstat -tulpan | grep 6600<br />
<br />
This will list IP:Port and the process name holding the connection (root privileges are required to see all processes).<br />
<br />
=== Crackling sound with some audio files ===<br />
<br />
This is usually a playback speed problem and can be fixed by uncommenting the audio_output_format line in:<br />
<br />
{{File|name=/etc/mpd.conf|content=<br />
audio_output_format "44100:16:2"}}<br />
<br />
This is usually a sane value for most mp3 files.<br />
<br />
==External links==<br />
<br />
* [http://www.musicpd.org/ Official Web Site]<br />
* [http://mpd.wikia.com/wiki/Main_Page Official Wiki]<br />
* [http://mpd.wikia.com/wiki/Clients Sorted List of MPD Clients]<br />
* [http://www.musicpd.org/forum/ MPD forum]</div>MGu3lhttps://wiki.archlinux.org/index.php?title=Music_Player_Daemon_(Espa%C3%B1ol)&diff=89038Music Player Daemon (Español)2009-12-27T08:05:03Z<p>MGu3l: </p>
<hr />
<div>[[Category: Audio/Video (Español)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|MPD}}<br />
{{i18n_entry|Français|MPD (Français)}}<br />
{{i18n_entry|Polski|mpd (polski)}}<br />
{{i18n_entry|Nederlands|Music Player Daemon (Nederlands)}}<br />
{{i18n_entry|Русский|MPD - Music Player Daemon (Русский)}}<br />
{{i18n_entry|简体中文|MPD(简体中文)}}<br />
{{i18n_entry|Türkçe|MPD (Türkçe)}}<br />
{{i18n_entry|Español|MPD (Español)}}<br />
{{i18n_links_end}}<br />
<br />
<br />
{{stub}}<br />
==¿Qué es MPD?==<br />
'''MPD''' (Music Player Daemon) es un reproductor de audio que maneja una arquitectura servidor-cliente. mpd se ejecuta en el fondo como un daemon, gestiona listas de reproducción y una base de datos, y hace uso de muy pocos recursos. Para hacer uso de una interfaz gráfica, es necesario un cliente adicional. Más información puede obtenerse en su [http://www.musicpd.org/ página web].<br />
<br />
==Procedimiento de Instalación del Daemon==<br />
<br />
Actualice e instale con pacman:<br />
# pacman -S mpd<br />
<br />
Ahora, añada el usuario mpd al grupo users:<br />
# gpasswd -a mpd users<br />
<br />
==Instrucciones de Configuración ==<br />
<br />
Para más información de la configuración de mpd, por favor visite http://mpd.wikia.com/wiki/Configuration<br />
<br />
===Linea de Tiempo del comportamiento habitual de mpd===<br />
* mpd es iniciado al cargar el sistema operativo por medio de {{Filename|/etc/rc.conf}}, incluyéndole en el apartado DAEMONS. (O, esto puede ser hecho manualmente ejecutando {{Codeline|/etc/rc.d/mpd start}} con privilegios de root).<br />
* Al ser iniciado mpd como root, leerá el archivo {{Filename|/etc/mpd.conf}}.<br />
* mpd lee la variable usuario en el archivo {{Filename|/etc/mpd.conf}}, y cambia de root a este usuario.<br />
* mpd continúa leyendo el contenido del archivo {{Filename|/etc/mpd.conf}} y se configura de acuerdo a este.<br />
<br />
Recuerde que mpd cambia el usuario de root a aquel mencionado en el archivo {{Filename|/etc/mpd.conf}}. Siendo asi, el uso de "~" en el archivo de configuracion hace referencia al directorio home del usuario, y no al directorio de root. Podria ser de utilidad cambiar todos los "~" a "/home/username" para prevenir cualquier confusion sobre este aspecto del comportamineto de mpd.<br />
<br />
===Un Archivo de Configuracion Limpio===<br />
<br />
* Como root, verifique si {{Filename|/etc/mpd.conf}} existe y elimine el archivo en caso de que exista. Esto es hecho por seguridad.<br />
<br />
Mpd viene con un ejemplo del archivo de configuracion, disponible en {{Filename|/etc/mpd.conf.example}}. Este archivo contiene abundante informacion acerca de la configuracion de mpd, y contiene valores predeterminados para el mixer, que simplemente pueden ser descomentados.<br />
<br />
* Como root, copie este archivo de ejemplo a {{Filename|/etc/mpd.conf}}.<br />
# cp /etc/mpd.conf.example /etc/mpd.conf<br />
<br />
Nunca ponga este archivo en su directorio home como algunos tutoriales sugieren. Esto podria complicarlo todo, y la mayoria de las veces no tendra ningun sentido (recuerde que esta es una guia corta de instalacion y configuracion). Si creó con anterioridad un archivo {{Filename|.mpdconf}} en su directorio home, eliminelo ahora. Esto es importante para evitar conflictos. Cuando está ubicado en /etc, como se indica aqui, mpd podra ser ejecutado como daemon al inicio. De otro modo, un script sería necesario para ejecutar mpd LUEGO de que el usuario inicie sesion (Como kdm o ~/.fluxbox/startup), o tambien sera necesario una ejecucion manual. Para una coleccion musical unica, el metodo utilizado aqui es mejor, aún si la coleccion es compartida entre multiples usuarios. Además, no se preocupe por los privilegios de root: aunque mpd es ejecutado como daemon, nunca lo hace completamente como root puesto que automaticamente pierde sus privilegios luego de ser ejecutado.<br />
<br />
===Sound Setup Correctly===<br />
<br />
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.<br />
<br />
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.<br />
<br />
===Editing {{Filename|mpd.conf}}===<br />
<br />
To edit the file, as root:<br />
# YOUREDITOR /etc/mpd.conf<br />
<br />
'''Keeps the setup in /var and uses "mpd" as default user instead of cluttering up ~/. This is the way the arch package is installed.'''<br />
<br />
Edit {{Filename|/etc/mpd.conf}} to reflect as such.<br />
<br />
music_directory "/home/user/music" # Your music dir.<br />
playlist_directory "/var/lib/mpd/playlists"<br />
db_file "/var/lib/mpd/db"<br />
log_file "/var/log/mpd/mpd.log"<br />
error_file "/var/log/mpd/mpd.error"<br />
pid_file "/var/run/mpd/mpd.pid"<br />
state_file "/var/lib/mpd/mpdstate"<br />
user "mpd"<br />
# Binding to address and port causing problems in mpd-0.14.2 best to leave<br />
# commented.<br />
# bind_to_address "127.0.0.1"<br />
# port "6600"<br />
<br />
Read steps below carefully, permissions need to be set correctly.<br />
<br />
* Keep user as "mpd", double check to make sure user "mpd" home directory is set to /var/lib/mpd <br />
$ cat /etc/passwd | grep mpd<br />
* Also make sure /var/lib/mpd is owned by mpd:mpd.<br />
$ ls -l /var/lib/ | grep mpd<br />
* 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.<br />
# touch /var/lib/mpd/db<br />
# touch /var/lib/mpd/mpdstate<br />
# touch /var/run/mpd/mpd.pid<br />
# touch /var/log/mpd/mpd.log<br />
# touch /var/log/mpd/mpd.error<br />
* Now change the ownership of the directories and files you created to user "mpd"<br />
# chown -R mpd:mpd /var/{lib,run,log}/mpd<br />
* 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. <br />
* 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'. <br />
**The previous method, creating the mpd database as root (# mpd --create-db), is deprecated.<br />
<br />
== Alternative Setup ==<br />
<br />
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: <br />
# You can easily have a single directory ~/.mpd (or any other directory under /home/username) for all MPD configuration files<br />
# No read/write permission errors<br />
# More flexible calls to MPD by using {{Filename|~/.xinitrc}} instead of including 'mpd' in the {{Filename|/etc/rc.conf}} DAEMONS array.<br />
<br />
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.<br />
<br />
* 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"}}.<br />
* Follow the 'old setup instructions' from above, ignoring the first part about copying the config to {{Filename|/etc/mpd.conf}}. <br />
* Create all of the requisite files in {{filename|"/home/user/.mpd/"}}:<br />
"~/.mpd/playlists"<br />
"~/.mpd/db"<br />
"~/.mpd/mpd.log"<br />
"~/.mpd/mpd.error"<br />
"~/.mpd/mpd.pid"<br />
"~/.mpd/mpdstate"<br />
* Let MPD start on bootup by calling it from your {{Filename|~/.xinitrc}} as follows:<br />
# this starts mpd as normal user<br />
mpd /home/username/.mpd/config<br />
{{Note| that you don't have to put a "&" at the end of the line here, since MPD will automatically daemonize itself.}}<br />
<br />
Lastly, delete the entry 'mpd' from your DAEMONS array in {{Filename|/etc/rc.conf}}, as you are not running it as root anymore.<br />
<br />
===Multi-MPD Setup===<br />
'''Useful if you you want to run for example an icecast server.'''<br />
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).<br />
<br />
==Troubleshooting==<br />
<br />
=== Autodetection failed ===<br />
<br />
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:<br />
<br />
Example for alsa output type:<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
device "hw:0,0" # optional<br />
format "44100:16:2" # optional<br />
}<br />
<br />
Example for alsa mixer:<br />
mixer_type "alsa"<br />
mixer_device "default"<br />
mixer_control "PCM"<br />
<br />
'''Note:''' in case of permission problems when using ESD with mpd run this as root:<br />
# chsh -s /bin/true mpd<br />
<br />
=== Executable Permissions ===<br />
<br />
{{Warning|This is not good security practice and may be unnecessary.}}<br />
<br />
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. <br />
# chmod a+x /home/user<br />
# chmod -R a+X /home/user/music<br />
<br />
==== Alternative solution ====<br />
<br />
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.<br />
# chmod -R g-rwx /home/user<br />
# chmod g+rx /home/user<br />
# chmod -R g+rX /home/user/music<br />
<br />
===Tips===<br />
<br />
To get rid of timeouts (i.e. when you paused music for long time) in gpmc and other clients uncomment and increase {{Codeline|connection_timeout}} option in {{Filename|mpd.conf}}.<br />
<br />
If files and/or titles are shown in wrong encoding, uncomment and change {{Codeline|filesystem_charset}} and {{Codeline|id3v1_encoding}} options.<br />
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].<br />
<br />
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.<br />
<br />
'''Streaming'''<br />
<br />
With the latest version of mpd (0.15), built-in httpd streaming is now available.<br />
<br />
To activate this feature, you'll just need to add a new output of type httpd in {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "httpd"<br />
name "What you want"<br />
encoder "lame" # vorbis or lame supported<br />
port "8000"<br />
bitrate "128"<br />
format "44100:16:2" # change 2 to 1 for mono<br />
}<br />
<br />
Restart the mpd deamon and, from another computer, simply load the stream as any other url. <br />
<br />
mplayer http://<server's IP>:8000<br />
<br />
Most players (i.e. vlc or xmms2) should also be able to load the stream via their "add url..." menu option.<br />
<br />
This is a nice clean way to replace your current icecast setup with something natively supported within MPD.<br />
<br />
==Client Install Procedure==<br />
<br />
Install a client program for mpd. Popular options are:<br />
<br />
* '''mpc''' &ndash; Command Line Client (you'll probably want this one no matter what)<br />
* '''ncmpc''' &ndash; NCurses Client (this one is very handy for running in a console) [http://hem.bredband.net/kaw/ncmpc/ Official Website of ncmpc]<br />
* '''ncmpcpp''' &ndash; Clone of ncmpc with some new features written in C++ [http://unkart.ovh.org/ncmpcpp/ Official website of ncmpcpp]<br />
* '''pms''' &ndash; NCurses Client (highly configurable and accessible) [http://pms.sourceforge.net/ Sourceforge Website of pms]<br />
* '''ario''' &ndash; GTK+ Client with a Rhythmbox like library browser [http://ario-player.sourceforge.net Official Website of Ario]<br />
* '''sonata''' &ndash; Python GTK+ Client [http://sonata.berlios.de/ Official Website of Sonata]<br />
* '''gmpc''' &ndash; GNOME Client [http://gmpcwiki.sarine.nl/index.php?title=GMPC Official Website of gmpc]<br />
* '''QMPDClient''' &ndash; Client written with Qt 4.x. [http://bitcheese.net/wiki/QMPDClient Official Website of QMPDClient]<br />
<br />
Install with:<br />
# pacman -Sy mpc<br />
# pacman -Sy ncmpc<br />
# pacman -Sy ncmpcpp<br />
# pacman -Sy pms<br />
# pacman -Sy ario<br />
# pacman -Sy sonata<br />
# pacman -Sy gmpc<br />
# pacman -Sy qmpdclient<br />
<br />
==Extra stuff==<br />
<br />
===Last.fm scrobbling===<br />
<br />
To scrobble your songs to [http://www.last.fm Last.fm] using MPD there are several alternatives.<br />
<br />
====mpdscribble====<br />
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.<br />
<br />
To install mpdscribble, just install it from the AUR and do the following (not as root):<br />
<br />
* {{Codeline|$ mkdir ~/.mpdscribble}}<br />
* Create the file {{Filename|~/.mpdscribble/mpdscribble.conf}} and add the following:<br />
username = <your last.fm username><br />
password = <md5 sum of your last.fm password> # Generated using "echo -n password | md5sum"<br />
host = <your mpd host> # defaults to $MPD_HOST or localhost<br />
port = <your mpd port> # defaults to $MPD_PORT or 6600<br />
log = ~/.mpdscribble/mpdscribble.log<br />
journal = ~/.mpdscribble/mpdscribble.cache<br />
verbose = 2<br />
sleep = 1<br />
musicdir = <your music directory><br />
* Add {{Codeline|mpdscribble}} to your {{Filename|~/.xinitrc}}.<br />
<br />
====Sonata====<br />
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.<br />
<br />
====lastfmsubmitd====<br />
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}}.<br />
<br />
===Last.fm playback with lastfmproxy===<br />
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.<br />
<br />
{{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.}}<br />
<br />
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.<br />
<br />
=== Never play on start ===<br />
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:<br />
'' ...''<br />
'' stat_busy "Starting Music Player Daemon"''<br />
<br />
# always start in paused state<br />
awk '/^state_file[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
sfile = substr($0, RSTART + 1, RLENGTH - 2)<br />
} /^user[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
user = substr($0, RSTART + 1, RLENGTH - 2)<br />
} END {<br />
if (sfile == "")<br />
exit;<br />
if (user != "")<br />
sub(/^~/, "/home/" user, sfile)<br />
system("sed -i \x27s|^\\(state:[ \\t]\\{1,\\}\\)play$|\\1pause|\x27 \x27" sfile "\x27")<br />
}' /etc/mpd.conf<br />
<br />
'' /usr/bin/mpd /etc/mpd.conf &> /dev/null''<br />
'' ...''<br />
<br />
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}}:<br />
NoUpgrade = etc/rc.d/mpd<br />
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).<br />
<br />
=== MPD & Alsa ===<br />
<br />
Sometimes, when you use other audio output, e.g: some web pages containing Flash applets, mpd cannot reproduce anything anymore (until you restart). The error looks something like: (if you search the file {{Filename|/var/log/mpd/mpd.error}})<br />
<br />
Error opening alsa device "hw:0,0": Device or resource busy<br />
<br />
And here is the solution (dmix saving our life again). Apply these lines in your {{Filename|/etc/mpd.conf}}:<br />
<br />
<pre><br />
audio_output {<br />
type "alsa"<br />
name "Sound Card"<br />
options "dev=dmixer"<br />
device "plug:dmix"<br />
}<br />
</pre><br />
<br />
And then restart with {{Codeline|/etc/rc.d/mpd restart}}.<br />
<br />
Searching on Internet I found the reason for why that happens in Gentoo's wiki:<br />
* The sound card does not support hardware mixing (uses '''dmix''' plugin)<br />
* An application does not work with ALSA with it's default settings<br />
<br />
====High CPU usage with ALSA====<br />
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.<br />
<br />
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}}.<br />
<br />
Example from {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
auto_resample "no"<br />
}<br />
<br />
Some users might also want to tell dmix to use 44kHz as well. More info about tuning performance of your MPD can be found from: [http://mpd.wikia.com/wiki/Tuning MPD wiki]<br />
<br />
=== Control mpd with lirc ===<br />
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.<br />
<br />
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.<br />
<br />
First of all, please setup your remotes as referred to the '''[[Lirc]]''' article.<br />
<br />
Edit your favored lirc startup configuration file, default location is {{Filename|~/.lircrc}}.<br />
<br />
Fill the file with the following pattern:<br />
<br />
begin<br />
prog = irexec<br />
button = <button_name><br />
config = <command_to_run><br />
repeat = <0 or 1><br />
end<br />
<br />
An useful example:<br />
<br />
## irexec<br />
begin<br />
prog = irexec<br />
button = play_pause<br />
config = mpc toggle<br />
repeat = 0<br />
end<br />
<br />
begin<br />
prog = irexec<br />
button = stop<br />
config = mpc stop<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = previous<br />
config = mpc prev<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = next<br />
config = mpc next<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = volup<br />
config = mpc volume +2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = voldown<br />
config = mpc volume -2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = pbc<br />
config = mpc random<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = pdvd<br />
config = mpc update<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = right<br />
config = mpc seek +00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = left<br />
config = mpc seek -00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = up<br />
config = mpc seek +1%<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = down<br />
config = mpc seek -1%<br />
repeat = 0<br />
end<br />
<br />
There are more functions for mpc, run {{Codeline|man mpc}} for more info.<br />
<br />
=== Control mpd with bluetooth phone ===<br />
You can also control mpd (to a certain extent) using a bluetooth enabled phone. You need to do the following:<br />
<br />
* install [http://remuco.sourceforge.net/index.php/Remuco remuco] -- a wireless remote control for several Linux media players ([http://aur.archlinux.org/packages.php?ID=25072 aur])<br />
* transfer remuco client -- jar/jad files from {{Filename|/usr/share/remuco/client/}} to your phone and install it<br />
* run {{Codeline|remuco-mpd}} (as current user)<br />
* run remuco on your phone, define a new bluetooth remuco connection (pair first if you haven't done this previously) and explore its capabilities<br />
<br />
More information about remuco including troubleshooting to be found at its [http://remuco.sourceforge.net/index.php/Remuco homepage]<br />
<br />
=== MPD & PulseAudio ===<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
# gpasswd -a mpd pulse-access<br />
# gpasswd -a mpd pulse-rt<br />
<br />
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.<br />
<br />
==Troubleshooting==<br />
===mpd --create-db hangs===<br />
This is a common error that's caused by corrupt mp3 tags.<br />
Here is an experimental way to solve this issue.<br />
Requirements:<br />
* kid3<br />
* easytag<br />
<br />
This method is very tedious, expecially with a huge database. Just as a baseline it took 2.5h to fix a 16Gb DB.<br />
<br />
====Easy Tag====<br />
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.<br />
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.<br />
<br />
====KID3====<br />
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.<br />
<br />
Repeat this procedure until your music library is done.<br />
<br />
===Cannot connect to mpd: host "localhost" not found: Temporary failure in name resolution===<br />
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<br />
<br />
::1 localhost.localdomain localhost<br />
<br />
===Port 6600 already in use===<br />
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:<br />
<br />
$ mpd --kill<br />
$ mpd --create-db<br />
<br />
A more brute-force approach:<br />
<br />
$ killall mpd<br />
$ mpd --create-db<br />
<br />
{{Note| If you typically run mpd as root, you will need to run the above commands as root.}}<br />
<br />
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<br />
<br />
If port 6600 is tied up for some other reason, one can use the following command to find the offending process:<br />
<br />
# netstat -tulpan | grep 6600<br />
<br />
This will list IP:Port and the process name holding the connection (root privileges are required to see all processes).<br />
<br />
=== Crackling sound with some audio files ===<br />
<br />
This is usually a playback speed problem and can be fixed by uncommenting the audio_output_format line in:<br />
<br />
{{File|name=/etc/mpd.conf|content=<br />
audio_output_format "44100:16:2"}}<br />
<br />
This is usually a sane value for most mp3 files.<br />
<br />
==External links==<br />
<br />
* [http://www.musicpd.org/ Official Web Site]<br />
* [http://mpd.wikia.com/wiki/Main_Page Official Wiki]<br />
* [http://mpd.wikia.com/wiki/Clients Sorted List of MPD Clients]<br />
* [http://www.musicpd.org/forum/ MPD forum]</div>MGu3lhttps://wiki.archlinux.org/index.php?title=Music_Player_Daemon_(Espa%C3%B1ol)&diff=89037Music Player Daemon (Español)2009-12-27T08:01:57Z<p>MGu3l: </p>
<hr />
<div>[[Category: Audio/Video (Español)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|MPD}}<br />
{{i18n_entry|Français|MPD (Français)}}<br />
{{i18n_entry|Polski|mpd (polski)}}<br />
{{i18n_entry|Nederlands|Music Player Daemon (Nederlands)}}<br />
{{i18n_entry|Русский|MPD - Music Player Daemon (Русский)}}<br />
{{i18n_entry|简体中文|MPD(简体中文)}}<br />
{{i18n_entry|Türkçe|MPD (Türkçe)}}<br />
{{i18n_entry|Español|MPD (Español)}}<br />
{{i18n_links_end}}<br />
<br />
==¿Qué es MPD?==<br />
'''MPD''' (Music Player Daemon) es un reproductor de audio que maneja una arquitectura servidor-cliente. mpd se ejecuta en el fondo como un daemon, gestiona listas de reproducción y una base de datos, y hace uso de muy pocos recursos. Para hacer uso de una interfaz gráfica, es necesario un cliente adicional. Más información puede obtenerse en su [http://www.musicpd.org/ página web].<br />
<br />
==Procedimiento de Instalación del Daemon==<br />
<br />
Actualice e instale con pacman:<br />
# pacman -S mpd<br />
<br />
Ahora, añada el usuario mpd al grupo users:<br />
# gpasswd -a mpd users<br />
<br />
==Instrucciones de Configuración ==<br />
<br />
Para más información de la configuración de mpd, por favor visite http://mpd.wikia.com/wiki/Configuration<br />
<br />
===Linea de Tiempo del comportamiento habitual de mpd===<br />
* mpd es iniciado al cargar el sistema operativo por medio de {{Filename|/etc/rc.conf}}, incluyéndole en el apartado DAEMONS. (O, esto puede ser hecho manualmente ejecutando {{Codeline|/etc/rc.d/mpd start}} con privilegios de root).<br />
* Al ser iniciado mpd como root, leerá el archivo {{Filename|/etc/mpd.conf}}.<br />
* mpd lee la variable usuario en el archivo {{Filename|/etc/mpd.conf}}, y cambia de root a este usuario.<br />
* mpd continúa leyendo el contenido del archivo {{Filename|/etc/mpd.conf}} y se configura de acuerdo a este.<br />
<br />
Recuerde que mpd cambia el usuario de root a aquel mencionado en el archivo {{Filename|/etc/mpd.conf}}. Siendo asi, el uso de "~" en el archivo de configuracion hace referencia al directorio home del usuario, y no al directorio de root. Podria ser de utilidad cambiar todos los "~" a "/home/username" para prevenir cualquier confusion sobre este aspecto del comportamineto de mpd.<br />
<br />
===Un Archivo de Configuracion Limpio===<br />
<br />
* Como root, verifique si {{Filename|/etc/mpd.conf}} existe y elimine el archivo en caso de que exista. Esto es hecho por seguridad.<br />
<br />
Mpd viene con un ejemplo del archivo de configuracion, disponible en {{Filename|/etc/mpd.conf.example}}. Este archivo contiene abundante informacion acerca de la configuracion de mpd, y contiene valores predeterminados para el mixer, que simplemente pueden ser descomentados.<br />
<br />
* Como root, copie este archivo de ejemplo a {{Filename|/etc/mpd.conf}}.<br />
# cp /etc/mpd.conf.example /etc/mpd.conf<br />
<br />
Nunca ponga este archivo en su directorio home como algunos tutoriales sugieren. Esto podria complicarlo todo, y la mayoria de las veces no tendra ningun sentido (recuerde que esta es una guia corta de instalacion y configuracion). Si creó con anterioridad un archivo {{Filename|.mpdconf}} en su directorio home, eliminelo ahora. Esto es importante para evitar conflictos. Cuando está ubicado en /etc, como se indica aqui, mpd podra ser ejecutado como daemon al inicio. De otro modo, un script sería necesario para ejecutar mpd LUEGO de que el usuario inicie sesion (Como kdm o ~/.fluxbox/startup), o tambien sera necesario una ejecucion manual. Para una coleccion musical unica, el metodo utilizado aqui es mejor, aún si la coleccion es compartida entre multiples usuarios. Además, no se preocupe por los privilegios de root: aunque mpd es ejecutado como daemon, nunca lo hace completamente como root puesto que automaticamente pierde sus privilegios luego de ser ejecutado.<br />
<br />
===Sound Setup Correctly===<br />
<br />
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.<br />
<br />
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.<br />
<br />
===Editing {{Filename|mpd.conf}}===<br />
<br />
To edit the file, as root:<br />
# YOUREDITOR /etc/mpd.conf<br />
<br />
'''Keeps the setup in /var and uses "mpd" as default user instead of cluttering up ~/. This is the way the arch package is installed.'''<br />
<br />
Edit {{Filename|/etc/mpd.conf}} to reflect as such.<br />
<br />
music_directory "/home/user/music" # Your music dir.<br />
playlist_directory "/var/lib/mpd/playlists"<br />
db_file "/var/lib/mpd/db"<br />
log_file "/var/log/mpd/mpd.log"<br />
error_file "/var/log/mpd/mpd.error"<br />
pid_file "/var/run/mpd/mpd.pid"<br />
state_file "/var/lib/mpd/mpdstate"<br />
user "mpd"<br />
# Binding to address and port causing problems in mpd-0.14.2 best to leave<br />
# commented.<br />
# bind_to_address "127.0.0.1"<br />
# port "6600"<br />
<br />
Read steps below carefully, permissions need to be set correctly.<br />
<br />
* Keep user as "mpd", double check to make sure user "mpd" home directory is set to /var/lib/mpd <br />
$ cat /etc/passwd | grep mpd<br />
* Also make sure /var/lib/mpd is owned by mpd:mpd.<br />
$ ls -l /var/lib/ | grep mpd<br />
* 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.<br />
# touch /var/lib/mpd/db<br />
# touch /var/lib/mpd/mpdstate<br />
# touch /var/run/mpd/mpd.pid<br />
# touch /var/log/mpd/mpd.log<br />
# touch /var/log/mpd/mpd.error<br />
* Now change the ownership of the directories and files you created to user "mpd"<br />
# chown -R mpd:mpd /var/{lib,run,log}/mpd<br />
* 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. <br />
* 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'. <br />
**The previous method, creating the mpd database as root (# mpd --create-db), is deprecated.<br />
<br />
== Alternative Setup ==<br />
<br />
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: <br />
# You can easily have a single directory ~/.mpd (or any other directory under /home/username) for all MPD configuration files<br />
# No read/write permission errors<br />
# More flexible calls to MPD by using {{Filename|~/.xinitrc}} instead of including 'mpd' in the {{Filename|/etc/rc.conf}} DAEMONS array.<br />
<br />
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.<br />
<br />
* 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"}}.<br />
* Follow the 'old setup instructions' from above, ignoring the first part about copying the config to {{Filename|/etc/mpd.conf}}. <br />
* Create all of the requisite files in {{filename|"/home/user/.mpd/"}}:<br />
"~/.mpd/playlists"<br />
"~/.mpd/db"<br />
"~/.mpd/mpd.log"<br />
"~/.mpd/mpd.error"<br />
"~/.mpd/mpd.pid"<br />
"~/.mpd/mpdstate"<br />
* Let MPD start on bootup by calling it from your {{Filename|~/.xinitrc}} as follows:<br />
# this starts mpd as normal user<br />
mpd /home/username/.mpd/config<br />
{{Note| that you don't have to put a "&" at the end of the line here, since MPD will automatically daemonize itself.}}<br />
<br />
Lastly, delete the entry 'mpd' from your DAEMONS array in {{Filename|/etc/rc.conf}}, as you are not running it as root anymore.<br />
<br />
===Multi-MPD Setup===<br />
'''Useful if you you want to run for example an icecast server.'''<br />
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).<br />
<br />
==Troubleshooting==<br />
<br />
=== Autodetection failed ===<br />
<br />
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:<br />
<br />
Example for alsa output type:<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
device "hw:0,0" # optional<br />
format "44100:16:2" # optional<br />
}<br />
<br />
Example for alsa mixer:<br />
mixer_type "alsa"<br />
mixer_device "default"<br />
mixer_control "PCM"<br />
<br />
'''Note:''' in case of permission problems when using ESD with mpd run this as root:<br />
# chsh -s /bin/true mpd<br />
<br />
=== Executable Permissions ===<br />
<br />
{{Warning|This is not good security practice and may be unnecessary.}}<br />
<br />
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. <br />
# chmod a+x /home/user<br />
# chmod -R a+X /home/user/music<br />
<br />
==== Alternative solution ====<br />
<br />
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.<br />
# chmod -R g-rwx /home/user<br />
# chmod g+rx /home/user<br />
# chmod -R g+rX /home/user/music<br />
<br />
===Tips===<br />
<br />
To get rid of timeouts (i.e. when you paused music for long time) in gpmc and other clients uncomment and increase {{Codeline|connection_timeout}} option in {{Filename|mpd.conf}}.<br />
<br />
If files and/or titles are shown in wrong encoding, uncomment and change {{Codeline|filesystem_charset}} and {{Codeline|id3v1_encoding}} options.<br />
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].<br />
<br />
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.<br />
<br />
'''Streaming'''<br />
<br />
With the latest version of mpd (0.15), built-in httpd streaming is now available.<br />
<br />
To activate this feature, you'll just need to add a new output of type httpd in {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "httpd"<br />
name "What you want"<br />
encoder "lame" # vorbis or lame supported<br />
port "8000"<br />
bitrate "128"<br />
format "44100:16:2" # change 2 to 1 for mono<br />
}<br />
<br />
Restart the mpd deamon and, from another computer, simply load the stream as any other url. <br />
<br />
mplayer http://<server's IP>:8000<br />
<br />
Most players (i.e. vlc or xmms2) should also be able to load the stream via their "add url..." menu option.<br />
<br />
This is a nice clean way to replace your current icecast setup with something natively supported within MPD.<br />
<br />
==Client Install Procedure==<br />
<br />
Install a client program for mpd. Popular options are:<br />
<br />
* '''mpc''' &ndash; Command Line Client (you'll probably want this one no matter what)<br />
* '''ncmpc''' &ndash; NCurses Client (this one is very handy for running in a console) [http://hem.bredband.net/kaw/ncmpc/ Official Website of ncmpc]<br />
* '''ncmpcpp''' &ndash; Clone of ncmpc with some new features written in C++ [http://unkart.ovh.org/ncmpcpp/ Official website of ncmpcpp]<br />
* '''pms''' &ndash; NCurses Client (highly configurable and accessible) [http://pms.sourceforge.net/ Sourceforge Website of pms]<br />
* '''ario''' &ndash; GTK+ Client with a Rhythmbox like library browser [http://ario-player.sourceforge.net Official Website of Ario]<br />
* '''sonata''' &ndash; Python GTK+ Client [http://sonata.berlios.de/ Official Website of Sonata]<br />
* '''gmpc''' &ndash; GNOME Client [http://gmpcwiki.sarine.nl/index.php?title=GMPC Official Website of gmpc]<br />
* '''QMPDClient''' &ndash; Client written with Qt 4.x. [http://bitcheese.net/wiki/QMPDClient Official Website of QMPDClient]<br />
<br />
Install with:<br />
# pacman -Sy mpc<br />
# pacman -Sy ncmpc<br />
# pacman -Sy ncmpcpp<br />
# pacman -Sy pms<br />
# pacman -Sy ario<br />
# pacman -Sy sonata<br />
# pacman -Sy gmpc<br />
# pacman -Sy qmpdclient<br />
<br />
==Extra stuff==<br />
<br />
===Last.fm scrobbling===<br />
<br />
To scrobble your songs to [http://www.last.fm Last.fm] using MPD there are several alternatives.<br />
<br />
====mpdscribble====<br />
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.<br />
<br />
To install mpdscribble, just install it from the AUR and do the following (not as root):<br />
<br />
* {{Codeline|$ mkdir ~/.mpdscribble}}<br />
* Create the file {{Filename|~/.mpdscribble/mpdscribble.conf}} and add the following:<br />
username = <your last.fm username><br />
password = <md5 sum of your last.fm password> # Generated using "echo -n password | md5sum"<br />
host = <your mpd host> # defaults to $MPD_HOST or localhost<br />
port = <your mpd port> # defaults to $MPD_PORT or 6600<br />
log = ~/.mpdscribble/mpdscribble.log<br />
journal = ~/.mpdscribble/mpdscribble.cache<br />
verbose = 2<br />
sleep = 1<br />
musicdir = <your music directory><br />
* Add {{Codeline|mpdscribble}} to your {{Filename|~/.xinitrc}}.<br />
<br />
====Sonata====<br />
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.<br />
<br />
====lastfmsubmitd====<br />
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}}.<br />
<br />
===Last.fm playback with lastfmproxy===<br />
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.<br />
<br />
{{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.}}<br />
<br />
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.<br />
<br />
=== Never play on start ===<br />
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:<br />
'' ...''<br />
'' stat_busy "Starting Music Player Daemon"''<br />
<br />
# always start in paused state<br />
awk '/^state_file[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
sfile = substr($0, RSTART + 1, RLENGTH - 2)<br />
} /^user[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
user = substr($0, RSTART + 1, RLENGTH - 2)<br />
} END {<br />
if (sfile == "")<br />
exit;<br />
if (user != "")<br />
sub(/^~/, "/home/" user, sfile)<br />
system("sed -i \x27s|^\\(state:[ \\t]\\{1,\\}\\)play$|\\1pause|\x27 \x27" sfile "\x27")<br />
}' /etc/mpd.conf<br />
<br />
'' /usr/bin/mpd /etc/mpd.conf &> /dev/null''<br />
'' ...''<br />
<br />
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}}:<br />
NoUpgrade = etc/rc.d/mpd<br />
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).<br />
<br />
=== MPD & Alsa ===<br />
<br />
Sometimes, when you use other audio output, e.g: some web pages containing Flash applets, mpd cannot reproduce anything anymore (until you restart). The error looks something like: (if you search the file {{Filename|/var/log/mpd/mpd.error}})<br />
<br />
Error opening alsa device "hw:0,0": Device or resource busy<br />
<br />
And here is the solution (dmix saving our life again). Apply these lines in your {{Filename|/etc/mpd.conf}}:<br />
<br />
<pre><br />
audio_output {<br />
type "alsa"<br />
name "Sound Card"<br />
options "dev=dmixer"<br />
device "plug:dmix"<br />
}<br />
</pre><br />
<br />
And then restart with {{Codeline|/etc/rc.d/mpd restart}}.<br />
<br />
Searching on Internet I found the reason for why that happens in Gentoo's wiki:<br />
* The sound card does not support hardware mixing (uses '''dmix''' plugin)<br />
* An application does not work with ALSA with it's default settings<br />
<br />
====High CPU usage with ALSA====<br />
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.<br />
<br />
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}}.<br />
<br />
Example from {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
auto_resample "no"<br />
}<br />
<br />
Some users might also want to tell dmix to use 44kHz as well. More info about tuning performance of your MPD can be found from: [http://mpd.wikia.com/wiki/Tuning MPD wiki]<br />
<br />
=== Control mpd with lirc ===<br />
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.<br />
<br />
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.<br />
<br />
First of all, please setup your remotes as referred to the '''[[Lirc]]''' article.<br />
<br />
Edit your favored lirc startup configuration file, default location is {{Filename|~/.lircrc}}.<br />
<br />
Fill the file with the following pattern:<br />
<br />
begin<br />
prog = irexec<br />
button = <button_name><br />
config = <command_to_run><br />
repeat = <0 or 1><br />
end<br />
<br />
An useful example:<br />
<br />
## irexec<br />
begin<br />
prog = irexec<br />
button = play_pause<br />
config = mpc toggle<br />
repeat = 0<br />
end<br />
<br />
begin<br />
prog = irexec<br />
button = stop<br />
config = mpc stop<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = previous<br />
config = mpc prev<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = next<br />
config = mpc next<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = volup<br />
config = mpc volume +2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = voldown<br />
config = mpc volume -2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = pbc<br />
config = mpc random<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = pdvd<br />
config = mpc update<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = right<br />
config = mpc seek +00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = left<br />
config = mpc seek -00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = up<br />
config = mpc seek +1%<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = down<br />
config = mpc seek -1%<br />
repeat = 0<br />
end<br />
<br />
There are more functions for mpc, run {{Codeline|man mpc}} for more info.<br />
<br />
=== Control mpd with bluetooth phone ===<br />
You can also control mpd (to a certain extent) using a bluetooth enabled phone. You need to do the following:<br />
<br />
* install [http://remuco.sourceforge.net/index.php/Remuco remuco] -- a wireless remote control for several Linux media players ([http://aur.archlinux.org/packages.php?ID=25072 aur])<br />
* transfer remuco client -- jar/jad files from {{Filename|/usr/share/remuco/client/}} to your phone and install it<br />
* run {{Codeline|remuco-mpd}} (as current user)<br />
* run remuco on your phone, define a new bluetooth remuco connection (pair first if you haven't done this previously) and explore its capabilities<br />
<br />
More information about remuco including troubleshooting to be found at its [http://remuco.sourceforge.net/index.php/Remuco homepage]<br />
<br />
=== MPD & PulseAudio ===<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
# gpasswd -a mpd pulse-access<br />
# gpasswd -a mpd pulse-rt<br />
<br />
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.<br />
<br />
==Troubleshooting==<br />
===mpd --create-db hangs===<br />
This is a common error that's caused by corrupt mp3 tags.<br />
Here is an experimental way to solve this issue.<br />
Requirements:<br />
* kid3<br />
* easytag<br />
<br />
This method is very tedious, expecially with a huge database. Just as a baseline it took 2.5h to fix a 16Gb DB.<br />
<br />
====Easy Tag====<br />
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.<br />
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.<br />
<br />
====KID3====<br />
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.<br />
<br />
Repeat this procedure until your music library is done.<br />
<br />
===Cannot connect to mpd: host "localhost" not found: Temporary failure in name resolution===<br />
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<br />
<br />
::1 localhost.localdomain localhost<br />
<br />
===Port 6600 already in use===<br />
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:<br />
<br />
$ mpd --kill<br />
$ mpd --create-db<br />
<br />
A more brute-force approach:<br />
<br />
$ killall mpd<br />
$ mpd --create-db<br />
<br />
{{Note| If you typically run mpd as root, you will need to run the above commands as root.}}<br />
<br />
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<br />
<br />
If port 6600 is tied up for some other reason, one can use the following command to find the offending process:<br />
<br />
# netstat -tulpan | grep 6600<br />
<br />
This will list IP:Port and the process name holding the connection (root privileges are required to see all processes).<br />
<br />
=== Crackling sound with some audio files ===<br />
<br />
This is usually a playback speed problem and can be fixed by uncommenting the audio_output_format line in:<br />
<br />
{{File|name=/etc/mpd.conf|content=<br />
audio_output_format "44100:16:2"}}<br />
<br />
This is usually a sane value for most mp3 files.<br />
<br />
==External links==<br />
<br />
* [http://www.musicpd.org/ Official Web Site]<br />
* [http://mpd.wikia.com/wiki/Main_Page Official Wiki]<br />
* [http://mpd.wikia.com/wiki/Clients Sorted List of MPD Clients]<br />
* [http://www.musicpd.org/forum/ MPD forum]</div>MGu3lhttps://wiki.archlinux.org/index.php?title=Music_Player_Daemon_(Espa%C3%B1ol)&diff=89035Music Player Daemon (Español)2009-12-27T07:39:23Z<p>MGu3l: Created page with 'Category: Audio/Video (Español) {{i18n_links_start}} {{i18n_entry|English|MPD}} {{i18n_entry|Français|MPD (Français)}} {{i18n_entry|Polski|mpd (polski)}} {{i18n_entry|Nede…'</p>
<hr />
<div>[[Category: Audio/Video (Español)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|MPD}}<br />
{{i18n_entry|Français|MPD (Français)}}<br />
{{i18n_entry|Polski|mpd (polski)}}<br />
{{i18n_entry|Nederlands|Music Player Daemon (Nederlands)}}<br />
{{i18n_entry|Русский|MPD - Music Player Daemon (Русский)}}<br />
{{i18n_entry|简体中文|MPD(简体中文)}}<br />
{{i18n_entry|Türkçe|MPD (Türkçe)}}<br />
{{i18n_links_end}}<br />
<br />
==¿Qué es MPD?==<br />
'''MPD''' (Music Player Daemon) es un reproductor de audio que maneja una arquitectura servidor-cliente. mpd se ejecuta en el fondo como un daemon, gestiona listas de reproducción y una base de datos, y hace uso de muy pocos recursos. Para hacer uso de una interfaz gráfica, es necesario un cliente adicional. Más información puede obtenerse en su [http://www.musicpd.org/ página web]<br />
<br />
==Procedimiento de Instalación del Daemon==<br />
<br />
Actualice e instale con pacman:<br />
# pacman -S mpd<br />
<br />
Ahora, añada el usuario mpd al grupo users:<br />
# gpasswd -a mpd users<br />
<br />
==Instrucciones de Configuración ==<br />
<br />
Para más información de la configuración de mpd, por favor visite http://mpd.wikia.com/wiki/Configuration<br />
<br />
===Timeline of mpd's behavior on a typical working setup===<br />
* mpd is started on boot by {{Filename|/etc/rc.conf}}, by including it in the DAEMONS array. (Or, this can be done manually each session by running {{Codeline|/etc/rc.d/mpd start}} with root privileges).<br />
* Since mpd is now started as root, it first reads the {{Filename|/etc/mpd.conf}} file.<br />
* mpd reads the user variable in the {{Filename|/etc/mpd.conf}} file, and changes from root to this user.<br />
* mpd then reads the contents of the {{Filename|/etc/mpd.conf}} file and configures itself accordingly.<br />
<br />
Notice that mpd changes the running user from root to the one named in the {{Filename|/etc/mpd.conf}} file. This way, uses of "~" in the configuration file point correctly to the home user's directory, and not root's directory. It may be worthwhile to change all uses of "~" to "/home/username" to avoid any confusion over this aspect of mpd's behavior.<br />
<br />
===A Clean Configuration File===<br />
<br />
* As root, check if {{Filename|/etc/mpd.conf}} exists and delete the file if it does. This is safe.<br />
<br />
Mpd comes with an example configuration file, available at {{Filename|/etc/mpd.conf.example}}. This file holds an abundance of information on mpd configuration, and holds default mixer values you can simply uncomment.<br />
<br />
* As root, copy this example file to {{Filename|/etc/mpd.conf}}.<br />
# cp /etc/mpd.conf.example /etc/mpd.conf<br />
<br />
Never put this file in the user's directory like some tutorials suggest. This would complicate things and most of the time doing this is useless (notice you're reading a quick installation howto). If you previously created a {{Filename|.mpdconf}} file in your home, remove it now. This is important to prevent conflicts. When placing it in /etc, like we do here, mpd will be able to run as a daemon at boot. Otherwise, a script would be needed to run mpd AFTER the user has logged (like kdm or ~/.fluxbox/startup) or it would require a manual move each time. For a single music collection, the method used here is simply better, even while the collection is shared to multiple users. Also, don't be afraid about root privileges: even while mpd runs as a daemon, it never completely runs as root since it automatically drops its root privileges after execution.<br />
<br />
===Sound Setup Correctly===<br />
<br />
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.<br />
<br />
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.<br />
<br />
===Editing {{Filename|mpd.conf}}===<br />
<br />
To edit the file, as root:<br />
# YOUREDITOR /etc/mpd.conf<br />
<br />
'''Keeps the setup in /var and uses "mpd" as default user instead of cluttering up ~/. This is the way the arch package is installed.'''<br />
<br />
Edit {{Filename|/etc/mpd.conf}} to reflect as such.<br />
<br />
music_directory "/home/user/music" # Your music dir.<br />
playlist_directory "/var/lib/mpd/playlists"<br />
db_file "/var/lib/mpd/db"<br />
log_file "/var/log/mpd/mpd.log"<br />
error_file "/var/log/mpd/mpd.error"<br />
pid_file "/var/run/mpd/mpd.pid"<br />
state_file "/var/lib/mpd/mpdstate"<br />
user "mpd"<br />
# Binding to address and port causing problems in mpd-0.14.2 best to leave<br />
# commented.<br />
# bind_to_address "127.0.0.1"<br />
# port "6600"<br />
<br />
Read steps below carefully, permissions need to be set correctly.<br />
<br />
* Keep user as "mpd", double check to make sure user "mpd" home directory is set to /var/lib/mpd <br />
$ cat /etc/passwd | grep mpd<br />
* Also make sure /var/lib/mpd is owned by mpd:mpd.<br />
$ ls -l /var/lib/ | grep mpd<br />
* 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.<br />
# touch /var/lib/mpd/db<br />
# touch /var/lib/mpd/mpdstate<br />
# touch /var/run/mpd/mpd.pid<br />
# touch /var/log/mpd/mpd.log<br />
# touch /var/log/mpd/mpd.error<br />
* Now change the ownership of the directories and files you created to user "mpd"<br />
# chown -R mpd:mpd /var/{lib,run,log}/mpd<br />
* 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. <br />
* 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'. <br />
**The previous method, creating the mpd database as root (# mpd --create-db), is deprecated.<br />
<br />
== Alternative Setup ==<br />
<br />
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: <br />
# You can easily have a single directory ~/.mpd (or any other directory under /home/username) for all MPD configuration files<br />
# No read/write permission errors<br />
# More flexible calls to MPD by using {{Filename|~/.xinitrc}} instead of including 'mpd' in the {{Filename|/etc/rc.conf}} DAEMONS array.<br />
<br />
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.<br />
<br />
* 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"}}.<br />
* Follow the 'old setup instructions' from above, ignoring the first part about copying the config to {{Filename|/etc/mpd.conf}}. <br />
* Create all of the requisite files in {{filename|"/home/user/.mpd/"}}:<br />
"~/.mpd/playlists"<br />
"~/.mpd/db"<br />
"~/.mpd/mpd.log"<br />
"~/.mpd/mpd.error"<br />
"~/.mpd/mpd.pid"<br />
"~/.mpd/mpdstate"<br />
* Let MPD start on bootup by calling it from your {{Filename|~/.xinitrc}} as follows:<br />
# this starts mpd as normal user<br />
mpd /home/username/.mpd/config<br />
{{Note| that you don't have to put a "&" at the end of the line here, since MPD will automatically daemonize itself.}}<br />
<br />
Lastly, delete the entry 'mpd' from your DAEMONS array in {{Filename|/etc/rc.conf}}, as you are not running it as root anymore.<br />
<br />
===Multi-MPD Setup===<br />
'''Useful if you you want to run for example an icecast server.'''<br />
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).<br />
<br />
==Troubleshooting==<br />
<br />
=== Autodetection failed ===<br />
<br />
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:<br />
<br />
Example for alsa output type:<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
device "hw:0,0" # optional<br />
format "44100:16:2" # optional<br />
}<br />
<br />
Example for alsa mixer:<br />
mixer_type "alsa"<br />
mixer_device "default"<br />
mixer_control "PCM"<br />
<br />
'''Note:''' in case of permission problems when using ESD with mpd run this as root:<br />
# chsh -s /bin/true mpd<br />
<br />
=== Executable Permissions ===<br />
<br />
{{Warning|This is not good security practice and may be unnecessary.}}<br />
<br />
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. <br />
# chmod a+x /home/user<br />
# chmod -R a+X /home/user/music<br />
<br />
==== Alternative solution ====<br />
<br />
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.<br />
# chmod -R g-rwx /home/user<br />
# chmod g+rx /home/user<br />
# chmod -R g+rX /home/user/music<br />
<br />
===Tips===<br />
<br />
To get rid of timeouts (i.e. when you paused music for long time) in gpmc and other clients uncomment and increase {{Codeline|connection_timeout}} option in {{Filename|mpd.conf}}.<br />
<br />
If files and/or titles are shown in wrong encoding, uncomment and change {{Codeline|filesystem_charset}} and {{Codeline|id3v1_encoding}} options.<br />
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].<br />
<br />
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.<br />
<br />
'''Streaming'''<br />
<br />
With the latest version of mpd (0.15), built-in httpd streaming is now available.<br />
<br />
To activate this feature, you'll just need to add a new output of type httpd in {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "httpd"<br />
name "What you want"<br />
encoder "lame" # vorbis or lame supported<br />
port "8000"<br />
bitrate "128"<br />
format "44100:16:2" # change 2 to 1 for mono<br />
}<br />
<br />
Restart the mpd deamon and, from another computer, simply load the stream as any other url. <br />
<br />
mplayer http://<server's IP>:8000<br />
<br />
Most players (i.e. vlc or xmms2) should also be able to load the stream via their "add url..." menu option.<br />
<br />
This is a nice clean way to replace your current icecast setup with something natively supported within MPD.<br />
<br />
==Client Install Procedure==<br />
<br />
Install a client program for mpd. Popular options are:<br />
<br />
* '''mpc''' &ndash; Command Line Client (you'll probably want this one no matter what)<br />
* '''ncmpc''' &ndash; NCurses Client (this one is very handy for running in a console) [http://hem.bredband.net/kaw/ncmpc/ Official Website of ncmpc]<br />
* '''ncmpcpp''' &ndash; Clone of ncmpc with some new features written in C++ [http://unkart.ovh.org/ncmpcpp/ Official website of ncmpcpp]<br />
* '''pms''' &ndash; NCurses Client (highly configurable and accessible) [http://pms.sourceforge.net/ Sourceforge Website of pms]<br />
* '''ario''' &ndash; GTK+ Client with a Rhythmbox like library browser [http://ario-player.sourceforge.net Official Website of Ario]<br />
* '''sonata''' &ndash; Python GTK+ Client [http://sonata.berlios.de/ Official Website of Sonata]<br />
* '''gmpc''' &ndash; GNOME Client [http://gmpcwiki.sarine.nl/index.php?title=GMPC Official Website of gmpc]<br />
* '''QMPDClient''' &ndash; Client written with Qt 4.x. [http://bitcheese.net/wiki/QMPDClient Official Website of QMPDClient]<br />
<br />
Install with:<br />
# pacman -Sy mpc<br />
# pacman -Sy ncmpc<br />
# pacman -Sy ncmpcpp<br />
# pacman -Sy pms<br />
# pacman -Sy ario<br />
# pacman -Sy sonata<br />
# pacman -Sy gmpc<br />
# pacman -Sy qmpdclient<br />
<br />
==Extra stuff==<br />
<br />
===Last.fm scrobbling===<br />
<br />
To scrobble your songs to [http://www.last.fm Last.fm] using MPD there are several alternatives.<br />
<br />
====mpdscribble====<br />
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.<br />
<br />
To install mpdscribble, just install it from the AUR and do the following (not as root):<br />
<br />
* {{Codeline|$ mkdir ~/.mpdscribble}}<br />
* Create the file {{Filename|~/.mpdscribble/mpdscribble.conf}} and add the following:<br />
username = <your last.fm username><br />
password = <md5 sum of your last.fm password> # Generated using "echo -n password | md5sum"<br />
host = <your mpd host> # defaults to $MPD_HOST or localhost<br />
port = <your mpd port> # defaults to $MPD_PORT or 6600<br />
log = ~/.mpdscribble/mpdscribble.log<br />
journal = ~/.mpdscribble/mpdscribble.cache<br />
verbose = 2<br />
sleep = 1<br />
musicdir = <your music directory><br />
* Add {{Codeline|mpdscribble}} to your {{Filename|~/.xinitrc}}.<br />
<br />
====Sonata====<br />
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.<br />
<br />
====lastfmsubmitd====<br />
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}}.<br />
<br />
===Last.fm playback with lastfmproxy===<br />
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.<br />
<br />
{{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.}}<br />
<br />
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.<br />
<br />
=== Never play on start ===<br />
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:<br />
'' ...''<br />
'' stat_busy "Starting Music Player Daemon"''<br />
<br />
# always start in paused state<br />
awk '/^state_file[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
sfile = substr($0, RSTART + 1, RLENGTH - 2)<br />
} /^user[ \t]+"[^"]+"$/ {<br />
match($0, "\".+\"")<br />
user = substr($0, RSTART + 1, RLENGTH - 2)<br />
} END {<br />
if (sfile == "")<br />
exit;<br />
if (user != "")<br />
sub(/^~/, "/home/" user, sfile)<br />
system("sed -i \x27s|^\\(state:[ \\t]\\{1,\\}\\)play$|\\1pause|\x27 \x27" sfile "\x27")<br />
}' /etc/mpd.conf<br />
<br />
'' /usr/bin/mpd /etc/mpd.conf &> /dev/null''<br />
'' ...''<br />
<br />
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}}:<br />
NoUpgrade = etc/rc.d/mpd<br />
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).<br />
<br />
=== MPD & Alsa ===<br />
<br />
Sometimes, when you use other audio output, e.g: some web pages containing Flash applets, mpd cannot reproduce anything anymore (until you restart). The error looks something like: (if you search the file {{Filename|/var/log/mpd/mpd.error}})<br />
<br />
Error opening alsa device "hw:0,0": Device or resource busy<br />
<br />
And here is the solution (dmix saving our life again). Apply these lines in your {{Filename|/etc/mpd.conf}}:<br />
<br />
<pre><br />
audio_output {<br />
type "alsa"<br />
name "Sound Card"<br />
options "dev=dmixer"<br />
device "plug:dmix"<br />
}<br />
</pre><br />
<br />
And then restart with {{Codeline|/etc/rc.d/mpd restart}}.<br />
<br />
Searching on Internet I found the reason for why that happens in Gentoo's wiki:<br />
* The sound card does not support hardware mixing (uses '''dmix''' plugin)<br />
* An application does not work with ALSA with it's default settings<br />
<br />
====High CPU usage with ALSA====<br />
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.<br />
<br />
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}}.<br />
<br />
Example from {{Filename|mpd.conf}}:<br />
<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
auto_resample "no"<br />
}<br />
<br />
Some users might also want to tell dmix to use 44kHz as well. More info about tuning performance of your MPD can be found from: [http://mpd.wikia.com/wiki/Tuning MPD wiki]<br />
<br />
=== Control mpd with lirc ===<br />
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.<br />
<br />
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.<br />
<br />
First of all, please setup your remotes as referred to the '''[[Lirc]]''' article.<br />
<br />
Edit your favored lirc startup configuration file, default location is {{Filename|~/.lircrc}}.<br />
<br />
Fill the file with the following pattern:<br />
<br />
begin<br />
prog = irexec<br />
button = <button_name><br />
config = <command_to_run><br />
repeat = <0 or 1><br />
end<br />
<br />
An useful example:<br />
<br />
## irexec<br />
begin<br />
prog = irexec<br />
button = play_pause<br />
config = mpc toggle<br />
repeat = 0<br />
end<br />
<br />
begin<br />
prog = irexec<br />
button = stop<br />
config = mpc stop<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = previous<br />
config = mpc prev<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = next<br />
config = mpc next<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = volup<br />
config = mpc volume +2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = voldown<br />
config = mpc volume -2<br />
repeat = 1<br />
end<br />
begin<br />
prog = irexec<br />
button = pbc<br />
config = mpc random<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = pdvd<br />
config = mpc update<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = right<br />
config = mpc seek +00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = left<br />
config = mpc seek -00:00:05<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = up<br />
config = mpc seek +1%<br />
repeat = 0<br />
end<br />
begin<br />
prog = irexec<br />
button = down<br />
config = mpc seek -1%<br />
repeat = 0<br />
end<br />
<br />
There are more functions for mpc, run {{Codeline|man mpc}} for more info.<br />
<br />
=== Control mpd with bluetooth phone ===<br />
You can also control mpd (to a certain extent) using a bluetooth enabled phone. You need to do the following:<br />
<br />
* install [http://remuco.sourceforge.net/index.php/Remuco remuco] -- a wireless remote control for several Linux media players ([http://aur.archlinux.org/packages.php?ID=25072 aur])<br />
* transfer remuco client -- jar/jad files from {{Filename|/usr/share/remuco/client/}} to your phone and install it<br />
* run {{Codeline|remuco-mpd}} (as current user)<br />
* run remuco on your phone, define a new bluetooth remuco connection (pair first if you haven't done this previously) and explore its capabilities<br />
<br />
More information about remuco including troubleshooting to be found at its [http://remuco.sourceforge.net/index.php/Remuco homepage]<br />
<br />
=== MPD & PulseAudio ===<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
# gpasswd -a mpd pulse-access<br />
# gpasswd -a mpd pulse-rt<br />
<br />
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.<br />
<br />
==Troubleshooting==<br />
===mpd --create-db hangs===<br />
This is a common error that's caused by corrupt mp3 tags.<br />
Here is an experimental way to solve this issue.<br />
Requirements:<br />
* kid3<br />
* easytag<br />
<br />
This method is very tedious, expecially with a huge database. Just as a baseline it took 2.5h to fix a 16Gb DB.<br />
<br />
====Easy Tag====<br />
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.<br />
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.<br />
<br />
====KID3====<br />
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.<br />
<br />
Repeat this procedure until your music library is done.<br />
<br />
===Cannot connect to mpd: host "localhost" not found: Temporary failure in name resolution===<br />
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<br />
<br />
::1 localhost.localdomain localhost<br />
<br />
===Port 6600 already in use===<br />
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:<br />
<br />
$ mpd --kill<br />
$ mpd --create-db<br />
<br />
A more brute-force approach:<br />
<br />
$ killall mpd<br />
$ mpd --create-db<br />
<br />
{{Note| If you typically run mpd as root, you will need to run the above commands as root.}}<br />
<br />
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<br />
<br />
If port 6600 is tied up for some other reason, one can use the following command to find the offending process:<br />
<br />
# netstat -tulpan | grep 6600<br />
<br />
This will list IP:Port and the process name holding the connection (root privileges are required to see all processes).<br />
<br />
=== Crackling sound with some audio files ===<br />
<br />
This is usually a playback speed problem and can be fixed by uncommenting the audio_output_format line in:<br />
<br />
{{File|name=/etc/mpd.conf|content=<br />
audio_output_format "44100:16:2"}}<br />
<br />
This is usually a sane value for most mp3 files.<br />
<br />
==External links==<br />
<br />
* [http://www.musicpd.org/ Official Web Site]<br />
* [http://mpd.wikia.com/wiki/Main_Page Official Wiki]<br />
* [http://mpd.wikia.com/wiki/Clients Sorted List of MPD Clients]<br />
* [http://www.musicpd.org/forum/ MPD forum]</div>MGu3l