Hello, my name's Jake Cross! I've recently ran into a problem when I upgrade to Visual Studio 2013 running .NET 4.5. I've been using Sharp-develop for programming C# with the .NET 4.0 framework but and it was working fine with the exact same code. I'm
unsure why this is, I don't believe it's because of my new laptop and I've made sure my mic was set to the default audio input device. Here's the code.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.IO; using System.Speech.Recognition; using System.Speech.Synthesis; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace J.A.R.V.I.S { public partial class Form1 : Form { public Form1() { InitializeComponent(); } SpeechRecognitionEngine jListen = new SpeechRecognitionEngine(); SpeechSynthesizer jTalk = new SpeechSynthesizer(); private void Form1_Load(object sender, EventArgs e) { jListen.SetInputToDefaultAudioDevice(); jListen.LoadGrammar(new Grammar(new GrammarBuilder(new Choices(File.ReadAllLines(@"C:\Program Files\Stackoverload\Jarvis\Grammar\English.txt"))))); jListen.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(jListen_SpeechRecognized); jListen.RecognizeAsync(RecognizeMode.Multiple); } void jListen_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { string speech = e.Result.Text; if(speech == "hello") { jTalk.Speak("Hi"); } } } }Thanks ahead of time!