I got the sketches to work, They will be posted to the above repo shortly. The key changes from some of the existing code out there that does not work anymore:
After WiFi connects, the delay must be increased to at least 1 sec:
while ( !WiFi.isConnected() ) delay(100);
delay(1000);
Preallocating the source buffer seems to be essential:
const int preallocateBufferSize = 128*1024;
const int preallocateCodecSize = 85332; // AAC+SBR codec max mem needed
void *preallocateBuffer = NULL;
void *preallocateCodec = NULL;
...
// Don't forget to malloc the buffers
preallocateBuffer = malloc(preallocateBufferSize);
preallocateCodec = malloc(preallocateCodecSize);
...
srcbuf = new AudioFileSourceBuffer(file, preallocateBuffer, preallocateBufferSize);
...
// Preallocating the MP3 generator doesn't seem to be essential
//gen = new AudioGeneratorMP3(preallocateCodec, preallocateCodecSize);
You must call M5.begin with the 6th argument false to disable the M5.Speaker code. With this argument, the skeptch will produce audio, but at half speed and half pitch:
M5.begin(true, false, true, true, kMBusModeOutput, false);
My M5Core2 library version is 0.1.9. I have 2.0.9 of the M5 board. definitions.