[alsa-devel] Clock Drift between hardware sound card and snd_aloop

Rob Nertney rob at rob-otics.com
Wed Jul 12 06:13:56 CEST 2017


Hi all,

I have successfully built a sound capture card that runs at a given rate
off its own clock. I receive the stream and do some post-processing on it,
and I want to present this modified data to the user as a capture pcm.

I initially thought that snd_aloop would be the best idea, as I can pipe my
post-processed data directly into it. However, the driver is apparently
calculating exact timing of what "should" be the rate based off of CPU
ticks/jiffies and the requested period/sample rate/etc in the requested
output stream.

In my actual hardware I see cycle slips. Underruns and overruns based off
of minor adjustments to the card's rate.

Is snd_aloop the appropriate driver to be using? Or should I create a new
card, similar to snd_aloop, which is more specifically interrupted (and
associated pointer locations, etc. modified) from the hardware card as well?

It seems like I should be able to synchronize snd_aloop's timing with my
hardware clock, but I haven't found anywhere in the API to achieve this.

How else can I avoid this clock drift?

Thanks,
Rob


More information about the Alsa-devel mailing list