<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Has anyone gotten MP3 streaming to work on Core2?]]></title><description><![CDATA[<p dir="auto">I'm about ready to give up after three days of trial and error. Has anyone gotten MP3 streaming to work on Core2?</p>
<p dir="auto">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 <a href="https://github.com/wsanders/M5Core2-Audio-Is-Broken" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/wsanders/M5Core2-Audio-Is-Broken</a>. 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.</p>
<p dir="auto">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?</p>
<p dir="auto">I am using Arduino IDE, M5Core2 library 0.1.9, ESP8266Audio 1.9.7.</p>
]]></description><link>https://community.m5stack.com/topic/6541/has-anyone-gotten-mp3-streaming-to-work-on-core2</link><generator>RSS for Node</generator><lastBuildDate>Sat, 09 May 2026 00:20:59 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6541.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 05 Jun 2024 18:18:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Has anyone gotten MP3 streaming to work on Core2? on Tue, 11 Jun 2024 00:39:39 GMT]]></title><description><![CDATA[<p dir="auto">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:</p>
<p dir="auto">After WiFi connects, the delay must be increased to at least 1 sec:</p>
<pre><code>  while ( !WiFi.isConnected() ) delay(100);
  delay(1000);
</code></pre>
<p dir="auto">Preallocating the source buffer seems to be essential:</p>
<pre><code>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);
</code></pre>
<p dir="auto">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:</p>
<pre><code>  M5.begin(true, false, true, true, kMBusModeOutput, false);
</code></pre>
<p dir="auto">My M5Core2 library version is 0.1.9. I have 2.0.9 of the M5 board. definitions.</p>
]]></description><link>https://community.m5stack.com/post/25522</link><guid isPermaLink="true">https://community.m5stack.com/post/25522</guid><dc:creator><![CDATA[wsanders]]></dc:creator><pubDate>Tue, 11 Jun 2024 00:39:39 GMT</pubDate></item></channel></rss>