If you have a project with an ESP32 with audio in which you use the ESP8266Audio library, you may have been unpleasantly surprised to find that it doesn’t work.
This problem occurs when we use the ESP8266Audio library with an ESP32 Core higher than 2.0.3. Then… ¡POOM! 💥
If when compiling it throws an error saying that
SPECIAL is not defined, that is, something like that, well, 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 ESP32 Core definition for Arduino, which generate an incompatibility with the ESP8266Audio library, preventing its correct operation.
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 to accept). Therefore, for now, the PR has not been accepted. But we can solve 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 ESP32. Here is the link to the Fork with the Solution
To apply this solution, simply:
- Download the code from the fork link I have provided
- Unzip the 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 should work! The ESP8266Audio library should work without problems in newer versions of ESP32.
It is a temporary solution until the original maintainer of the ESP8266Audio library accepts the PR and releases a new version that solves the compatibility issue.
But in the meantime, at least you have a work-around to make the ESP8266Audio work with the latest Core ESP32 definitions 😉.