저는 병렬 포트를 통해 릴레이를 제어하기위한 간단한 음성 인식 응용 프로그램과 함께 작업했으며이 프로그램이 어떻게 작동하는지 기본 프로그램입니다..NET에서 음성 인식이 작동하지 않습니다.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Speech.Synthesis;
using Microsoft.Speech.Recognition;
namespace speechHardware
{
class Program
{
static void Main(string[] args)
{
// Create a new SpeechRecognitionEngine instance.
var sre = new SpeechRecognitionEngine();
SpeechSynthesizer s = new SpeechSynthesizer();
Console.WriteLine("starting recognizer.......");
s.Speak("starting recognizer.");
// Create a simple grammar that recognizes "light on", "light off", or "fan on","fan off".
Choices colors = new Choices();
Console.WriteLine("option list.......");
colors.Add("light on");
colors.Add("light off");
colors.Add("fan on");
colors.Add("fan off");
GrammarBuilder gb = new GrammarBuilder();
gb.Append(colors);
Console.WriteLine("starting grammer builder.......");
// Create the actual Grammar instance, and then load it into the speech recognizer.
Grammar g = new Grammar(gb);
sre.LoadGrammar(g);
// Register a handler for the SpeechRecognized event.
sre.SpeechRecognized += SreSpeechRecognized;
//sre.SetInputToWaveFile("C:\Users\Raghavendra\Documents\MATLAB\test.wav");
sre.SetInputToDefaultAudioDevice();
Console.WriteLine("input device recognised.......");
s.Speak("input device recognised.");
sre.RecognizeAsync(RecognizeMode.Multiple);
Console.ReadLine();
Console.WriteLine("stopping recognizer.....");
sre.RecognizeAsyncStop();
}
static void SreSpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
SpeechSynthesizer s = new SpeechSynthesizer();
Console.WriteLine("\nSpeech Recognized: \t{0}" + e.Result.Confidence, e.Result.Text);
if (e.Result.Confidence < 0.85)
return;
switch (e.Result.Text)
{
case "light on":
light(1);
s.Speak("the light has been turned on.");
break;
case "light off":
light(0);
s.Speak("the light has been turned off.");
break;
case "fan on":
fan(1);
s.Speak("the fan has been turned on.");
break;
case "fan off":
fan(0);
s.Speak("the fan has been turned off.");
break;
default:
break;
}
}
static void light(int val)
{
Console.WriteLine("\nSpeech Recognized:light ");
}
static void fan(int val)
{
Console.WriteLine("\nSpeech Recognized: fan");
}
}
}
내 친구 컴퓨터에서는 완벽하게 작동하지만 컴퓨터에서는 입력 내용이 인식되지 않습니다. 우리는 거의 같은 설정을 가지고 있습니다. 마이크도 잘 작동하고 잘못 알고있어.
내가 설치 한 Microsoft 음성 플랫폼 - 소프트웨어 개발 키트 (SDK), 버전 10.2 (86 판) Microsoft 음성 플랫폼 - 서버 런타임 버전 10.2 (86 판)
저를 도와주세요.
신뢰도 값을 기록하십시오. 그것이 무엇을 출력하는지보십시오. – WoLfulus
"우리 둘 다 거의 같은 설정을 가지고 있습니다." 뭐가 달라? 구성을 동일하게 만들면 문제가 사라지는 지 확인할 수 있습니다. 무엇이 다른지 알게되면 문제가 발생하는지 확인할 수 있습니다. – ChrisF
제어판 - 음성 인식에서 "컴퓨터를 더 잘 이해하도록 교육"을 실행 했습니까? –