C # speech recognition

There is a message here about this ... but this does not work for me. I added the system.speech.dll file that I found on the Internet, but I can not use System.speech because it is not displayed.

Error 1: Could not find the name of the type or namespace 'SpeechRecognizer' (do you miss the using directive or assembly reference?)

Error 2: Cannot find the name of the type or namespace 'SpeechRecognizedEventArgs' (do you miss the using directive or assembly references?)

I used this code. I am using Windows Vista 64

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 SpeechLib; using System.Threading; namespace WindowsFormsApplication13 { public partial class Form1 : Form { SpeechRecognizer rec = new SpeechRecognizer(); public Form1() { InitializeComponent(); rec.SpeechRecognized += rec_SpeechRecognized; } void rec_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { lblLetter.Text = e.Result.Text; } private void Form1_Load(object sender, EventArgs e) { var c = new Choices(); // Doens't work must use English words to add to Choices and // populate grammar. // //for (var i = 0; i <= 100; i++) // c.Add(i.ToString()); c.Add("one"); c.Add("two"); c.Add("three"); c.Add("four"); c.Add("Five"); c.Add("six"); c.Add("seven"); c.Add("eight"); c.Add("nine"); c.Add("ten"); // etc... var gb = new GrammarBuilder(c); var g = new Grammar(gb); rec.LoadGrammar(g); rec.Enabled = true; } } } 
+6
c # speech-recognition
source share
5 answers

1) You need to add a link to System.Speech in your project

2) You did not need to search for "System.Speech.dll" on the Internet, it should be in .Net 3 (or 3.5, but get 3.5 anyway, if you have no good reason)

Edit:

You can look here:

http://dotnet.org.za/beta/archive/2008/01/06/system-speech-recognition.aspx

+4
source share

I agree with James Ogden. In addition, you must add the "using" statement:

 using System.Speech.Recognition 

Or fully qualify class names.

+4
source share

Make sure you have a language engine that matches the language configured in Vista. See http://support.microsoft.com/kb/934377

+1
source share

Not directly related to the above issue, it is worth noting that the Speech SDK will not be available on all client computers. While Vista includes speech recognition, XP does not. A possible way to fix this is to get XP users to install the Speech SDK, which includes one. Another is to add Office 2003 (not 2007) as a dependency.

0
source share

I have a problem with the SpeechRecognizer class on Windows XP. sometimes it works, but sometimes it does not work, and it needs to restart the computer. on windows 7 it works fine. I think that some problems are in the speech engine itself, because when I launch my application several times, it stops working.

Im using this code:

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 SpeechLib using System.Threading;

WindowsFormsApplication13 namespace {open partial class Form1: Form {

  SpeechRecognizer rec = new SpeechRecognizer(); public Form1() { InitializeComponent(); rec.SpeechRecognized += rec_SpeechRecognized; } void rec_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { lblLetter.Text = e.Result.Text; } private void Form1_Load(object sender, EventArgs e) { var c = new Choices(); c.Add("one"); c.Add("two"); c.Add("three"); c.Add("four"); c.Add("Five"); c.Add("six"); c.Add("seven"); c.Add("eight"); c.Add("nine"); c.Add("ten"); // etc... var gb = new GrammarBuilder(c); var g = new Grammar(gb); rec.LoadGrammar(g); rec.Enabled = true; } } 

}

0
source share

All Articles