Example #1
0
        public AudioHandler(KinectSensor kinectSensor)
        {
            audioPreAnalysis  = new AudioPreAnalysis();
            this.kinectSensor = kinectSensor;
            // Get its audio source
            AudioSource audioSource = this.kinectSensor.AudioSource;

            // Allocate 1024 bytes to hold a single audio sub frame. Duration sub frame
            // is 16 msec, the sample rate is 16khz, which means 256 samples per sub frame.
            // With 4 bytes per sample, that gives us 1024 bytes.
            this.audioBuffer = new byte[audioSource.SubFrameLengthInBytes];

            // Open the reader for the audio frames
            this.reader = audioSource.OpenReader();

            // PixelFormats.Indexed1;
            this.energyBitmap = new WriteableBitmap(EnergyBitmapWidth, EnergyBitmapHeight, 96, 96, PixelFormats.Indexed4, new BitmapPalette(new List <Color> {
                Colors.White, Colors.Green, Colors.Red, Colors.LightBlue, Colors.Aquamarine, Colors.Pink, Colors.Orange
            }));

            // Initialize foreground pixels
            this.foregroundPixels = new byte[EnergyBitmapHeight];
            for (int i = 0; i < this.foregroundPixels.Length; ++i)
            {
                this.foregroundPixels[i] = 0xff;
            }
            for (int i = 0; i < this.lineVolumePixels.Length; ++i)
            {
                this.lineVolumePixels[i] = 0x55;
            }
            for (int i = 0; i < this.lineVolumePixelsIsSpeaking.Length; ++i)
            {
                this.lineVolumePixelsIsSpeaking[i] = 0x11;
            }
            for (int i = 0; i < this.lineVolumePixelsSoft.Length; ++i)
            {
                this.lineVolumePixelsSoft[i] = 0x22;
            }
            for (int i = 0; i < this.lineVolumePixelsLoud.Length; ++i)
            {
                this.lineVolumePixelsLoud[i] = 0x33;
            }

            //    this.kinectImage.Source = this.energyBitmap;
            CompositionTarget.Rendering += this.UpdateEnergy;



            //if (this.reader != null)
            //{
            //    // Subscribe to new audio frame arrived events
            //    this.reader.FrameArrived += this.Reader_FrameArrived;
            //}


            getSpeechthings();
        }
Example #2
0
        public void analyze()
        {
            ffpa = this.parent.faceFrameHandler.faceFramePreAnalysis;
            bfpa = this.parent.bodyFrameHandler.bodyFramePreAnalysis;
            apa  = this.parent.audioHandler.audioPreAnalysis;

            searchMistakes();

            saveCurrentBodyAsOldBody();
        }