1

I followed a very basic tutorial (forgot the link) and it all seems straightforward, but I don't seem to be getting the output I want. Here is my main form class:

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Speech.Recognition; namespace OralNotes.Alpha { public partial class MainForm : Form { private SpeechRecognitionEngine recognitionEngine; public MainForm() { InitializeComponent(); recognitionEngine = new SpeechRecognitionEngine(); recognitionEngine.SetInputToDefaultAudioDevice(); recognitionEngine.SpeechRecognized += (s, args) => { foreach (RecognizedWordUnit word in args.Result.Words) { if (word.Confidence > 0.8f) txtNotes.Text += word.Text + " "; } txtNotes.Text += Environment.NewLine; }; recognitionEngine.LoadGrammar(new DictationGrammar()); } private void btnStart_Click(object sender, EventArgs e) { recognitionEngine.RecognizeAsync(); } private void btnStop_Click(object sender, EventArgs e) { recognitionEngine.RecognizeAsyncStop(); } } } 

And you probably don't need this, but here it is anyway:

using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace OralNotes.Alpha { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } } } 

I click start and talk, and nothing happens.

UPDATE*

ok so this is working, if I adjust this line

if (word.Confidence > 0.8f) 

to a lower number I get a word or two in. Not transcribing sentences or anything, is there a way to make this have better recognition?

8
  • When you say you click start do you mean you run the application and the form does not show? Commented Dec 7, 2012 at 0:18
  • Sorry, There is a button "Start" that I click is supposed to start the listening I guess. The form loads fine. Commented Dec 7, 2012 at 0:19
  • Would be beneficial to post that code since that is what starts the routine. Commented Dec 7, 2012 at 0:31
  • This is ALL the code. It is just a single form visual studio winform application. Commented Dec 7, 2012 at 0:39
  • ok, it sounds like you have not defined an onclick event handler for your button. Move the speech code into its own method. Then add an onClick handler that calls that method. Post back if you need help with that. Commented Dec 7, 2012 at 0:41

1 Answer 1

1

It seems that the engine that you are using returns a confidence value on every word it hears.

I suspect that the confidence values range from 0-1. Which means that if you lower the value from 0.8 you are making the engine more tolerant to words. Maybe it is the quality of your mic?

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.