public int volumethreshold = 9; // Used to determine when the volule is enough high to be a peak (volume between 0 and 13-14) #endregion #region Constructor /// <summary> /// Instantiates a Pitch object /// </summary> public Pitch(KinectDevice kd) { this.recordingFormat = new WaveFormat(44100, 1); this.pitchList = new List <float>(); this.pitchRecorded = new List <float>(); this.sent = false; this.isRecording = false; this.kinect = kd; i = 0; AudioAnalysis.FFT.reflexEvent += switchSendEvent; Length = 500; Threshold = 20.0; ThresholdVariation = 50.0; minFrequency = 10.0; maxFrequency = 130.0; instance = this; }
/// <summary> /// Instanciate a PitchWaveProvider /// </summary> /// <param name="source">Stream Source</param> /// <param name="ar">Pitch Reference</param> public PitchWaveProvider(IWaveProvider source, Pitch ar) { if (source.WaveFormat.SampleRate != 44100) { throw new ArgumentException("Pitch Detection only works at 44.1kHz"); } if (source.WaveFormat.Encoding != WaveFormatEncoding.IeeeFloat) { throw new ArgumentException("Pitch Detection only works on IEEE floating point audio data"); } if (source.WaveFormat.Channels != 1) { throw new ArgumentException("Pitch Detection only works on mono input sources"); } this.source = source; this.pitchDetector = new AutoCorrelator(source.WaveFormat.SampleRate); this.waveBuffer = new WaveBuffer(8192); this.AR = ar; }