[alsa-devel] Alsa timing question

Raymond Toy rtoy at google.com
Thu Aug 25 02:10:04 CEST 2011

I'm working on an application where I'd like to have relatively fixed timing
between calls to snd_pcm_writei.  As an example, of this I used the sample
pcm.c code from <
 I placed a simple function to write out the time (from clock_getttime)
before each call to snd_pcm_writei in write_loop.  With a sample rate of
48kHz and a buffer time of 128000 and period time of 42667, what I see is
that most calls to snd_pcm_writei are spaced about 50 ms apart.  This makes
some sense, but I was expecting the calls to be about 42.67 ms apart.
 However, about every 6th call, the time is just 200 us or so.  Why is that?

Is there any simple way to make the calls spaced more closely to 42.67 ms
apart?  Do I need to do something more complicated to achieve this?


More information about the Alsa-devel mailing list