Skip to contentSkip to conversation

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

DISCUSSION Mark Hills 1 participant 1 message Jul 8, 2021

lore
Share & tools
lore

Mark Hills

author
#0 lore raw

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)

Signature · 43 lines
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