ESP32-audioI2S
ESP32-audioI2S copied to clipboard
speech / host does not work together
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
- audio.connecttospeech("Radio abc"), "de");
- waiting for audio_eof_speech()
- audio.connecttohost(".... radio stream url");
sorry for bother you, but how to code this line #2?
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");
}
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
audio.connecttospeech("Radio abc"), "de"); // will never heard
while (audio.isRunning()) {audio.loop(); }
audio.connecttohost(".... radio stream url");
thanks, works as well!
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.