You are not logged in.

#1 2019-02-19 03:52:04

bitmask
Member
Registered: 2017-10-16
Posts: 7

Very high audio latency with ALSA, configuration option have no effect

My keypress (bottom out) to audio output latency, using aplay and an audio file with 0ms of delay, ranges from 45-60ms (measured with microphone).

--------------------------------------------------

`aplay -l` (HDA Intel PCH / ALC892 is in use):

    **** List of PLAYBACK Hardware Devices ****
    card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 2: Device [USB Advanced Audio Device], device 0: USB Audio [USB Audio]
      Subdevices: 1/1
      Subdevice #0: subdevice #0

--------------------------------------------------

`~/.asoundrc`:

    pcm.!default {
     type plug
     slave.pcm "dmixer"
    }

    pcm.dmixer  {
      type dmix
      ipc_key 1024
      slave {
      pcm "hw:0,0"
      period_time 0
      period_size 16
      buffer_size 128
      rate 96000
     }
     bindings {
      0 0
      1 1
     }
    }

    ctl.dmixer {
     type hw
     card 0
    }

^(The only reason I'm attempting to use dmix is so that I would have the ability to use a small buffer... of course, it doesn't work)

--------------------------------------------------

`/usr/share/alsa/alsa.conf` (large, pastebin):https://pastebin.com/1K118zp8

--------------------------------------------------

Changing any of the `.asoundrc` dmix options (rate, buffer_size etc.) to even the most ridiculous values seems to have no effect whatsoever on audio output. I've also tried the `echo 128 > /proc/asound/card0/pcm0p/sub0/prealloc` trick, which completes successfully but has zero effect with small or large numbers.

Why are my changes not having any effect? The `.asoundrc` file is being read, which I know since I can screw things up with it, but some things are being completely ignored. How else can I get low latency from ALSA? I'm already using the Arch Linux CK kernel. JACK is not an option, since this is for Wine.

Last edited by bitmask (2019-02-19 03:52:33)

Offline

#2 2019-02-20 09:27:04

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,723

Re: Very high audio latency with ALSA, configuration option have no effect

What are you playing back on in your playback attempts, which exact commandlines do you use? Do you explicitly access the dmix definition (or more generally, are you sure you still have a "default" device? The override with !default can be a bit finicky, output of

aplay -L

would clear this up)?  In general the best latency should come from directly accessing hw:0 without dmix with the obvious caveat that the access would be exclusive. That said due to the static nature of dmix it is relatively hard to configure in a general manner that will make all applications happy. You will in general get better latency guarantees with pulseaudio and/or jack.

That said, since you mention wine, what is the actual problem you are having? Depending on what you intend to use there, it's quite likely that your issue stems from something entirely unrelated to the theoretically perceived latency in simple aplay dmix tests.

Last edited by V1del (2019-02-20 11:49:03)

Offline

Board footer

Powered by FluxBB