Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speak example never stopping on ESP32 #18

Open
schmurtzm opened this issue Dec 28, 2021 · 1 comment
Open

Speak example never stopping on ESP32 #18

schmurtzm opened this issue Dec 28, 2021 · 1 comment

Comments

@schmurtzm
Copy link

Similar to : earlephilhower/ESP8266Audio#473

On ESP32, after playing a SAM voice it never stop to say the last sound.
To find out this you have to modify a little the default example by replacing the delay(); with something not blocking.

Here the example to verify this little bug on ESP32 (and a quick/dirty solution in comments) :

#include <Arduino.h>
#include <ESP8266SAM.h>
#include <AudioOutputI2S.h>

unsigned long previousMillis = 0;        // will store last time sam voice was played
const long interval = 5000;              // inerval between the repeats

AudioOutputI2S *out = NULL;

void setup()
{
  out = new AudioOutputI2S();
  out->begin();
}

void loop()
{

  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    ESP8266SAM *sam = new ESP8266SAM;
    sam->Say(out, "Bonjour");
    delete sam;
    // quick fix to avoird infinite repeat on ESP32 :
    //out->stop();  

  }
}

I hesitated to create this issue in ESP8266audio library but I think that the out->stop(); could be added at line 87 of ESP8266SAM.cpp.
Need expert opinion to confirm 😉

@Rob58329
Copy link

Rob58329 commented Jul 22, 2022

I have found that on the ESP32, I often need to finish each sentance with a SPACE (or a full-stop, or a comma) for example
"sam->Say(out, "Hello ");
and this stops the sound at word/sentance end.

BUT, I still also occasionally get and issue on the ESP32 if the battery is getting low, that the above command is repeatedly started but never finished (as if the ESP32 was crashing, but it isn't, and instead the "Say(" function seems to be crashing part way through and repeating, giving me:
"Hel"
"Hel"
"Hel"
"Hel"
until the ESP32 is rebooted (or runs out of power). I haven't found a way of identifying or fixing this yet (other than recharging the battery!) (Although this MIGHT be the "Adafruit MAX98357A i2s 3W amplifier" which is crashing/looping?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants