Voice Recognition coding for .net

Greetings to all,

I would like to develop a function which is voice recognition, eg. I can say “open program”, then the program will be open etc.

Anyone have resources on this?

TQ
JYnetAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AaronReamsCommented:
I'm not sure how much of this you'll want to do yourself as its pretty complicated.  If possible I'd consider using a third party voice recoginition SDK.  I've used SpeechWorks Dragon before and it worked out fairly well.  Training the system always improves accuracy.

http://www.scansoft.com/naturallyspeaking/sdk/client/

Or your could always just use the Microsoft speech SDK but I'm not as familiar with their product.

http://www.microsoft.com/downloads/details.aspx?FamilyId=5DAAE9C4-188C-4547-A9D6-1671132A39A1&displaylang=en&EventType=hp

0
JYnetAuthor Commented:
no need too complicated, only record my voice, like "open word", then it will compare the wave, then open MS word.
0
AaronReamsCommented:
Hmmm, sounds tricky to me.

You might try and look at this article for vocal stress analysis.  Perhaps you can extrapolate some functionality for your project from this source code.

http://www.codeproject.com/netcf/ShakyVoice.asp

Anyway, Good luck.  If you don't mind, let me know if you get it all working.  It sounds kewl.

Regards,
Aaron
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

thedude112286Commented:
The math required for voice recognition is well above my head but Microsoft's Speech API (SAPI) does the job for you.  I think it comes pre-installed on most Windows computers but you might want to check MSDN on that.  If you want to recieve commands by voice, try this:

// project created on 8/8/2003 at 9:38 PM
using System;
using System.Windows.Forms;
using SpeechLib;

namespace SAPI_tester
{
      class Reco      {
            private SpSharedRecoContext context;

            public Reco()
            {
                  //SR
                  context = new SpSharedRecoContext();
                                    
                  //setup event sync                  
                  context.EventInterests = SpeechRecoEvents.SRERecognition;
                  context.Recognition += new _ISpeechRecoContextEvents_RecognitionEventHandler(OnRecognition);
                                                Init();
            }
            
            protected void Init() {
                  //Free dictation
                  /*ISpeechRecoGrammar grammar = context.CreateGrammar(1);
                  
                  grammar.DictationLoad("", SpeechLoadOption.SLOStatic);
                  grammar.DictationSetState(SpeechRuleState.SGDSActive);*/
                  
                  //Grammar, Rule-Based C&C
                  string fileName = Application.StartupPath + @"\grammar.xml";
                  int ruleID = 0;
                  
                  ISpeechRecoGrammar grammar = context.CreateGrammar(1);
                  grammar.CmdLoadFromFile(fileName, SpeechLoadOption.SLOStatic);
                  grammar.DictationSetState(SpeechRuleState.SGDSInactive);
                  grammar.CmdSetRuleIdState(ruleID, SpeechRuleState.SGDSActive);
            }
            
            public void OnRecognition(int streamNumber, object streamPosition, SpeechRecognitionType recognitionType, ISpeechRecoResult result)
            {
                  string txt = result.PhraseInfo.GetText(0, result.PhraseInfo.Elements.Count, false);
            }
      }                  
}


And an example grammar.xml file:

<GRAMMAR>
<!--      
      <RULE ID="0" NAME="main" TOPLEVEL="ACTIVE">
            <P PROPNAME="StuffPreNumber"><O>*+</O></P>
            <RULEREF NAME="number" />
      </RULE>
      
      <RULE ID="1" NAME="number">
            <L PROPNAME="number">
                  <P VAL="0">zero</P>
                  <P VAL="1">one</P>
                  <P VAL="2">two</P>
            </L>
      </RULE>
-->
      <RULE ID="0" NAME="Main" TOPLEVEL="ACTIVE">
            <L PROPNAME="CommandType">
                  <P VAL="SingleArgument">
                        <RULEREF NAME="NoArgumentCommand" />
                  </P>
                  <P VAL="TwoArgument">
                        <RULEREF NAME="SingleArgumentCommand" />
                  </P>
            </L>
      </RULE>
      
      <RULE ID="1" NAME="NoArgumentCommand">
            *+
            <RULEREF NAME="NoArgumentAction" />
      </RULE>
      
      <RULE ID="2" NAME="SingleArgumentCommand">
            *+
            <RULEREF NAME="SingleArgumentAction" />
            <P PROPNAME="Argument">*+</P>
      </RULE>
      
      <RULE ID="3" NAME="NoArgumentAction">
            <L PROPNAME="NoArgumentAction">
                  <P VAL="Play">Play</P>
                  <P VAL="Stop">Stop</P>
                  <P VAL="Pause">Pause</P>
                  <P VAL="LastTrack">
                        <L>                        
                              <O>Go to the</O>
                              <O>Play the</O>
                        </L>
                        <L>
                              <P>last</P>
                              <P>previous</P>
                        </L>
                        <L>
                              <P>track</P>
                              <P>song</P>
                        </L>
                  </P>
                  <P VAL="NextTrack">
                        <L>                        
                              <O>Go to the</O>
                              <O>Play the</O>
                        </L>
                        next
                        <L>
                              <P>track</P>
                              <P>song</P>
                        </L>
                  </P>
                  <P VAL="SongName">
                        <L>
                              <P>What song is this</P>
                              <P>What's this song called</P>
                              <P>What is this song called</P>
                              <P>What's the name of this song</P>
                              <P>What is the name of this song</P>
                        </L>
                  </P>
                  <P VAL="Artist">
                        <L>
                              <P>Who *+</P>
                              <P>What band *+</P>
                              <P>Which band *+</P>
                              <P>What group *+</P>
                              <P>Which group *+</P>
                              <P>What artist *+</P>
                              <P>Which artist *+</P>
                        </L>
                  </P>
            </L>
      </RULE>
      
      <RULE ID="4" NAME="SingleArgumentAction">
            <L PROPNAME="NoArgumentAction">
                  <P VAL="Play">Play</P>
                  <P VAL="Stop">Stop</P>
            </L>
      </RULE>      
</GRAMMAR>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JYnetAuthor Commented:
Dude,

do i need to download and install SAPI before i can run ur code? or just open a new c# project and paste ur code to compile like that?
0
thedude112286Commented:
SAPI must be installed on the user's computer and you will need SpeechLib.dll, the managed interface (Interop Assembly).  If you need help finding them, just ask.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.