If you have a project with an ESP32 with audio in which you use the ESP8266Audio library, you may have had the unpleasant surprise that it doesn’t work for you.
This problem occurs when we use the ESP8266Audio library with an ESP32 Core version higher than 2.0.3. So… POOM! 💥
If when compiling you get an error saying that SPECIAL
is not defined, that is, something like this, then it’s happening to you too. But don’t worry, it has an easy solution!
error: 'SPECIAL' was not declared in this scope pinMode(sck, SPECIAL);
Logically, the problem arises due to changes in the Core definition of the ESP32 for Arduino, which create an incompatibility with the ESP8266Audio library, preventing it from functioning correctly.
Fortunately, thanks to the community and Open Source, the library has a Pull Request (PR) that solves these problems. Pull Request #505
The ESP8266Audio library is not actively maintained (it has 22 PRs waiting to be accepted). Therefore, for the moment, the PR has not been accepted. But we can fix it by downloading the fork directly.
Specifically, the user Tobozo (hey! thanks Tobozo!) is the one who has fixed the library to resolve the incompatibility with the latest versions of the ESP32. Here you have the link to the Fork with the Solution
To apply this solution, simply:
- Download the code from the fork from the link I provided
- Unzip the zip file
- Go to the Arduino installation folder on your system
- In the Arduino folder, go to the “libraries” directory
- Replace the “ESP8266Audio” folder in your Arduino installation with the folder downloaded from the fork
Once these steps are completed, it’s time to work! The ESP8266Audio library should work without problems in newer versions of the ESP32.
This is a temporary solution while the original maintainer of the ESP8266Audio library accepts the PR and releases a new version that fixes the compatibility issue.
But in the meantime, at least you have a workaround to get the ESP8266Audio working with the latest definitions of the ESP32 Core 😉.