Has anyone gotten MP3 streaming to work on Core2?
-
I'm about ready to give up after three days of trial and error. Has anyone gotten MP3 streaming to work on Core2?
Yesterday, I was able to stream a low-bandwidth station but today even that doesn't work. I posted some examples of what I have tried, in https://github.com/wsanders/M5Core2-Audio-Is-Broken. The sketch WSWebRadio-broken.ino was working yesterday for a low-bandwith (32k) stream, but produced broken distorted audio from a 192k stream. Today none of the programs in my repo produce any audio.
I haven't seen any posts about working MP3 streaming sketches less than a couple years old, which seems to hint that it just doesn't work. Maybe everyone has switched to MicroPython?
I am using Arduino IDE, M5Core2 library 0.1.9, ESP8266Audio 1.9.7.
-
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.
-
This post is deleted!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login