Closed amcdnl closed 2 years ago
This library has some integration for text-to-speech….
It requires a lot of boilerplate I would rather not include in this library, which is why I created this package. Think:
im open to supporting other sources for the text-to-speech files, the difference between the way I choose and other solutions I’ve seen is that this first calls the text to speech server to generate the speech mp3 and then just queues that. Others are encoding the text in the url (which gives issues).
I also provide a dedicated tts url to all my sponsors, which makes enabling tts a matter of setting a single environment variable, as you can also see in sonos2mqtt.
@svrooij - Yup - I saw that package. My only fear about a remote TTS would be time.
I'm using this to notify me when motion is outside my home and the faster the better. My google nest cams -> homebridge -> homekit -> sonos.
What this package does in essence is:
If speed is the main concern, you could of course pre-generate the mp3 files and host them on a webserver locally. And instead of calling the tts command, you would call the notification command with your local hosted files.
You could even consider sponsoring me, and use my cloud hosted version to pre-generate your mp3 files that you then save locally.
No to mention the fact that you could also run the remote package in docker on a raspberry pi. That would give you local cached messages and auto addes not cached messages to the cache.
You're probably doing something like: Movement detected at {name-of-cam}
, which would only result in x number of messages depending on the amount of camera's.
I would also accept a PR on this package supporting say instead of a remote service (amazon in this case).
How about build support for home assistant text to speech since everybody is already using that anyway.
Thanks for the link!
I actually use Homebridge ( though I'm probably going to end up moving to HomeAssistant for more advanced things ) and I actually wrote a quick plugin using your library - https://github.com/amcdnl/homebridge-sonos-announcer to do what I wanted.
While we are on the topic, I was trying to resolve a file locally but I got mime type errors. I was wondering if you had a good example of how you would do that.
manager.PlayNotification({
trackUri: path.resolve('./hello.mp3')
});
Reference: https://github.com/amcdnl/homebridge-sonos-announcer/blob/master/src/index.ts#L72
Your Sonos speaker cannot access files from the machine running the script. You have to run a small webserver that will serve the mp3.
Like if you would host an html file. This is exactly what I meant by all the things you need to include, this is also the reason for me to build a separate library just for tts
Your Sonos speaker cannot access files from the machine running the script. You have to run a small webserver that will serve the mp3.
Ah, I see how it works now. Ok all that makes sense. Thanks for explaining that.
Awesome package, thanks for building this.
It would be awesome if the TTS was integrated natively. There are a variety of solutions out there that might make this possible like: https://www.npmjs.com/package/say
Wanted to see if you had explored this before ... if nothing else it would make it easier for others to get started.