Copyright 6 Vista 7 new! Languages 8 Glovepie scripts 9



Download 0.65 Mb.
Page25/30
Date conversion08.07.2018
Size0.65 Mb.
1   ...   22   23   24   25   26   27   28   29   30

Making GlovePIE talk

You can make GlovePIE speak by using the “say” command, like this:


say(“Hello World”)
Or you can set speech.text, like this:
speech.text = “Hello World”
The advantage/disadvantage of setting speech.text is that it won’t say it again until you set speech.text to something different. Say will say it every time you use say.
You can get it to speak in different voices like this:
speech.sam.text = “Hello, my name is Sam.”

speech.mike.text = “Hello, my name is Mike.”

speech.mary.text = “Hello, my name is Mary.”
If Mike and Mary sound the same as Sam, and you have XP, then you need to download this (don’t download this on Vista!!!):

http://www.aldostools.com/sapi51xp.msi
You can also use other popular text to speech engines by name, if you have them.
If you want to try out and download some high-quality voices, and don’t mind using up disk space, you can go to:
http://www.cepstral.com/demos/
You can download the Cepstral voices, but they are trial versions which add stuff at the start of everything it says. Please buy them rather than cracking them with a keygen, as they are good quality.
There are lots of other speech parameters you can read or set. Just type “speech.” and use the code completion box.

Speech Recognition


You can use Speech recognition in GlovePIE to control games with speech.
Just use the said( ) function like this:
Enter = said(“jump”)
That will press the “Enter” key, whenever you say “jump” into the microphone.
You can also use the AskedFor( ) function like this:
Four = AskedFor(“rocket launcher”)
The AskedFor function will only trigger if you say something like “can I please have a rocket launcher?”. It will not trigger if you just say “rocket launcher” or “rocket launcher please”. AskedFor does understand lots of different ways of phrasing a request, everything from “I need a rocket launcher now” to “please give me a rocket launcher”.

Amount of Confidence Required

You can change the amount of confidence required by specifying a second parameter which is a number. The default is 2.


Eg.
Enter = said(“jump”, 3)
The higher the number, the more confidence is required to recognise it. If it thinks you said “jump” when you actually said “pump”, set the confidence value higher. If it doesn’t recognise it when you do say “jump” set the confidence value lower.
The following confidence values exist:
0: No confidence required: Will always recognise at least one of the phrases in your script, no matter how different what you said is, unless you only said the first word of a multi-word phrase.

1: Partial phrase, low confidence: Will quickly guess what you said based on the first syllable or two, unless it is a multi-word phrase in which case it will wait for the start of the last word. Will accept anything that is even vaguely close, and respond quickly.


2: Partial phrase, medium confidence: Will quickly guess what you said based on the first syllable or two, unless it is a multi-word phrase. It will accept things that are reasonably close to what it is expecting.
3: Partial phrase, high confidence: Will quickly guess what you said based on the first syllable, unless it is a multi-word phrase. It will only accept things that it is sure matches.
4: Complete phrase, low confidence: Will wait until it is sure you have finished speaking, and it has processed the complete phrase before guessing. The whole phrase must be vaguely close to what it was expecting.
5: Complete phrase, medium confidence: Will wait until it is sure you have finished speaking, and it has processed the complete phrase before guessing. The whole phrase must be reasonably close to what it was expecting.
6: Complete phrase, high confidence: Will wait until it is sure you have finished speaking, and it has processed the complete phrase. The whole phrase must be very close to what it was expecting.
If your script has a phrase that contains another phrase, like this:
W = Said(“weapon”)

X = Said(“weapon fire linked”)


then you need to set the shorter phrase to wait for the complete phrase, like this:
W = Said(“weapon”, 5)

X = Said(“weapon fire linked”)


Otherwise it will press W before you have finished saying “weapon fire linked”.
If you are expecting the user to say things that aren’t in your script, and you want them to be ignored, you need to set the confidence reasonably high.
Other than that, which confidence levels you choose is up to you.
But if GlovePIE isn’t recognising what you say, the first thing you should do is go to the Speech Control Panel (You can use the CP-Settings menu in GlovePIE), and do some training. You should also change the recognition settings in Control Panel to change how quickly it responds, and how much accuracy it requires.

Push-to-talk


If you only want it to recognise you when you are holding down a button, you need to set Microphone.Enabled. eg.
Microphone.Enabled = joystick1.Button1
It will only trigger the speech commands when you are holding down the joystick button. The rest of the time it will ignore your speech. It doesn’t turn the microphone off, or let other applications use it, it just ignores you when it hears you.
You can also do the opposite, like this:
Microphone.PushToNotTalk = joystick1.Button2
Now, when you hold down button 2 it will ignore anything you say. Good for when you are talking to your team-mates.
Don’t use Microphone.PushToTalk, it doesn’t work.

Other Microphone Stuff

There are other Microphone values you can read and set.


For example:
Mouse.LeftButton = Microphone.AudioLevel > 0.5
That will click the left mouse button whenever you make a loud noise.
TooFast, TooSlow, TooLoud and TooQuiet will be true for an instant when GlovePIE is trying to recognise your speech but you are speaking too fast, slow, loud or quietly.
For example:
if Microphone.TooFast then say(“Don’t talk so fast.”)

if Microphone.TooSlow then say(“You need to talk faster.”)

if Microphone.TooLoud then say(“Stop shouting. I’m not deaf.”)

if Microphone.TooQuiet then say(“Speak up, I can’t hear you.”)


HeardNoise will be true for an instant when GlovePIE is trying to recognise your speech and it hears some other noise.
if Microphone.HeardNoise then say(“I can’t hear you over the noise.”)
InPhrase will be true while you are speaking, and false while you are not.

InSound will be true while there is sound which might be speech, and false otherwise.


Microphone.CompletePhrase will be whatever text you said, but it only works if you said one of the phrases in your script. It will only be set to something for an instant. For example:
var.saidsomething = said(“hello”) or said(“goodbye”) or said(“thank you”)

if microphone.CompletePhrase <> "" then Say(microphone.CompletePhrase)


Microphone.PartialPhrase will be set to whatever partial text you said, but it only works if you said one of the phrases in your script. It will only be set to something for an instant. For example:
var.saidsomething = said(“this is a test”) or said(“does it work”) or said(“I don’t know”)

if microphone.PartialPhrase <> "" then debug = microphone.PartialPhrase


Speak slowly for the above example. Notice how what you say appears one word at a time in the debug box?
1   ...   22   23   24   25   26   27   28   29   30


The database is protected by copyright ©dentisty.org 2016
send message

    Main page