Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Speech programming

Speech programming

Scheduled Pinned Locked Moved C#
csharpgraphicsdocker
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TheEagle
    wrote on last edited by
    #1

    Hi.. Ihave downloaded the microsoft SAPI SDK to make a simple speech Recognition C# application.After search the internet for examples i wrote the code: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using SpeechLib; using System.IO; namespace ReviewWinApp { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form {private SpSharedRecoContext objRecoContext; private SpeechLib.ISpeechRecoGrammar grammar; private System.Windows.Forms.MainMenu mainMenu1; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.MenuItem menuItem3; private System.Windows.Forms.Button button1; private System.Windows.Forms.TextBox tbxOFile; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.RadioButton rdoEVoice; private System.Windows.Forms.MenuItem menuItem4; private System.Windows.Forms.Button button2; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.mainMenu1 = new System.Windows.Forms.MainMenu(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.menuItem2 = new System.Windows.Forms.MenuItem(); this.menuItem3 = new System.Windows.Forms.MenuItem(); this.menuItem4 = new System.Windows.Forms.MenuItem(); this.button1 = new System.Windows.Forms.Button(); this.tbxOFile = new System.Windows.Forms.TextBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.rdoEVoice = new System.Windows.Forms.RadioButton(); this.button2 = new System.Windows.Forms.Button(); this.groupBox1.Sus

    K 1 Reply Last reply
    0
    • T TheEagle

      Hi.. Ihave downloaded the microsoft SAPI SDK to make a simple speech Recognition C# application.After search the internet for examples i wrote the code: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using SpeechLib; using System.IO; namespace ReviewWinApp { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form {private SpSharedRecoContext objRecoContext; private SpeechLib.ISpeechRecoGrammar grammar; private System.Windows.Forms.MainMenu mainMenu1; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.MenuItem menuItem3; private System.Windows.Forms.Button button1; private System.Windows.Forms.TextBox tbxOFile; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.RadioButton rdoEVoice; private System.Windows.Forms.MenuItem menuItem4; private System.Windows.Forms.Button button2; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.mainMenu1 = new System.Windows.Forms.MainMenu(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.menuItem2 = new System.Windows.Forms.MenuItem(); this.menuItem3 = new System.Windows.Forms.MenuItem(); this.menuItem4 = new System.Windows.Forms.MenuItem(); this.button1 = new System.Windows.Forms.Button(); this.tbxOFile = new System.Windows.Forms.TextBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.rdoEVoice = new System.Windows.Forms.RadioButton(); this.button2 = new System.Windows.Forms.Button(); this.groupBox1.Sus

      K Offline
      K Offline
      kasik
      wrote on last edited by
      #2

      From what I can see, you dont appear to have started grammar (I assume button2_Click is the method that you want to start the recognition). Try placing the following code at the end of that method...

      grammar.DictationSetState(SpeechRuleState.SGDSActive);

      Just a guess :)


      “Accept that some days you are the pigeon, and some days you are the statue” -- David Brent Cheers, Will H

      T 2 Replies Last reply
      0
      • K kasik

        From what I can see, you dont appear to have started grammar (I assume button2_Click is the method that you want to start the recognition). Try placing the following code at the end of that method...

        grammar.DictationSetState(SpeechRuleState.SGDSActive);

        Just a guess :)


        “Accept that some days you are the pigeon, and some days you are the statue” -- David Brent Cheers, Will H

        T Offline
        T Offline
        TheEagle
        wrote on last edited by
        #3

        You are right.. After i have added your code the dictation grammar worked..that helped me to find how to use the grammar in my file(tryRecog.xml) as a context free grammar (CFG) using the code: grammar.CmdSetRuleIdState(0,SpeechRuleState.SGDSActive); You found exactly where does the error exist in the whole code..That was realy impressive.Thank you very much.

        1 Reply Last reply
        0
        • K kasik

          From what I can see, you dont appear to have started grammar (I assume button2_Click is the method that you want to start the recognition). Try placing the following code at the end of that method...

          grammar.DictationSetState(SpeechRuleState.SGDSActive);

          Just a guess :)


          “Accept that some days you are the pigeon, and some days you are the statue” -- David Brent Cheers, Will H

          T Offline
          T Offline
          TheEagle
          wrote on last edited by
          #4

          Hi..iam happy to talk to you again. I want to use the CmdLoadFromResource() method of ths speech SDK 5.1 to make the xml file that includes the Grammar embeded but i dont know how to use this method in C#. Do you know how to use this method?

          K 1 Reply Last reply
          0
          • T TheEagle

            Hi..iam happy to talk to you again. I want to use the CmdLoadFromResource() method of ths speech SDK 5.1 to make the xml file that includes the Grammar embeded but i dont know how to use this method in C#. Do you know how to use this method?

            K Offline
            K Offline
            kasik
            wrote on last edited by
            #5

            I'm sorry, but I have never used this method. I haven't used XML files for use with SAPI either. I think your best bet would be to ask again in the forums, or just try and attempt it and see what happens. Sorry I couldn't be of more help.


            “Accept that some days you are the pigeon, and some days you are the statue” -- David Brent Cheers, Will H

            T 1 Reply Last reply
            0
            • K kasik

              I'm sorry, but I have never used this method. I haven't used XML files for use with SAPI either. I think your best bet would be to ask again in the forums, or just try and attempt it and see what happens. Sorry I couldn't be of more help.


              “Accept that some days you are the pigeon, and some days you are the statue” -- David Brent Cheers, Will H

              T Offline
              T Offline
              TheEagle
              wrote on last edited by
              #6

              Thank you for your respond..I will take your advice and put my question in the C# forum..We spent an interesting time together thank you very much:).

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups