This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AUDIO LATENCY on AM335x with ALSA driver

Other Parts Discussed in Thread: AM3352

Dear support,

    I am working on a custom board with a Sitara AM3352 and a tlv320aic32x4 codec.

Using ALSA, the playback delay is quite low but the capture latency is very high (about 500ms).

I know the driver can achieve bedder performance because using portaudio I measured a capture latency of 22ms. The problem is that the portaudio is not stable.

I would like to decrease the latency,  100ms would be acceptable and I wonder if someone has already explored the path.

If I set CONFIG_IRQ_FORCED_THREADING=y and use the "threadirqs" kernel parameter I get some progress, but not enough.

Now I am trying to port the jack server but I am not sure this is the way.

Googling around the web I found that many developers suggest to enable the RT kernel patch. It is quite odd, but it seems that the kernel 3.14.26, distributed with the am335x-evm-01.00.00.00 does not support this patch.

So, how to reduce capture delay? Thank you in advance.

  • Hi Peregrinus,

    The audio blocks use ALSA framework for sound capture. On the capture sides, there is ring buffers that hold audio samples. This ring buffer give a cushion while capturing back audio against buffer overruns / underruns. In the ALSA Audio Capture implementation by default is set the capture ring buffer size to hold 0.5 seconds of data. The capture starts once this ring buffer is full so the minimum latency will be about 0.5 seconds.
    Therefore I suggest you to minimize the capture period size for minimizing the ALSA capture delay.
    Probably there are some additional more minor settings which can affect the capture latency like the following kernel configuration options which should be enabled:
    CONFIG_HZ_1000
    CONFIG_IRQ_FORCED_THREADING
    CONFIG_PREEMPT

    BR
    Tsvetolin Shulev
  • For playback streams, a sample is actually played only after all previous samples in the buffer have been played, so the latency is the buffer size.

    For capture streams, your application gets notified as soon as the first period is captured, so the latency is the period size.

    How exactly does your program work?

  • Thank you for your answer Tsvetolin,

    with the following kernel options,


    CONFIG_IRQ_FORCED_THREADING
    CONFIG_PREEMPT

    and reducing the ALSA circular buffer size,  I can reach about 130ms of latency, it is not possible to go below this value. I would like to get somethig more but it is enough.

    Best regards.