我无法让kinect sdk在语音识别时进行语音识别和跟踪骨骼数据

时间:2012-12-26 21:55:19

标签: kinect speech-recognition speech

我有一个巫婆计划,我启用了语音识别......

        RecognizerInfo ri = GetKinectRecognizer();

        speechRecognitionEngine = new SpeechRecognitionEngine(ri.Id);

        // Create a grammar from grammar definition XML file.
        using (var memoryStream = new MemoryStream(Encoding.ASCII.GetBytes(fileContent)))
        {
            var g = new Grammar(memoryStream);
            speechRecognitionEngine.LoadGrammar(g);
        }

        speechRecognitionEngine.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(speechEngine_SpeechRecognized);
        speechRecognitionEngine.SpeechRecognitionRejected += new EventHandler<SpeechRecognitionRejectedEventArgs>(speechEngine_SpeechRecognitionRejected);

speechRecognitionEngine.SetInputToAudioStream(                     sensor.AudioSource.Start(),new SpeechAudioFormatInfo(EncodingFormat.Pcm,16000,16,1,32000,2,null));

        speechRecognitionEngine.RecognizeAsync(RecognizeMode.Multiple);

...

all'工作正常,SpeechRecognized事件被正确解雇..

问题是,当我能够进行骨架数据跟踪时,

          sensor.SkeletonStream.Enable();
          sensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
          sensor.SkeletonFrameReady += sensor_SkeletonFrameReady;

语音识别停止工作......

我能得到你的帮助吗?

非常感谢你!

1 个答案:

答案 0 :(得分:1)

如果在开始音频捕获后启用了骨架流,则不会处理音频 由于存在错误,启用或禁用SkeletonStream将停止Kinect传感器返回的AudioSource流。以下指令序列将停止音频流:             kinectSensor.Start();             kinectSensor.AudioSource.Start(); // - &gt;这将创建一个音频流             kinectSensor.SkeletonStream.Enable(); // - &gt;这会将音频流停止为不良副作用

解决方法是在更改SkeletonStream状态后反转调用顺序或重新启动AudioSource。

        Workaround #1 (start audio after skeleton):
        kinectSensor.Start();
        kinectSensor.SkeletonStream.Enable();
        kinectSensor.AudioSource.Start();

        Workaround #2 (restart audio after skeleton):
        kinectSensor.Start();
        kinectSensor.AudioSource.Start(); // --> this will create an audio stream
        kinectSensor.SkeletonStream.Enable(); // --> this will stop the audio stream as an undesired side effect
        kinectSensor.AudioSource.Start(); // --> this will create another audio stream

来源 - http://msdn.microsoft.com/en-us/library/jj663798.aspx