audiolinux-device-driveralsampd

Configuring volume control for USB-DAC to be used via mpd


I am building a music player system using a Raspberry Pi with Raspbian and a NuForce uDAC-3 USB-DAC.

I got mpd use the DAC instead of Pi's sound system using these lines in /etc/mpd.conf. As far as I know, the essential thing here is selecting hw device 1 instead of default 0.

audio_output {
   type            "alsa"
   name            "My ALSA Device"
   device          "hw:1,0"        # optional
   format          "44100:16:2"    # optional
   mixer_device    "default"       # optional
   mixer_control   "PCM"           # optional
   mixer_index     "0"             # optional
}

The driver used for my DAC (snd_usb_audio) doesn't, however, support hardware volume control. There is no volume control available for it in alsamixer, for example. As far as I know, that's a known "feature" for that driver or it's support for that DAC. I got mpd control the volume by uncommenting this in /etc/mpd.conf:

mixer_type                      "software"

The primary problem now is that there is some lag in volume control that wasn't there with the integrated sound system. I mean, when I slide the volume control in my client program (QMPDClient), there is a short but notable delay before the change in volume can be heard. It's bearable but makes me wonder if everything really works as it should.

The second problem, somewhat related to the first one, is that I am wondering if there is a way to make the sound more perfect as far as any configuration files are concerned.

I have tried various examples of /etc/asound.conf I have found on the internet but either I don't understand what they are supposed to do or they simply are not working. What I thought I would get is either a Master volume control for the DAC recognized by mpd or a virtual sound card that would have a Master volume control and that would feed the sound to the DAC. Initially, /etc/asound.conf was empty, and it still is, now that nothing there seems to affect anything.

Just for the case it has any relevance, the music is in .flac files ripped from CDs.


Solution

  • To get lower latency, reduce the buffer_time setting:

    audio_output {
        ...
        buffer_time 100000
    }