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

audio.openai_speech() sound file does not play #928

Open
SaKiEQ opened this issue Dec 16, 2024 · 1 comment
Open

audio.openai_speech() sound file does not play #928

SaKiEQ opened this issue Dec 16, 2024 · 1 comment

Comments

@SaKiEQ
Copy link

SaKiEQ commented Dec 16, 2024

I created a basic sketch, that either plays audio.connecttohost(); or audio.openai_speech();
While it plays sound from host streams just fine, it remains silent when requesting the TTS response.

I get the 'AUDIO_INFO' feedback "audio_info: SSL has been established in 594 ms, free Heap: 134904 bytes", nothing plays.
The API key is fine, when I run a local CURL request with the API key I get a mp3 file as response.

Any pointers what could be wrong ?

@BoltSwith
Copy link

I encountered a similar experience in the last two days. I had recently updated the library to Version: 3.0.13x (Updated on: Dec 01.2024).
Connecttohost() plays fine, however, audio.openai_speech() remains silent after returning TRUE.

I managed to get it working somehow after tinkering with the sequence of commands/statements. But this only got rid of the problem temporarily, because, after multiple request/chats/query, the problem seems return until I restart the chip.

Try the following:

  1. Create a separate task to initialize and loop through audio.loop();
  2. Run the new task on core 1 and assign it a priority of 2 - 3, you can use stack size between 8192 or 10240 bytes.
  3. In the new task, call the Audio Lib functions in this sequence
  • audio.setConnectionTimeout(6000, 6000);
  • audio.openai_speech(OPENAI_API_KEY, "tts-1", YOUR_TEXT_MSG, "shimmer", "mp3", "1");
  • audio.setVolume(YOUR_SET_VOLUME);
  • audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
  • while(1){ audio->loop(); vTaskDelay(1); }// loop end

Let me know if this helps.

NB:
I'm using esp-idf version: v5.3.1 ; the esp32s3 SoC (N16R8), Arduino (As a Component) version: v3.1.0-rc1

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