Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alsa full duplex communication

Tags:

alsa

I want to implement full duplex communication using alsa. I first wrote capture and playback programs and i am transferring data from captured process to playback process using UDP communication. It is working fine when i was running two processes where one is capturing and another is playing(consider this as half duplex from A to B) , the problem comes when i was trying to implement another half duplex(Half duplex from B to A) then I am getting Broken Pipe error while reading the data from Mic. How to resolve this?. Any help, thanks in advance.

Note: I am running two processes on different systems

like image 395
Siva Krishna Aleti Avatar asked Oct 25 '25 04:10

Siva Krishna Aleti


1 Answers

When the application has to wait for a PCM device, it goes to sleep and gets woken up at the next period boundary. Therefore, the optimal size to read/write is one period (or a multiple of that).

You should read/write sample data as soon as some frames are available.

To reduce the chances of an over/underrun, increase the buffer size. (On capture devices, increasing the buffer size does not increase latency.)

like image 110
CL. Avatar answered Oct 26 '25 23:10

CL.