This Sound Driver Runs on the ESP32’s ULP Coprocessor
Just like its little brother the ESP8266, the ESP32 has proven to be extremely versatile and useful for tasks that Espressif probably…
Just like its little brother the ESP8266, the ESP32 has proven to be extremely versatile and useful for tasks that Espressif probably never even imagined when they developed the microcontroller. Both the ESP8266 and the ESP32 were intended to be used in IoT applications, where energy efficiency and wirelessly connectivity are the most important factors. But they can do so much more, and now you can even use the ESP32’s coprocessor to run a sound driver.
This video comes from YouTuber Bitluni, who you may remember from his ESP32 composite video project that we featured early last year. While he was able to generate audio before, it ran on the ESP32’s primary processor. The problem with that is that it eats at valuable resources that are needed for the intensive task of generating video. Because analog audio is completely dependent on frequency timing, sustaining consistent audio actually dramatically impacts how well the rest of the code runs on the main processor.
Luckily, the ESP32 also has a rarely-used ULP (Ultra Low-Power) coprocessor. Bitluni was able to develop a sound driver that runs on that coprocessor, and removes the strain from the main processor so that it’s free to handle more resource-intensive tasks. As Bitluni explains, getting the coprocessor to successfully run a decent sound driver was difficult due to some odd design decisions on Espressif’s part. But he was eventually able to get it working, and has provided his code. All this sound driver requires from the main processor is that it occasionally top off the buffer in the coprocessor’s memory. That means you can have sound without limiting the rest of your code.