public SampleAggregator(int fftLength)
 {
     if (!IsPowerOfTwo(fftLength))
     {
         throw new ArgumentException("FFT Length must be a power of two");
     }
     this.m         = (int)Math.Log(fftLength, 2.0);
     this.fftLength = fftLength;
     this.fftBuffer = new Complex[fftLength];
     this.fftArgs   = new FftEventArgs(fftBuffer);
 }
        private void FftCalculated(object sender, FftEventArgs e)
        {
            var highestValue = new Complex();
            int index        = 0;

            foreach (var complex in e.Result)
            {
                if (highestValue.Y == 0 || complex.Y > highestValue.Y && index < 25 && index > 5)
                {
                    highestValue = complex;                                                                               // get tones between 25 / 145 hz
                }
                index++;
            }

            _averageValues.Add(highestValue);
        }