Exemple #1
0
        public BeatDetector(int sampligRate, int bandCount, int length)
        {
            this.bandCount = bandCount;
            period         = 1.0f / sampligRate;
            signalPowers   = new float[bandCount];
            signalAverages = new MovingAverage[bandCount];
            for (int i = 0; i < bandCount; ++i)
            {
                signalAverages[i] = new MovingAverage(100);
            }

            powerProcessor = new FFTProcessor(10, true, true);
            powerBuffer    = new Utility.CircularBuffer <float>(powerProcessor.WindowSize);

            lowBinIndex  = (int)Math.Floor(powerProcessor.WindowSize * bpmLow / (60 * sampligRate));
            highBinIndex = (int)Math.Ceiling(powerProcessor.WindowSize * bpmHigh / (60 * sampligRate)) + 1;
            binCount     = highBinIndex - lowBinIndex;

            bpmAverages = new MovingAverage[binCount];
            for (int i = 0; i < binCount; ++i)
            {
                bpmAverages[i] = new MovingAverage(200);
            }
            peakiness = new float[binCount];
            scores    = new float[binCount];
        }
Exemple #2
0
 public SpectrumVizualizer(int pixelCount, float fLow, float fHigh, int samplingRate)
 {
     fft        = new FFTProcessor(13);
     aggregator = new ToneAggregator(pixelCount, fLow, fHigh, samplingRate, 1 << 13);
     colors     = new RainbowPerOctave(pixelCount, fLow, fHigh);
     filter     = new HoldFilter(pixelCount);
     Colors     = new Vector4[pixelCount];
 }