Can't find Arduino M5core2 Sound example

I've been digging a lot for the last couple days, into trying to create some sounds from the M5core2 speaker (tones) but I haven't been able to get anything to work.

I tried the Arduino 2.x Example, but that's declared as the M5Tough. Then I found the same example file on the M5core2 from 'github' (updated?):
M5-ProductExampleCodes/Core/M5Core2/Arduino/speak/speak.ino at master · m5stack/M5-ProductExampleCodes · GitHub

But I can't get that to compile. The errors end with:

c:/users/mfros/appdata/local/arduino15/packages/m5stack/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\mfros\AppData\Local\arduino\sketches\B714D4ED1044DE02A7B84BDD4D8EEB69\sketch\DingDongSimp.ino.cpp.o:(.literal._Z8DingDongv+0x4): undefined reference to `previewR'
collect2.exe: error: ld returned 1 exit status
Multiple libraries were found for "SD.h"
  Used: C:\Users\mfros\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.1.3\libraries\SD
  Not used: C:\Users\mfros\AppData\Local\Arduino15\libraries\SD
  Not used: C:\Users\mfros\Documents\Arduino\libraries\SD
Using library M5Core2 at version 0.2.0 in folder: C:\Users\mfros\Documents\Arduino\libraries\M5Core2 
Using library Wire at version 2.0.0 in folder: C:\Users\mfros\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.1.3\libraries\Wire 
Using library SPI at version 2.0.0 in folder: C:\Users\mfros\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.1.3\libraries\SPI 
Using library FS at version 2.0.0 in folder: C:\Users\mfros\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.1.3\libraries\FS 
Using library SD at version 2.0.0 in folder: C:\Users\mfros\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.1.3\libraries\SD 
Using library SPIFFS at version 2.0.0 in folder: C:\Users\mfros\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.1.3\libraries\SPIFFS 
Using library HTTPClient at version 2.0.0 in folder: C:\Users\mfros\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.1.3\libraries\HTTPClient 
Using library WiFi at version 2.0.0 in folder: C:\Users\mfros\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.1.3\libraries\WiFi 
Using library WiFiClientSecure at version 2.0.0 in folder: C:\Users\mfros\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.1.3\libraries\WiFiClientSecure 
exit status 1

Compilation error: exit status 1

I tried another from:

Wouldn't compile either...

Tried a sketch that I found in: How to make audio tone from Core2 speaker · Issue #12 · m5stack/M5Unified · GitHub

#include <M5Unified.h>

const uint8_t sin_wav[] = { 128, 152, 176, 198, 218, 234, 245, 253, 255, 253, 245, 234, 218, 198, 176, 152, 128, 103, 79, 57, 37, 21, 10, 2, 0, 2, 10, 21, 37, 57, 79, 103 };

void setup(void)
{
  M5.begin();
  M5.Display.setFont(&fonts::DejaVu18);

  { /// By changing the sampling rate, the fold noise changes.
    auto spk_cfg = M5.Speaker.config();
//  spk_cfg.sample_rate =  50000;
    spk_cfg.sample_rate =  96000;
//  spk_cfg.sample_rate = 100000;
//  spk_cfg.sample_rate = 144000;
//  spk_cfg.sample_rate = 192000;
//  spk_cfg.sample_rate = 200000;
    M5.Speaker.config(spk_cfg);
  }
  M5.Speaker.begin();
  M5.Speaker.setVolume(64);
}

void loop(void)
{
  delay(500);
  for (int i = 500; i < 8000; i += 1) {
//  M5.Speaker.tone(i, 1000, 0, true);
    M5.Speaker.tone(i, 1000, 0, true, sin_wav, sizeof(sin_wav));
    M5.Display.setCursor(0, M5.Display.height() / 2);
    M5.Display.printf("Freq = %d Hz        ", i);
    delay(1);
  }

  delay(500);
  for (int i = 500; i < 8000; i += 500) {
//  M5.Speaker.tone(i, 500, 0, true);
    M5.Speaker.tone(i, 500, 0, true, sin_wav, sizeof(sin_wav));
    M5.Display.setCursor(0, M5.Display.height() / 2);
    M5.Display.printf("Freq = %d Hz        ", i);
    while (M5.Speaker.isPlaying()) { delay(1); }
  }
}

Which worked, but it uses M5Unified.h which has the ".tone()" function. I need to use the "M5core2.h" for my application and I couldn't get the script to compile with both of them declared. To be honest, I'm not sure what the M5Unified.h is, other than it's supposed to support multiple M5 products (I think...).

I'm looking for a simple function to sent out tones.
Any other ideas?

Sir Michael

I just selected the board, then opened the Samples menu, here is the partial list

I can't find the "Simple_tone" example under the M5Core2 examples. Where EXACTLY did you find the example? I searched from the IDE 2.3.4 "File/Examples/M5Core2" (the "M5Core2 was a LONG way down and didn't include any of the examples that I'm seeing in the snapshot that you showed above.

I did find one under the ESP32 (had to search my whole hard drive). I tried the sketch which requires "#include <ESP_I2S.h>". I found that under the library file ESP32-audioI2S-Master which states:

ESP32-audioI2S

:warning: This library only works on multi-core ESP32 chips like the ESP32-S3. It does not work on the ESP32-S2 or the ESP32-C3 :warning:

I don't think the M5Stack Core2 qualifies.

Am I missing something here?

Sir Michael

Your menus look weird, here is mine from the top. The first section is always Builtin Examples, then samples for the selected board, and lastly all the other libraries in your libraries folder that are made to work with the board (if properly formed library)

I'm using Windows 11, and the Arduino IDE is 2.3.4. Yes, it does look different!
Are you running on a Mac or Linux?

Could you paste the contents of the Simple_tone that you are showing?
Thanks!

Sir Michael

I am on a Mac IDE 2.3.4. Your menus aren't right.

/*
 This example generates a square wave based tone at a specified frequency
 and sample rate. Then outputs the data using the I2S interface to a
 MAX08357 I2S Amp Breakout board.
 I2S Circuit:
 * Arduino/Genuino Zero, MKR family and Nano 33 IoT
 * MAX08357:
   * GND connected GND
   * VIN connected 5V
   * LRC connected to pin 0 (Zero) or 3 (MKR), A2 (Nano) or 25 (ESP32)
   * BCLK connected to pin 1 (Zero) or 2 (MKR), A3 (Nano) or 5 (ESP32)
   * DIN connected to pin 9 (Zero) or A6 (MKR), 4 (Nano) or 26 (ESP32)
 DAC Circuit:
 * ESP32 or ESP32-S2
 * Audio amplifier
   - Note:
     - ESP32 has DAC on GPIO pins 25 and 26.
     - ESP32-S2 has DAC on GPIO pins 17 and 18.
  - Connect speaker(s) or headphones.
 created 17 November 2016
 by Sandeep Mistry
 For ESP extended
 Tomas Pilny
 2nd September 2021
 Lucas Saavedra Vaz (lucasssvaz)
 22nd December 2023
 */

#include <ESP_I2S.h>

const int frequency = 440;    // frequency of square wave in Hz
const int amplitude = 500;    // amplitude of square wave
const int sampleRate = 8000;  // sample rate in Hz

i2s_data_bit_width_t bps = I2S_DATA_BIT_WIDTH_16BIT;
i2s_mode_t mode = I2S_MODE_STD;
i2s_slot_mode_t slot = I2S_SLOT_MODE_STEREO;

const int halfWavelength = (sampleRate / frequency);  // half wavelength of square wave

int32_t sample = amplitude;  // current sample value
int count = 0;

I2SClass i2s;

void setup() {
  Serial.begin(115200);
  Serial.println("I2S simple tone");

  // start I2S at the sample rate with 16-bits per sample
  if (!i2s.begin(mode, sampleRate, bps, slot)) {
    Serial.println("Failed to initialize I2S!");
    while (1);  // do nothing
  }
}

void loop() {
  if (count % halfWavelength == 0) {
    // invert the sample every half wavelength count multiple to generate square wave
    sample = -1 * sample;
  }

  i2s.write(sample);  // Right channel
  i2s.write(sample);  // Left channel

  // increment the counter for the next sample
  count++;
}

Here is what the Samples looks like, you need to scroll further to get to the Examples for M5Core, then ESP_I2S then Simple Tone. YES, Apple does it better in this case.

The Simple_tone.ino that you sent is the same as what I had found but it seems like it's for a different processor. It's not listed for the M5Core2.

I did try it and it was of course looking for the ESP_I2S.h file. I installed the "ESP32-audioI2S-master" but the Simple_tone.ino still won't find the ESP_I2S.h file.

C:\Users\mfros\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.1\libraries\ESP_I2S\examples\Simple_tone\Simple_tone.ino:29:10: fatal error: ESP_I2S.h: No such file or directory
 #include <ESP_I2S.h>
          ^~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: ESP_I2S.h: No such file or directory

I'm back at square-one!

Question: I was able to get this one to work:
//How to make audio tone from Core2 speaker · Issue #12 · m5stack/M5Unified · GitHub
(about in the middle of the page). It requires:

#include <M5Unified.h>

and I can't get my code to compile with both that and

#include <M5Core2.h>

There are some boards that I have added to my M5Stack Core2 (relay) that requires the M5Core2.h.

Sir Michael

Lets start at the beginning. Post readable photos of both sides of the board. There appears to be two very similarly named boards that are actually quite different.

My M5Stack is a Core2 AWS: Amazon.com: M5Stack Core2 ESP32 IoT Development Kit for AWS IoT Kit : Electronics

The Relay board is: https://www.robotshop.com/products/m5stack-4-channel-relay-132-module-v11-stm32f030

The Prototype board is: https://www.robotshop.com/products/m5stack-plc-proto-industrial-board-module-v11

However, at this point, it's NOT the hardware. I can't get the sketches to compile. It's not a matter of them not working through the speaker.

I probably won't be able to work on the problem again until Monday, we have weekend guests coming.

Thanks for your help so far!

Sir Michael

Earlier you said
Screenshot 2025-01-24 at 16.13.44
BUT I already showed you that in fact it is there, here is the proof again

There are 8 different examples that I have found, and I can only get 1 to work, but that one uses "M5Unified.h" which is apparently NOT compatible with the M5Core2.h.

  1. Yes, I see that you have it under the "Examples for M5Core2/ESP_I2S/Simple_Tone". You stated that you were on a Mac and that my Menus weren't right. But that's what I've got.

I found the "Simple_tone.ino" and tried but it won't compile. It requires "ESP_I2S.h" but there are no libraries that are compatible with the M5Core2! I've tried them all.

G:\My Drive\Documents\Arduino\LDMOS-Amplifier Redesign\New Function Study\Sound\Simple_tone\Simple_tone.ino:29:10: fatal error: ESP_I2S.h: No such file or directory
 #include <ESP_I2S.h>
          ^~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: ESP_I2S.h: No such file 
  1. I also found "Core2_Sounds.h" but I think that it was written for the Platformio. I tried putting the "Core2_Sounds.h" and "Core2_Sounds.cpp" in the same directory as the code:
// Demonstrates C0re2 Sounds functions
// By: Steve Hageman, August 2022

#include "M5Core2.h"
#include "Core2_Sounds.h"

bool toggle = false;

void setup() {
  // put your setup code here, to run once:
  // Initialize the M5Stack object & internal speaker
  Serial.begin(115200);  
  Serial.println(F("Setup Begin"));
  M5.begin(false, false, true, true, kMBusModeInput, false);  // Init M5Core2

  int32_t err = soundsPlay(beepLong, sizeof(beepLong));
  if (err != CORE2_SOUNDS_OK) {
    M5.Lcd.println("Core2 Sounds Error.");
    while (1)
      ;
  }


  while (1) {

    soundsPlay(beep, sizeof(beep));
    delay(200);
    soundsPlay(beepLong, sizeof(beepLong));
    delay(200);
  }
}
void loop() {
}

It compiles & loads OK but it crashes:

12:59:29.572 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
12:59:29.572 -> mode:DIO, clock div:1
12:59:29.572 -> load:0x3fff0030,len:1344
12:59:29.572 -> load:0x40078000,len:13964
12:59:29.572 -> load:0x40080400,len:3600
12:59:29.572 -> entry 0x400805f0
12:59:30.243 -> SetuM5Core2 initializing...axp: vbus limit off
12:59:30.285 -> axp: gpio1 init
12:59:30.285 -> axp: gpio2 init
12:59:30.285 -> axp: rtc battery charging enabled
12:59:30.285 -> axp: esp32 power voltage was set to 3.35v
12:59:30.285 -> axp: lcd backlight voltage was set to 2.80v
12:59:30.285 -> axp: lcd logic and sdcard voltage preset to 3.3v
12:59:30.285 -> axp: vibrator voltage preset to 2v
12:59:30.487 -> touch: ERROR - FT6336 not responding
12:59:30.576 -> OK
12:59:30.576 -> Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
12:59:30.576 -> 
12:59:30.576 -> Core  1 register dump:
12:59:30.576 -> PC      : 0x400dea82  PS      : 0x00060a30  A0      : 0x800d1d24  A1      : 0x3ffb21f0  
12:59:30.576 -> A2      : 0x00000000  A3      : 0x3f400140  A4      : 0x00008c94  A5      : 0x3ffb223c  
12:59:30.576 -> A6      : 0xffffffff  A7      : 0x3ffc27fc  A8      : 0x00000000  A9      : 0x3ffb21e0  
12:59:30.576 -> A10     : 0x0000000d  A11     : 0x00000000  A12     : 0x3ffc25bc  A13     : 0x00000000  
12:59:30.576 -> A14     : 0x3ffb8a74  A15     : 0x00000000  SAR     : 0x00000019  EXCCAUSE: 0x0000001c  
12:59:30.576 -> EXCVADDR: 0x00000018  LBEG    : 0x400880a4  LEND    : 0x400880c0  LCOUNT  : 0xffffffff  
12:59:30.576 -> 
12:59:30.576 -> 
12:59:30.576 -> Backtrace: 0x400dea7f:0x3ffb21f0 0x400d1d21:0x3ffb2230 0x400d1cdb:0x3ffb2260 0x400db4fe:0x3ffb2290
12:59:30.576 -> 
12:59:30.576 -> 
12:59:30.576 -> 
12:59:30.576 -> 
12:59:30.576 -> ELF file SHA256: cb7e261b6a973977
12:59:30.576 -> 
12:59:30.944 -> Rebooting...

I've tried as many as I could find, but can't get anything to work.

Sir Michael

The fact I am on a Mac is irrelevant, and your menus looking funny to me is just windows as it turns out.
I have not yet heard you say you tried the sample I found. You first have to select M5Core2 as your board, see pic 1 now open File and select Examples. Now look down the list until you see 'Examples for M5Core2' see pic 2
Now look down until you see ESP_I2S and then select Simple_tone.
If I have it you have it unless you have messed with your environment.



Sonofcy,

"I have not yet heard you say you tried the sample I found. "
Please recheck Post #8 above. I did try the one that you sent. I had found that Example as in searching well and when I tried it, the compile failed because there was no "ESP_I2S.h" that is compatible with the M5Core2!

I could NOT find an ESP_I2S.h that would work when I searched through the Arduino Library. I tried them ALL.

You keep saying that my Example Menu is "wrong" but I have no idea how to have it change the Arduino 2.x IDE to be the same as what you see on your Mac.

The closest that I've come to finding a 'Sound' that works is the one that uses

Core2_Sounds.h

but as I mentioned in Post #12 above, it crashes continuously with the errors indicated in #8. I tried modifying the M5.begin(...) with different arguments and it continues to crash when I reload it, except for when I remove all references to

soundsPlay();

Do you understand how to decode the crash dump output?

Sir Michael

There are (at least) two different packages for M5Stack boards

  • Most (all?) of their boards are ESP32, so if you use the built-in generic esp32 board by Espressif Systems -- currently version 3.0.7 or 3.1.1 -- the M5 boards are among the dozens and dozens listed.
  • M5Stack by M5Stack official, their own board package, available through the Additional Board Manager URL https://static-cdn.m5stack.com/resource/arduino/package_m5stack_index.json The current version is 2.1.3 (and from I can tell, based on v2 of the generic esp32 board).

If under Tools | Board, you choose

  • esp32 | M5Core2, then for the "Examples for M5Core2" include
    • ESP Rainmaker
    • ESP_I2S
    • ESP_NOW
    • ESP_SR
    • ESP
    • ESP Async UDP
  • M5Stack | M5Core2, the "ESP_" examples are missing
    • ESP Rainmaker
    • ESP
    • ESP Async UDP

M5Core2 is also a library. It has M5Core2.h. Overall, M5Stack is moving away from these board-specific libraries, toward their M5Unified library.

Looking at the list of "Examples from Custom Libraries" is

  • M5Core2
    • basics
      • speak

At the current latest version of the library, six-months-old 0.2.0, the example is wrong

#include <M5Tough.h>
#include <driver/i2s.h>

extern const unsigned char
    previewR[120264];  // Referring to external data (Dingdong audio files are
                       // stored inside).

Wrong M5; and previewR is missing. This was fixed two months ago, but not in a formal release yet

#include <M5Core2.h>
#include <driver/i2s.h>

extern const unsigned char previewR[120264];  // Referring to external data (Dingdong audio files are
                                              // stored inside).

and the data is in the restored file data.c.

const unsigned char previewR[120264]={ 
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

So with

  • M5Stack M5Core2 board
  • updated speak.ino
  • missing data.c (create a new tab and paste the content)

it compiled for me. Does it work? No idea.

I am doing my level best to be civil, but you are pushing me too far.

I just compiled the example. There is only one ESP_I2S.h and it is in the ESP32 library.

I see there is another post and it has a lot more info that is different so I will mute this thread and let you try to work with whoever posted that. GOODBYE!

sonofcy,
My apologies if you were getting frustrated with me, but you were only pointing out that there was an example sketch, one which I had found and tested (without success). Turns out there was a missing 'data.c' file that was part of the problem!

kenb4,

  1. Thank you, that worked. I was missing the 'data.c' and looking back, I don't see where it is mentioned in the code. I did as you suggested and created a 'data.c' tab and copied the file. Incidentally, I had noticed the include of the M5Tough.h and found the updated example using the M5Core2 early on. That wasn't an issue.

  2. So, do I understand this correctly that the "dingdong" that it plays is from the pre-recorded data that is in the 'data.c' file? In order for me to play a different tone, I would have to somehow create a similar file with that tone?

  3. You mentioned that there are 2 different packages fro the M5Stack Boards. I'm using the M5Stack Core2 AWS. If there are different versions, I'm not sure how to tell. Arduino "Board Info shows:

  1. You also mentioned that M5Stack is moving toward the M5Unified. Am I reasonably safe in trying to migrate my code from the M5Core2 to the M5Unified? From some brief checks, I think that I would have to re-write some of my Display Texts, but so far, I haven't gotten too far into the graphics. Is that solid enough that I can use it? The reason that I ask, is that the M5Unified has a 'tone' function that allows entering frequency and duration for the tone. I take it that I can't use BOTH M5Core2.h and M5Unified.h...

  2. I didn't realize that I could choose the M5Core2 board UNDER the ESP32 board menu. When I choose this again getting the warning that the i2s.h file is deprecated (which I had seen before! That was one of my earlier compile errors!!!). Now, if I go back to the M5Core2 under the "M5Stack" menu, it compiles correctly! I don't understand the difference. I'm tempted to either re-install the M5Stack .json' file. Not sure what to do.

Sir Michael

First of all: use whatever works. Use version control, GitHub, etc., and save the code that works. Record in the README the versions of the Board and Libraries that worked. Then you can (usually) go back to those, no matter how you tinker with things going forward.

Now, you may have noticed that M5Stack, like lots of manufacturers, makes lots of different boards; in particular, lots of ESP32 boards. At the core is the C-(the-programming-language)-level library: ESP-IDF (IoT Development Framework). The current version is 5.4. On top of that, Espressif wraps that to be Arduino-compatible, with setup and loop and a bunch of other stuff, in a C++ platform, arduino-esp32, which is currently at version 3.1.1. (Note that 3.1.1 is actually based on IDF 5.3.2.)

The M5Unified library "provides access to the built-in hardware of M5Stack controllers", regularly and last updated to version 0.2.3 two days ago. That hardware includes

Espressif acquired a majority stake in M5Stack back in April. Seems the way forward is to use:

  • the generic esp32 board (which is arduino-esp32), with the specific M5 model, which handles the CPUs, WiFi, etc.
    • because this is a newer version of the code, some older stuff (in it, or related to it) will now be deprecated.
  • M5Unified library for the extra hardware mentioned above

Eventually, the examples and such may/will be ported over. Until then; before the "unified" era, they made their own

  • M5Stack board, based on
    • arduino-esp32 v2, based on
      • ESP-IDF v4
  • a bunch of board-model-specific libraries, like M5Core2

and so all the old stuff is geared toward that. If you can use that and the code works, then great. Of course, one should be able to switch the board and the library and fix a few things and have the code work with the latest versions of stuff. But that's a lot of tedious work, sometimes involving some code archaeology. As in this case, "Ooops, we deleted a file with all the data in it." (In fact, one reason to "unify" and not have all these discrete variants is to avoid mistakes like that.)

Onto the specific issue here

For Arduino, a sketch is

  • a directory
    • with an .ino file with the same name
    • plus all the "eligible" source files in that directory (.ino, .cpp, .c, a few others)
      • and a src subdirectory, if any
        • and any subdirectories under that, recursively

Therefore every example is a directory. When the .ino has an extern, that means: "you can compile this source file into a module with the assumption that there will be a thing with this name and this type/size; and when the linker tries to put it all together, it's gonna be provided somewhere." That somewhere could be another module in the sketch, or in a library, or the core platform.

  1. So there is no need to say there is a data.c file; an accurate comment would be nice, but not required. Which also makes it too easy to remove a file when "cleaning up" and not noticing the sketch is broken.

  2. If you want to play "recorded sound" then you will need similar data. In theory, you could also feed generated data to create sounds the same way. If you want to play "tones", there should be an easier way.

There's another "Examples from Custom Libraries": M5Unified | Basic | Speaker. The example is two years old. Does it compile? Not for me.

/Arduino/libraries/M5GFX/src/lgfx/v1/platforms/esp32/common.cpp:1612:15: error: '_twowire' was not declared in this scope
 1612 |           if (_twowire) {
      |               ^~~~~~~~

Poking around, there's

#if defined ( ARDUINO ) && __has_include (<Wire.h>)
      TwoWire* _twowire = nullptr;
#endif

So adding that include, and commenting out all the displays, none of which match my M5CoreInk

#include <Wire.h>

// If you use ATOMDisplay, write this.
// #include <M5AtomDisplay.h>

// If you use ModuleDisplay, write this.
// #include <M5ModuleDisplay.h>

// If you use ModuleRCA, write this.
// #include <M5ModuleRCA.h>

// If you use Unit LCD, write this.
// #include <M5UnitLCD.h>

// If you use Unit OLED, write this.
// #include <M5UnitOLED.h>

// If you use UnitRCA (for Video output), write this.
// #include <M5UnitRCA.h>

// * The display header must be included before the M5Unified library.

with the esp32 M5CoreInk board, it works. Is it... disappointing that the examples don't "just work"? Absolutely.

I wouldn't bother reinstalling. What's likely happening is that the other version kinda works, and is cached; switching back doesn't force a recompile for whatever reason, and it sorta works. But you would not be able to get a clean compile with those settings to work.

kenb4,

Surprisingly, the code that you included compiled and worked for me! Again, it's one that has the sound in a hex file (included in the .h file).

I do very much appreciate the information on the M5Stack family being acquired by Espressif. That gives me a much better understanding of the move to the M5Unified.h.

I did start to move my code over from the M5Core2.h to the M5Unified.h. The biggest change appeared to be the way the 3 buttons were handled and for the Touch buttons that I created. But for now, I think that I'll just stick with the M5Core2.h and just move on.

One of the things that continues to frustrate me, is that the guys that create the "Examples" do it in their level of expertise, often with little or no comments. They forget that many of the those that are looking to the examples don't have the understanding of the code that the author does. A good example of this is the M5Unified.h "Touch" example. There are so many for loops and code declarations that hide the basics that are required to use the examples.

Anyway, I ramble...

Again, Thanks for you help.

Sir Michael