Пример #1
0
        void Update()
        {
            float[] window = microphoneController.GetMostRecentSamples(windowSize);
            DoFFT(window, 1);//microphoneBuffer.Channels);
            //windowsSoFar++;

            f0 = IndexToFrequency(HighestPoint(spectrum));


            /*float mean = 0; MicrophoneInput.SumIntensity(spectrum) / spectrum.Length;
             * noiseLevel += (mean - noiseLevel) / windowsSoFar;
             * formants = PeakPicking(spectrum, 0);
             *
             * if (formants.Length > 1)
             * {
             *  f1 = formants[1].Peak;
             *  if (formants.Length > 2)
             *      f2 = formants[2].Peak;
             *  else
             *      f2 = 0;
             * }
             * else
             * {
             *  f1 = 0;
             *  f2 = 0;
             * }
             * f1freq = IndexToFrequency(f1);
             * f2freq = IndexToFrequency(f2);*/
        }
Пример #2
0
        void Update()
        {
            float[] window = microphoneController.GetMostRecentSamples(SyllableDetectionAlgorithm.windowSize);

            if (yin != null)
            {
                pitch = yin.getPitch(window);
            }

            if (syllableDetectionAlgorithm != null)
            {
                if (syllableDetectionAlgorithm.Run(window, Time.deltaTime))
                {
                    gameObject.SendMessage("OnSoundEvent", SoundEvent.SyllablePeak, SendMessageOptions.DontRequireReceiver);
                }
            }
        }