UDP audio streaming over WiFi

PCRiscV
Posts: 11
Joined: Thu Jan 04, 2024 3:57 pm

UDP audio streaming over WiFi

Postby PCRiscV » Thu Jun 13, 2024 4:44 pm

Hello,

I am trying to stream full duplex audio between an ESP32S3 (Adafruit Metro board) and a remote computer, for now a Raspberry PI.
I can send UDP audio packets from the Raspberry PI to the ESP32 over WiFi. I send a packet every 10 ms, capture it on the ESP32 and push it to the I2S bus to be played on a speaker. This path works great. I use 16 kHz sampling rate, and do not even compress the audio so each packet has 160 samples, 2 bytes per sample.

The problem is in the other direction. I cannot sent UDP packets at a high rate. If I send few packets per seconds, everything works fine, but if I try to send 100 packets per seconds (10 ms frames) I get many ENOMEN (errno=12) from the sendto call. I tried to reduce the packet rate to 50 packets per second (20 ms frame) but that did not help. The problem seems related to the packet rate, not the size of the packets.

Is there some information somewhere on how to configure LWIP or the WiFi driver to work well in UDP. What should I tune to achieve a reasonable realtime audio performance? I would be OK if I could do 25 packets per second, but even at that rate I am still getting burst of ENOMEM errors.

The strange thing is sometime it works for a long time without any errors, but suddenly for no obvious reason, I get those bursts of errors and then it recovers. Is it related to the WiFi spectrum?

Thanks

Who is online

Users browsing this forum: No registered users and 60 guests