Decided to wire up a simple speech writing application as a test bed for learning Speech Recognition + F#. To allow the speech recognition to be started or stopped I wired up the following methods:
let Activate () =
sp.RecognizeAsync(RecognizeMode.Multiple)
let Deactivate () =
sp.RecognizeAsyncCancel()
sp.RecognizeAsyncStop()
I can start the engine fine with the default grammar dictionary. The problem comes whens I call the deactivate method. I often get the following exception:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Speech.dll
Additional information: Cannot perform this operation while the recognizer is doing recognition.