Exemplo n.º 1
0
        private Note GetNoteFromRelationship(Note rootNote, int nextRel, NoteList noteList)
        {
            Note nextNote = rootNote;

            for (int i = 0; i < nextRel; i++)
            {
                nextNote = noteList.Next(nextNote);
            }

            return(nextNote);
        }
Exemplo n.º 2
0
        private string ParseChordName(string sbmtdName, int i)
        {
            string   parsedName;
            NoteList noteList = new NoteList();
            Note     note     = noteList.NoteTree[i];
            int      space    = sbmtdName.IndexOf(" "); //First set of characters should be the root note

            parsedName = (note.PrimaryName + sbmtdName.Substring(space));

            return(parsedName);
        }
Exemplo n.º 3
0
        private List <Chord> GenAllChordsFromEntry(Chord origChord)
        {
            List <Chord> allRoots = new List <Chord>();
            NoteList     noteList = new NoteList();

            for (int i = 0; i < 12; i++)
            {
                Chord chord = new Chord(noteList.NoteTree[i], origChord.NoteDifference, ParseChordName(origChord.ChordName, i));
                chord.ChordNoteList = GetNoteListFromDefinition(chord.RootNote, chord.NoteDifference, noteList);
                allRoots.Add(chord);
            }

            return(allRoots);
        }
Exemplo n.º 4
0
        public Note GetNoteByIncrement(Note rootNote, int inc)
        {
            Note     note = new Note();
            NoteList list = new NoteList();

            note = rootNote;               //start at the root note

            for (int i = 1; i <= inc; i++) //don't need to start at the root note
            {
                note = list.Next(note);
            }

            return(note);
        }
Exemplo n.º 5
0
        public static int FindNoteIncrement(Note root, Note toFind)
        {
            int i = 0; //this is how we count beyond an octave

            //start counting at the root note
            Note     checkNote = new Note(root);
            NoteList list      = new NoteList();

            while (checkNote.index != toFind.index)
            {
                i++;
                checkNote = list.Next(checkNote);
            }

            return(i);
        }
Exemplo n.º 6
0
        public List <string> NotesToUI()
        {
            List <string> UINotes = new List <string>();

            NoteList list = new NoteList();

            foreach (Note note in list.NoteTree)
            {
                UINotes.Add(note.PrimaryName);
                if (!(note.SecondaryName == null))
                {
                    UINotes.Add(note.SecondaryName);
                }
            }

            return(UINotes);
        }
Exemplo n.º 7
0
        private List <Note> GetNoteListFromDefinition(Note rootNote, int[] noteDifference, NoteList noteList)
        {
            List <Note> foundNotes = new List <Note>();

            foundNotes.Add(rootNote);

            for (int i = 1; i < noteDifference.Length; i++)
            {
                foundNotes.Add(GetNoteFromRelationship(rootNote, noteDifference[i], noteList));
            }

            return(foundNotes);
        }
Exemplo n.º 8
0
        private static List <Note> MapNoteNames(List <string> notesInChord)
        {
            NoteList    oNotes      = new NoteList();
            List <Note> mappedNotes = new List <Note>();
            char        sharp       = '\x266f'; //UFT-16 encoding
            char        flat        = '\x266D';

            foreach (string note in notesInChord)
            {
                if (note == "B" + sharp)
                {
                    mappedNotes.Add(oNotes.NoteTree[3]);
                }
                else if (note == "C")
                {
                    mappedNotes.Add(oNotes.NoteTree[3]);
                }
                else if (note == "C" + sharp)
                {
                    mappedNotes.Add(oNotes.NoteTree[4]);
                }
                else if (note == "D" + flat)
                {
                    mappedNotes.Add(oNotes.NoteTree[4]);
                }
                else if (note == "D")
                {
                    mappedNotes.Add(oNotes.NoteTree[5]);
                }
                else if (note == "D" + sharp)
                {
                    mappedNotes.Add(oNotes.NoteTree[6]);
                }
                else if (note == "E" + flat)
                {
                    mappedNotes.Add(oNotes.NoteTree[6]);
                }
                else if (note == "E")
                {
                    mappedNotes.Add(oNotes.NoteTree[7]);
                }
                else if (note == "F" + flat)
                {
                    mappedNotes.Add(oNotes.NoteTree[7]);
                }
                else if (note == "E" + sharp)
                {
                    mappedNotes.Add(oNotes.NoteTree[8]);
                }
                else if (note == "F")
                {
                    mappedNotes.Add(oNotes.NoteTree[8]);
                }
                else if (note == "F" + sharp)
                {
                    mappedNotes.Add(oNotes.NoteTree[9]);
                }
                else if (note == "G" + flat)
                {
                    mappedNotes.Add(oNotes.NoteTree[9]);
                }
                else if (note == "G")
                {
                    mappedNotes.Add(oNotes.NoteTree[10]);
                }
                else if (note == "G" + sharp)
                {
                    mappedNotes.Add(oNotes.NoteTree[11]);
                }
                else if (note == "A" + flat)
                {
                    mappedNotes.Add(oNotes.NoteTree[11]);
                }
                else if (note == "A")
                {
                    mappedNotes.Add(oNotes.NoteTree[0]);
                }
                else if (note == "A" + sharp)
                {
                    mappedNotes.Add(oNotes.NoteTree[1]);
                }
                else if (note == "B" + flat)
                {
                    mappedNotes.Add(oNotes.NoteTree[1]);
                }
                else if (note == "B")
                {
                    mappedNotes.Add(oNotes.NoteTree[2]);
                }
                else if (note == "C" + flat)
                {
                    mappedNotes.Add(oNotes.NoteTree[2]);
                }
                else
                {
                    throw new Exception("How did you... this isn't even a note!!!");
                }
            }
            return(mappedNotes);
        }