🤖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?

    Scheduled Pinned Locked Moved SOFTWARE
    6 Posts 4 Posters 16.6k Views 2 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            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 Offline
              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 Offline
                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

                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
                • First post
                  Last post