[pulseaudio-discuss] precise stream timing

Matt Robbins mer34 at cornell.edu
Thu Jun 2 07:33:15 PDT 2011

Hello Pulseaudio community,

I'm playing around with pulse to assess suitability for my project, and
while it seems like I should be able to do what I want, I'm struggling with
the API.  Essentially, I need to record audio data with precise (~1ms) time
stamps.  I'm doing collaborative sound source localization between several
machines, all synced to gps time.  Since I don't really need sample-accurate
time, I figured it would be acceptable to call gettimeofday() on ALSA
interrupts to get a pretty good idea of when the samples were recorded.
 Since all of the machines will be using the same hardware, I don't even
care if there's some fixed latency involved.  While doing this in ALSA would
be an interesting project, when combined with some the other things I need
to do (stream splitting, fixed-point resampling, etc.), it feels like I'd be
reinventing the wheel.  I've been using JACK to accomplish what I need, but
there are stability and support issues on the embedded systems I'm using, so
I'm looking into alternatives, especially since the recent headless ubuntu
release, which has a working pulse server by default :)

I've tried cobbling something together using the pacat.c source using
pa_stream_set_read_callback().  My callback gets called, but although I call
pa_stream_get_timing_info(), I can't see how to derive the information I
need from the pa_timing_info struct because I can't see how the timestamp
field is related to the current fragment.

I'm not even sure if I'm going about this the right way, so if anyone who
knows the system could give me a few pointers, I'd really appreciate it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110602/9896fbd9/attachment-0001.htm>

More information about the pulseaudio-discuss mailing list