theguy0000 Posted March 5, 2006 Posted March 5, 2006 ah! I see, thanks! The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
ConsultingJoe Posted March 5, 2006 Author Posted March 5, 2006 so did your script stop listening at all while testing it Check out ConsultingJoe.com
theguy0000 Posted March 5, 2006 Posted March 5, 2006 actually, yes...it only works the first time, then it doesn't recognize anything after that The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
ConsultingJoe Posted March 5, 2006 Author Posted March 5, 2006 (edited) actually, yes...it only works the first time, then it doesn't recognize anything after thatwell mine works a little longer usually but i dont know much about objects and the SR, is there anyone that can helpp.s. what do you think of my site Edited March 5, 2006 by zerocool60544 Check out ConsultingJoe.com
theguy0000 Posted March 5, 2006 Posted March 5, 2006 very simple fix...$Grammar.DictationSetState($SGDSActive);CONTINUE LISTENINGjust put that at the end of the listening loop...while 1 Sleep(100) if $recog <> "" Then Select Case $recog = "exit" exit;HEAR EXIT Case $recog = "hello" MsgBox(0,"hi","HI",1);HEAR HELLO Case $recog = "I love you" MsgBox(0,"","I love you too",1) Case $recog = "test" MsgBox(0,"","What are you testing LOSER",1) EndSelect ;_talkOBJ($recog, 3); TALKS AFTER IT HEARS SOMETHING, The mic hears the pc and affects the recognition _talkOBJ($recog, 3, "dont talk"); JUST POP-UP Endif $recog = "";SET TO NULL FOR REPEATED COMMANDS $Grammar.DictationSetState($SGDSActive);CONTINUE LISTENING WEndlike that. It worked for me. The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
ConsultingJoe Posted March 5, 2006 Author Posted March 5, 2006 POST the complete script you did because it looks like moved things around Check out ConsultingJoe.com
theguy0000 Posted March 5, 2006 Posted March 5, 2006 (edited) no not really... expandcollapse popupGlobal $recog = "PLEASE SPEAK NOW";SET GLOBAL $RecoContext=ObjCreate("SAPI.SpSharedRecoContext") if @error then Msgbox(0,"","Error opening $RecoContext: " & @error);ERROR CHECK exit endif $SinkObject=ObjEvent($RecoContext,"MYEvent_") $SPRS_INACTIVE = 0 $SPRS_ACTIVE = 1 $SGDSActive=$SPRS_ACTIVE $SGDSInactive=$SPRS_INACTIVE $Grammar = $RecoContext.CreateGrammar(1) $Grammar.Dictationload $Grammar.DictationSetState($SGDSActive);LISTEN while 1 Sleep(100) if $recog <> "" Then Select Case $recog = "exit" exit;HEAR EXIT Case $recog = "hello" MsgBox(0,"hi","HI",1);HEAR HELLO Case $recog = "I love you" MsgBox(0,"","I love you too",1) Case $recog = "test" MsgBox(0,"","What are you testing LOSER",1) EndSelect ;_talkOBJ($recog, 3); TALKS AFTER IT HEARS SOMETHING, The mic hears the pc and affects the recognition _talkOBJ($recog, 3, "dont talk"); JUST POP-UP Endif $recog = "";SET TO NULL FOR REPEATED COMMANDS $Grammar.DictationSetState($SGDSActive);CONTINUE LISTENING WEnd ;$Grammar.DictationSetState($SGDSInactive);STOP LITENING Func MYEvent_Recognition($StreamNumber,$StreamPosition,$RecognitionType,$Result) $recog = $Result.PhraseInfo.GetText;SET $recog VAR EndFunc Func _TalkOBJ($s_text, $s_voice = 3, $s_dont = "") Local $quite = 0 Local $o_speech = ObjCreate ("SAPI.SpVoice") Select Case $s_voice == 1 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mary", "Language=409").Item(0) TrayTip("Female Reader",$s_text,1) Case $s_voice == 2 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mike", "Language=409").Item(0) TrayTip("Male Reader",$s_text,1) Case $s_voice == 3 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Sam", "Language=409").Item(0) TrayTip("OldMan Reader",$s_text,1) EndSelect if $s_dont <> "dont talk" then $o_speech.Speak ($s_text) $o_speech = "" ENDif Sleep(1000) TrayTip("","",1) EndFunc;==>_TalkOBJ Edited March 5, 2006 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
theguy0000 Posted March 5, 2006 Posted March 5, 2006 made a bunch of changes... expandcollapse popupGlobal $recog = "PLEASE SPEAK NOW";SET GLOBAL $RecoContext=ObjCreate("SAPI.SpSharedRecoContext") if @error then Msgbox(0,"","Error opening $RecoContext: " & @error);ERROR CHECK exit endif $SinkObject=ObjEvent($RecoContext,"MYEvent_") $SPRS_INACTIVE = 0 $SPRS_ACTIVE = 1 $SGDSActive=$SPRS_ACTIVE $SGDSInactive=$SPRS_INACTIVE $voice = 3 $silent = "" $Grammar = $RecoContext.CreateGrammar(1) $Grammar.Dictationload $Grammar.DictationSetState($SGDSActive);LISTEN while 1 Sleep(100) If $recog <> "" Then If $recog = "exit" Then Exit ElseIf $recog = "PLEASE SPEAK NOW" Then _TalkOBJ("PLEASE SPEAK NOW") ElseIf $recog = "Set Voice Mary" Then $voice = 1 _TalkOBJ ("Mary here", 1, $silent) ElseIf $recog = "Set Voice Mike" Then $voice = 2 _TalkOBJ ("Mike, reporting for duty", 2, $silent) ElseIf $recog = "Set Voice Sam" Then $voice = 3 _TalkOBJ ("You have selected Sam", 3, $silent) ElseIf $recog = "Silence" Then $silent = "dont talk" _TalkOBJ("Shhhh!", $voice, "dont talk") ElseIf $recog = "Speak" Then $silent = "" _TalkOBJ("I'm here to talk", $voice, $silent) Else _TalkOBJ(SR_reply($recog), $voice, $silent) EndIf EndIf $recog = "";SET TO NULL FOR REPEATED COMMANDS $Grammar.DictationSetState($SGDSActive);CONTINUE LISTENING WEnd ;$Grammar.DictationSetState($SGDSInactive);STOP LITENING Func MYEvent_Recognition($StreamNumber,$StreamPosition,$RecognitionType,$Result) $recog = $Result.PhraseInfo.GetText;SET $recog VAR EndFunc Func _TalkOBJ($s_text, $s_voice = 3, $s_dont = "") Local $quite = 0 Local $o_speech = ObjCreate ("SAPI.SpVoice") Select Case $s_voice == 1 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mary", "Language=409").Item(0) TrayTip("Female Reader",$s_text,1) Case $s_voice == 2 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mike", "Language=409").Item(0) TrayTip("Male Reader",$s_text,1) Case $s_voice == 3 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Sam", "Language=409").Item(0) TrayTip("OldMan Reader",$s_text,1) EndSelect if $s_dont <> "dont talk" then $o_speech.Speak ($s_text) $o_speech = "" ENDif Sleep(1000) TrayTip("","",1) EndFunc;==>_TalkOBJ Func SR_reply($text) Switch $text Case "hi" Return "hello" Case "hello" Return "Hi there!" Case "test" Return "What the heck are you testing?" EndSwitch Return "I'm Sorry. I did not understand what you said. Please try again." EndFunc everything works fine, but after awhile, SCiTE will tell me that the script stopped responding... The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
ConsultingJoe Posted March 5, 2006 Author Posted March 5, 2006 I worked a little. Nice setup but it still has the same problem Check out ConsultingJoe.com
theguy0000 Posted March 5, 2006 Posted March 5, 2006 (edited) yeah, lets see if we can get this thing figured out... what I find interesting is that it not only stops listening, but the process itself completely stops responding. By the Way.....I got my AIML bot to work with this, but still same problem. Edited March 5, 2006 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
ConsultingJoe Posted March 5, 2006 Author Posted March 5, 2006 yeah, lets see if we can get this thing figured out...what I find interesting is that it not only stops listening, but the process itself completely stops responding.By the Way.....I got my AIML bot to work with this, but still same problem.yeah, I think that it has to do with the grammar, it probably thinks your not done talking or something. i am clueless, why does it have to be so hard?? Check out ConsultingJoe.com
theguy0000 Posted March 5, 2006 Posted March 5, 2006 where did you find the information about the SR? Somewhere on MSDN maybe? The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
ConsultingJoe Posted March 5, 2006 Author Posted March 5, 2006 (edited) where did you find the information about the SR? Somewhere on MSDN maybe?http://www.autoitscript.com/forum/index.ph...c=14106&hl=sapiorhttp://www.autoitscript.com/forum/index.ph...c=13974&hl=sapi Edited March 5, 2006 by zerocool60544 Check out ConsultingJoe.com
theguy0000 Posted March 6, 2006 Posted March 6, 2006 hmm ok I will research MSDN some then. The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
ConsultingJoe Posted March 6, 2006 Author Posted March 6, 2006 (edited) hmm ok I will research MSDN some then.I tryied but I really dont know any VB or C++Thanks.This could be used in almost every script.I can't wait to have a convo with my computerlol I'm a loser Edited March 6, 2006 by zerocool60544 Check out ConsultingJoe.com
theguy0000 Posted March 6, 2006 Posted March 6, 2006 I tryied but I really dont know any VB or C++Thanks.This could be used in almost every script.I can't wait to have a convo with my computerlol I'm a loser lolMan this is harder than I thought...All I need is some good documentation on SAPI.SpSharedRecoContext... The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
ConsultingJoe Posted March 6, 2006 Author Posted March 6, 2006 lolMan this is harder than I thought...All I need is some good documentation on SAPI.SpSharedRecoContext...Check this out:http://msdn.microsoft.com/library/default....RecoContext.asp Check out ConsultingJoe.com
theguy0000 Posted March 6, 2006 Posted March 6, 2006 (edited) now, that was useful! I looked through and found that $RecoContext.CreateGrammar creates a new object. And, Dictationload isn't there, but rather LoadDictation... also, SetDictationState is in there instead of DictationSetState...I'm going to experiment with this info a little... man...I changed those to what msdn said (which obviously should be official) and it just stopped working. I get "The requested action with this object has failed.". So obviously that wasn't right. Edited March 6, 2006 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
Lemures Posted March 8, 2006 Posted March 8, 2006 I made one of these last year, and I had it recognizing basic commands like "my computer" or "volume up". However, I stopped when i hit the following problem: the word "winamp". or indeed, any word not in the speech library. I dont know how to add words to the recognition library! The speech thing had NO IDEA what "winamp" was, so it always translated it to something different each time, so i could never do something simple like "run winamp". I still have the code laying around if anybody is interested. I would really like to get this sort of thing working. Perhaps we could make some sort of context sensitive system where the commands are based on the current context. Perhaps people could make their own script. For example, my "winamp.au3" script would be included (pretending i made one). If you had somebody elses "winamp.au3", the commands would be different, so the whole thign would sort of be personalizable. By context sensitive I mean that the commands are based on what you are currently doing or just did. For example, If i say "raise the volume" and I'm in windows media player, it raises the volume in there. If i said "raise the volume" and I'm in winamp, it searches the "winamp.au3" for what to do when it wants to raise the volume, and then it follows those specific commands. This way soembody could create individual sections for different programs, like for games and such. *shrug*
ConsultingJoe Posted March 8, 2006 Author Posted March 8, 2006 WOW That would be great if we could get the code, I am so confused as to why this script stops listening, I've been trying things for weeks now. And great idea about the context. I wanted to make two scripts one that people can create commands that listen for words then the script would do what is setup like run a program or send keys or play music. The second script would be an AI TTS SR script with custom brain files. So yeah just post your script Thanks a lot Zerocool Check out ConsultingJoe.com
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now