Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Exception thrown in managed recognizer in Windows 7 x64

36 views
Skip to first unread message

gbelicka

unread,
Apr 20, 2010, 10:46:01 AM4/20/10
to
I am trying to feed an audio file to the managed .NET recognition engine
under Windows 7 (ultimate, 64bit). If I load the dictation grammar, the code
works and I get recognition results. However, if I select the "Pronunciation"
dictation grammar so I can get the raw Phonems I get a
TargetInvocationException every time. I read a few blogs that talked about
making sure the recognition engine was running on a background thread but
that did not seem to help. The code is pretty simple, and I suspect this
might be an issue in the Interop wrapper around SAPI?

I've copied the abbriviated code and exception information below. Any input
would be VERY appreciated. I really need a way to get at the raw phonems
(and am hoping to avoid using SAPI directly).

Geo...

m_objEngine = this.GetRecognitionEngine("MS-1033-80-DESK",
CultureInfo.CurrentCulture);
if (m_objEngine is SpeechRecognitionEngine)
{
DictationGrammar objDictationGrammar = new
DictationGrammar("grammar:dictation#Pronunciation");
m_objEngine.LoadGrammar(objDictationGrammar);

string szInputMultimedia = @"C:\audio.wav";
m_objEngine.SetInputToWaveFile(szInputMultimedia);
m_objEngine.RecognizeAsync(RecognizeMode.Multiple);

}


TargetInvocationException
Exception has been thrown by the target of an invocation
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo
method, Object target, Object[] arguments, SignatureStruct& sig,
MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method,
Object target, Object[] arguments, Signature sig, MethodAttributes
methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean
skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Speech.Internal.AsyncSerializedWorker.WorkerProc(Object ignored)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
ignoreSyncCtx)
at
System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Inner Exception: "Value does not fall within the expected range"

at System.Speech.Internal.SapiInterop.ISpRecoResult.GetAlternates(Int32
ulStartElement, Int32 cElements, Int32 ulRequestCount, IntPtr[] ppPhrases,
Int32& pcPhrasesReturned)
at
System.Speech.Recognition.RecognitionResult.ExtractDictationAlternates(ISpRecoResult recoResult, Int32 maxAlternates)
at
System.Speech.Recognition.RecognitionResult.Initialize(IRecognizerInternal
recognizer, ISpRecoResult recoResult, Byte[] sapiResultBlob, Int32
maxAlternates)
at
System.Speech.Recognition.RecognizerBase.CreateRecognitionResult(SpeechEvent
speechEvent)
at
System.Speech.Recognition.RecognizerBase.ProcessRecognitionEvent(SpeechEvent
speechEvent)
at System.Speech.Recognition.RecognizerBase.DispatchEvents(Object
eventData)


0 new messages