Closed RespawnDespair closed 3 days ago
Well, that's embarassing. The log actually shows no errors and upon reconnecting the ESP it actually does give output. It sounds a bit garbled, but sound is coming out.
I will go back to the Azure TTS sketch, which in fact did throw log errors...
Well, still no luck, I keep getting these errors when trying to use the Azure TTS example:
[I] StreamCopy.h : 158 - StreamCopy::copy 432 -> 432 -> 0 bytes - in 22 hops
[I] StreamCopy.h : 408 - try write - 2 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 3 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 4 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 5 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 6 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 7 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 8 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 9 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 10 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 11 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 12 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 13 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 14 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 15 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 16 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 17 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 18 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 19 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 20 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 21 (open 432 bytes)
[E] StreamCopy.h : 401 - write to target has failed after 22 retries! (432 bytes)
[I] StreamCopy.h : 158 - StreamCopy::copy 432 -> 432 -> 0 bytes - in 22 hops
[I] StreamCopy.h : 408 - try write - 2 (open 432 bytes)
[I] StreamCopy.h : 408 - try write - 3 (open 432 bytes)
I have tried different Output formats and codec since it seems the originall riff-16khz format used in the example is no longer available. (https://learn.microsoft.com/en-us/azure/ai-services/speech-service/rest-text-to-speech?tabs=streaming#audio-outputs)
So I am sure it is still me making a stupid mistake, but any guidance would be highly appreciated...
That should be pretty trivial to fix: Just take one of the RAW formats and remove the decoder!
If you write invalid data to the WAV decoder, this is bound to fail...
Yes, using a raw output format without a decoder indeed works. This is good news, it means the hardware is all good and the library works, thanks for this.
I still think the example is broken because the requested riff output format no longer appears on the list provided by Microsoft? If I use the WAV decoder and the output format specified in the example I get the errors mentioned in the previous log. I will try some additional combinations with the encoder, but I have a working reference now.
Again many thanks for the library and the help!
My quick tests did not result in a working OutputFormat and decoder combination.
Changing the requested OutputFormat in the example to riff-8khz-16bit-mono-pcm
and changing the sample_rate to 8000 also results in the errors above.
Since the riff- formats only appear on the non-streaming tab of the Microsoft page I get the feeling they are not available and it defaults to a different format?
If the example works for everyone else it might still be a thing on my end, but it does work in raw without a decoder, so I am still confused.
If you have a WAV file, changing the AudioInfo does not have any impact since it is finally take from the header. Did you try to get the file with curl on your desktop in order to analyze it?
Please share your working sketch, so that I can adjust the example accordingly.
I have altered the example a little since I use Dutch, but in essence all I did is remove the WAVE Decoder and modify the requested OutputFormat in the header to RAW as you suggested.
When using the original riff-16khz-16bit-mono-pcm
it does not work with the WAVE Decoder as setup in the example.
I have the file on my PC, but I am not experienced enough with WAVE files to know what I should look for.
....
AudioInfo info(16000, 1, 16);
...
I2SStream i2s; // or I2SStream
StreamCopy copier(i2s, AzureURLStream); // copy in to out
void setup(){
Serial.begin(115200);
AudioLogger::instance().begin(Serial, AudioLogger::Info);
// setup i2s
auto config = i2s.defaultConfig(TX_MODE);
config.copyFrom(info);
config.pin_ws = GPIO_NUM_27; //LCK
config.pin_bck = GPIO_NUM_26; //BCK
config.pin_data = GPIO_NUM_14; //DIN
i2s.begin(config);
....
String ssml = "<speak version='1.0' xml:lang='" + language + "'><voice xml:lang='" + language + "' xml:gender='" + gender + "' name='" + voice + "'>" + msg + "</voice></speak>";
AzureURLStream.addRequestHeader("Ocp-Apim-Subscription-Key", speechKey.c_str());
AzureURLStream.addRequestHeader("X-Microsoft-OutputFormat", "raw-16khz-16bit-mono-pcm"); // if you change this, change the settings for i2s and the decoder
...
}
void loop(){
copier.copy();
}
Just look at the first 4 characters of the file: it should be RIFF
Closed due to inactivity
Problem Description
After experiencing this issue with the Azure TTS example I tried to run the most basic example which I believe is the streams-generator-i2s example. Luckily this shows the same issue.
I have the MAX98357A connected to other pins than usual, because it is part of a bigger project. The device is functional and works with another Library (ESP32-audioI2S https://github.com/schreibfaul1/ESP32-audioI2S).
There I have defined the pins as follows:
Below I have attached the full sketch, where i tried to define the alternative pins as well.
When running the code it throws an error writing to the I2S stream as shown in this log extract:
I have read through the solved issues, but I could find no similar issue, which also leads me to believe I have made an error somewhere. I would appreciate any feedback or suggestions. I would love to use this library for my project as it feels the most clean and well coded to me.
Device Description
A Generic ESP32 WROOM 32D device setup in Arduino as follows: ESP32 Dev Module Partition Scheme: Huge App PSRAM: Disabled
Sketch
Other Steps to Reproduce
No response
What is your development environment
Arduino IDE on MacOS
I have checked existing issues, discussions and online documentation