From Qi-Hardware
Jump to: navigation, search

Music Player Daemon (MPD) is the server side of a client-server music player. The client is the music player UI, which can terminate while the server continues playing the music.

[edit] installation and configuration

opkg update
opkg install mpd libid3tag libaudiofile libspeex

Note: As of the 2011-05-28 release, mpd can only play .wav files. You can build the mpd-mini package in openwrt-xburst although after the first build you must edit feeds/packages/sound/mpd/Makefile to change --disable-alsa to --enable-alsa and rebuild. You can then install your .ipk and you will get an mpd version 0.16.5-2 that works, although the init script needs fixing since service_start and service_stop are absent:

patch -p0 < mpd.init.patch

In /etc/mpd.conf set:

#music_directory  "~/music"
music_directory   "/srv/music"
#playlist_directory  "~/.mpd/playlists"
playlist_directory   "/srv/music/playlists"
#db_file  "~/.mpd/database"
db_file   "/var/run/mpd-database"
#state_file  "~/.mpd/state"
state_file   "/var/run/mpd-state"
#follow_outside_symlinks  "yes"
follow_outside_symlinks   "yes"
#follow_inside_symlinks  "yes"
follow_inside_symlinks   "yes"
audio_output {
  type  "alsa"
  name  "audio output device"

Note that the database and state files are kept in RAM above to avoid trashing the NAND but state will be lost across reboots.

To allow mpd to set the volume to a level other than f**king loud:

cat <<EOF >/etc/asound.conf

pcm.!default {
    type plug
    slave {
        pcm "softvol"
pcm.softvol {
    type softvol
    slave {
        pcm "dmix"
    control {
        name "PCM"
        card 0
        count 1

# For OSS emulation
pcm.dsp0 {
    type plug
    slave.pcm "softvol"
ctl.mixer0 {
    type hw
    card 0

# Note that this asound.conf may cause trouble with MIC, which is why it's not stock yet

Note that mpd will automatically use the ALSA device default and mixer control PCM referred to in the asound.conf.

[edit] Testing

Use Netcat:

nc localhost 6600

..and refer to the protocol documentation:

update  # to get mpd to scan your music directory for files and tags
stats   # to check that some songs were found from the update
add /   # to add all the songs ( relative to music_dir) to the current playlist
status  # to see the volume level
setvol 0
setvol 100
setvol 50  # to check the softvol configuration

[edit] For older firmware

In /etc/init.d/mpd change:

pld=`grep playlist_directory

pld=`grep ^playlist_directory

..and comment out the amixer line.

Personal tools