 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
trueski
Joined: 08 Apr 2008 Posts: 32
|
Posted: Sun Aug 10, 2008 7:58 pm Post subject: |
|
|
| you can set one of the variables to "local" and then all of the rest will be global |
|
| Back to top |
|
 |
ZEUS Guest
|
Posted: Thu Sep 11, 2008 1:38 am Post subject: |
|
|
Hi, I was wondering too if this great COM voice recgonition script can be run, and will operate on Vista without that other Windows GUI control that pops up (upon activation of this script... the one with the level meter)?
I want hopefully to be able to run this without that other GUI.
Does anyone know? Thank you very much for assistance if you know how to disable that  |
|
| Back to top |
|
 |
mosaic
Joined: 25 Apr 2007 Posts: 23
|
Posted: Mon Nov 10, 2008 9:16 pm Post subject: |
|
|
Use SAPI.SpInProcRecognizer instead of SAPI.SpSharedRecognizer
would initialize on my vista machine without invoking the one with the level meter.
I have no knowledge on how to get voice input work though.
For those who have COM experience, you may want to check out the following article:
http://sapi-reloaded.blogspot.com/2008/10/simple-asr-application.html
Cheers,
Mosaic |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Nov 20, 2008 8:33 am Post subject: |
|
|
Hey, that is great Mosaic!
It does indeed not display the widget anymore. But, I am mixed-up/lost on Vista. With SAPI.SpSharedRecognizer & the widget, and using Sean's COM script here, actions like
| Code: |
WORD := COM_Invoke(pphrase,"GetText")
|
fail after the first instance! :not sure why:
... but it doesn't seem to work at all with SAPI.SpInProcRecognizer... tho it does seem to initialize, ... I am not getting any errors, just doesn't flat out work. Does anyone know why this is the case on Vista??
Best regards & Greetings - ZEUS |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Nov 20, 2008 9:04 am Post subject: |
|
|
I reviewed that link, and what doesn't seem to be in Sean's code is init of the RecoEngine.... I am not sure about the rest, but could this be why voice input does not work with SpInprocRecognizer?  |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1397
|
Posted: Thu Nov 20, 2008 12:37 pm Post subject: |
|
|
| I have only one fact to comment here: SpInProcRecognizer is exclusive unlike SpSharedRecognizer as the name suggests, i.e., if (succeeded to) initialize SpInProcRecognizer, other apps can't use (the acquired) SAPI engine until it's released. Is it OK? |
|
| Back to top |
|
 |
ZEUS Guest
|
Posted: Fri Nov 21, 2008 1:27 am Post subject: |
|
|
| Sean wrote: | | I have only one fact to comment here: SpInProcRecognizer is exclusive unlike SpSharedRecognizer as the name suggests, i.e., if (succeeded to) initialize SpInProcRecognizer, other apps can't use (the acquired) SAPI engine until it's released. Is it OK? |
Hey Sean!
Not sure if I totally understand your question/process, you mean, there would be a way to interface with it?
Basically after I run this glob
| Code: |
COM_Init()
; set up listener
plistener := COM_CreateObject("SAPI.SpInProcRecognizer")
; set up pcontext
pcontext := COM_Invoke(plistener, "CreateRecoContext")
pgrammar := COM_Invoke(pcontext , "CreateGrammar")
COM_Invoke(pgrammar, "DictationSetState", 0)
prules := COM_Invoke(pgrammar, "Rules")
prulec := COM_Invoke(prules, "Add", "wordsRule", 0x1|0x20)
COM_Invoke(prulec, "Clear")
pstate := COM_Invoke(prulec, "InitialState")
; Add here the words to be recognized!
COM_Invoke(pstate, "AddWordTransition", "+" . 0, "Hello")
; rest of init
COM_Invoke(prules, "Commit")
COM_Invoke(pgrammar, "CmdSetRuleState", "wordsRule", 1)
COM_Invoke(prules, "Commit")
pevent := COM_ConnectObject(pcontext, "On")
Return
|
If I left the Vista voice widget up and try to speak words... it seems to be listening, but it says things like "pressing backspace", what? or something random. I am not sure what is going on. This has been my experience so far  |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1397
|
Posted: Fri Nov 21, 2008 11:45 am Post subject: |
|
|
| ZEUS wrote: | | Not sure if I totally understand your question/process, you mean, there would be a way to interface with it? |
I don't really know (:I don't have a plan to upgrade to Vista), I'm just worrying about using SpInProcRecognizer due to its exclusive access. If it doesn't matter with you, then OK. BTW, to use SpInProcRecognizer I think you have to explicitly claim the audio input device. |
|
| Back to top |
|
 |
ZEUS Guest
|
Posted: Fri Nov 21, 2008 12:46 pm Post subject: |
|
|
| Sean wrote: |
I don't really know (:I don't have a plan to upgrade to Vista), I'm just worrying about using SpInProcRecognizer due to its exclusive access. If it doesn't matter with you, then OK. BTW, to use SpInProcRecognizer I think you have to explicitly claim the audio input device. |
Ahh ... I was pouring over some non-ahk examples out there, and not so sure, ... and that was kinda my outstanding view on SpInProcRecognizer... that you might use it for exclusive sources!
Can anyone else chime in here on this function? The over things I am concluding here for Vista is:
1) SpInProcRecognizer needs to have the Mic source Claimed somehow
2) There is no other way to run this function on vista to where the voice meter doesn't show up.
Thank you very much. Hopefully the great Lexikos is still monitoring this thread -- we really need your help!  |
|
| Back to top |
|
 |
