Microsoft.Speech SpeechRecognitionEngine.setInputToDefaultAudioDevice() method throwing System.InvalidOperationException

◇◆丶佛笑我妖孽 提交于 2019-11-30 18:52:10

问题


I'm using Microsoft.Speech (NOT System.Speech!) and I'm trying to set the input of the audio stream to my microphone, which is the default audio device, but it is throwing the exception:

System.InvalidOperationException' occurred in Microsoft.Speech.dll but was not handled in user code`

Additional information: Cannot find the requested data item, such as a data key or value.

This was just a test, ideally I want to set the audio stream to my speakers, but if I can get this to work I can just use a virtual audio device software to plug into the mic stream. If anyone can also set the audio stream to the speakers directly, that would be perfect.

Your help is appreciated!


回答1:


Based on limited information on the net, the situation is the following. Microsoft.Speech recognizer is recognizer for servers, like VXML servers and it might not support all audio devices and all input rates. For example, it might be that your audio driver does not support recording with low quality. So Microsoft.Speech might not accept your audio device.

You need to use System.Speech API instead, it is designed for desktop API and should work.



来源:https://stackoverflow.com/questions/33318596/microsoft-speech-speechrecognitionengine-setinputtodefaultaudiodevice-method-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!