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

    How could I make text to speech using the speaker?

    SOFTWARE
    4
    6
    14.2k
    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.
    • A
      AndreaF
      last edited by

      I have M5stickC with speaker hat. I'm wondering if it's possible to perform text to speech routines in order to allow the speaker to speak a string.

      1 Reply Last reply Reply Quote 0
      • ChrisWRC
        ChrisWR
        last edited by ChrisWR

        This works on the M5stack, for the stickC I cannot test tho..

        #include <M5Stack.h>
        #include <M5StackUpdater.h>
        #include <Arduino.h>
        #include <ESP8266SAM.h>  //https://github.com/earlephilhower/ESP8266SAM
        #include <AudioOutputI2S.h>  //https://github.com/earlephilhower/ESP8266Audio
        
        AudioOutputI2S *out = NULL;
        
        void setup()
        {
          M5.begin();
          Wire.begin();
          if(digitalRead(BUTTON_A_PIN) == 0){
            Serial.println("Will load menu binary");
            updateFromFS(SD);
            ESP.restart();
          }  
          out = new AudioOutputI2S(0, 1, 32);
          out->begin();
        }
        
        void loop()
        {
          ESP8266SAM *sam = new ESP8266SAM;
          sam->Say(out, "Can you hear me now?");
          delay(500);
          sam->Say(out, "I can't hear you!");
          delete sam;
        }
        
        1 Reply Last reply Reply Quote 0
        • ChrisWRC
          ChrisWR
          last edited by ChrisWR

          Try this for the M5stickC could work, ...

          #include <M5StickC.h>
          #include <Arduino.h>
          #include <ESP8266SAM.h>  //https://github.com/earlephilhower/ESP8266SAM
          #include <AudioOutputI2S.h>  //https://github.com/earlephilhower/ESP8266Audio
          
          AudioOutputI2S *out = NULL;
          
          void setup()
          { 
            out = new AudioOutputI2S(0, 1, 32);
            out->begin();
          }
          
          void loop()
          {
            ESP8266SAM *sam = new ESP8266SAM;
            sam->Say(out, "Can you hear me now?");
            delay(500);
            sam->Say(out, "I can't hear you!");
            delete sam;
          }
          
          X 1 Reply Last reply Reply Quote 1
          • X
            xis @ChrisWR
            last edited by

            @chriswr It works on the M5stickC :)

            Can you explain the line " out = new AudioOutputI2S(0, 1, 32);" ?
            What do the numbers 0, 1, 32 mean?
            Thank you.

            1 Reply Last reply Reply Quote 0
            • X
              xis
              last edited by

              I see some examples, like here :
              https://www.xtronical.com/i2sinternetradio/
              There is a line:
              // audio.connecttospeech("Wenn die Hunde schlafen, kann der Wolf gut Schafe stehlen.", "de");
              It seems to be another way, but you can choose the language.
              Could this work on the M5stickC with the SPK HAT?
              What do I put on DIN connection, Bit clock, and Left Right Clock?

              1 Reply Last reply Reply Quote 0
              • M
                makadodo
                last edited by

                @chriswr said in How could I make text to speech using the speaker?:

                ESP8266SAM *sam = new ESP8266SAM;
                sam->Say(out, "Can you hear me now?");
                delay(500);
                sam->Say(out, "I can't hear you!");
                delete sam;

                @ChrisWR will this work with ATOM Echo Smart Speaker Development Kit? https://m5stack.com/collections/m5-atom

                1 Reply Last reply Reply Quote 1
                • M mtrobregado referenced this topic on
                • First post
                  Last post