Click here to Skip to main content
15,888,148 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
C#
SpeechRecognitionEngine sRecognize = new SpeechRecognitionEngine(); 

Here is the code:
C#
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)
        {
	    
        }
        /*private void sRecognize_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) {
            if(e.Result.Text=="exit"){
                Application.Exit();
            }
            else {
                richTextBox1.Text = richTextBox1.Text + "" + e.Result.Text.ToString();
            }
            //MessageBox.Show("Speech Recognized: "+e.Result.Text.ToString());
        }*/
       
    }
}

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.
Posted
Comments
Dave Kreskowiak 8-Dec-16 22:01pm    
You never said what the error was.
[no name] 9-Dec-16 13:28pm    
Read the error message. If it says "something" about file not found, it's probably not lying to you. We can't see your screen or read your mind.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900