Пример #1
0
        /// <summary>
        /// RTP Client for receiving an RTP stream containing a WAVE audio stream
        /// </summary>
        /// <param name="port">The port to listen on</param>
        public RTPClient(int port)
        {
            WSRConfig.GetInstance().logInfo("RTPClient", "Loading...");

              this.port = port;

              // Initialize the audio stream that will hold the data
              audioStream = new SpeechStreamer(AUDIO_BUFFER_SIZE);

              WSRConfig.GetInstance().logInfo("RTPClient", "Done");
        }
Пример #2
0
        protected Boolean SetupAudioSource(KinectSensor sensor, SpeechRecognitionEngine sre)
        {
            WSRConfig cfg = WSRConfig.GetInstance();
              if (!sensor.IsRunning) {
            cfg.logInfo("KINECT", "Sensor is not running");
            return false;
              }

              // Use Audio Source to Engine
              KinectAudioSource source = sensor.AudioSource;
              source.EchoCancellationMode = EchoCancellationMode.CancellationAndSuppression;
              source.NoiseSuppression = true;
              source.BeamAngleMode = BeamAngleMode.Adaptive; //set the beam to adapt to the surrounding
              source.AutomaticGainControlEnabled = false;

              cfg.logInfo("ENGINE", "Audio Level: " + sre.AudioLevel);
              cfg.logInfo("KINECT", "AutomaticGainControlEnabled : " + source.AutomaticGainControlEnabled);
              cfg.logInfo("KINECT", "BeamAngle : " + source.BeamAngle);
              cfg.logInfo("KINECT", "EchoCancellationMode : " + source.EchoCancellationMode);
              cfg.logInfo("KINECT", "EchoCancellationSpeakerIndex : " + source.EchoCancellationSpeakerIndex);
              cfg.logInfo("KINECT", "NoiseSuppression : " + source.NoiseSuppression);
              cfg.logInfo("KINECT", "SoundSourceAngle : " + source.SoundSourceAngle);
              cfg.logInfo("KINECT", "SoundSourceAngleConfidence : " + source.SoundSourceAngleConfidence);

              var stream = source.Start();
              streamer = new SpeechStreamer(stream);
              sre.SetInputToAudioStream(stream, new SpeechAudioFormatInfo(EncodingFormat.Pcm, 16000, 16, 1, 32000, 2, null));
              return true;
        }