AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Voice Recognition COM
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
trueski



Joined: 08 Apr 2008
Posts: 32

PostPosted: Sun Aug 10, 2008 7:58 pm    Post subject: Reply with quote

you can set one of the variables to "local" and then all of the rest will be global
Back to top
View user's profile Send private message
ZEUS
Guest





PostPosted: Thu Sep 11, 2008 1:38 am    Post subject: Reply with quote

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)? Smile

I want hopefully to be able to run this without that other GUI.

Does anyone know? Smile Thank you very much for assistance if you know how to disable that Smile
Back to top
mosaic



Joined: 25 Apr 2007
Posts: 23

PostPosted: Mon Nov 10, 2008 9:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
Guest






PostPosted: Thu Nov 20, 2008 8:33 am    Post subject: Reply with quote

Hey, that is great Mosaic! Very Happy

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?? Confused

Best regards & Greetings - ZEUS
Back to top
Guest






PostPosted: Thu Nov 20, 2008 9:04 am    Post subject: Reply with quote

Quote:

http://sapi-reloaded.blogspot.com/2008/10/simple-asr-application.html

<CComPtr> pRecoEngine;
<CComPtr> pRecoContext;
<CComPtr> pRecoGrammar;
<CComPtr> pInputToken;
<CComPtr> pRecoResult;



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? Smile
Back to top
Sean



Joined: 12 Feb 2007
Posts: 1397

PostPosted: Thu Nov 20, 2008 12:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
ZEUS
Guest





PostPosted: Fri Nov 21, 2008 1:27 am    Post subject: Reply with quote

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 Smile
Back to top
Sean



Joined: 12 Feb 2007
Posts: 1397

PostPosted: Fri Nov 21, 2008 11:45 am    Post subject: Reply with quote

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
View user's profile Send private message
ZEUS
Guest





PostPosted: Fri Nov 21, 2008 12:46 pm    Post subject: Reply with quote

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 Wink ... 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! Smile
Back to top
GeorgeS
Guest





PostPosted: Fri Nov 21, 2008 5:03 pm    Post subject: Reply with quote

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 Very Happy

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

PostPosted: Sun Nov 23, 2008 8:01 am    Post subject: Reply with quote

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
View user's profile Send private message
GeorgeS
Guest





PostPosted: Sun Nov 23, 2008 11:52 am    Post subject: Reply with quote

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? Confused
Back to top
Sean



Joined: 12 Feb 2007
Posts: 1397

PostPosted: Sun Nov 23, 2008 11:34 pm    Post subject: Reply with quote

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? Confused

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
View user's profile Send private message
GeorgeS
Guest





PostPosted: Mon Nov 24, 2008 2:46 am    Post subject: Reply with quote

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) Smile Smile

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? Smile

Best regards
Back to top
Peter_Schubie
Guest





PostPosted: Wed Dec 03, 2008 1:24 pm    Post subject: Reply with quote

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? Very Happy Have a great day & thanks for any tips to advance my work!! Have a great day!~
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group