示例#1
0
        public void AddHeldNotesFromFrequencyBands(SongElements songElements, List <FrequencyBand> frequencyBands)
        {
            List <PossibleHeldNote> possibleHeldNotes = new List <PossibleHeldNote>();

            foreach (FrequencyBand frequencyBand in frequencyBands)
            {
                possibleHeldNotes.AddRange(GetHeldNotesFromFrequencyBand(frequencyBand));
            }

            possibleHeldNotes.Sort(delegate(PossibleHeldNote h1, PossibleHeldNote h2)
            {
                return(h1.AmplitudeMeanValue.CompareTo(h2.AmplitudeMeanValue));
            });
            possibleHeldNotes.Reverse();

            FinalHeldNotes finalHeldNotes = new FinalHeldNotes();

            foreach (PossibleHeldNote heldNote in possibleHeldNotes)
            {
                finalHeldNotes.TryToAddHeldNote(heldNote);
            }

            finalHeldNotes.SortByTime();

            foreach (PossibleHeldNote heldNote in finalHeldNotes.HeldNotes)
            {
                songElements.AddHeldNote(heldNote.StartTime, heldNote.EndTime, heldNote.Applicability);
            }
        }
示例#2
0
        public AudioAnalyzer()
        {
            SongElements = new SongElements();

            fft = new FFT();

            fft.A = 0;
            fft.B = 1;
        }
示例#3
0
        private void AddOnsets(SongElements songElements)
        {
            List <AmplitudeDetection.MyPoint> amplitudePoints = amplitudeDetection.Points;

            float[] onsets = onsetDetection.Onsets;

            int samplesNotUsed = 0;

            for (int i = 0; i < onsets.Length; i++)
            {
                if (samplesNotUsed > 0)
                {
                    samplesNotUsed--;
                    continue;
                }

                if (onsets[i] > 0.01f)
                {
                    songElements.AddSingleBeat(timePerSample * i, amplitudePoints[i].Y);

                    samplesNotUsed = 4;
                }
            }
        }
示例#4
0
        public void AddHeldNotes(SongElements songElements)
        {
            RectangleDetection rectangularDetection = new RectangleDetection();

            rectangularDetection.AddHeldNotesFromFrequencyBands(songElements, frequencyBands);
        }