I have a problem with my speech recognition reference in my C# application. When I reference it in my C# code with the using System.Speech.Recognition
statement, the program will only run when a microphone is present and will refuse to run when the opposite case is true. Is there a way that I can use this library selectively, so that the program won't shut down if another computer that is hosting it doesn't have a microphone? Thanks in advance!
You need to check for the presence of the microphone before you create the SpeechRecognizer object.
Ie, instead of doing:
using System.Speech.Recognition;
SpeechRecognizer reco = new SpeechRecognizer();
do
using System.Speech.Recognition;
SpeechRecognizer reco = null;
if (MicrophonePresent())
{
reco = new SpeechRecognizer();
// do remainder of setup here
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.