I hope people can understand that I'm not just being lazy and that I've tried my very best to get this created. I just can NOT get something useful created, so I need
something that truly shows me a
useful example, and not just stepping blocks.
But don't just take my word for it. I'll do my best to show you my working steps..
So the VERY FIRST sentence here:
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms720151(v=vs.85)#api-for-speech-recognition...says this:
Just as ISpVoice is the main interface for speech synthesis, ISpRecoContext is the main interface for speech recognition.
...and reading this, I take 2 key words out:
ISpVoice & ISpRecoContext
...Looking at
ISpVoice, I can see that it is used in this function for the Text-to-Speech tools (I'm just using one from this thread, but I already have a function that uses this api, and referenced it before starting this thread):
(vlax-invoke sapi
"Speak" "I wish you the best of everything in New 2011 Year! Thanks for using KitoxToolset from www.kitox.com" 0)
...Which would lead me to believe that I should probably be using
ISpRecoContext when I start my Speech-to-Text approach. So, when I select that hyperlink in the first sencence (here's the page):
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms718476(v=vs.85)...then I read that portion, it states this:
A new ISpRecoContext object can be created by calling ISpRecognizer::CreateRecoContext.
...Well, now that tells me that I need to start with a
ISpRecognizer... Well how do I make one of those? Check this page out..
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms720099(v=vs.85)...when I search the right column, we see our
ISpRecognizer is created via the
SpSharedRecognizer Object class. Well, that's a good sign because this code does in fact work:
...and it even pops up the Listener on my machine:
[not sure how to post images, see attached image "listener_capture.png"]
So now... what's next? Well, remember we were told earlier that this object can create
ISpRecoContext. So let's dump our 'recognizer' properties to check:
Command: (vlax-dump-object recognizer t)
; ISpeechRecognizer: ISpeechRecognizer Interface
; Property values:
; AudioInput = #<VLA-OBJECT ISpeechObjectToken 00000206e310a410>
; AudioInputStream = Exception occurred
; IsShared (RO) = -1
; Profile = #<VLA-OBJECT ISpeechObjectToken 00000206e310a6e0>
; Recognizer = #<VLA-OBJECT ISpeechObjectToken 00000206e310ae30>
; State = 2
; Status (RO) = #<VLA-OBJECT ISpeechRecognizerStatus 00000206e3b60c60>
; Methods supported:
; CreateRecoContext ()
; DisplayUI (4)
; EmulateRecognition (3)
; GetAudioInputs (2)
; GetFormat (1)
; GetProfiles (2)
; GetRecognizers (2)
; IsUISupported (2)
...Well look at that! A supported method is "CreateRecoContext ()". So let's do that:
Command: (setq reco-context (vlax-invoke recognizer 'CreateRecoContext))
#<VLA-OBJECT ISpeechRecoContext 00000206e310d600>
Command: (vlax-dump-object reco-context t)
; ISpeechRecoContext: ISpeechRecoContext Interface
; Property values:
; AudioInputInterferenceStatus (RO) = 0
; CmdMaxAlternates = 0
; EventInterests = 327679
; Recognizer (RO) = #<VLA-OBJECT ISpeechRecognizer 00000206e3b60288>
; RequestedUIType (RO) = ""
; RetainedAudio = 0
; RetainedAudioFormat = #<VLA-OBJECT ISpeechAudioFormat 00000206e310a530>
; State = 1
; Voice = #<VLA-OBJECT ISpeechVoice 00000206e310de00>
; VoicePurgeEvent = 0
; Methods supported:
; Bookmark (3)
; CreateGrammar (1)
; CreateResultFromMemory (1)
; Pause ()
; Resume ()
; SetAdaptationData (1)
...Great, so now what? When I circle back to the ISpRecognizer documentation..
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms718548(v=vs.85)...It doesn't even say what to do next? So this is where I get lost. I have 2 useful objects, but no guidance on what to do with them. I can see all of the methods down at the bottom, but they definitely don't match my listed options when I dump my 'recognizer' object... So that's where this dies.
I've tried looking at VBA codes to see if I can extrapolate those somehow. But no luck.
So please, please, if someone can provide some useable code to get further along, that would be super cool.. because when I summarize what I'm able to accomplish.. it looks like this LoL:
(defun c:TEST
( / recognizer reco
-context
) )
Best,
~DD