On Wed, 26.08.09 10:12, Andrew McNabb (amcnabb at mcnabbs.org) wrote: > I've recently started using the PulseAudio Simple API. Overall I've > been very happy, but I'm having a minor problem. I'm sure it's my > fault, but I can't figure out what I'm doing wrong. > > I'm using the Simple API to record audio samples. My problem is that > the data seem to come in bursts instead of at an even rate. In other > words, many reads complete almost instantly, and then the next read > blocks for as much as a second. The rate is even. Just the intervals between the packets are larger than you might expect... PA by default uses a 2s hw playback buffer and delays wakeups as much as possible and the requested application latency allows. Reducing wakeups minimizes power consumption. > Although I don't need any real-time guarantees, I would like to keep the > latency as low as possible. What might I be doing wrong? Is there > anything I can do make the reads go at a steady pace? Pass a non-NULL pa_buffer_attr argument to pa_simple_new() and set all its values to (uint32_t) -1, except of tlength which you should set to the size (in bytes in your selected sample spec) of the overall latency you want. As one example this sets the latency to 200ms: attr->tlength = pa_usec_to_bytes(200*PA_USEC_PER_MSEC, &ss); Lennart -- Lennart Poettering Red Hat, Inc. lennart [at] poettering [dot] net http://0pointer.net/lennart/ GnuPG 0x1A015CC4