Reputation: 15
I am developing Windows Phone 8 app using c#/xaml. I am basically trying to convert voice to text and store it in textbox. The voice input will be normal english. But for that I need to create whole grammar file i guess. Is there anything ready made or am i missing something. Please help
private async void record_Click(object sender, EventArgs e)
{
// Begin recognition using the default grammar and store the result.
SpeechRecognitionUIResult recoResult = await recoWithUI.RecognizeWithUIAsync();
recoWithUI.Recognizer.Grammars.AddGrammarFromPredefinedType("message", SpeechPredefinedGrammar.Dictation);
await this.recoWithUI.Recognizer.PreloadGrammarsAsync();
// Check that a result was obtained
if (recoResult.RecognitionResult != null)
{
// Determine if the user wants to save the note.
var result = MessageBox.Show(string.Format("Heard you say \"{0}\" Save?", recoResult.RecognitionResult.Text), "Confirmation", MessageBoxButton.OKCancel);
// Save the result to the Azure Mobile Service DB if the user is satisfied.
if (result == MessageBoxResult.OK)
{
voicetext.Text = recoResult.RecognitionResult.Text;
}
}
}
Upvotes: 0
Views: 602
Reputation: 13932
If you don't load any grammars into the recognizer, you get the predefined short message dictation grammar.
// Load the pre-defined dictation grammar by default
// and start recognition.
SpeechRecognitionUIResult recoResult = await recoWithUI.RecognizeWithUIAsync();
// Do something with the recognition result
MessageBox.Show(string.Format("You said {0}.", recoResult.RecognitionResult.Text));
Upvotes: 1