Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Voice Recognition COM


  • Please log in to reply
21 replies to this topic
TodWulff
  • Members
  • 142 posts
  • Last active: Sep 15 2013 04:16 PM
  • Joined: 29 Dec 2007

This is really cool, thnx. :D I'll have to get a headset or something so it can understand me better. :p


I believe that you can train it more and more, in order to help it better understand you. I think you access that thru normal gui dialogs.

Here's to hoping that some speech SDK SME jumps in and answers our queries... :)
When replying, please feel free to address me as Tod. My AHK.net site...

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
I'm new to the Speech API, but I can at least answer this question:

How the hell is the script triggered to cause the OnRecognition function to kick off?

COM_ConnectObject connects events exposed by an object to the corresponding functions in script.


If I understand COM_ConnectObject correctly, it works as follows:
Retrieve an IConnectionPoint interface (pconn) representing the events exposed by the object.

Construct an object and an IDispatch interface. This object is referred to as an "event sink" (pevent or psink.) RegisterCallback and NumPut are used to construct the interface, with the actual code contained in COM_DispInterface.

Call pconn->Advise(psink) to create a connection between the connection point and the event sink.

When the source object raises an event, it calls the Invoke method of our event sink. On the AutoHotkey side, COM_DispInterface is executed with A_EventInfo == 6. RegisterCallback and DllCall are used to dynamically call the appropriate function, based on a script-defined prefix and the name of the event being raised.

i.e. what faculties of AHK are you employing to cause this functionality to exist.

In summary:
[*:ikdwiyae]NumGet and DllCall to call methods of COM interfaces.
[*:ikdwiyae]VarSetCapacity, RegisterCallback and NumPut to construct a COM interface.
[*:ikdwiyae]RegisterCallback and DllCall to call a function dynamically.
Edit:
Okay, now I can answer another one. :D

Is there a way to tell it to receive All words SDK recognizes?

Replace everything from COM_Init() to ExitApp with:
COM_Init()
plistener:= COM_CreateObject("SAPI.SpSharedRecognizer")
pcontext := COM_Invoke(plistener, "CreateRecoContext")
pgrammar := COM_Invoke(pcontext , "CreateGrammar")
COM_Invoke(pgrammar, "DictationSetState", [color=red]1[/color])
; No rules to set up!
pevent := COM_ConnectObject(pcontext, "On")
Return

CleanUp:
COM_Release(pevent)
; No rules to clean up!
COM_Release(pgrammar)
COM_Release(pcontext)
COM_Release(plistener)
COM_Term()
ExitApp


75C
  • Guests
  • Last active:
  • Joined: --
Sean, can you please explain in laymens terms why COM Standard Library of this is recommended over the previous CoHolper version? :) Is there any major compatibility, performance, or other differentiations? :)

TodWulff
  • Members
  • 142 posts
  • Last active: Sep 15 2013 04:16 PM
  • Joined: 29 Dec 2007

I'm new to the Speech API, but I can at least answer this question:
...

Edit:
Okay, now I can answer another one. :D


Thanks, Lexikos! ;-)

-t
When replying, please feel free to address me as Tod. My AHK.net site...

TodWulff
  • Members
  • 142 posts
  • Last active: Sep 15 2013 04:16 PM
  • Joined: 29 Dec 2007

I have been able to get it running and working stand alone reasonably well (I occasionally get the no interface dialog, but I suspect that it is because I am being too impatient (opening a second instance of the script while the first one is releasing it resources, etc.) and confusing the underlying MS framework).


As info, I determined what was causing this issue for me. I was making use of a downloaded version of the COM.ahk wrapper. Once I deleted it, and the associated #include in my scripts, allowing AHK to look in the lib folder for the version included with the latest version of AHK, the no interface issue disappeared.

I post this herein, in the interests of allowing others to learn from my 'mistakes'.

Take care.

-t
When replying, please feel free to address me as Tod. My AHK.net site...

TodWulff
  • Members
  • 142 posts
  • Last active: Sep 15 2013 04:16 PM
  • Joined: 29 Dec 2007
Is there a way that the speech api can have it's 'ears' plugged for just a bit? In my IDE app, I am making use of COM TTS as well as the VR functionality.

The damn scripts tend to get into some goofy loops when the app hears itself... :-)

Please advise. Thanks, in advance.

-t
When replying, please feel free to address me as Tod. My AHK.net site...

AhkLearner
  • Members
  • 101 posts
  • Last active: Aug 27 2016 12:58 PM
  • Joined: 25 Feb 2014

hi,

I have win7 professional, do i still need to install Speech SDK 5.1 ?

coz i saw in Details

 

Supported Operating System

Windows XP

    • Windows XP Professional or Home Edition

    • Microsoft Windows 2000, all versions

    • Microsoft Windows Millennium Edition

    • Microsoft Windows 98, all versions

    • Microsoft Windows NT 4.0 Workstation or Server, Service Pack 6a, English, Japanese, or Simplified Chinese versions

    • Microsoft Internet Explorer ® 5.0 or later. Users of Windows NT 4.0 require Microsoft Internet Explorer 5.5 or later.

    • Microsoft Visual C++ ® 6.0 (Service Pack 3 or later version is needed to run the SAPI 5 SDK samples)

    • Microsoft Visual Studio.NET is required to compile the C# examples

 

 Thanks in advance for your help and support.

 

 

 

Read the original thread linked at the top. You need to install
Speech SDK 5.1