Can't get snd-aloop in sync with another device

Mark Hills mark at xwax.org
Thu Jul 8 18:24:39 CEST 2021


I use dmix+snd-aloop for all local applications; then forwarded to the 
dmix+Layla3G using a custom C program.

Despite asking for clock sync, they slowly drift. Am I doing something 
wrong?

  $ echo hw:Layla3G,0,0 > /proc/asound/Loopback/timer_source

The forwarder drains its buffer and eventually underruns. Loopback is not 
providing enough audio to feed Layla3G -- drifts by about 9 samples/second 
at 48kHz.

This _feels_ like a regression; I'm pretty sure this was perfectly in time 
before. I'd need to bisect kernel and alsa-lib changes.

Below shows the status during playback/capture.

The timer is definitely connected in some way. It's listed below, and 
aloop ticking corresponds to whether Layla3G is open by any application 
(not just the forwarder)

-- 
Mark



$ cat /proc/asound/Loopback/cable#0
Cable 0 substream 0:
  inactive
Cable 0 substream 1:
  inactive
Cable 0 substream 2:
  inactive
Cable 0 substream 3:
  valid: 3
  running: 3
  pause: 0
  Playback
    buffer_size:        65536
    buffer_pos:         12800
    silent_size:        0
    period_size:        512
    bytes_per_sec:      384000
    sample_align:       8
    rate_shift:         0
    sound timer:        hw:0,0,0
    timer open:         playback
  Capture
    buffer_size:        65536
    buffer_pos:         53760
    silent_size:        0
    period_size:        512
    bytes_per_sec:      384000
    sample_align:       8
    rate_shift:         0
    sound timer:        hw:0,0,0
    timer open:         playback
Cable 0 substream 4:
  inactive
Cable 0 substream 5:
  inactive
Cable 0 substream 6:
  inactive
Cable 0 substream 7:
  inactive



More information about the Alsa-devel mailing list