[alsa-devel] Is there a way to figure out if the clocks of two snd_pcm_t's deviate? (snd_pcm_info_get_sync?)

pl bossart bossart.nospam at gmail.com
Fri Sep 4 14:52:51 CEST 2009

> I am looking for a way to find out whether the clocks of two
> snd_pcm_t's are perfectly in sync and don't deviate (or only deviate
> by a constant phase).

short answer:no
You would need hardware that would count the bit clock transitions and
provide the delta. Few devices provide this in the consumer space, and
when they do they actually perform an asynchronous sample-rate
conversion on the fly (cf. Freescale DSP563xx). Analog Devices also
provides dedicated sample-rate converters that perform this comparison
and resampling; they are typically used when multiple masters are
All this nice hardware wouldn't work anyway for USB where audio is
transmitted in packets every ms; it's hard to guess what the real
audio speed is.
That's the reason why I introduced the resampling enable/disable in
the PA module-loopback code, only the user/system designer will know
if you have one master or more, and whether you should enable
variable-rate interpolation.
- PL

More information about the Alsa-devel mailing list