Ejemplo n.º 1
0
        private static SongPropertyValues GetHeldNoteSPV(SongElements songElements)
        {
            songElements.SortByTime();

            float highestApplicability = -1;
            float lowestApplicability  = 9999;

            foreach (SongElements.HeldNote heldNote in songElements.HeldNotes)
            {
                highestApplicability = Math.Max(highestApplicability, heldNote.Applicability);
                lowestApplicability  = Math.Min(lowestApplicability, heldNote.Applicability);
            }

            List <MyPoint> points = new List <MyPoint>();

            points.Add(new MyPoint(0, 0));

            foreach (SongElements.HeldNote heldNote in songElements.HeldNotes)
            {
                points.Add(new MyPoint(heldNote.StartTime - 0.03f, 0));
                points.Add(new MyPoint(heldNote.StartTime, heldNote.Applicability));
                points.Add(new MyPoint(heldNote.EndTime, heldNote.Applicability));
                points.Add(new MyPoint(heldNote.EndTime + 0.03f, 0));
            }

            SongPropertyValues heldNoteValues = new SongPropertyValues("Held Notes " + DateTime.Now.Millisecond);

            heldNoteValues.Points = points;

            return(heldNoteValues);
        }
Ejemplo n.º 2
0
        public static SongPropertyValues GetSongPropertyValues(string fileDirectory, float vth, float msqe)
        {
            //RectangleDetection.TEST_MAXIMUM_SQUARED_ERROR = msqe;
            FrequencyBand.ValueThreshold = vth;

            Console.WriteLine(vth + " / " + msqe);

            AudioAnalyzer audioAnalyzer = new AudioAnalyzer();

            audioAnalyzer.LoadAudioFromFile(fileDirectory);
            audioAnalyzer.Analyze();

            SongPropertyValues spv = GetHeldNoteSPV(audioAnalyzer.SongElements);

            spv.Normalize();

            return(spv);
        }
Ejemplo n.º 3
0
        private static SongPropertyValues GetSingleBeatsSPV(SongElements songElements)
        {
            songElements.SortByTime();

            List <MyPoint> points = new List <MyPoint>();

            points.Add(new MyPoint(0, 0));

            foreach (SongElements.SingleBeat singleBeat in songElements.SingleBeats)
            {
                points.Add(new MyPoint(singleBeat.Time - 0.03f, 0));
                points.Add(new MyPoint(singleBeat.Time, singleBeat.Applicability));
                points.Add(new MyPoint(singleBeat.Time + 0.03f, 0));
            }

            SongPropertyValues onsetValues = new SongPropertyValues("SingleBeats");

            onsetValues.Points = points;

            return(onsetValues);
        }