Streaming Audio over WiFi using the Arduino Uno R4 WiFi, AutoAnalogAudio Library & VLC
Pushing the system to its internal limits
With recent developments regarding the AutoAnalogAudio library and the Uno R4 WiFi, I was able to get an audio stream to play on VLC over WiFi from a microphone attached to the Uno R4. This was a little bit of a challenge due to the inherent limitations of the R4, but I was able to make it function.
In short, the attached ESP32 that handles WiFi is connected to the main RA4M1 chip via a Serial bridge, running at 115200 baud. This pretty much limits the associated audio stream to lower quality 8Khz 8-bit samples. A modification is possible, but with out-of-the-box behaviour, my tests show that 9Khz 8-bit audio is the upper limit.
I've included an example into the AutoAnalogAudio library to demonstrate this behaviour, compressing the 14-bit output of the ADC (microphone input) into 8-bit samples using PCMU encoding and sending them directly to VLC Media Player in RTP format over UDP.
To configure the example, one would need to enter their WiFi credentials into the associated secrets.h file. This helps to establish the WiFi connection used for audio streaming to a computer. With the PC running VLC on the same WiFi network, users then need to determine the IP Address of the VLC machine and enter it into their sketch as targetIP.
Once those two things are done, just run the example with a microphone connected to pin A1 on the Arduino Uno R4 WiFi. Then open VLC and open a Network Stream at rtp://@:5004
The audio is lower quality, only really good for voice transmission, but as stated, users can override this behaviour by modifying the ESP32 core for the Uno R4 WiFi and configuring the bridge to run at a faster speed. See the Arduino Forum post here. With a customized ESP32 Bridge sketch, and customizing the Modem.h file in the WiFiS3 library for the Uno R4 WiFi, I've achieved internal baud rates of 2MHz, allowing streaming up to 50KB/s or about 25KHz audio sampling at 16-bits.
Version 1.55.1 of the AutoAnalogAudio library has been released including support for nRF54L15 and Uno/Nano R4 boards, and can be installed via the Arduino Library Manager.
No comments:
Post a Comment