3
Why the Speech Recognition does not work on Windows 7 or Windows 10.
I developed by Microsoft sample code and it didn’t work, I found this code on the internet that shows it working on the person’s PC and it also didn’t work.
Installed here:
- speeach recognition language-tele(en) speeach text to Speech
- voice(en Heloisa) Speech Platform sdk x86 v11.0 server Speech
- Platform Runtime (x64)
Windows 7 x64 and my other PC is Windows 10 x86.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Speech.Recognition;
namespace reconocimiento2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SpeechRecognitionEngine rec = new SpeechRecognitionEngine();
private void Form1_Load(object sender, EventArgs e)
{
button1.Visible = false;
button2.Visible = false;
button3.Visible = false;
Choices lista = new Choices();
lista.Add(new string []{"amarelo","azul","vermelho","todos","nenhum","sair"});
Grammar gramatica = new Grammar(new GrammarBuilder(lista));
try
{
rec.SetInputToDefaultAudioDevice();
rec.LoadGrammar(gramatica);
rec.SpeechRecognized += reconocimento;
rec.RecognizeAsync(RecognizeMode.Multiple);
}
catch (Exception)
{
throw;
}
}
void reconocimento(object sender, SpeechRecognizedEventArgs e)
{
if(e.Result.Text=="amarelo")
{
button1.Visible = true;
}else
if(e.Result.Text=="azul")
{
button2.Visible = true;
}else
if(e.Result.Text=="vermelho")
{
button3.Visible = true;
}else
if(e.Result.Text=="todos")
{
button1.Visible = true;
button2.Visible = true;
button3.Visible = true;
}else
if(e.Result.Text=="nenhum")
{
button1.Visible = false;
button2.Visible = false;
button3.Visible = false;
}else
if(e.Result.Text=="sair")
{
Application.Exit();
}
}
}
}
What mistake did this make?? And what is your difficulty??
– Marco Souza
The computer does not recognize the voice command at all. I speak and nothing happens. As if it did not recognize.
– gabriel
Have you debugged? In your "recon" function has a lot of
if
s specific. You checked what in fact is being "recognized" (i.e., printed the value received in that function)? At least do your homework, otherwise it’s really hard for someone to help you.– Luiz Vieira