TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Er Jasvinder Nehal
NA
20
7.9k
how can make speech recognition application in C#
Jun 17 2015 9:09 AM
i want to make speech recognition application using C# and window vista
below is my 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;
using System.Speech.Synthesis;
using System.Speech.Recognition;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Speech.AudioFormat;
using System.Globalization;
namespace proposed_embed_system
{
public partial class Form5 : Form
{
SpeechSynthesizer ss = new SpeechSynthesizer();
// PromptBuilder pb = new PromptBuilder();
SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
Choices clist = new Choices();
public Form5()
{
clist.Add(new string[] { "hello", " johan ", "kate" });
Grammar gr = new Grammar(new GrammarBuilder(clist));
try
{
sre.RequestRecognizerUpdate();
sre.LoadGrammar(gr);
sre.SpeechRecognized += sre_SpeechRecognized;
sre.SetInputToDefaultAudioDevice();
sre.RecognizeAsync(RecognizeMode.Multiple);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return; }
ss.SelectVoiceByHints(VoiceGender.Female);
ss.Speak("Well Come to Voice mode Transaction");
InitializeComponent();
}
public void say(string h)
{
ss.Speak(h);
}
void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
string r = e.Result.Text;
if (r == "hello")
{
say("hi");
}
if (r == " johan")
{
say("ok what is your mother name");
}
if (r == "kate")
{
say("please select transaction type");
}
}
}
}
when run show error
The language for the grammar does not match the language of the speech recognizer.
Please help where i wrong with these codes
Reply
Answers (
1
)
can we upload doc files using c#??if so..contribute code plz
convert string length into binary number