https://wiki.archlinux.org/api.php?action=feedcontributions&user=Petr&feedformat=atomArchWiki - User contributions [en]2024-03-29T10:04:32ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Dmenu&diff=149272Dmenu2011-07-18T10:23:10Z<p>Petr: /* Configuration */</p>
<hr />
<div>[[Category:Utilities (English)]]<br />
{{i18n|dmenu}} {{DISPLAYTITLE:dmenu}}<br />
<br />
== Introduction ==<br />
<br />
[http://www.suckless.org/programs/dmenu.html dmenu] is a fast and lightweight dynamic menu for X. It reads arbitrary text from stdin, and creates a menu with one item for each line. The user can then select an item, through the arrow keys or typing a part of the name, and the line is printed to stdout. dmenu_run is a wrapper that ships with the dmenu distribution that allows its use as an application launcher.<br />
<br />
== Installation ==<br />
<br />
Installing dmenu is simple:<br />
# pacman -S dmenu<br />
<br />
run it<br />
$ dmenu_run<br />
<br />
== Configuration ==<br />
Now, you will want to attach the '''dmenu_run''' command to a keystroke combination. This can be done either via your window manager or desktop environment configuration, or with a program like xbindkeys. See the [[Hotkeys]] article for more information.<br />
And so, dmenu nice to be [[Prelink]]'ed.<br />
<br />
== External Resources ==<br />
* [http://tools.suckless.org/dmenu dmenu] &ndash; The official dmenu website<br />
* [http://dmwit.com/yeganesh Yeganesh] &ndash; a light wrapper that reorders commands based on popularity<br />
* [http://aur.archlinux.org/packages.php?ID=33379 dmenu-launch (AUR)] &ndash; A simple Dmenu-based application launcher. Launches binaries and XDG shortcuts.<br />
* [https://bbs.archlinux.org/viewtopic.php?id=80145 Dmenu Hacking thread ] &ndash; Dmenu hacking thread in arch linux forums.</div>Petrhttps://wiki.archlinux.org/index.php?title=ASUS_Eee_PC_1018P&diff=123981ASUS Eee PC 1018P2010-12-04T13:12:33Z<p>Petr: /* Fn Keys */</p>
<hr />
<div>== Pm-utils ==<br />
<br />
To pm-suspend get working:<br />
<br />
echo 'SUSPEND_MODULES="xhci_hcd"' > /etc/pm/config.d/00sleep_module<br />
<br />
echo 'SUSPEND_MODULES="xhci_hcd"' > /etc/pm/config.d/unload_modules<br />
<br />
== Fn Keys ==<br />
<br />
After installing aur/acpi-eeepc-generic and <br />
<br />
cp /etc/acpi/eeepc/models/acpi-eeepc-1001P-events.conf /etc/acpi/eeepc/models/acpi-eeepc-1018P-events.conf<br />
<br />
Some keys (like F1 - suspend) starts to working correctly. Suspend key need to be configured to pm-suspend.</div>Petrhttps://wiki.archlinux.org/index.php?title=ASUS_Eee_PC_1018P&diff=123745ASUS Eee PC 1018P2010-12-03T20:34:25Z<p>Petr: /* Fn Keys */</p>
<hr />
<div>== Pm-utils ==<br />
<br />
To pm-suspend get working:<br />
<br />
echo 'SUSPEND_MODULES="xhci_hcd"' > /etc/pm/config.d/00sleep_module<br />
<br />
echo 'SUSPEND_MODULES="xhci_hcd"' > /etc/pm/config.d/unload_modules<br />
<br />
== Fn Keys ==<br />
<br />
After installing aur/acpi-eeepc-generic and <br />
<br />
cp /etc/acpi/eeepc/models/acpi-eeepc-1001P-events.conf /etc/acpi/eeepc/models/acpi-eeepc-1018P-events.conf<br />
<br />
Some keys (like F1 - suspend) starts to working correctly. Suspend key need to be configured to pm-utils.</div>Petrhttps://wiki.archlinux.org/index.php?title=ASUS_Eee_PC_1018P&diff=123741ASUS Eee PC 1018P2010-12-03T20:31:05Z<p>Petr: </p>
<hr />
<div>== Pm-utils ==<br />
<br />
To pm-suspend get working:<br />
<br />
echo 'SUSPEND_MODULES="xhci_hcd"' > /etc/pm/config.d/00sleep_module<br />
<br />
echo 'SUSPEND_MODULES="xhci_hcd"' > /etc/pm/config.d/unload_modules<br />
<br />
== Fn Keys ==<br />
<br />
After installing aur/acpi-eeepc-generic and <br />
<br />
cp /etc/acpi/eeepc/models/acpi-eeepc-1001P-events.conf /etc/acpi/eeepc/models/acpi-eeepc-1018P-events.conf<br />
<br />
Some keys (like F1 - suspend) starts to working correctly.</div>Petrhttps://wiki.archlinux.org/index.php?title=ASUS_Eee_PC_1018P&diff=123738ASUS Eee PC 1018P2010-12-03T20:30:01Z<p>Petr: Created page with " == Pm-utils == To pm-suspend get working: # echo 'SUSPEND_MODULES="xhci_hcd"' > /etc/pm/config.d/00sleep_module # echo 'SUSPEND_MODULES="xhci_hcd"' > /etc/pm/config.d/unload_..."</p>
<hr />
<div><br />
== Pm-utils ==<br />
<br />
To pm-suspend get working:<br />
<br />
# echo 'SUSPEND_MODULES="xhci_hcd"' > /etc/pm/config.d/00sleep_module<br />
<br />
# echo 'SUSPEND_MODULES="xhci_hcd"' > /etc/pm/config.d/unload_modules<br />
<br />
== Fn Keys ==<br />
<br />
After installing aur/acpi-eeepc-generic and <br />
<br />
# cp /etc/acpi/eeepc/models/acpi-eeepc-1001P-events.conf /etc/acpi/eeepc/models/acpi-eeepc-1018P-events.conf<br />
<br />
Some keys (like F1 - suspend) starts to working correctly.</div>Petrhttps://wiki.archlinux.org/index.php?title=Music_Player_Daemon&diff=122146Music Player Daemon2010-11-23T17:20:47Z<p>Petr: /* A clean configuration file */</p>
<hr />
<div>[[Category:Audio/Video (English)]]<br />
[[Category:Daemons and system services (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n|Music Player Daemon}}<br />
'''MPD''' (music player daemon) is an audio player that has a server-client architecture. MPD runs in the background as a daemon, manages playlists and a music database, and uses very few resources. In order to interface with it, you need a separate client. More information can be found on their [http://www.musicpd.org/ website].<br />
<br />
''Please'' have a look at the official page for setup and troubleshooting instructions, the main developer called our wiki page in its current state ''"full of symptom killers"'', hence the official pages should contain better instructions.<br />
<br />
==Daemon install procedure==<br />
Install with [[pacman]]:<br />
# pacman -S mpd<br />
<br />
==Setup instructions==<br />
For more information about MPD configuration visit 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 {{Codeline|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 {{Codeline|~}} 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 {{Codeline|~}} to {{Codeline|/home/username}} to avoid any confusion over this aspect of MPD's behavior.<br />
<br />
===A clean configuration file===<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|/usr/share/doc/mpd/mpdconf.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 /usr/share/mpd/mpdconf.example /etc/mpd.conf<br />
(/usr/share/doc/mpd/mpdconf.example is good for userspace setup)<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 {{Filename|/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 {{Filename|~/.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 />
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 />
===Software mixing===<br />
To change the volume of audio from mpd independent of other programs, uncomment or add the switch in mpd.conf:<br />
<br />
{{File|name=/etc/mpd.conf|content=<br />
mixer_type "software"<br />
}}<br />
<br />
===Editing {{Filename|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 />
{{File|name=/etc/mpd.conf|content=<br />
music_directory "/home/user/music" # Your music dir.<br />
playlist_directory "/var/lib/mpd/playlists"<br />
db_file "/var/lib/mpd/mpd.db"<br />
log_file "/var/log/mpd/mpd.log"<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 />
<br />
Read steps below carefully, permissions need to be set correctly.<br />
<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 />
* 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 />
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/user/.mpd/mpd.conf"}}.<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 />
<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/mpd.conf<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 />
===Quick setup===<br />
<br />
The fastest way to do set up the structure is to do this:<br />
<br />
$ mkdir -p ~/.mpd/playlists && touch ~/.mpd/database && cp /usr/share/doc/mpd/mpdconf.example ~/.mpd/mpd.conf<br />
<br />
Then edit mpd.conf to your liking. Beware that you must uncomment the db_file entry if you do edit mpd.conf.<br />
<br />
Then, to run it:<br />
<br />
$ mpd ~/.mpd/mpd.conf<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 />
==Client install procedure==<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 />
# pacman -S mpc<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 />
# pacman -S ncmpc<br />
* '''ncmpcpp''' &ndash; Clone of ncmpc with some new features written in C++ [http://unkart.ovh.org/ncmpcpp/ Official website of ncmpcpp]<br />
# pacman -S ncmpcpp<br />
* '''dmpc''' &ndash; Dmenu-based MPC client with a playlist manager and state-saving on playlist changes [http://aur.archlinux.org/packages.php?ID=33380 AUR package of dmpc]<br />
Install [http://aur.archlinux.org/packages.php?ID=33380 dmpc] from the [[AUR]].<br />
* '''pms''' &ndash; NCurses Client (highly configurable and accessible) [http://pms.sourceforge.net/ Official website of pms]<br />
Install [http://aur.archlinux.org/packages.php?ID=24378 pmus] from the [[AUR]].<br />
* '''ario''' &ndash; GTK+ Client with a Rhythmbox like library browser [http://ario-player.sourceforge.net Official Website of Ario]<br />
# pacman -S ario<br />
* '''sonata''' &ndash; Python GTK+ Client [http://sonata.berlios.de/ Official Website of Sonata]<br />
# pacman -S sonata<br />
* '''gmpc''' &ndash; GNOME Client [http://gmpcwiki.sarine.nl/index.php?title=GMPC Official Website of gmpc]<br />
# pacman -S gmpc<br />
* '''QMPDClient''' &ndash; Client written with Qt 4.x. [http://bitcheese.net/wiki/QMPDClient Official Website of QMPDClient]<br />
# pacman -S qmpdclient<br />
<br />
==Extra stuff==<br />
===Last.fm scrobbling===<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 />
<pre><br />
[mpdscribble] <br />
host = <your mpd host> # optional, defaults to $MPD_HOST or localhost<br />
port = <your mpd port> # optional, 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 />
proxy = <your proxy> # optional, e. g. http://your.proxy:8080, defaults to none<br />
<br />
[last.fm]<br />
# last.fm section, comment if you don't use last.fm<br />
url = http://post.audioscrobbler.com # optional<br />
username = <your last.fm username><br />
password = <your last.fm password> # md5sum also possible: echo -n PASSWORD | md5sum | cut -f 1 -d " "<br />
<br />
[libre.fm]<br />
# libre.fm section, comment if you don't use libre.fm<br />
url = http://turtle.libre.fm/<br />
username = <your libre.fm username><br />
password = <your libre.fm password><br />
</pre><br />
* Add {{Codeline|mpdscribble}} to your {{Filename|~/.xinitrc}}:<br />
pidof mpdscribble >& /dev/null<br />
if [ $? -ne 0 ]; then<br />
mpdscribble &<br />
fi<br />
<br />
====Sonata & Ario====<br />
The easiest way, if you don't care about having to have a program window open all the time, is using Sonata or Ario which are graphical frontends to MPD. They have built-in support for Last.fm scrobbling in their preferences. A 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 [http://aur.archlinux.org/packages.php?ID=14214 lastfmproxy] from the [[AUR]] 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 />
====Method 1====<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 />
<br />
====Method 2====<br />
<br />
Another simpler method, would be to add mpd to your {{Filename|[[rc.conf]]}} deamons array and add {{Codeline|mpc stop}} or {{Codeline|mpc pause}} to {{Filename|/etc/rc.local.shutdown}} and to {{Filename|/etc/rc.local}}. (Remember you must have mpc installed to use this method).<br />
<br />
Adding only the order in {{Filename|/etc/rc.local}} cannot assure that mpd will play absolutely nothing, since there may be a delay before the stop command is executed. <br />
On the other hand, if you only add the order to {{Filename|/etc/rc.local.shutdown}}, that will assure that mpd won't play at all, as long as you properly shutdown your system.<br />
Even though they are redundant, adding it to {{Filename|/etc/rc.local}} would serve as a safety for those, presumably, rare occasions when you do not shutdown the system properly.<br />
<br />
===MPD & ALSA===<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 />
For a detailed description, it is recommended to take a look at [http://mpd.wikia.com/wiki/Alsa this] link. There you can find an example asound.conf which worked for me right out of the box.<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}}. This will degrade quality slightly, however.<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 />
Although it may not give as drastic a speedup, enabling mmap may speed things up:<br />
<br />
audio_output {<br />
type "alsa"<br />
name "My ALSA Device"<br />
use_mmap "yes"<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 designed 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 />
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 />
## 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 />
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 />
===Autodetection failed===<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 mentioned 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 />
{{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 outside of "mpd" home directory /var/lib/mpd). By default useradd sets permissions on home dir to 1700 drwx------. So if you're 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 />
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 />
====Another alternative solution====<br />
Another alternative is to remount the music directory under a directory that mpd has access to. This does not entail the same security risks as modifying the permissions on one's home directory.<br />
# mkdir /var/lib/mpd/music<br />
# echo "/home/$USER/music /var/lib/mpd/music none bind" >> /etc/fstab<br />
# mount -a<br />
# /etc/rc.d/mpd restart<br />
And that should fix the problem. See also [https://bbs.archlinux.org/viewtopic.php?id=86449 the forum thread.]<br />
<br />
===Avoiding timeouts===<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 />
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 />
$ mplayer http://<server's IP>:8000<br />
<br />
{{Note | You must open the port on your router / firewall for the stream to be connectible to from another computer.}}<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 />
===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, especially 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 />
::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 />
$ mpd --kill<br />
$ mpd --create-db<br />
<br />
A more brute-force approach:<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 />
# 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 />
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 />
===daemon: cannot setgid for user "mpd": Operation not permitted ===<br />
<br />
The error is stating that the user starting the process (you) does not have permissions to become another user (mpd) which the configuration has told that process to run as.<br />
<br />
To solve the issue, simply start mpd as root.<br />
su -c "/etc/rc.d/mpd start"<br />
or<br />
sudo /etc/rc.d/mpd start<br />
<br />
==External links==<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>Petr