Set TTS Voice locally

Hi
It would be great if you could add something like a Capability "SpeechSynthesis"
Command "setVoice", [enum]
Attribute ttsVoice, "string"

This would allow us to select which TTS voice we want to use "locally" (in a rule, for example) instead of on a global basis.

Thanks

1 Like

I'm not sure if it can be done with RM but it can be done programmatically
Have a look here

That would be so cool for setting off conversations between my devices. I could have a sexy lady's voice on a Home Mini chat with a hunky Australian on my Google Home ha ha ha :smile:

That would really freak out my Airbnb Guests. Ha ha haaaaaah!

3 Likes

I've read about that one, but how do I implement it and where?
Do I have to write an app and/or driver?

You certainly need something if RM can't do it.
I have been thinking to add it to 'Speaker Central' or 'Message Central' (http://hubitat.uk) but not got around to it yet.. maybe next release

Andy

1 Like

Maybe this app can be modified to work in Hubitat
(That's the one I'm using in SmartThings for TTS and it works great)

Media Rendered Events.groovy

I installed it in Hubitat, but had to remove these lines:
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
:frowning:

I can open the app but some parts do not work. Must have something to do with the missing 2 javax. Can they be replaced by something else?

I'm no groovy programmer, but I'm sure someone can fix this. Anyone?

It’s already been ported correctly.

Search is your friend...

Looks great but I'm getting errors:

What do I need to do?

Forget my previous text...

This one goes into the Drivers Code section, not the Apps :woozy_face:

1 Like

I modified a fork of the squeeze player integration (for LMS - Logitech Media Server) to do exactly this. Basically it has in preferences for each device a voice/language choice and also a custom command to setVoice so you can change the voice through rules machine.

Note: The voice selected in preferences will override the HE global Voice selection. And the setVoice command will override the default in preferences. To go back to voice preference of the device you just need to send a NULL through setVoice (or an invalid voice).

I commented all my changes with //ecallegari so you can easily add it on any TTS driver. Chrome device driver is my next one for cast devices and the fullyk integration is another one.

I will post soon (remind me if I don't in the next day or two). Just wanted to do some more testing on some of the voices/languages/characters since my main purpose to do this was to handle multi-lingual announcements and speech. (living in a multi-lingual home)

Wow, very cool. I look forward to try that!

I think a random sentence generator, taking random sentences from Wikipedia or suchlike and having them play in a conversation would be hilarious.

Ok, checked it in but not fully tested. It works for most voices I tried but have not tested putting in non-English characters. When I arrive home I will try that out and fix if needed.

It's a fork from the original squeezebox from xap. Only modifications in squeezebox-player.groovy marked with //ecallegari.

I plan to implement more on others if you have any ideas of other integrations that could use it.

1 Like

Thanks Cobra!!
I just made a few modifications to the MediaRenderer Player apps and now I can select which voice I want my Sonos to speak (one per Sonos) and it works!
But now I want to do it on a text by text basis.

Now and since you look like an expert in groovy programming, may I ask a favour from you?

I would like to know how to split this text in 2 and get rid of the []
This is some text to speak [Salli]

To get 2 strings:
1-This is some text to speak
2- Salli

Then with a simple modif in MediaRenderer I will be able to make it speak the way I want just by putting the voice in the text string. :slight_smile:

Thanks in advance

Ok nailed it! :nerd_face:

Now I can select TTS voice either per speaker:

OR
Directly inside the text to be sent to the speaker in this case [Salli]

Took me a while because I'm new to this groovy stuff. But I'm beginning to like it!

P.S. This will ONLY work with DLNA compatible speakers and a slightly modified version of the MediaRenderer Player driver app by Author: SmartThings - Ulises Mujica (Ule) and
altered for Hubitat by @veeceeoh.

One down, 2 more to go!
1- I need some kind of geofences system like the one used in Stringify
2- I need some kind of traffic alert system, again like the one used is Stringify

Ok, you must have guessed it, I "was" a BIG user of Stringify :slight_smile:
I was also a Beta tester for them for almost 2 years, mainly with geofences.
Sooooo sad Comcast decided to shut it down. :cry:

But I think there's hope with Hubitat.

3 Likes