Networked Speaker Driver

It's likely going to be a while on this, I've been traumatized by the sonos integration, in any event, they both use the same interface (ssdp for discovery and upnp subscriptions to the devices services)

2 Likes

So ... This morning's firmware update now has TTS. So I commented out the section of the driver that were causing the errors. and entered some text in the 'Play Text and Restore' driver
image

I got an error on line 644 that it did not like 'integerValue'. I commented just that part out
def currentVolume = device.currentState("level") // ?.integerValue

AND MY SPEAKER SPOKE THE TEST STRING!:grinning:

Now I will try my webCoRE piston that announces arrival/departures to see if that works.

UPDATE: webCoRE pistons are now able to send text to my speakers! I just have to figure out how to change the voice. It was a female voice with ST and the voice being sent now is male, and the wife does NOT like being told things from males, so that has to change. :smiley:

3 Likes

We did not implement this currently, we were kicking around being able to change this globally, probably in location settings. For now you have Hubitat Harry as we call him.

1 Like

So at my house is was ....

ST Polly: "Matthew is home now"
Wife/Daughter: "Thank you!"

Now if will be:

Hubitat Harry: "Matthew is home now"
Wife/Daughter: "I already knew that!"
:crazy_face:

I have the opposite issue, my wife and girls yell at Alexa... But they love when Hubitat speaks, "Alarm is Set" or "Alarm is disabled" or any of the other phrases I now have set up...

However, I never get to hear their reactions to "Patrick has left the building" when I leave my geofence.

1 Like

Mike,

Is the app / driver call for native TTS the same as SmartThings; i.e.,

	def sound = textToSpeech(text)
	def trackUrl = sound.uri
	def duration = sound.duration

BTW. I am single, so no wife. However, my Amazon Echo has requested that we go into couples counseling. I am suspicious she is having an affair with the thermostat! Way too cozy around here!

3 Likes

I'm testing with.

speaker.speak(message)
speaker.playTextAndRestore(message)
speaker.playText(message)

They all seem to work to play the message

Andy

1 Like

Mike
any chance we can get this via a variable (even %female% , %male% - not necessarily a specific voice)
That way we can select for each message

I was using voice mp3s while waiting for tts and have normal announcements by a femail voice and alerts (leaks etc) with a male voice
Easy to distinguish between the two then.

If it's set globally we could only have one voice

Just a wish from me :slight_smile:

Thanks for all your hard work on this.
It's one of the last things to sort out for me

Andy

Understand. I am developing a speaker driver. I need to know the command there to convert the text to sound (as is done with the previous message in SmartThings).

Yes, same, same...

Probably not any time soon, however once you have the generated uri you can use it directly without calling textToSpeach, so change global setting, build a few, switch back ect, so similar to what you were doing with your mp3s.
We allow 5MB of these on your hub before we start pruning the least used ones.
The file name is an md5 hash of the text and the voice name.

1 Like

@mike.maxwell
Brilliant idea!
Thanks... now.. silly question... when does the global setting arrive? :sunny:

Andy

Lol, now that I've had something to eat and thinking a bit clearer, I'll probably do both.
A global setting, and an optional param to select the actor.

3 Likes

This is AWESOME! I have my Bose speaker doing text to speech now, so easy :grinning:

Is there a way to put some silence at the beginning of the generated file? Sometimes there is no problem, other times the first word gets cut off when played back.

Try adding a couple of commas to the beginning of your message.

,,, start of message

A comma usually adds a slight pause with aws polly

1 Like

@mike.maxwell

This is even better!!
Thanks SO much for considering this Mike

Andy

That didn't seem to work...but thank you for the suggestion! That led me to append "a" to the beginning of the string, that never comes through so it works.

Is it the delay of the speaker turning on? Wondering if you could string a command to turn on and "play" just before sending the tts request?

1 Like

It actually seems like the speakers automatically ramp up the volume. I had to add some silence at the beginning of all my mp3 files when I was generating hard-coded phrases and playing them from the NAS. The speakers are always on, though they do go on stand-by. But I can play the TTS file back-to-back and it always drops the first second or two of the file.

I do need to test playing back music and then sending a notification, as their docs say "speaker will gracefully stop whatever its doing, play the Audio Notification, and then resume whatever it was doing"...

Just read that there is an SSML break tag that will insert a pause...tried to append that to the data string but it didn't work. I am no Groovy expert :wink:

text = "<break time='2s'/>" + text