Reconhecimento de voz (Microsoft Speech)?

0 respostas
Matrirxp

Ola galera.
Estou precisando de ajuda,quero fazer um reconhecedor de voz, mas esta não esta funcionando.

Esse é o codigo:

`using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Speech.Recognition;
using System.Globalization;
using Microsoft.Speech.Synthesis;
using Microsoft.Speech.AudioFormat;
using System.Windows.Forms;


namespace WindowsFormsApplication1
{




    public partial class Form1 : Form
    {
        SpeechRecognitionEngine sre = new SpeechRecognitionEngine(new CultureInfo("en-US"));



        public Form1()
        {
            InitializeComponent();
        }

        public void LoadFile()
        {


            try
            {


                    

                    sre.SetInputToDefaultAudioDevice();
                    
                    String[] comands = { "yes" };

                    sre.LoadGrammar(new Grammar(new GrammarBuilder(new Choices(comands))));

                    sre.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(rec);


                    sre.RecognizeAsync(RecognizeMode.Multiple);

               
            }
            catch (Exception ex)
            {

                MessageBox.Show("Erro:" + ex.Message);

            }
        }



        private void Form1_Load(object sender, EventArgs e)
        {
            LoadFile();
   



        }






        private void rec(object s, SpeechRecognizedEventArgs e)
         {
            label1.Text = e.Result.Text;

        }


    }
}

Ele não esta reconhecendo quando eu falo “yes”.

Criado 12 de agosto de 2016
Respostas 0
Participantes 1