Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Baby Shower Stetho-Microphone Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
theowl
Groupie
Groupie
Avatar

Joined: February 24 2006
Location: United States
Online Status: Offline
Posts: 59
Posted: February 27 2006 at 18:09 | IP Logged Quote theowl

Hi!

I'm trying to create a little gag for a baby shower that is due to be held at my place. I'm going to set-up a little display on one of the walls and have an X10 remote there. When the expecting mother stands by the display and presses a button on the remote, it will trigger the following macro...

(Don't have the macro in front of me, so this is from memory)

TTS "Scanning for expecting mother"
TTS "Located mother, scanning for baby"
TTS "Found Baby, calibating long range stetho-microphones."
TTS "You should hear your baby in 5. 4. 3. 2. 1."
ph_playsound("C:\givemecoffee.wav",0)

This sounds simple enough, but the wave file always starts playing instantly instead of waiting for the TTS to finish. I've placed WAIT commands on the previous line, DELAY commands, even moved the playsound to another macro and had the current macro Delay, then call the new macro. The wave plays every time as soon as the macro runs.

Can someone help me get this working please...I only have a few weeks to perfect the entire display/setup.

Also, if any of you can figure out how I could do gag #2 with just PH and some lamp modules, it would be so cool to have it too.

Gag #2...

Another display in the room would indicate that it's capable of guessing the sex of the baby. It would have a pink light, blue light, and a yellow light in the center. Upon pushing a button on another X10 remote, PH would start flashing the lights slow at first...then work up to 1 flash / second (or more). Finally, landing on a single light of the three (determined by a rand function I'm guessing). With the time restriction I have, I figured the first one would easier...but my coding skill must not be what it used to.

Thanks!
Back to Top View theowl's Profile Search for other posts by theowl
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: February 27 2006 at 19:06 | IP Logged Quote dhoward

This is tricky. The problem is that the TTS function is asynchronous. That is, the TTS function is called and returns immediately and a separate TTS thread speaks the queued phrase when it becomes available. So the first four TTS commands will queue up and return immediately and then play the wave file (which should be synchronous).

What I would do is call the TTS engine once with all of the above text and use a SAPI5 tag to add some delay between the spoken sentences. Like:

TTS 'Scanning for expecting mother <SILENCE MSEC="1000"/> Located mother, scanning for baby'

I would do this on the first macro line. I would then use a Wait command for the appropriate length. You'll have to time how long it takes for the TTS to finish. If the entire TTS string takes 20 seconds then use a Wait 22. The third line should be your playsound. This should give you the desired effect.

Im at work right now so cant play with #2, but I'll mess around with it and post later.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
theowl
Groupie
Groupie
Avatar

Joined: February 24 2006
Location: United States
Online Status: Offline
Posts: 59
Posted: February 28 2006 at 14:26 | IP Logged Quote theowl

I tried gag #1 by putting all the tts on one line with the silence thing, which did not work at all. So I copied that line over and tried it as a formula line using ph_tts, which gave the following message when I hit the verify button.

A critical error occurred at 2006-02-28 13:19:29.978.PowerHome Version: 1.03.4.4Error Number: 35Error Message: Error calling external object function speak at line 3 in function f_speak of object uo_tts_sapi5.Window: uo_tts_sapi5Object: uo_tts_sapi5Event: f_speakLine: 3

Here's the line...

ph_tts('Stethoscope system activated <SILENCE MSEC="1000"> Scanning for expecting mother <SILENCE MSEC="1000"> Located mother, scanning for baby <SILENCE MSEC="1000"> Baby located, directing long range stetho-microphones <SILENCE MSEC="1000">')

I have all the other lines marked as Skip, so this should be the only one that runs. If I remove the <SILENCE MSEC="1000">, the tts and formula lines will work. Is there something stupidly simple that I'm forgetting?

Owl
Back to Top View theowl's Profile Search for other posts by theowl
 
theowl
Groupie
Groupie
Avatar

Joined: February 24 2006
Location: United States
Online Status: Offline
Posts: 59
Posted: February 28 2006 at 14:34 | IP Logged Quote theowl

GOT IT!

I used the KISS method and used the way tts pauses after a period against it.

ph_tts('Stethoscope system activated. . . Scanning for expecting mother. . . Located mother, scanning for baby . . . Baby located, directing long range stetho-microphones . . . You should hear your baby in 5 . 4. 3. 2')

Followed by WAIT 22
Finishing with the playsound line

It's perfect...TY!
Back to Top View theowl's Profile Search for other posts by theowl
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: February 28 2006 at 15:02 | IP Logged Quote dhoward

Awesome!

The problem you may have been having with the TTS could have been an assumption on my part where I assumed you were using SAPI 5. The embedded XML commands only work for SAPI 5.

If you're using Direct SS (SAPI 4), then these commands do not work (there is actually another syntax for this type of stuff for SAPI 4, but I don't know it offhand).

However, you're correct, the periods will work just fine adding an appropriate amount of silence.

Still going to look at gag #2, just havent had a chance yet.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum