Jump to content

- - - - -

SAPI Module - Using Speech in Premise

  • Please log in to reply
No replies to this topic

#1 123



  • Registered
  • PipPipPipPip
  • 2170 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 07 March 2008 - 11:40 AM

I downloaded the SAPI module many months ago but did not get a chance to integrate it until now.

Personally, I was not really sure if it will make sense. I've seen a lot of examples of voice in HA applications and most of them were marketing gimmicks with little real-world use. So I tried it out and I found out that SAPI, and voice in general, absolutely ROCKS!

It took me a couple days to clean up my implementation and make it work in a way that made sense. Here is what I did:

First I bought a commercial SAPI voice from Cepstral. The female voice I bought -"Callie" is much better than the voices that come with the Microsoft package. Her vocabulary is much richer and she can pronounce complicated words very well.

My first implementation was a system status message that can be requested from any audio zone though a local Lutron Homeworks keypad.

I dynamically composed a message that let me know the status of the security system, warned me of any turned of heating zones and read out to me all the Lutron lighting zones a are still on. It was just like HAL 9000! ;-) I will use the feature when going to sleep and want to check the status of things without having to fire up a tablet. When I used it yesterday I found out a fan was still running in a basement bath at midnight. Since I do not have the fan defined in my Premise hierarchy I would never have found out. Finally HA that works.

I had to write a fair amount of code to make things work seamlessly between my 18 Mediazones. In addition to switching sound source-input, I had to make sure original source, volume and mute status was maintained after the message played out. Since I will use voice to report the smoke location when fire alarms are triggered I made sure the volume was set to a minimum of 50% in zones that were below that level … then turn it back to the original.

I am planning to implement a routing that will look for lights that were forgotten on and turn them off. For instance, bathrooms with lights on for more than an hour or lights kept on after 1am. I was trying to figure out how to turn off the lights without entrapping the person who may be using the room. Voice is the natural solution. Simply send them a message "The light in this bathroom will turn of in 30 seconds."

SAPI voice is asynchronous in Premise. This means that our code keeps on executing while the speech is being spoken out. Since there is no way to ask the speech object whether the speech finished you have to guess the total duration of the message and use AddTimer
to schedule any code that will execute once the message is over. Even though a lot of my code is tied to my specific VAUX, Lutron, CADDX implementation I am willing to share the code if anyone is interested.


Voice really works in Premise and it has some wonderful applications in HA. I am sure I will end up creating some annoying voice features but ultimately you can weed out what works and what does not. The 3rd party SAPI module is a great example of how powerful the Premise architecture is.


I would love to see what you've done. Coding is my weak point. I really don't do any at all. So I learn from looking at others scripts and such.

So yes, please do share.

On a related note, I have always wanted to give my system a very specific voice. If you've seen Red Dwarf, I think it's a natural to give a home automation system Holly's voice. If you haven't seen it then none of this makes sense :)

Sounds good…toss it up on the site… I’m not a strong coder, but I can mimic w/ the best of them….

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users