Click here to Skip to main content
15,900,973 members
Please Sign up or sign in to vote.
4.33/5 (2 votes)
See more:
please help me how to convert speech to text using c#
Posted
Comments
♥…ЯҠ…♥ 19-Nov-13 23:34pm    
Nice question....!!!

1 solution

Did you Googled this? Following are very first two links from google search.

http://stackoverflow.com/questions/4677471/voice-speech-to-text

C# Speech to Text

Many more you will find Here.
Google Search
 
Share this answer
 
Comments
Maciej Los 19-Nov-13 17:23pm    
+5!
RaisKazi 19-Nov-13 19:36pm    
Thank you Maciej.
srinivaspitla66 20-Nov-13 2:14am    
RaisKazi it's not working i already tried this please post complete code...
srinivaspitla66 20-Nov-13 2:36am    
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;
using System.Speech.Synthesis;
using System.Speech.Recognition;
using System.Speech.Recognition.SrgsGrammar;
using System.Threading;


namespace SpeechToText
{
public partial class Form1 : Form
{
SpeechSynthesizer sSynth = new SpeechSynthesizer();
PromptBuilder pBuilder = new PromptBuilder();
SpeechRecognitionEngine sRecognize = new SpeechRecognitionEngine();

public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
pBuilder.ClearContent();
pBuilder.AppendText(textBox1.Text);
sSynth.Speak(pBuilder);
}

private void button2_Click(object sender, EventArgs e)
{
button2.Enabled = false;
button3.Enabled= true;
Choices sList = new Choices();
sList.Add(new string[] { "hello","hi","how","are","you","srinivas","test","i"});
Grammar gr = new Grammar(new GrammarBuilder(sList));
try
{
sRecognize.RequestRecognizerUpdate();
sRecognize.LoadGrammar(gr);
sRecognize.SpeechRecognized += sRecognize_SpeechRecognized;

sRecognize.SetInputToDefaultAudioDevice();
sRecognize.RecognizeAsync(RecognizeMode.Multiple);

}
catch
{
return;
}
/* sRecognize.SetInputToDefaultAudioDevice();
sRecognize.LoadGrammar(new DictationGrammar());
sRecognize.SpeechRecognized += new EventHandler<speechrecognizedeventargs>(sRecognize_SpeechRecognized);
sRecognize.RecognizeAsync(RecognizeMode.Multiple);*/

}

void sRecognize_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
/* foreach (RecognizedWordUnit word in e.Result.Words)
{
listBox1.Items.Add(word.Text);
}*/
if (e.Result.Text == "exit")
{
Application.Exit();
}
else
{
textBox1.Text = textBox1.Text + " " + e.Result.ToString();
}
}



private void Form1_Load(object sender, EventArgs e)
{
// sRecognize.SpeechRecognized += new EventHandler<speechrecognizedeventargs>(sRecognize_SpeechRecognized);

}



}
}
this is my code but speech is not recogniging...can u help me...
RaisKazi 20-Nov-13 9:35am    
We can provide you direction. If some code is not working then post a New question with the details.

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