Speech Recognition in Windows 8 (rather than having to hit a pesky button)
In easy way to voice command your xaml applications. Windows 8 will know all the commands it knows and then all the commands you add with:
recognizer.LoadGrammar(grammar);
public void StartRecognitionCycle()
{
List<string> grammarList = newList<string>() { “Call”, “Time”, “Information”, “Directions”, “Voice”, “Mute” };
Choices choices = newChoices(grammarList.ToArray());
GrammarBuilder grammarBuilder = newGrammarBuilder(choices);
Grammar grammar = newGrammar(grammarBuilder);
recognizer = new SpeechRecognizer();
recognizer.LoadGrammar(grammar);
recognizer.Enabled =true;
recognizer.SpeechRecognized += newEventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);
}
public void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
switch (e.Result.Text.ToLower())
{
case“call”:
{
if(CellOn)
CallCommand.Execute();
break;
}
case“time”:
{
if (CellOn)
WatchCommand.Execute();
break;
}
case“information”:
{
if (CellOn)
ReviewCommand.Execute();
break;
}
case “directions”:
{
if (CellOn)
DirectionsAudioCommand.Execute();
break;
}
case“meeting”:
{
if (CellOn)
MeetingReminderCommand.Execute();
break;
}
case “voice”:
{
CellOn = true;
break;
}
case “mute”:
{
CellOn = false;
break;
}
}
}
Keywords:
System.Speech.Recognition
.Net
Windows 8
WINRT
(From started from SQL demo here http://www.redmondpie.com/speech-recognition-in-a-c-wpf-application/)
Share on Facebook