Example #1
0
        public List <int> getNonSilentNotes()
        {
            List <int> nonSilentNotes = new List <int>();

            for (int i = 0; i < musicItemList.Count; i++)
            {
                MusicItem mi = musicItemList[i];
                if (!mi.isSilence())
                {
                    nonSilentNotes.Add(i);
                }
            }
            return(nonSilentNotes);
        }
Example #2
0
        public List <Duration> getNotesStart(bool getSilences)
        {
            List <Duration> notes     = new List <Duration>();
            Duration        noteStart = 0;

            for (int i = 0; i < musicItemList.Count; i++)
            {
                MusicItem mi = musicItemList[i];
                if (getSilences || !mi.isSilence())
                {
                    notes.Add(noteStart);
                }
                noteStart += mi.getDuration();
            }
            return(notes);
        }
Example #3
0
        private int getDisonance(MusicItem mi1, MusicItem mi2)
        {
            if (mi1.isSilence() || mi2.isSilence())
            {
                return(0);
            }

            Chord a, b;

            if (mi1.isChord())
            {
                a = (Chord)mi1;
            }
            else
            {
                a = new Chord();
                a.add((Note)mi1);
            }

            if (mi2.isChord())
            {
                b = (Chord)mi2;
            }
            else
            {
                b = new Chord();
                b.add((Note)mi2);
            }

            int totalDisonance = 0;

            for (int i = 0; i < a.size(); i++)
            {
                for (int j = 0; j < b.size(); j++)
                {
                    totalDisonance += getDisonance(a.get(i), b.get(j));
                }
            }

            return(totalDisonance / (a.size() * b.size()));
        }