当我说一个特定的词以便以后继续其他内容时,我需要此功能完成。
我正在使用System.Speech.Recognition库处理c#。 另外,我正在使用西班牙语,并且之前尝试过识别功能,但是它可以通过按键“录音”完成。
public static void waitforstart() {
while (true) {
SpeechRecognitionEngine oEscucha = new SpeechRecognitionEngine();
oEscucha.SetInputToDefaultAudioDevice();
GrammarBuilder gr = new GrammarBuilder();
oEscucha.LoadGrammar(new DictationGrammar());
oEscucha.SpeechRecognized += Deteccion;
oEscucha.RecognizeAsync(RecognizeMode.Single);
Console.WriteLine("1");
if (intro.IndexOf("botella", 0, StringComparison.CurrentCultureIgnoreCase) != -1) { //That chechs if "botella" is inside the text ignoring uppercase
break;
}
} }
答案 0 :(得分:-1)
public static void waitforstart() {
while (true) {
SpeechRecognitionEngine oEscucha = new SpeechRecognitionEngine();
oEscucha.SetInputToDefaultAudioDevice();
GrammarBuilder gr = new GrammarBuilder();
oEscucha.LoadGrammar(new DictationGrammar());
oEscucha.SpeechRecognized += Deteccion;
oEscucha.Recognize();
Console.WriteLine(intro);
if (intro.IndexOf("botella", 0, StringComparison.CurrentCultureIgnoreCase) != -1) { //That chechs if "botella" is inside the text ignoring uppercase
break;
}
} }