ALSA dmix Output Edit

There's a couple of different configuration options here. The easiest is to edit mpd.conf as follows:
<br />audio_output {<br />      type                    "alsa"<br />      name                    "Sound Card"<br />      options                 "dev=dmixer"<br />      device                  "plug:dmix"<br />}

An additional option is as follows:
When you want to allow users to dmix their played sounds to mpd output sound if you run mpd from init scripts you need either to configure ALSA dmix plugin, either don't forget to set the ipc_* stuff well, because without it only root would be able to dmix other sounds.

Sample /etc/asound.conf configuration:
<br />pcm.dmixer { <br />  type dmix <br />  ipc_key 1024<br />  ipc_key_add_uid false<br />  ipc_perm 0666            # mixing for all users<br />  slave { <br />      pcm "hw:0,0" <br />      period_time 0 <br />      period_size 1024 <br />      buffer_size 8192<br />      rate 44100<br />  }<br />  bindings { <br />      0 0 <br />      1 1 <br />  } <br />} 

pcm.dsp0 { <br />  type plug <br />  slave.pcm "dmixer" <br />} 

pcm.!default { <br />  type plug <br />  slave.pcm "dmixer" <br />} 

pcm.default { <br /> type plug <br /> slave.pcm "dmixer" <br />} 

ctl.mixer0 { <br />  type hw <br />  card 0 <br />}

ALSA MPD software volume control Edit

The following is what is needed to get a working software volume control that can be controlled by alsamixer, as well as the mpd volume control. This allows mpd to be lowered in volume, but not the other sounds on your system (or vice-versa)

An alternative to this ALSA configuration would be to simply add the following to /etc/mpd.conf and restart mpd:
<br />mixer_type "software"<br />

Create asound.confEdit

First, the following lines are required in /etc/asound.conf. Note the software mixer mpdvol with the name "MPD". This will be used when editing the /etc/mpd.conf file. The software mixer "softvol" controls the level of the other sounds on your computer, and has the generic name of "Software".

<br /># the sound card<br />pcm.real {<br />type hw<br />card 0<br />device 0<br />}

# the ipc stuff is needed for permissions, etc.<br />pcm.dmixer {<br />type dmix<br />ipc_key 1024<br />ipc_perm 0666<br />slave.pcm "real"<br />slave {<br />  period_time 0<br />  period_size 1024<br />  buffer_size 8192<br />  rate 44100  <br />}<br />bindings {<br />  0 0<br />  1 1 <br />}<br />}

ctl.dmixer {<br />type hw<br />card 0<br />}

# software volume<br />pcm.softvol {<br />type softvol<br />slave.pcm "dmixer"<br />control {<br />  name "Software"<br />  card 0<br />}<br />}
# mpd volume control<br />pcm.mpdvol {<br />type softvol<br />slave.pcm "dmixer"<br />control {<br />  name "MPD"<br />  card 0<br />}<br />}
# ctrl for mpd volume<br />ctl.mpdvol {<br />type hw<br />card 0<br />}

# input<br />pcm.input {<br />      type dsnoop<br />      ipc_key 3129398<br />      ipc_key_add_uid false<br />      ipc_perm 0660<br />      slave.pcm "810"<br />}

# duplex device<br />pcm.duplex {<br />      type asym<br />      playback.pcm "softvol"<br />      capture.pcm "input"<br />}

# default devices<br />pcm.!default {<br />type plug<br />slave.pcm "duplex"<br />}

# for oss devices<br />pcm.dsp0 {<br />type plug<br />slave.pcm "duplex"<br />}

====Edit mpd.conf====
Next, the following lines need to be edited in /etc/mpd.conf:

The device line in the audio_output below should be set to the device name for the mpd volume that was specified above in the asound.conf file.
Note that the mixer_device line uses the same device as the device line in the audio_output section, but that the mixer_control line should be set to the NAME that was given in asound.conf.

<br />audio_output {<br />      type                    "alsa"<br />      name                    "Alsa Software Volume"<br /> device            "mpdvol"<br />}


<br />mixer_type                      "alsa"<br />mixer_device                    "mpdvol"<br />mixer_control                   "MPD"<br />

You will need to restart the mpd daemon before these settings to work. If they aren't working, you may try rebooting your system. You should see a listing for the volume for MPD using gnome-alsamixer or alsamixer. You can also control the volume setting using any other client for mpd (mpc, ncmpc, gmpc, sonata, etc.). It doesn't affect the other sounds on your system!

=== ALSA select digital audio out ===
Example to select the digital audio output (not the (default?) analog out):

.asoundrc (usually already present in home directory). This example is for a nforce3 board. Settings for other chip sets will vary, see Alsa-Project for more examples.
<br />pcm.intel8x0 {<br /> type hw<br /> card 0<br />}
<br />pcm.!default {<br /> type plug<br /> slave.pcm "spdif"<br /> slave.rate 48000<br />}

ctl.intel8x0 {<br /> type hw<br /> card 0<br />}
Now the corresponding entry in mpd.conf. The device name must match the slave.pcm name in the .asoundrc file:
<br />audio_output {<br />      type                    "alsa"<br />      name                    "My ALSA Device"<br />      device                  "spdif"<br />}

May this save somebody some time...

Another example, how to activate the 2nd device on the first audio hardware:
Hercules Fortissimo IV ice1724 with kernel 2.6.26 and Alsa 1.0.17:
<br />pcm.ice1724 {<br />  type hw<br />  card 0<br />}

pcm.!iec958 {<br />  type plug<br />  slave.pcm "hw:0,1"<br />}

pcm.!default {<br />  type plug<br />  slave.pcm "hw:0,1"<br />}

ctl.ice1724 {<br />  type hw<br />  card 0<br />}
Now the corresponding entry in mpd.conf. The 'plughw' did the trick, it matches the "hw:0,1" entry from the Alsa .asoundrc file !
<br />audio_output {<br />      type                    "alsa"<br />      name                    "My ALSA Device"<br />      device                  "plughw:0,1"<br />}

ALSA select digital audio out (bit-perfect) Edit

The examples above might produce bit-perfect output, however I've tested the example below and can confirm that it works with a CMI 8768 card. I've successfully played 96KHz FLAC with mpd using this configuration.

In /etc/mpd.conf:

<br />audio_output {<br />      type                    "alsa"<br />      name                    "SPDIF"<br />      device                  "cards.pcm.iec958"<br />}

For an explanation of bit-perfect audio, go here: