我想知道是否可以在不使用语音转文本方法的情况下捕获语音输入并判断用户是否说了简单的话,例如是/否/下一个等。我尝试使用谷歌搜索,但结果并不理想。分析波形是一种方法吗?怎么做?希望有人可以帮助我。
问问题
1271 次
1 回答
2
它内置在 Windows 中,您可以从 C# 访问它
见文档
http://msdn.microsoft.com/en-us/library/hh361683(v=office.14).aspx
这个例子非常简单:-
// Create a new SpeechRecognitionEngine instance.
SpeechRecognizer recognizer = new SpeechRecognizer();
// Create a simple grammar that recognizes "red", "green", or "blue".
Choices colors = new Choices();
colors.Add(new string[] { "red", "green", "blue" });
// Create a GrammarBuilder object and append the Choices object.
GrammarBuilder gb = new GrammarBuilder();
gb.Append(colors);
// Create the Grammar instance and load it into the speech recognition engine.
Grammar g = new Grammar(gb);
recognizer.LoadGrammar(g);
// Register a handler for the SpeechRecognized event.
recognizer.SpeechRecognized +=
new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);
}
// Create a simple handler for the SpeechRecognized event.
void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
MessageBox.Show("Speech recognized: " + e.Result.Text);
}
于 2013-07-02T04:03:31.420 回答