Ejemplo n.º 1
0
        public float[] DetectOnsets(IFrameData waveData, int samplesPerSecond, int sampleWindowSize, float sensitivity = 1.5f)
        {
            _onsetDetection = new OnsetDetection(sampleWindowSize, samplesPerSecond);

            waveData.BeginChunkyRead(sampleWindowSize);

            IFrameDataSubset subset = null;
            while(waveData.ReadChunk(ref subset))
            {
                var mono = ConvertStereoToMono(subset);
                _onsetDetection.AddFlux(mono);
            }

            var onsets = _onsetDetection.FindOnsets(sensitivity);
            _onsetDetection.NormalizeOnsets(onsets, 0);

            return onsets;
        }
Ejemplo n.º 2
0
        public float[] DetectOnsets(IFrameData waveData, int samplesPerSecond, int sampleWindowSize, float sensitivity = 1.5f)
        {
            _onsetDetection = new OnsetDetection(sampleWindowSize, samplesPerSecond);

            waveData.BeginChunkyRead(sampleWindowSize);

            IFrameDataSubset subset = null;

            while (waveData.ReadChunk(ref subset))
            {
                var mono = ConvertStereoToMono(subset);
                _onsetDetection.AddFlux(mono);
            }

            var onsets = _onsetDetection.FindOnsets(sensitivity);

            _onsetDetection.NormalizeOnsets(onsets, 0);

            return(onsets);
        }