Posts: 3
Joined: Mon Apr 18, 2016 12:49 pm

Audio delay when using pulseaudio and gstreamer

Mon Apr 18, 2016 1:06 pm

Hello everybody,

Currently i am working on a voice application for the raspberry pi. It is very important that the audio delay is as low as possible.

I'm using pulseaudio and gstreamer for this because pulseaudio includes some echocancellers, and these echo cancellers are mandatory for the voice application i am working on.

When using gstreamer and alsa, i get an acceptable delay of say 200 ms. I test this by connecting a USB microphone to the pi and sending the audio output of the microphone dierctly to the analog output (speaker output). The gstreamer commands are:

gst-launch-1.0 alsasrc device=plughw:camera ! alsasink sync=false

As mentioned earlier, the delay using alsa only is very acceptable. Next try is the same topology, but using pulseaudio.

gst-launch-1.0 pulsesrc ! pulsesink sync=false

Now, i have a delay of about one second, which way to high!
When googling for this problem, i found this page ( ... cyControl/ ) were some tips are given to reduce the latency when using pulseaudio. I have implemented these tips by building gstreamer from source and modified pulssrc.c and pulsesink.c according to the documentation, but no improvement.

Can anyone give a hint about reducing the latency when using pulseaudio on raspberry pi. Help is greatly appriciated.



User avatar
Posts: 27
Joined: Wed Apr 08, 2015 2:37 am
Location: Indonesia
Contact: Website

Re: Audio delay when using pulseaudio and gstreamer

Tue Aug 30, 2016 3:25 pm


Any update about this issue?
I had similar matter, my Qt application with sound also got high latency.
It has about 1 second delay before playing.
And the sound yielded also not smooth.
If you have any workarround, please let me know.

Thanks a lot guys ..
/Ddy, Batam Island - Indonesia
MyRaspberryPi : Cross Compile, wxWidgets/C++ and Linux Journal at

User avatar
Posts: 343
Joined: Thu May 26, 2016 10:36 pm

Re: Audio delay when using pulseaudio and gstreamer

Wed Aug 31, 2016 9:04 am

If you need low latency audio, USB simply will not cut it. The UAC2 protocol requires blocked audio over USB.
You can probably bring the latency down by milliseconds by using GPIO soundcards.

You should be able to bring your gstreamer latency down to the order of 3 ms using alsa directly. I have clocked a GPIO soundcard down to 0.5 ms latency with low CPU load. As you crank up the CPU load, the required latency (block size) will increase.

To lower the audio latency, work out how to reduce the block size which ALSA is using.

You can also find the theoretical minimum latency using the latency alsa command, which you have to compile yourself for the Pi. Here is an example of using the latency command :
sudo ./latency -r 96000 -f S32_LE -p

Discuss hearing, acoustics, audio injector products, -
Sound card for the Raspberry Pi with inbuilt microphone :
Audio Inector Octo multitrack GPIO sound card

Posts: 3
Joined: Mon Apr 18, 2016 12:49 pm

Re: Audio delay when using pulseaudio and gstreamer

Tue Oct 25, 2016 2:23 pm

We could not decrease the delay when using pulseaudio, so we switched back to alsa. We used the gstreamer line below to measure audio delay and it was around 250 ms, which is acceptable for us.

gst-launch-1.0 alsasrc device=plughw:camera ! alsasink sync=false

Return to “Graphics, sound and multimedia”