🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5Tough/Basic/Speak example only plays in setup.

    Arduino
    2
    3
    341
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      electromechpro
      last edited by

      HI,

      I am having difficulty getting any sound source to play more than once with my M5Tough. The closest I could find was a February 2022 post regarding sound not playing at all, but the example in the current Tough library sort-of works. It compiles, downloads, and displays what the program tells it to, as well as playing the "dingdong" sound written in hex in progmem. Pressing the lower right corner of anywhere else on the screen has no effect, and there are no serial debug hints, either. The Core2 speak example is written slightly differently, with the sound hex file in the main .ino. When loaded into the tough, it plays the sound once and has a black screen.
      I was working with the ESP8266Audio library, but it also has no mention of repeating a sound, and the issues page gives passing mention to deleting and reloading the sound file info, unclear where. The closest I got with that was to trigger a sound once from an mp3 on the SD card via a touchbutton.
      Ideally, I would like to trigger a sound, from either SD/mp3 or hex in progmem, from a function that can be called from a desired condition (such as a touch button via handler, gpio pin, RTC event, etc.)
      Can someone revisit the library and update the Speak example for the Tough? It might also workm for the Core2.

      felmueF 1 Reply Last reply Reply Quote 0
      • felmueF
        felmue @electromechpro
        last edited by

        Hello @electromechpro

        have you tried the example from the M5Unified library? It works for me on my M5Core2. (I don't have access to my M5Tough right now so I cannot check if that works as well.)

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        E 1 Reply Last reply Reply Quote 0
        • E
          electromechpro @felmue
          last edited by

          @felmue
          Thanks, Felix.

          I sometimes try Core2 examples, as it seems to have more documentation. The M5Unified example is working on the Tough. I commented out the initial module statements:

          // 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>

          ...and the display shows the menu with the buttons.
          I see they have the wave file directly in the .ino, so I may try and translate my mp3 to hex and paste it in where the wav_unsigned_8bit_click goes.

          This definitely gives me something to work with, so thank you.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post