edi.Y

Hi,

I'm trying to implement a recognizer but every time
I'm trying to use SpeechRecognitionEngin.SetInputToDefaultAudioDevice()
I'm getting an unknown exception

private SpeechRecognizer sharedRecognizer;
sharedRecognizer = new SpeechRecognizer();
sharedRecognizer.Enabled = false;
dictationResult = String.Empty;
appRecognizer = new SpeechRecognitionEngine();

//this is where the code fail in runtime
appRecognizer.SetInputToDefaultAudioDevice();

appRecognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(appRecognizer_SpeechRecognized);



i tried this on 3 different machines ... how can i solve this problem without installing vista :)




Re: Windows Presentation Foundation (WPF) SetInputToDefaultAudioDevice failed in XP

ssssssssss

Having the same problem.

Tested heavily and found that this code works as Console Application in Win XP SP2. However, fails with nonlogical ArgumentException "Value does not fall within the expected range".

Have no idea what does it mean, the method actually have no arguments, so it looks like MS .NET 3 bug.





Re: Windows Presentation Foundation (WPF) SetInputToDefaultAudioDevice failed in XP

Emrah Yi?it

Just insert this line of code in a different Thread.

Thread t1 = new Thread(delegate(){

refSpeechRecognizer.SetInputToDefaultAudioDevice();

});

I hope it helps...






Re: Windows Presentation Foundation (WPF) SetInputToDefaultAudioDevice failed in XP

Emrah Yi?it

Just run this method on a different thread...

Thread t1 = new Thread(delegate(){

refSpeechRecognizer.SetInputToDefaultAudioDevice();

});

t1.Start();

I hope it helps...






Re: Windows Presentation Foundation (WPF) SetInputToDefaultAudioDevice failed in XP

Tamir Khason

Have you SAPI 5.1 installed on your XP machine




Re: Windows Presentation Foundation (WPF) SetInputToDefaultAudioDevice failed in XP

Rob_Iles

Hello,

Thanks for the tip - it no longer throws an error - - but none of the reco events fire.

any more suggestions

(using System.Speech on XPSP2)

Thanks.






Re: Windows Presentation Foundation (WPF) SetInputToDefaultAudioDevice failed in XP

Emrah Yi?it

Hi,

Actually you should start recognition in the Thread too...

SpeechRecognizer.SetInputToDefaultAudioDevice();

SpeechRecognizer.RecognizeAsync();

And also in the RecognitionCompleted event handler....

SpeechRecognizer.RecognizeAsync();