33 audio.cpp
44
55 Created on: Oct 28.2018 */ char audioI2SVers[] =" \
6- Version 3.3.2o " ;
7- /* Updated on: Jul 10 .2025
6+ Version 3.3.2p " ;
7+ /* Updated on: Jul 11 .2025
88
99 Author: Wolle (schreibfaul1)
1010 Audio library for ESP32, ESP32-S3 or ESP32-P4
@@ -483,6 +483,7 @@ bool Audio::openai_speech(const String& api_key, const String& model, const Stri
483483
484484 String post_body = " {"
485485 " \" model\" : \" " + model + " \" ," +
486+ " \" stream\" : true," + // add
486487 " \" input\" : \" " + input_clean + " \" ," +
487488 " \" instructions\" : \" " + instructions_clean + " \" ," +
488489 " \" voice\" : \" " + voice + " \" ," +
@@ -491,14 +492,16 @@ bool Audio::openai_speech(const String& api_key, const String& model, const Stri
491492 " }" ;
492493
493494 String http_request =
494- " POST " + String (path) + " HTTP/1.0\r\n " // UNKNOWN ERROR CODE (0050) - crashing on HTTP/1.1 need to use HTTP/1.0
495+ // "POST " + String(path) + " HTTP/1.0\r\n" // UNKNOWN ERROR CODE (0050) - crashing on HTTP/1.1 need to use HTTP/1.0
496+ " POST " + String (path) + " HTTP/1.1\r\n "
495497 + " Host: " + host.get () + " \r\n "
496498 + " Authorization: Bearer " + api_key + " \r\n "
497499 + " Accept-Encoding: identity;q=1,*;q=0\r\n "
498500 + " User-Agent: nArija/1.0\r\n "
499501 + " Content-Type: application/json; charset=utf-8\r\n "
500502 + " Content-Length: " + post_body.length () + " \r\n "
501- + " Connection: close\r\n " + " \r\n "
503+ // + "Connection: close\r\n" + "\r\n"
504+ + " \r\n "
502505 + post_body + " \r\n "
503506 ;
504507
@@ -3394,7 +3397,7 @@ void Audio::processWebStream() {
33943397 if (!m_pwst.chunkSize ){
33953398 if (m_pwst.f_skipCRLF ){
33963399 if (_client->available () < 2 ) { // avoid getting out of sync
3397- AUDIO_INFO (" webstream chunked: not enough bytes available for skipCRLF" );
3400+ if (!m_f_tts) AUDIO_INFO (" webstream chunked: not enough bytes available for skipCRLF" );
33983401 return ;
33993402 }
34003403 int a =_client->read (); if (a != 0x0D ) log_w (" chunk count error, expected: 0x0D, received: 0x%02X" , a); // skipCR
0 commit comments