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

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Mon Aug 26 05:36:15 PDT 2013


On Mon, 2013-08-26 at 13:31 +0200, Svein Seldal wrote:
> 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?

No, PA doesn't offer that. Reading and writing to the sound card is
handled completely separately, from different threads, so there's no
read/write synchronization in the server either.

You said that you use a dedicated box for the processing, so using the
default sound server doesn't sound like a hard requirement. In that case
I recommend using JACK, it's designed for this kind of use cases.

-- 
Tanu



More information about the pulseaudio-discuss mailing list