[pulseaudio-discuss] Client setting for pa_buffer_attr for low latency
Peter.Onion at btinternet.com
Thu Jan 3 04:54:46 PST 2008
I have some existing "game like" applications that currently use ALSA to
produce some sound effects linked to button presses and other events.
I've just moved my PCs over from Gentoo to Fedora 8 so I've come across
pulseaudio for the first time.
I've used some of the examples in the 0.9.8 tarball to get make a first
try at using the pulseaudio client APIs with a glib event loop and it
seems to be working OK.
I have had problems with working out suitable values for the fields in
pa_buffer_attr. Because I need the sounds to be synchronised to events
on the GUI the default values are unsuitable at they produce a large
buffer and latency. But if the values are set too low the audio is
noisey, and sounds as if it is being played at the wrong (too low)
By trial and error I've settled on the following values for now....
attr.maxlength = 4800;
attr.tlength = 2880;
attr.prebuf = 960;
attr.minreq = 960;
These are multiples of 480 because another of the applications produces
480 samples of sound every for each 100Hz timer tick and to change this
will require work on code that has been stable for a couple of years and
that I would rather prefere not to have to touch (because it's quite
complicated ;) ).
I've looked but I can't find any guidance in the documentation on how to
work out appropriate values for the attr structure.
More information about the pulseaudio-discuss