This application I am writing a plugin for has a mode where it uses a timer to drive the delivery of sound. At every tick, if some condition is filled, the buffer is filled with data, otherwise the application runs. I managed to write a plugin that successfully delivers audio using the normal pulseaudio API. I check the size of pa_stream_writable_size every tick, and if it is below some threshold, the application runs and produces sound. This threshold right now is some magic number I stumbled upon, but I think it is related to whatever tlength the server automatically gives me. // too high, and there is a big pause before audio begins to play #define milliseconds 30 ... int mixlen = pa_usec_to_bytes (milliseconds * PA_USEC_PER_MSEC, &device.spec); ... pa_threaded_mainloop_lock (device.mainloop); free_space = pa_stream_writable_size (device.stream); pa_threaded_mainloop_unlock (device.mainloop); if (free_space < mixlen) play (); else write_to_buffer (); I can't write the plugin with the simple API, though, because the only measure I have of the buffer state is pa_simple_get_latency, and this doesn't seem to reflect the state of the sound buffer in the same way that pa_stream_writable_size does. So, I assume I am misunderstanding what "latency" means. I've never used an audio API before, so I don't have any real understanding of the word, just a sense of it from mailing lists and games. What happens here either there is a large period (~30 seconds to 90 seconds) of silence before audio begins to play fine, or I get bursts of audio (5-10 seconds) followed by very long bursts of silence. I know this is related to prebuffering, but beyond that I am lost. // there isn't any right number to pick here #define MILLISECONDS 180 ... int latency = pa_simple_get_latency if (latency < MILLISECONDS) play (); else return 0; So, in short: 1. What is latency? 2. How do the meaning of pa_stream_writable_size and pa_simple_get_latency differ in terms of the fill state of the buffer? 3. Would there be an objection to adding something along the lines of pa_simple_writable_size? Does that even make sense?_