Pregunta

So I'm writing a small tool to do Voice Recognition. I started just with SAPI 5.4 and used an SRGS xml file to set up my grammar. It worked very nicely. All my commands were recognized easily. However, I'm trying to get this thing to run on XP and I'm having trouble. I've used the following code to read in my existing xml file:

listener = New SpSharedRecoContext()
AddHandler listener.Recognition, AddressOf Handle_Speech
Dim grammar As ISpeechRecoGrammar
grammar = listener.CreateGrammar()
grammar.CmdLoadFromFile(Utilities.INI.ConfigPath & "\Voice_Commands.xml")
grammar.CmdSetRuleIdState(0, SpeechRuleState.SGDSActive)

However, the performance of SAPI 5.1 in recognizing commands is much-much worse than 5.4. First of all it starts an external listener app that you have to turn on (I guess this isn't too bad). But I think the main problem is that the listener will start doing OS operations when I speak (opening folders etc.); so its obviously listening for more than just my pre-defined set of commands.

Does anyone know how to make SAPI 5.1 perform like 5.4?

Thanks,

Ian

¿Fue útil?

Solución

Are you sure this is XP? The behavior you're describing sounds like you're getting Windows Speech Recognition running, which only runs on Vista and above.

You need an in-proc recognizer (SpInProcRecoContext), instead of the shared recognizer. This needs a bit of work to initialize (you need to attach an engine & audio source). I wrote a bit on this on my blog, but I used the native APIs to do it.

Lastly, the SR engine on XP is indeed not as good as the SR engine in Vista and above. After all, the XP SR engine is over a decade old.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top