Welcome to Dream.In.Code
Become a C# Expert!

Join 136,910 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,733 people online right now. Registration is fast and FREE... Join Now!




voice interface in C# for xp

 
Reply to this topicStart new topic

voice interface in C# for xp, i need code voive interface in c#

narendra28
30 Mar, 2008 - 09:20 AM
Post #1

New D.I.C Head
*

Joined: 30 Mar, 2008
Posts: 4

hello guys,

i have coded voice interface in vista but it isnt working for xp even though i have installed sapi 5.1 and visual c# express edition.
can any one really help.
i have attached the code to this post.
regards
nick


Attached File(s)
Attached File  KeySimulator___VoiceCommander.zip ( 107.19k ) Number of downloads: 95
Attached File  KeySimulator___VoiceCommander.zip ( 107.19k ) Number of downloads: 58
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Voice Interface In C# For Xp
30 Mar, 2008 - 09:22 AM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,998



Thanked: 126 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Why dont you post the code you're having an issue with. most, including myself, wont download files from people we dont know. When posting code please use code tags code.gif
User is online!Profile CardPM
+Quote Post

narendra28
RE: Voice Interface In C# For Xp
1 Apr, 2008 - 09:14 AM
Post #3

New D.I.C Head
*

Joined: 30 Mar, 2008
Posts: 4

QUOTE(narendra28 @ 30 Mar, 2008 - 10:20 AM) *

hello guys,

i have coded voice interface in vista but it isnt working for xp even though i have installed sapi 5.1 and visual c# express edition.
can any one really help.
i have attached the code to this post.
regards
nick

i really have lot of files so cant actually paste it here this is narendra a young computer science engineer from india and im sure im not any kind of harm.
narendra.k.b@gmail.com is my email id
plz chk n deal..
thanq
narendra
User is offlineProfile CardPM
+Quote Post

RodgerB
RE: Voice Interface In C# For Xp
1 Apr, 2008 - 04:12 PM
Post #4

D.I.C Lover
Group Icon

Joined: 21 Sep, 2007
Posts: 2,131



Thanked: 17 times
Dream Kudos: 2200
Expert In: Dot Net Technologies

My Contributions
QUOTE(narendra28 @ 2 Apr, 2008 - 03:14 AM) *

narendra.k.b@gmail.com is my email id
plz chk n deal..
thanq
narendra


All questions here should be dealt with on the forums, not your private mailbox. You should go to more effort to help us fix the issue than what we need to, to help you.

That includes posting the code in a properly formatted post instead of attaching it. You will have a lot better chance of getting it solved if you conform to these standards. smile.gif
User is offlineProfile CardPM
+Quote Post

narendra28
RE: Voice Interface In C# For Xp
10 Apr, 2008 - 02:17 AM
Post #5

New D.I.C Head
*

Joined: 30 Mar, 2008
Posts: 4

hello
this is my sample speech recognition code
I have plan of extending the code such that the recognized wored would be the parameter for the switch case which has shell execuete command for different commands.
this is code


csharp

//code

using System;
using System.Speech;
using System.Speech.Recognition;
using System.Threading;
using System.Diagnostics;
using System.Globalization;

namespace SpeechTest
{
class Program
{
static void Main(string[] args)
{
EnumerateEngines();
args = CheckArguments(args);


CommandListener listener = new CommandListener();
listener.SetCommands(args);
listener.Run();
}


private static string[] CheckArguments(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Setting up default words. Enter your own words via command line arguments");
args = new string[] { "notepad", "shutdown", "restart", "outlook" };
}


Console.Write("Now listening for...");
foreach (string word in args)
{
Console.Write(String.Format("'{0}', ", word));
}
Console.WriteLine("\r\n(Press a key to stop listening)");
return args;
}


private static void EnumerateEngines()
{
Console.WriteLine("The following engines are available");
foreach (RecognizerInfo config in
SpeechRecognitionEngine.InstalledRecognizers())
{
Console.WriteLine(config.Name + " " +
config.Description);
}
}
}


class CommandListener
{
SpeechRecognitionEngine speechRecogniser;


public CommandListener()
{
speechRecogniser = new SpeechRecognitionEngine();
speechRecogniser.SetInputToDefaultAudioDevice();


speechRecogniser.SpeechDetected += new
EventHandler<SpeechDetectedEventArgs>(speechRecogniser_SpeechDetected);
speechRecogniser.SpeechHypothesized += new
EventHandler<SpeechHypothesizedEventArgs>(speechRecogniser_SpeechHypothesized);
speechRecogniser.SpeechRecognitionRejected += new
EventHandler<SpeechRecognitionRejectedEventArgs>(speechRecogniser_SpeechRecognitionRejected);
speechRecogniser.SpeechRecognized += new
EventHandler<SpeechRecognizedEventArgs>(speechRecogniser_SpeechRecognized);
speechRecogniser.AudioStateChanged += new
EventHandler<AudioStateChangedEventArgs>(speechRecogniser_AudioStateChanged);
speechRecogniser.AudioSignalProblemOccurred += new
EventHandler<AudioSignalProblemOccurredEventArgs>(speechRecogniser_AudioSignalProblemOccurred);



}


#region Event Handlers
void speechRecogniser_AudioSignalProblemOccurred(object
sender, AudioSignalProblemOccurredEventArgs e)
{
NotifyEvent("Audio problem {0}",
e.AudioSignalProblem.ToString("G"));
}


void speechRecogniser_AudioStateChanged(object sender,
AudioStateChangedEventArgs e)
{
NotifyEvent("Audio state now {0}",
e.AudioState.ToString("G"));
}


void speechRecogniser_SpeechRecognized(object sender,
SpeechRecognizedEventArgs e)
{
NotifyEvent("Recognized '{0}' at {1} seconds",
e.Result.Text, e.Result.Audio.AudioPosition);
}


void speechRecogniser_SpeechRecognitionRejected(object sender,
SpeechRecognitionRejectedEventArgs e)
{
NotifyEvent("RecognitionRejected '{0}' at {1} seconds",
e.Result.Text, e.Result.Audio.AudioPosition);
}


void speechRecogniser_SpeechHypothesized(object sender,
SpeechHypothesizedEventArgs e)
{


NotifyEvent("Hypothesized '{0}' at seconds",
e.Result.Text);
}


void speechRecogniser_SpeechDetected(object sender,
SpeechDetectedEventArgs e)
{
NotifyEvent("Detected speech at {0} seconds",
e.AudioPosition.TotalSeconds);
}
#endregion


public void SetCommands(string[] commands)
{
GrammarBuilder grammarBuilder = new GrammarBuilder();


grammarBuilder.Culture =
speechRecogniser.RecognizerInfo.Culture;
grammarBuilder.Append(new Choices(commands));
Grammar grammar = new Grammar(grammarBuilder);


speechRecogniser.UnloadAllGrammars();
speechRecogniser.LoadGrammar(grammar);


speechRecogniser.RecognizeAsync(RecognizeMode.Multiple);

}


public void Run()
{
while (!Console.KeyAvailable)
{
Thread.Sleep(100);
}


speechRecogniser.Dispose();
}


private static void NotifyEvent(string format, params object[] args)
{
Console.WriteLine(string.Format(format, args));
}
}

}




what i want is to send the recognized word to switch case and get that particular command executed.
thankqq

Please use code tags => code.gif

This post has been edited by PsychoCoder: 10 Apr, 2008 - 03:25 AM


Attached File(s)
Attached File  speech.txt ( 4.79k ) Number of downloads: 37
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 09:56PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month