ESP32-audioI2S icon indicating copy to clipboard operation
ESP32-audioI2S copied to clipboard

speech / host does not work together

Open aber68 opened this issue 1 year ago • 7 comments

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

aber68 avatar May 08 '24 18:05 aber68

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

schreibfaul1 avatar May 09 '24 05:05 schreibfaul1

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

aber68 avatar May 09 '24 07:05 aber68

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");
}

schreibfaul1 avatar May 09 '24 07:05 schreibfaul1

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

aber68 avatar May 09 '24 07:05 aber68

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

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

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

ivuslat avatar Jun 02 '24 09:06 ivuslat

thanks, works as well!

aber68 avatar Jun 02 '24 15:06 aber68

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jul 03 '24 02:07 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jul 17 '24 02:07 github-actions[bot]