GeorgeS Guest
|
Posted: Fri Nov 21, 2008 5:03 pm Post subject: |
|
|
Hello, I think this function is really awesome! congrats Sean!
question: does anyone know how to deactivate a individual word rule?
I found this info below that seems to suggest it can be, but not sure how it would translate it for
here
| Quote: |
menuRule.InitialState.AddWordTransition(null, "Yellow", " ",
SpeechGrammarWordType.SGLexical, "Yellow", 1, ref PropValue, 1.0F);
menuRule.InitialState.AddWordTransition(null, "Red", " ",
SpeechGrammarWordType.SGLexical, "Red", 2, ref PropValue, 1.0F);
menuRule.InitialState.AddWordTransition(null, "Green", " ",
SpeechGrammarWordType.SGLexical, "Green", 3, ref PropValue, 1.0F);
menuRule.InitialState.AddWordTransition(null, "Blue", " ",
SpeechGrammarWordType.SGLexical, "Blue", 4, ref PropValue, 1.0F);
grammar.Rules.Commit();
//The CmdSetRuleState method activates or deactivates a rule by its
name.
grammar.CmdSetRuleState("MenuCommands",
SpeechRuleState.SGDSActive);
|
|
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1397
|
Posted: Sun Nov 23, 2008 8:01 am Post subject: |
|
|
| GeorgeS wrote: | | question: does anyone know how to deactivate a individual word rule? |
Do you have any plan to take advantage of Property Name/Id/Value? Otherwise, it essentially does the same job as AddWordTransition in the script posted at the top of this thread. Read whole this thread, there are a few suggestions which may interest you, although I haven't tested them myself. |
|
| Back to top |
|
 |
GeorgeS Guest
|
Posted: Sun Nov 23, 2008 11:52 am Post subject: |
|
|
| Sean wrote: | | GeorgeS wrote: | | question: does anyone know how to deactivate a individual word rule? |
Do you have any plan to take advantage of Property Name/Id/Value? Otherwise, it essentially does the same job as AddWordTransition in the script posted at the top of this thread. Read whole this thread, there are a few suggestions which may interest you, although I haven't tested them myself. |
Hello Sean. Was it in this thread? I actually couldn't find any examples or even posts with the word Property in it?  |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1397
|
Posted: Sun Nov 23, 2008 11:34 pm Post subject: |
|
|
| GeorgeS wrote: | Hello Sean. Was it in this thread? I actually couldn't find any examples or even posts with the word Property in it?  |
I didn't mean for Property. I suggested to experiment with multiple intermediary rule states using AddState with single grammar rule. If failed, then with multiple gramma rules. That seems the way to go. Unfortunately I can't experiment myself. |
|
| Back to top |
|
 |
GeorgeS Guest
|
Posted: Mon Nov 24, 2008 2:46 am Post subject: |
|
|
OIC - ok, ... could you pls do me a favor? I understand you cannot test this, but maybe you can suggest what you think is most likely to work, and I'll report back my findings for Vista [the goal: to deactivate a single command, while leaving the others intact)
| Code: |
#Persistent
OnExit, CleanUp
COM_Init()
plistener:= COM_CreateObject("SAPI.SpSharedRecognizer")
COM_Invoke(plistener, "AudioInput", paudioin ? "+" . paudioin : "+0")
pcontext := COM_Invoke(plistener, "CreateRecoContext")
pgrammar := COM_Invoke(pcontext , "CreateGrammar")
COM_Invoke(pgrammar, "DictationSetState", 0)
prules := COM_Invoke(pgrammar, "Rules")
prulec := COM_Invoke(prules, "Add", "wordsRule", 0x1|0x20)
COM_Invoke(prulec, "Clear")
pstate := COM_Invoke(prulec, "InitialState")
; Add here the words to be recognized!
COM_Invoke(pstate, "AddWordTransition", "+" . 0, "One")
[color]COM_Invoke(pstate, "AddWordTransition", "+" . 0, "Two")[/color]
COM_Invoke(pstate, "AddWordTransition", "+" . 0, "Three")
;;
COM_Invoke(prules, "Commit")
COM_Invoke(pgrammar, "CmdSetRuleState", "wordsRule", 1)
COM_Invoke(prules, "Commit")
pevent := COM_ConnectObject(pcontext, "On")
Return
|
... so lets say I want to write a GOSUB that takes down voice command "TWO"... what things could I try?
Best regards |
|
| Back to top |
|
 |
Peter_Schubie Guest
|
Posted: Wed Dec 03, 2008 1:24 pm Post subject: |
|
|
HELLO! I am building voice commands into a cool application on Vista for controlling major features such as chat and browser navigation. However, I am running into the same problems as the previous posters with the Vista Widget interfering with the gui interfaces popping up. I have tried recent code posted concering the change to "SpInProcRecognizer" which does not really work on Vista. I have also tried running all the examples posted in this forum. I [don't know] if it really works at all, but with the code presented I cannot get registered words to be accepted. I don't know what is wrong. Has anyone any ideas how to run voiceCOM without the widget? Is this SpInProcRecognizer something I should be focusing on? Have a great day & thanks for any tips to advance my work!! Have a great day!~ |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|