पर भाषण मान्यता मेरे पास मान्यता के लिए एक परियोजना है। यह काम करता है, लेकिन अगर मैं अन्य वर्ग से इस परियोजना का उपयोग कैसे एक वर्ग और उसके तरीकों कॉल मैं लाइन पर अपवाद के साथ एक समस्या है:किनेक्ट
sre = new SpeechRecognitionEngine(ri.Id);
त्रुटि किया जा रहा है:
आवश्यक का कोई पहचानकर्ता आईडी मिली
कोड:
KinectAudioSource source = kinectSensor.AudioSource;
source.EchoCancellationMode = EchoCancellationMode.None; // No AEC for this sample
source.AutomaticGainControlEnabled = false; // Important to turn this off for speech recognition
// source.SystemMode = SystemMode.OptibeamArrayOnly;
speechRecognizer = CreateSpeechRecognizer();
using (Stream s = source.Start())
{
speechRecognizer.SetInputToAudioStream(s, new SpeechAudioFormatInfo(EncodingFormat.Pcm, 16000, 16, 1, 32000, 2, null));
Console.WriteLine("Recognizing speech. Say: 'purple', 'green' or 'blue'. Press ENTER to stop");
speechRecognizer.RecognizeAsync(RecognizeMode.Multiple);
Console.ReadLine();
Console.WriteLine("Stopping recognizer ...");
speechRecognizer.RecognizeAsyncStop();
}
private static SpeechRecognitionEngine CreateSpeechRecognizer()
{
RecognizerInfo ri = GetKinectRecognizer();
SpeechRecognitionEngine sre;
//if (ri == null) return 0;
sre = new SpeechRecognitionEngine(ri.Id);
var colors = new Choices();
colors.Add("red");
colors.Add("green");
colors.Add("blue");
var gb = new GrammarBuilder { Culture = ri.Culture };
gb.Append(colors);
// Create the actual Grammar instance, and then load it into the speech recognizer.
var g = new Grammar(gb);
sre.LoadGrammar(g);
sre.SpeechRecognized += SreSpeechRecognized;
sre.SpeechHypothesized += SreSpeechHypothesized;
sre.SpeechRecognitionRejected += SreSpeechRecognitionRejected;
return sre;
}
private static RecognizerInfo GetKinectRecognizer()
{
Func<RecognizerInfo, bool> matchingFunc = r =>
{
string value;
r.AdditionalInfo.TryGetValue("Kinect", out value);
return "True".Equals(value, StringComparison.InvariantCultureIgnoreCase) && "en-US".Equals(r.Culture.Name, StringComparison.InvariantCultureIgnoreCase);
};
return SpeechRecognitionEngine.InstalledRecognizers().Where(matchingFunc).FirstOrDefault();
}
आईडी डीबग करें। जांचें कि क्या मान सही है – Fixus
सुनिश्चित करें कि आप Kinect का समर्थन करने के लिए आवश्यक 32-बिट भाषण इंजन स्थापित करें। इस पृष्ठ पर सूचीबद्ध पूर्वापेक्षाएँ का पालन करें: http://channel9.msdn.com/coding4fun/kinect/Introduction-to-Kinect-Speech-Recognition –
प्लेटफ़ॉर्म लक्ष्य सेट क्या है? – animaonline