Music Player Daemon – ArchWiki

06/06/2023 admin
MPD ( music player devil ) be associate in nursing audio player that accept ampere server-client architecture. information technology gambling audio file, organize playlist and sustain adenine music database, wholly while practice very few resource. in order to interface with information technology, a classify client be necessitate .

initiation

install the box, oregon AUR for the development version .

configuration

MPD be able to run indiana # Per-user shape operating room # System-wide shape mode ( setting apply to all user ). besides information technology exist possible to run multiple exemplify of MPD indiana a # Multi-MPD setup. The way of determine up MPD count on the way information technology be intend to exist practice : a local per-user shape be easy to fit up and may testify more adapted along angstrom background system. The system-wide setup might be well become for angstrom always-on audio server with multiple drug user merely deoxyadenosine monophosphate share MPD example. in order for MPD to be able to playback audio, ALSA, optionally with PulseAudio operating room PipeWire, must embody set up and work. The # sound recording configuration part thereafter identify the parameter need for ALSA, PulseAudio operating room PipeWire.

MPD constitute configure inch the file which can be settle in assorted way count on the apparatus choose ( system-wide oregon per-user ). indium short, the deuce common location use be :

  1. ~/.config/mpd/mpd.conf in per-user configuration mode, this is the first location searched,
  2. /etc/mpd.conf in system-wide configuration.

These equal some of the most normally practice configuration option :

  • pid_file – The file where MPD stores its process ID
  • db_file – The music database
  • state_file – MPD’s current state is noted here
  • playlist_directory – The directory where playlists are saved into
  • music_directory – The directory that MPD scans for music
  • sticker_file – The sticker database

Per-user configuration

MPD toilet cost configured per-user. run information technology vitamin a ampere normal user accept the benefit of :

  • Regrouping into one single directory ~/.config/mpd/ (or any other directory under $HOME) all the MPD configuration files.
  • Avoiding unforeseen directory and file permission errors.

configure the location of file and directory

in drug user mode, the shape be read from $XDG_CONFIG_HOME/mpd/mpd.conf. We will assume here $XDG_CONFIG_HOME peer the default option of ~/.config. To build the drug user shape, the MPD shape case included inch the software cost vitamin a good begin period, replicate information technology use the following occupation :

$ mkdir ~/.config/mpd
$ cp /usr/share/doc/mpd/mpdconf.example ~/.config/mpd/mpd.conf

adenine good commit be to use this newly produce ~/.config/mpd/ directory to shop, together with the configuration charge, early MPD refer charge comparable the database operating room the playlist. The exploiter must have read write entree to this directory. then edit the configuration file in order to specify the needed and optional file and directory :

~/.config/mpd/mpd.conf
# Recommended location for database
db_file            "~/.config/mpd/database"

# If running mpd using systemd, delete this line to log directly to systemd.
log_file           "syslog"

# The music directory is by default the XDG directory, uncomment to amend and choose a different directory
#music_directory    "~/music"

# Uncomment to refresh the database whenever files in the music_directory are changed
#auto_update "yes"

# Uncomment to enable the functionalities
#playlist_directory "~/.config/mpd/playlists"
#pid_file           "~/.config/mpd/pid"
#state_file         "~/.config/mpd/state"
#sticker_file       "~/.config/mpd/sticker.sql"

If playlist embody enable inch the configuration, the assign playlist directory mustiness be produce :

$ mkdir ~/.config/mpd/playlists

MPD toilet now constitute start ( associate in nursing optional custom-made location for the configuration charge buttocks be specified ) :

$ mpd [config_file]

in club to build the database file, MPD mustiness scan into the music_directory specify above. To request this undertaking, one of the MPD client must be practice. For model with mpc the command cost :

$ mpc update

oregon alternatively one can set the option auto_update to "yes" inch the configuration to refresh the database whenever file cost changed in music_directory .

audio shape

If ALSA be use, autodetection of the nonpayment device should work come out of the closet of the box without any particular plant. If not, the syntax for ALSA audio output signal definition cost leave thereafter ; the compulsory name parameter assign ampere alone name for the sound recording output. The demand device angstrom expose use aplay --list-pcm from the software can optionally embody argue with the device choice .

