jishi / node-sonos-http-api

An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.
http://jishi.github.io/node-sonos-http-api/
MIT License
1.85k stars 460 forks source link

Micorosft TTS Error 401 when invoiking /synthesize #905

Open JsChiSurf opened 3 weeks ago

JsChiSurf commented 3 weeks ago

Hi All,

Been using this great library since 2017 and it has worked flawlessly.

I realized last night that out of the blue some of my various scheduled announcements were not running, so I pulled up a direct call in my browser, such as:

http://192.168.1.136:5005/sayall/hellow%20world/Catherine/70

And when doing the above (or any other TTS comands), am now receiving the following out of the blue (w/o any other sort of system changes, upgrades, installs, etc):

{"status":"error","error":"Got status 401 when invoking /synthesize","stack":"[object Object]\n at /home/pi/downloads/node-sonos-http-api/lib/tts-providers/microsoft.js:88:12\n at process._tickDomainCallback (internal/process/next_tick.js:129:7)"}

I checked to make sure my API Key didn't expire and I can manually make curl calls to request a new token, etc, w/o issue, but the synthesize has stopped working even with the most simple one or two words text phrase (hello world in the above example).

I see some references to others out there that it may reflect an issue with the service itself, so am wondering if anyone else is seeing the same issue.

Thanks.

JsChiSurf commented 3 weeks ago

Raw console log output versions this library's formatted error output (basically same thing just a bit more verbose):

2024-11-02T13:12:01.171Z INFO http server listening on 0.0.0.0 port 5005 2024-11-02T13:12:09.104Z INFO announce file for phrase "your" does not seem to exist, downloading 2024-11-02T13:12:09.820Z ERROR Error at /home/pi/node-sonos-http-api/lib/tts-providers/microsoft.js:88:12 at processTicksAndRejections (node:internal/process/task_queues:96:5) 2024-11-02T13:12:09.821Z ERROR Error at /home/pi/node-sonos-http-api/lib/tts-providers/microsoft.js:88:12 at processTicksAndRejections (node:internal/process/task_queues:96:5) (node:5208) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsa fe(), or Buffer.from() methods instead. (Use node --trace-deprecation ... to show where the warning was created)

JsChiSurf commented 2 weeks ago

Not sure if anyone else has/had been experiencing the same issue with the Microsoft TTS API, but I think this may have to do with deprecation of the old API / voices, etc, in favor of the Azure AI Speech TTS and use of the 'Neural' AI voices.

I created a new API key under the Azure TTS service, updated the endpoints in this library for both authorization and synthesizing (based on regional servers / your location), as well as created a new VOICE array in the script (microsoft.js) with the updated available names, and all is working well again.

I do miss the BenjaminRUS voice, but there are many other nice ones to choose from and they are definitely more natural.