Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hello everyone...
i am working on "WINDOWS FORMS, C#"
sorry to bother you, but i have to display my project in which i am working on "speech recognition" i actually want to draw a shape (in built in C# like circle), when a user asks to make it, can anyone tell me the syntax to connect the two logics,
1; recognize speech
2; draw circle

the coding modules i have made are,

FOR SPEECH RECOGNITION


C#
using System.Speech.AudioFormat;
    using System.Speech;


    namespace speechexampl
{
        public partial class Form1 : Form
        {

            SpeechRecognizer rec = new SpeechRecognizer();


            public Form1()
            {

                InitializeComponent();

                rec.SpeechRecognized += rec_SpeechRecognized;

            }


            void rec_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
            {

                lblLetter.Text = e.Result.Text;

            }


            void Form1_Load(object sender, EventArgs e)
            {

                var c = new Choices();
                for (var i = 0; i <= 100; i++)

                 c.Add(i.ToString());


C#
var gb = new GrammarBuilder(c);

              var g = new Grammar(gb);

              rec.LoadGrammar(g);

              rec.Enabled = true;

          }


FOR DRAWING OBJECTS

C#
Pen myPen2 = new Pen(System.Drawing.Color.Red, 3);
            Rectangle myRectangle2 = new Rectangle(95, 130, 100, 100);
            graphicsObj.DrawEllipse(myPen2, myRectangle2);
Posted
Updated 27-Aug-18 15:49pm
v2
Comments
fjdiewornncalwe 17-Jan-12 14:33pm    
As it is right now, you have not asked a question. What problems have you run into? What can we help you with?
What you have shown us right now does not lend itself to us helping you.
momo.pomo 17-Jan-12 15:10pm    
i want to create a program, which should draw a circle when user says it to draw.
Pete O'Hanlon 17-Jan-12 17:26pm    
As you say you are a beginner, don't you think that this project is too ambitious? Start with something simple and work up from there.
momo.pomo 19-Jan-12 5:43am    
cant u people just tell me wot i am asking instead of giving me suggestions? or just dont reply to my thread.
Pete O'Hanlon 19-Jan-12 7:25am    
So, advising you that you are trying to do something that you clearly aren't able to do isn't helping you? Why have you chosen to do something like this? Are you seriously expecting us to do the hard part for you?

There is no "syntax" as you put it.

This isn't that hard. You have to define a language (list of commands) for the user to speak so you application can build a graph of objects that describe how the image should be painted.

Defining the shape is easy, like "Add Circle", "Fill Circle", or whatever.

Defining how to select an object that is already being drawn, not so easy. How are you going to do that? The same is also true for defining how the user is going to specify the size, location and orientation of the object.

This project is no so much focused on how to draw objects. That's easy. The hard part is how and are you going to have the user specify what needs to be drawn and what commands the user is going to use and how they work. All this project is about is building and maintaining a collection of objects that tell your rendering code how to draw them.
 
Share this answer
 
Comments
momo.pomo 17-Jan-12 14:33pm    
when user just says "draw circle", it should recognize and draw it the same time, regardless of sizes as m a beginner and dont want to add so much features.
Dave Kreskowiak 17-Jan-12 17:02pm    
Sooooo what part of this are you having a problem with?
momo.pomo 18-Jan-12 4:17am    
i am not able to get speech as a command;


if (speech = "circle")
{
drawCircle();
}

??????
lukeer 18-Jan-12 6:31am    
That is because speech recognition is a very difficult task to do.
thanks for all above, i have solved the problem.. it was just a line of code that you people were reluctant to tell.
 
Share this answer
 

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