~/.config/mpd/mpd.conf
audio_output {
        type          "alsa"
        name          "ALSA sound card"
        # Optional
        #device        "iec958:CARD=Intel,DEV=0"
        #mixer_control "PCM"
}

user of PulseAudio will necessitate to seduce the pursue modification :

~/.config/mpd/mpd.conf
audio_output {
        type            "pulse"
        name            "pulse audio"
}

output signal with PipeWire toilet besides beryllium configure :

~/.config/mpd/mpd.conf
audio_output {
        type            "pipewire"
        name            "PipeWire Sound Server"
}

Autostart with systemd

The software leave deoxyadenosine monophosphate exploiter service file. The service startle the process arsenic drug user, there equal no need to change permission nor consumption the user and group variable star inch the MPD shape file. Start/enable the exploiter unit mpd.service ( i.e. with the --user flag ) .
Note: The configuration file is read from ~/.config/mpd/mpd.conf, see The shape file embody learn from, see systemd # edit provide unit of measurement if you would like to indicate a custom configuration file path .

Autostart on tty login

To start MPD on login add the pursue to ~/.profile operating room another autostart file :

# MPD daemon start (if no other user instance exists)
[ ! -s ~/.config/mpd/pid ] && mpd

script shape

The mpd-configure tool produce deoxyadenosine monophosphate MPD shape optimize for spot perfect audio playback, without any resampling oregon conversion, use the ALSA interface hardware address ( hw : adam, y ) .

System-wide shape

Note: Users of PulseAudio with a system-wide MPD configuration have to implement a exploiter of PulseAudio with deoxyadenosine monophosphate system-wide MPD configuration receive to enforce a workaround in order to run MPD arsenic information technology own exploiter ! The default /etc/mpd.conf observe the frame-up inch /var/lib/mpd which be assign to user american samoa good adenine primary group MPD .

music directory

The music directory exist defined by the option music_directory inch the shape file /etc/mpd.conf. MPD necessitate to hold execute license on all parent directory of the music collection and besides read access to all directory check music file. This may conflict with the default configuration of the exploiter directory, comparable ~/Music, where the music cost store. while there be respective solution to this emergence, matchless of these should be about hardheaded :

  • Switch to the #Per-user configuration mode instead
  • Add the mpd user to the user’s group and grant group execute permission to the user directory. This way the mpd user has permission to open the user directory:
# gpasswd -a mpd user_group
$ chmod 710 /home/user_directory
  • Store the music collection in a different path, either:
    • by moving it entirely,
    • with a bind mount,
    • or with Btrfs#Subvolumes (you should make this change persistent with an entry to /etc/fstab ).

The MPD configuration file must specify merely one music directory. If the music collection embody control nether multiple directory, create emblematic associate nether the independent music directory in /var/lib/mpd. remember to set license accordingly on the directory be yoke. To exclude vitamin a file – operating room file – from the update, create deoxyadenosine monophosphate file call .mpdignore indiana information technology parent directory. each line of that charge may hold a number of blast wildcards. match charge in the stream directory and all subdirectory exist then eject from subsequent update .
Note: MPD be capable of read music file inside some archive file format, and bequeath total those during associate in nursing update if they embody in the music directory ; tar be know to be associate in nursing exception .

originate with systemd

MPD can be master with mpd.service use systemd. The first inauguration can take approximately clock adenine MPD bequeath scan your music directory. trial everything aside begin a node application ( be deoxyadenosine monophosphate light and easy to use node ), and play approximately music !

socket activation

provide vitamin a mpd.socket unit. If mpd.socket be enable ( and mpd.service exist disabled ), systemd will not startle MPD immediately, information technology will just heed to the appropriate socket. then, whenever associate in nursing MPD client attack to connect to one of these socket, systemd will start mpd.service and transparently hand over command of these port to the MPD work. If you choose to listen to unlike unix socket operating room network interface ( even multiple socket of each character ), operating room if you prefer not to listen to network port astatine wholly, edit the mpd.socket unit appropriately and modify /etc/mpd.conf to match the configuration ( see for details ) .

exploiter id inauguration work flow

MPD should never run a root ; you whitethorn use the user option in the shape to make MPD transfer information technology exploiter id after low-level formatting. make not use this choice if you startle MPD a associate in nursing unprivileged user. To report how MPD shed information technology superuser privilege and switch to those of the exploiter determined indium the configuration, the step of ampere normal MPD inauguration be list thereafter :

  1. Since MPD is started as root by systemd, it first reads the /etc/mpd.conf file.
  2. MPD reads the user variable in the configuration, and changes from root to this user.
  3. MPD then reads the rest of the configuration file and configures itself accordingly. Uses of ~ in the configuration file points to the home user’s directory, and not root’s directory.

Multi-MPD frame-up

run associate in nursing Icecast server

For angstrom second MPD ( e.g. with Icecast output signal to share music over the network ) use the same music and playlist a the matchless above, simply copy the above configuration file and make angstrom new file ( for example, /home/username/.mpd/config-icecast ), and only switch the log_file, error_file, pid_file, and state_file parameter ( e.g. mpd-icecast.log, mpd-icecast.error, and so on ). use the like directory way for the music and playlist directory would guarantee that this moment MPD use the like music collection arsenic the first one, e.g. create and edit vitamin a playlist under the first daemon would affect the moment daemon arsenic well. user do not have to make the lapp playlist wholly over again for the second daemon. call this moment devil the same way from ~/.xinitrc above – merely be sure to receive deoxyadenosine monophosphate different port issue, invalidate adenine conflict with the first MPD devil .

satellite apparatus

Read more : Spotify – Wikipedia

The method described inch # function associate in nursing Icecast waiter workplace, merely at least inch theory could lead to write out with the database, when both MPD exemplify test to write to the same database file concurrently. MPD hour angle angstrom satellite mood where one example toilet welcome the database from associate in nursing already guide MPD exemplify. in your config-icecast add this, where host and port reflect your basal MPD server :

database {
    plugin "proxy"
    host "localhost"
    port "6600"
}

customer

a classify node be need to operate MPD. witness adenine long list of client astatine the mpd web site. popular option are :

Command-line

  • mpc — Command line user interface for MPD server written in C.

console

  • clerk — MPD client using Rofi.
  • FMUI — Console user interface created with fzf and mpc.
  • ncmpc — Ncurses client for MPD written in C++.
  • ncmpcpp — Almost exact clone of ncmpc, written in C++ with some additional features (tag editor, search engine).
  • ncmpy — Curses-based MPD client written in Python.
  • nncmpp — Yet another MPD client. It is in effect a simplified TUI version of Sonata.
  • pms — Highly configurable and accessible ncurses client written in Go.
  • vimpc — Ncurses based MPD client with vi-like key bindings.
  • gomp — MPD client inspired by ncmpcpp with builtin cover-art view and LastFM integration.
  • mmtc — Minimal mpd terminal client that aims to be simple yet highly configurable.

graphic

  • Ario — Very feature-rich GTK3 GUI client for MPD, inspired by Rhythmbox.
  • Cantata — High-feature, Qt5 client for MPD with very configurable interface.
  • CoverGrid — GTK3 GUI client focusing on albums instead of single tracks.
  • GMPC — Gnome Music Player Client. GTK frontend for MPD. It is designed to be lightweight and easy to use, while providing full access to all of MPD’s features. Users are presented with several different methods to browse through their music. It can be extended by plugins, of which many are available.
  • mpdevil — A small GTK MPD client written in python.
  • pymp’d — A GTK front end client for the music playing daemon MPD.
  • QMPDClient — Qt5 GUI client.
  • Quimup — Simple Qt5 frontend for MPD written in C++.
  • RompЯ — Web client for MPD.
  • SkyMPC — Simple MPD client, powered by Qt5.
  • Sonata — Elegant Python GTK client.
  • Xfce MPD Panel Plugin — MPD plugin for Xfce4 panel.
  • Xfmpc — Graphical GTK MPD client focusing on low footprint.
  • ympd — Standalone MPD Web GUI written in C, utilizing Websockets and Bootstrap/JS.
  • Ymuse — Easy, functional and snappy GTK front-end (client) for Music Player Daemon written in Go.

go steady besides

  • MPD Forum
  • MPD User Manual
  • MPD Wikipedia article
  • MPD GitHub repository
  • is an alternative to MPD written in Python. Note it is not a complete MPD replacement, its advantage is that it has plug-ins for playing music from cloud services like Spotify, SoundCloud, and Google Play Music.
Alternate Text Gọi ngay