Why speech recognition does not work on Windows 7 or Windows 10.
Developed by the Microsoft sample code and did not work, I found this code on the internet that shows it working on the person's PC and it also did not work.
Installed here:
- speeach recognition language-tele (en) speeach text to speech
- voice (pt-br 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();
}
}
}
}