Exemple #1
0
        protected void InitSpeechEngine(bool def)
        {
            try {
                WSRConfig        cfg     = WSRConfig.GetInstance();
                WSRSpeechManager manager = WSRSpeechManager.GetInstance();

                // File
                manager.InitEngines();

                // Default
                if (def)
                {
                    manager.AddDefaultEngine("Default", cfg.language, cfg.confidence);
                }

                // RTP
                if (rtpClient == null)
                {
                    return;
                }
                var format = new SpeechAudioFormatInfo(16000, AudioBitsPerSample.Sixteen, AudioChannel.Stereo);
                manager.AddEngine("RTP", cfg.language, cfg.confidence, rtpClient.AudioStream, format);
            }
            catch (Exception ex) {
                WSRConfig.GetInstance().logError("ENGINE", "InitEngines: " + ex.Message);
            }
        }
Exemple #2
0
        // ==========================================
        //  HANDLE SPEECH RECOGNITION
        // ==========================================

        public override void InitSpeechEngine()
        {
            base.InitSpeechEngine(false);

            try {
                WSRConfig             cfg     = WSRConfig.GetInstance();
                WSRSpeechManager      manager = WSRSpeechManager.GetInstance();
                SpeechAudioFormatInfo format  = new SpeechAudioFormatInfo(EncodingFormat.Pcm, 16000, 16, 1, 32000, 2, null);

                for (int i = 0; i < Sensors.Count; i++)
                {
                    KinectAudioSource source = Sensors[i].Sensor.AudioSource;
                    source.EchoCancellationMode        = EchoCancellationMode.CancellationAndSuppression;
                    source.NoiseSuppression            = true;
                    source.BeamAngleMode               = BeamAngleMode.Adaptive; //set the beam to adapt to the surrounding
                    source.AutomaticGainControlEnabled = false;
                    if (WSRConfig.GetInstance().Echo >= 0)
                    {
                        source.EchoCancellationSpeakerIndex = WSRConfig.GetInstance().Echo;
                    }

                    String prefix = "KINECT_" + i;
                    cfg.logInfo(prefix, "AutomaticGainControlEnabled : " + source.AutomaticGainControlEnabled);
                    cfg.logInfo(prefix, "BeamAngle : " + source.BeamAngle);
                    cfg.logInfo(prefix, "EchoCancellationMode : " + source.EchoCancellationMode);
                    cfg.logInfo(prefix, "EchoCancellationSpeakerIndex : " + source.EchoCancellationSpeakerIndex);
                    cfg.logInfo(prefix, "NoiseSuppression : " + source.NoiseSuppression);
                    cfg.logInfo(prefix, "SoundSourceAngle : " + source.SoundSourceAngle);
                    cfg.logInfo(prefix, "SoundSourceAngleConfidence : " + source.SoundSourceAngleConfidence);

                    var stream = source.Start();
                    // streamer = new SpeechStreamer(stream); // FIXME
                    manager.AddEngine(prefix, cfg.language, cfg.confidence, stream, format);
                }
            }
            catch (Exception ex) {
                WSRConfig.GetInstance().logError("ENGINE", "Init Kinect Engines: " + ex.Message);
            }
        }