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

speech / host does not work together #741

Open
aber68 opened this issue May 8, 2024 · 6 comments
Open

speech / host does not work together #741

aber68 opened this issue May 8, 2024 · 6 comments

Comments

@aber68
Copy link

aber68 commented May 8, 2024

hello, why does this lines not work on arduino ESP32-S3? thx 4 help br andreas

... code
audio.connecttospeech("Radio abc"), "de"); // will never heard
audio.connecttohost(".... radio stream url");

... code

connecttospeech works only if called without following connecttohost. i want to realize an annoncement of an radio station before playing the stream

@schreibfaul1
Copy link
Owner

  1. audio.connecttospeech("Radio abc"), "de");
  2. waiting for audio_eof_speech()
  3. audio.connecttohost(".... radio stream url");

@aber68
Copy link
Author

aber68 commented May 9, 2024

sorry for bother you, but how to code this line #2?

@schreibfaul1
Copy link
Owner

please try it like this, I haven't tested the function yet, but the idea is that it should be done like this

#include "Arduino.h"
#include "WiFi.h"
#include "Audio.h"

// Digital I/O used
#define I2S_DOUT      25
#define I2S_BCLK      27
#define I2S_LRC       26

Audio audio;

String ssid =     "*******";
String password = "*******";

void setup() {
    Serial.begin(115200);
    WiFi.mode(WIFI_STA);
    WiFi.begin(ssid.c_str(), password.c_str());
    while (WiFi.status() != WL_CONNECTED) delay(1500);
    audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
    audio.setVolume(21); // default 0...21
    audio.connecttospeech("Wenn die Hunde schlafen, kann der Wolf gut Schafe stehlen.", "de"); // Google TTS
}

void loop(){
    audio.loop();
}

void audio_eof_speech(const char *info){
    Serial.print("eof_speech  ");Serial.println(info);
    audio.connecttohost(".... radio stream url");
}

@aber68
Copy link
Author

aber68 commented May 9, 2024

this will probably work, but i need to choose many radio stations. is there an other possibility to wait on eof_speech? i tried with a flag within audio_eof_speech(const char *info) but this doesn't work

@ivuslat
Copy link

ivuslat commented Jun 2, 2024

audio.connecttospeech("Radio abc"), "de"); // will never heard

while (audio.isRunning()) {audio.loop(); }

audio.connecttohost(".... radio stream url");

@aber68
Copy link
Author

aber68 commented Jun 2, 2024

thanks, works as well!

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

3 participants