Ejemplo n.º 1
0
        public int findModa(int count)
        {
            int moda  = 0;
            int veces = 0;

            count = (count > tracker.PitchRecordHistorySize) ? tracker.PitchRecordHistorySize : count;
            for (int i = tracker.PitchRecordHistorySize - count; i < tracker.PitchRecordHistorySize; i++)
            {
                PitchTracker.PitchRecord rec = (PitchTracker.PitchRecord)tracker.PitchRecords[i];
                if (repetitions(i, count) > veces)
                {
                    moda = rec.MidiNote;
                }
            }
            return(moda);
        }
Ejemplo n.º 2
0
        int repetitions(int element, int count)
        {
            int rep = 0;

            PitchTracker.PitchRecord refer = (PitchTracker.PitchRecord)tracker.PitchRecords[element];
            int tester = refer.MidiNote;

            for (int i = tracker.PitchRecordHistorySize - count; i < tracker.PitchRecordHistorySize; i++)
            {
                PitchTracker.PitchRecord rec = (PitchTracker.PitchRecord)tracker.PitchRecords[i];
                if (rec.MidiNote == tester)
                {
                    rep++;
                }
            }
            return(rep);
        }