TTS interface (text to speech)

Lots of other options that don't take too much to get going. I'm using VLC player for a door open tone now, but I was using it for TTS and it worked really well. Also, if you have a Google Home or Mini, the Google Assistant Relay port is really nice and gives you a choice of voices.

Appreciate the comment.

History. The issue is with some code I am writing. It works for the Samsung Multi-room speakers, but not the soundbar. I can do TTS with AWS fine on the speakers. Have to use another TTS service for the soundbar. When used, the sound will interrupt the playing steam, play the notification text, and then resume the playing stream. Speakers are synced so that the same can be played throughout the house.

PS - This is not for me. It is for other users of the devices - I want it to be as easy as possible for them to be able to utilize the functions of the speakers-soundbars; including TTS, playing channels, and controlling the device settings. It is a lot of code and all works well except tts on the soundbar.

1 Like

Thanks for the background. Hope you figure that one out. Great of you to beat your head against the wall for the good of the community! :grin:

I know we can set the TTS voice globally, but is there a way to set it "locally" in a rule for example
Something like:
speak "this is a test" using Sally voice or "this is another test" using Matthew voice

P.S. I have both Sonos speaker and Google Home

Yes you can in the code that calls the textToSpeech.

Map textToSpeech(String stringToBeSynthesized, String voice = null)

The English, US voices are:

  • Ivy
  • Joanna
  • Kendra
  • Kimberly
  • Salli
  • Joey
  • Justin
  • Matthew

"In the Code"? I have to write an app?

The only available commands I have are these (Sonos speaker)

No, then. You are sort of out of luck since the Sonos interface does not have a voice parameter input during speak nor playText.

I would put in a feature request for the Capability "SpeechSynthesis" by adding
command "setVoice", [enum]
attribute ttsVoice, "string"

Is there a character limit in what can be said with TTS?

I have a completely random clicking coming from one of my google home speakers (nothing in the logs about it) and about the only way I can get it to stop clicking (without powering it off for an extended period) is I created a virtual switch that makes it speak for a long sentence. After the sentence the speaker usually stops clicking.

Reason I ask for the character limit is this is the rule that the virtual switch runs.

And everytime it stops speaking on the word "This"?

Any ideas?

There is no limit...

Any idea on what could cause it to not complete the words listed in the rule? I tried this on a sonos one as well?

Edit, I turned off the "Stop after TTS Complete" toggle on the driver page, it appears to complete it now.

1 Like

Is there any documentation around which of the SSML tags work with Hubitat and which ones don't? I am tyring to use some of them and they don't seem to be working but other seem to work fine. For example, the <break time="3s"/> works fine but <say-as interpret-as=”ordinal”> does not. The REAL problem I'm running into is that logging does absolutely no good in trying to figure out if these are working correctly or being stripped out. This phrase: This is <break time="3s"/> a test of TTS. on a log, looks like this: This_is__a_test_of_TTS. (substituted underscores for spaces since discourse won't allow you to put two spaces next to each other). It's really a bit of a bugger to figure out.

Any of the embedded tags that poly supports should work.
We don't perform any filtering.

2 Likes

I figured out the problem for some reason the quote marks I copied from one reference source for Amazon Polly did not come through as regular double quotes. It wasn't until I typed it by hand that it worked correctly. The one that didn't work was:
<say-as interpret-as=”ordinal”>52</say-as>
And the one that worked was:
<say-as interpret-as="ordinal">52</say-as>

Very, VERY subbtle difference. It wasn't until I put them side-by-side that I got it to work. Sorry for the confusion.

2 Likes

ahhh yes.. The “pretty” quotes don’t work for code.. That used to drive me bananas when I wasn’t using an ide and copying and pasting..

It's almost impossible to see unless you put them into the right font and right next to each other. I've never run into this before so it wasn't anything I've had to look for. Only spun my wheels on that for half a day. UGH! :angry: lol

1 Like

been there.. Cursing why isn’t this #%*%# code working.. Now I use an IDE that has built-in github integration and supports all the languages I need..

And doesn’t do the pretty quotes

Well, this was typing into the edit device page...so no other real option than Chrome. Not like I was writing code. :slight_smile:

1 Like

Just come over from ST and loving HE. Local execution rules! I am using TTS with RM, passing the text in a string using a custom command and it works well. I am trying to embed a SSML pause as shown above in my TTS but as I save it drops out the command. Is there special syntax? can I use a local variable and concatenate it in? BTW, I have been successful with using a variable to add text, but not with SSML in it

For example, my TTS string is “this is a test” %variable%” and it works if %variable% is text string but I can’t pass “” as it will not save into the variable string.

Any help would be appreciated or a simple nope won’t work, SSML is only for use in code is good as well.

If anyone knows how to do this in RM, @bravenel would know.

You can put "" in a variable:

What you want to do is to get the entire string into a variable, and then use the variable in the speech action. Please show the actual string you want to use.

2 Likes