[pulseaudio-discuss] Low latency audio in-out application

Svein Seldal sveinse at seldal.com
Mon Aug 26 04:31:16 PDT 2013


Hi

I'm working on using a [dedicated] linux box for an audio filtering use. 
My intentions is to take stereo audio in, process it, and play the 
result on audio out (all on the same sound device). The catch is that 
this app requires as low latency as possible to be usable in the field 
(<40ms)

Since pulseaudio is conveniently available on desktops, I wrote a simple 
pulse app which opens two streams, one record and one playback and 
filter the audio between them.

In the current design, I clock everything by using a record stream read 
CB. The read callback takes the available data, process it, and write it 
asynch to the playback stream without using playback write CB. This 
works, but with significant latency (200ms).

However, when I start to adjust the latency settings on either streams, 
I get underrun errors. Apparently, even though the two streams originate 
from the same wordclock, they expect/deliver data at varying intervals. 
But having a floating buffer inbetween adds further delay.

Does anyone have ideas of what other approaches would be best for this 
app? E.g. clock it from the playback write CB and asynchronously read 
data from record?

IMHO it would be nice if playback and record streams could be 
syncronized, not just playback streams. It would make things very much 
simpler when record deliver x number of bytes, the playback wants the 
same x number of bytes. Perhaps PA offers this already?


Best regards,
Svein


More information about the pulseaudio-discuss mailing list