UPDATE :
Original article still below, but it has been brought to my attention that there is an issue with the my code that causes this issue! Doh! So a fix will be out soon for the DacAudio project.
I noticed a problem some time ago whilst working with WAV files (in my DACAudio project) that if they were too big then behaviour was incorrect. If the data went over about 90K for a single WAV then it would only play up to a certain point and no more. But for my needs this didn’t seem a big deal and I moved on. Then recently I was adding a lot of small (around 5K) WAV files and when the total data content got up to around 90K the ESP32 would behave unpredictably, either by crashing or by just exiting the main loop and ending. To make it even more confusing I could actually add lots of data, way above the 90K mark and as long as I didn’t reference above 90K’s worth in the main code then all would be fine, only if I created a pointer to reference some data already stored in the ESP’s program memory would it trigger the issue.
For example imagine I’ve ten 20K WAV files uploaded and stored into program memory and in my code I reference 4 of them like so
WavPtr1=&Wav1Data;
WavPtr2=&Wav2Data;
WavPtr3=&Wav3Data;
WavPtr4=&Wav4Data;
My code will work fine but if add the line
WavPtr5=&Wav5Data;
Then it could crash out with a “Guru Meditation” error or just report “User code completed” (or something like that indicating the main execution loop has terminated). Now in the example above I am simplifying what my code did. I do in fact pass the pointer to the WAV data to the constructor of an object but within that constructor all that it does is assign a pointer as shown above.
This problem fundamentally affects the DACAudio software for those wanting to use large amounts of data. One of the ESP32’s selling points is it’s ability to address a large program memory area (typically around 4mb being supplied), if you cannot do this then some projects are dead in the water. I’ve spent some time looking for a solution online on various websites including official Espressive forums and from the bits of information I can gather (and it’s all a bit disjointed and unclear) the problem “may” be to do with the definition files for the Arduino IDE or a problem with the basic tools Espressive supply for compilation on their MCU.
What Next?
My plan is to look at other ways of compiling C++ code on the ESP32 and see if the issue goes away. Finding time to take that on, learn the environment, cope with any missing libraries that I need may however be challenging……. A simpler task may be to create a very simple repeatable example that I can post on the Espressive forums and see if any help is forthcoming. I’ll keep this website posted with any progress.
It’s great if this code gets fixed, as it is otherwise amazing
As per you tube comments, see this page for rayvt123’s fixes
https://www.xtronical.com/dac-audio-library-3-1-version-2-released/
I’ll be implementing these into the next update which should be out in about 3 days.