2009-07-23 06:05:27     Sound latency

Document created by Aaronwu Employee on Aug 16, 2013
Version 1Show Document
  • View in full screen mode

2009-07-23 06:05:27     Sound latency

Yuval Yosef (ISRAEL)

Message: 77947   

 

Hello,

 

We facing up to sound latency problem on BF537-Stamp, CS codec I2S Linux-2.6.28.9-ADI-2009R1-pre,

I2S i/f, ALSA, mmap.

 

According to scope sound latency between MIC to Speaker is ~360 msec.

My simple application do the following:

   get samples from Portaudio

   save in buffer

   provide samples from buffer to Portaudio

 

So, the most of the time takes transferring samples in uClinux.

 

I will be glad to get any recommendation how to decrease latency.

Thanks in advance.

QuoteReplyEditDelete

 

 

2009-07-23 06:17:38     Re: Sound latency

Sonic Zhang (CHINA)

Message: 77948   

 

Which sound device do you use? ad1836?

QuoteReplyEditDelete

 

 

2009-07-23 06:24:34     Re: Sound latency

Yuval Yosef (ISRAEL)

Message: 77949   

 

CS42L52

QuoteReplyEditDelete

 

 

2009-07-23 06:57:59     Re: Sound latency

Yuval Yosef (ISRAEL)

Message: 77950   

 

soc framework

QuoteReplyEditDelete

 

 

2009-07-23 20:45:30     Re: Sound latency

Robin Getz (UNITED STATES)

Message: 77980   

 

Yuval:

 

Sorry - we don't have time to support non-ADI codecs.

 

-Robin

QuoteReplyEditDelete

 

 

2009-07-23 22:00:06     Re: Sound latency

Barry Song (CHINA)

Message: 77983   

 

For audio, if the driver has no other problem, the delay is mainly decided by the DMA fragement size everytime. The size is less, the delay is less, but cause more interrupts. There is a weigh/balance between DMA fragement size and CPU overload because interrupts.

QuoteReplyEditDelete

 

 

2009-07-23 22:03:41     Re: Sound latency

Barry Song (CHINA)

Message: 77984   

 

So you can adjust       

 

.period_bytes_min = ...,

.period_bytes_max = ...,

 

to achive less delay if you are  sensitive on delay but not CPU overload.

QuoteReplyEditDelete

 

 

2009-07-23 22:14:21     Re: Sound latency

Barry Song (CHINA)

Message: 77985   

 

>According to scope sound latency between MIC to Speaker is ~360 msec.

>My simple application do the following:

>  get samples from Portaudio

>  save in buffer

>   provide samples from buffer to Portaudio

 

It seems you also record data to userspace buffer then play it? If so, you buffer should not be too big, or you should playback the data soon before the buffer becomes too big. Pls output the userspace buffer with less fragement.

QuoteReplyEditDelete

 

 

2009-07-27 01:44:57     Re: Sound latency

Yuval Yosef (ISRAEL)

Message: 78056   

 

Thanks, Barry.

 

Upon decreasing .period_bytes_max I have latency ~300 ms.

 

What estimated latency for AD codecs works with ASOC framefork ?

 

In the same test AD1836 codec has latency 120 msec . Is it OK for the codec ? But it not works

 

with ASOC , as I know.

QuoteReplyEditDelete

Attachments

    Outcomes