I am getting this error on an app that used to work correctly, but now everytime I run the app I get this error.
Can someone please help me?
I get the error on this line:
SpeechRecognitionEngine sRecognize = new SpeechRecognitionEngine();
Here is the 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 System.Speech.Synthesis;
using System.Speech.Recognition;
using System.Threading;
using System.Speech.AudioFormat;
using NAudio.Wave;
using NAudio.Lame;
namespace Note_Taker__
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SpeechSynthesizer sSynth = new SpeechSynthesizer();
PromptBuilder pBuilder = new PromptBuilder();
SpeechRecognitionEngine sRecognize = new SpeechRecognitionEngine();
private void newToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox1.Text = "";
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
DialogResult dr = openFileDialog1.ShowDialog();
if(dr==DialogResult.OK){
richTextBox1.LoadFile(openFileDialog1.FileName);
}
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
DialogResult dr = saveFileDialog1.ShowDialog();
if (dr == DialogResult.OK)
{
richTextBox1.SaveFile(saveFileDialog1.FileName);
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void speak_Click(object sender, EventArgs e)
{
pBuilder.ClearContent();
pBuilder.AppendText(richTextBox1.Text);
sSynth.Speak(pBuilder);
}
private void start_Click(object sender, EventArgs e)
{
}
}
}
Can someone also please help me in increasing the level of confidence I can have for the speech to text conversion in this app?
Thanks.
What I have tried:
I tried placing public static on the speechrecognitionengine variable.
I didn't try anything else, because I don't understand the rror.
It says something about file not found, but I included the system.speech reference and I am also using it in the code, so I don't know what's wrong.