Access Denied HRESULT: 0x80070005 (E_ACCESSDENIED)) on SetInputToDefaultAudioDevice();

0

I tried to programe some Speech Recognition app and I found this code:

SpeechRecognitionEngine recognitionEngine = new SpeechRecognitionEngine();

recognitionEngine.SetInputToDefaultAudioDevice();    
recognitionEngine.LoadGrammar(new DictationGrammar());    

RecognitionResult result = recognitionEngine.Recognize(new TimeSpan(0, 0,20));    
foreach (RecognizedWordUnit word in result.Words)     
{     
     Console.Write(word.Text);     
} 

But when I want to Debug it, it shows Error Access Denied HRESULT: 0x80070005 (E_ACCESSDENIED)) on command : recognitionEngine.SetInputToDefaultAudioDevice();

(The reference to System.Speech is set). I looked through many threads already, but I can't find an answer. Should I set somwhere the access to microphone or how can I solve this problem?

Thanks for the answer ;)

c#
.net
error-handling
speech-recognition
asked on Stack Overflow Nov 21, 2012 by doskarJ • edited Nov 21, 2012 by MethodMan

1 Answer

0

You need to install speech recognition and text to speech features to your windows. If you are using windows 10, go to start menu and write settings there.

Open settings page.

Open time and language.

Open Region&Language tab.

Add English language US as a language if it doesnt exist.

Click to the English language. Then click to options.

Then under the Speech tab, click download.

Then windows will download the required packages.

After all finishes, restart your system.

answered on Stack Overflow May 29, 2018 by smoothumut

User contributions licensed under CC BY-SA 3.0