public void ProgressionTest_getChord()
 {
     Progression.clearProgression();
     Progression.addChord(ChordFactory.getChordByName("C"));
     Progression.addChord(ChordFactory.getChordByName("Am7"));
     Progression.addChord(ChordFactory.getChordByName("G#(add9)"));
     Assert.AreEqual("A, C, E, G", Progression.getChord(1).getNotes());
 }
 public void ProgressionTest_removeChord()
 {
     Progression.clearProgression();
     Progression.addChord(ChordFactory.getChordByName("C"));
     Progression.addChord(ChordFactory.getChordByName("Am7"));
     Progression.addChord(ChordFactory.getChordByName("G#(add9)"));
     Progression.removeChord(2);
     Assert.AreEqual("C, Am7", Progression.getChordNames());
 }
 public void ProgressionTest_swapChords()
 {
     Progression.clearProgression();
     Progression.addChord(ChordFactory.getChordByName("C"));
     Progression.addChord(ChordFactory.getChordByName("Am7"));
     Progression.addChord(ChordFactory.getChordByName("G#(add9)"));
     Progression.swapChords(0, 1);
     Assert.AreEqual("Am7, C, G#(add9)", Progression.getChordNames());
 }
 public void ProgressionTest_replaceChord()
 {
     Progression.clearProgression();
     Progression.addChord(ChordFactory.getChordByName("C"));
     Progression.addChord(ChordFactory.getChordByName("Am7"));
     Progression.addChord(ChordFactory.getChordByName("G#(add9)"));
     Progression.replaceChord(0, ChordFactory.getChordByName("Db9"));
     Assert.AreEqual("Db9, Am7, G#(add9)", Progression.getChordNames());
 }
Ejemplo n.º 5
0
        public void ChordFactoryTest_getChordRecomendationsByLast()
        {
            Note         key            = NoteFactory.getNoteByName("C");
            Mode         mode           = ModeFactory.getModeByName("Ionian");
            Chord        chord          = ChordFactory.getChordByName("C");
            List <Chord> recomendations = ChordFactory.getChordRecomendationsByLast(key, chord, mode);

            Assert.AreEqual("G", recomendations.ElementAt(0).getName());
        }
Ejemplo n.º 6
0
        public void ChordFactoryTest_getChordRecomendationsByDegree()
        {
            Note         key            = NoteFactory.getNoteByName("C");
            Note         degree         = NoteFactory.getNoteByName("G");
            Mode         mode           = ModeFactory.getModeByName("Ionian");
            List <Chord> recomendations = ChordFactory.getChordRecomendationsByTonic(key, degree, mode);

            Assert.IsTrue(recomendations.Count() > 1);
        }
 public void ProgressionTest_getTabNumber()
 {
     Progression.clearProgression();
     Progression.addChord(ChordFactory.getChordByName("C"));
     Assert.AreEqual("X", Progression.getTabNumber(1, 6));
     Assert.AreEqual("3", Progression.getTabNumber(1, 5));
     Assert.AreEqual("2", Progression.getTabNumber(1, 4));
     Assert.AreEqual("0", Progression.getTabNumber(1, 3));
     Assert.AreEqual("1", Progression.getTabNumber(1, 2));
     Assert.AreEqual("0", Progression.getTabNumber(1, 1));
 }
Ejemplo n.º 8
0
        public static List <Chord> getChordRecomendationsTriads(Note key, Mode mode)
        {
            int          i;
            int          tonicValueCheck;
            Note         tonic;
            List <Chord> chords = new List <Chord>();

            for (i = 0; i < 12; i++)
            {
                tonicValueCheck = key.getValue() + i;
                if (tonicValueCheck > 12)
                {
                    tonicValueCheck = tonicValueCheck - 12;
                }
                tonic = NoteFactory.getNoteByValue(tonicValueCheck, key);

                if (mode.containsInterval(i))
                {
                    // augmented 0 4 8
                    if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                        (mode.containsInterval(8 + i) || (mode.containsInterval((8 + i) - 12))))
                    {
                        chords.Add(ChordFactory.getChordByName(tonic.getName() + "aug"));
                    }

                    // major 0 4 7
                    if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                        (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))))
                    {
                        chords.Add(ChordFactory.getChordByName(tonic.getName()));
                    }

                    // minor 0 3 7
                    if ((mode.containsInterval(3 + i) || (mode.containsInterval((3 + i) - 12))) &&
                        (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))))
                    {
                        chords.Add(ChordFactory.getChordByName(tonic.getName() + "m"));
                    }

                    // diminished 0 3 6
                    if ((mode.containsInterval(3 + i) || (mode.containsInterval((3 + i) - 12))) &&
                        (mode.containsInterval(6 + i) || (mode.containsInterval((6 + i) - 12))))
                    {
                        chords.Add(ChordFactory.getChordByName(tonic.getName() + "dim"));
                    }
                }
            }
            return(chords);
        }
 public void ProgressionTest_changeTuning()
 {
     Progression.clearProgression();
     Progression.addChord(ChordFactory.getChordByName("E"));
     Assert.AreEqual("0", Progression.getTabNumber(1, 6));
     Assert.AreEqual("2", Progression.getTabNumber(1, 5));
     Assert.AreEqual("2", Progression.getTabNumber(1, 4));
     Assert.AreEqual("1", Progression.getTabNumber(1, 3));
     Assert.AreEqual("0", Progression.getTabNumber(1, 2));
     Assert.AreEqual("0", Progression.getTabNumber(1, 1));
     Progression.changeTuning(NoteFactory.getNoteByName("E"), NoteFactory.getNoteByName("A"), NoteFactory.getNoteByName("D"),
                              NoteFactory.getNoteByName("G#"), NoteFactory.getNoteByName("B"), NoteFactory.getNoteByName("E"));
     Assert.AreEqual("E, A, D, Ab, B, E", Progression.getTuning());
     Assert.AreEqual("0", Progression.getTabNumber(1, 6));
     Assert.AreEqual("2", Progression.getTabNumber(1, 5));
     Assert.AreEqual("2", Progression.getTabNumber(1, 4));
     Assert.AreEqual("0", Progression.getTabNumber(1, 3));
     Assert.AreEqual("0", Progression.getTabNumber(1, 2));
     Assert.AreEqual("0", Progression.getTabNumber(1, 1));
 }
Ejemplo n.º 10
0
 public void TabChordFactory_getNoteByChord()
 {
     tabChord = TabChordFactory.getTabByChord(ChordFactory.getChordByName("E"), 1, guitar);
     Assert.AreEqual("0", tabChord.getFretNumber(6));
     Assert.AreEqual("2", tabChord.getFretNumber(5));
     Assert.AreEqual("2", tabChord.getFretNumber(4));
     Assert.AreEqual("1", tabChord.getFretNumber(3));
     Assert.AreEqual("0", tabChord.getFretNumber(2));
     Assert.AreEqual("0", tabChord.getFretNumber(1));
     tabChord = TabChordFactory.getTabByChord(ChordFactory.getChordByName("Am"), 1, guitar);
     Assert.AreEqual("X", tabChord.getFretNumber(6));
     Assert.AreEqual("0", tabChord.getFretNumber(5));
     Assert.AreEqual("2", tabChord.getFretNumber(4));
     Assert.AreEqual("2", tabChord.getFretNumber(3));
     Assert.AreEqual("1", tabChord.getFretNumber(2));
     Assert.AreEqual("0", tabChord.getFretNumber(1));
     tabChord = TabChordFactory.getTabByChord(ChordFactory.getChordByName("C"), 1, guitar);
     Assert.AreEqual("X", tabChord.getFretNumber(6));
     Assert.AreEqual("3", tabChord.getFretNumber(5));
     Assert.AreEqual("2", tabChord.getFretNumber(4));
     Assert.AreEqual("0", tabChord.getFretNumber(3));
     Assert.AreEqual("1", tabChord.getFretNumber(2));
     Assert.AreEqual("0", tabChord.getFretNumber(1));
     tabChord = TabChordFactory.getTabByChord(ChordFactory.getChordByName("G"), 1, guitar);
     Assert.AreEqual("3", tabChord.getFretNumber(6));
     Assert.AreEqual("2", tabChord.getFretNumber(5));
     Assert.AreEqual("0", tabChord.getFretNumber(4));
     Assert.AreEqual("0", tabChord.getFretNumber(3));
     Assert.AreEqual("0", tabChord.getFretNumber(2));
     Assert.AreEqual("3", tabChord.getFretNumber(1));
     tabChord = TabChordFactory.getTabByChord(ChordFactory.getChordByName("G"), 2, guitar);
     Assert.AreEqual("3", tabChord.getFretNumber(6));
     Assert.AreEqual("5", tabChord.getFretNumber(5));
     Assert.AreEqual("5", tabChord.getFretNumber(4));
     Assert.AreEqual("4", tabChord.getFretNumber(3));
     Assert.AreEqual("3", tabChord.getFretNumber(2));
     Assert.AreEqual("3", tabChord.getFretNumber(1));
     tabChord = TabChordFactory.getTabByChord(ChordFactory.getChordByName("E"), 2, guitar);
     Assert.AreEqual("X", tabChord.getFretNumber(6));
     Assert.AreEqual("X", tabChord.getFretNumber(5));
     Assert.AreEqual("2", tabChord.getFretNumber(4));
     Assert.AreEqual("4", tabChord.getFretNumber(3));
     Assert.AreEqual("5", tabChord.getFretNumber(2));
     Assert.AreEqual("4", tabChord.getFretNumber(1));
     tabChord = TabChordFactory.getTabByChord(ChordFactory.getChordByName("E"), 3, guitar);
     Assert.AreEqual("X", tabChord.getFretNumber(6));
     Assert.AreEqual("7", tabChord.getFretNumber(5));
     Assert.AreEqual("6", tabChord.getFretNumber(4));
     Assert.AreEqual("4", tabChord.getFretNumber(3));
     Assert.AreEqual("5", tabChord.getFretNumber(2));
     Assert.AreEqual("4", tabChord.getFretNumber(1));
     tabChord = TabChordFactory.getTabByChord(ChordFactory.getChordByName("C"), 1, guitar);
     Assert.AreEqual("X", tabChord.getFretNumber(6));
     Assert.AreEqual("3", tabChord.getFretNumber(5));
     Assert.AreEqual("2", tabChord.getFretNumber(4));
     Assert.AreEqual("0", tabChord.getFretNumber(3));
     Assert.AreEqual("1", tabChord.getFretNumber(2));
     Assert.AreEqual("0", tabChord.getFretNumber(1));
     tabChord = TabChordFactory.getTabByChord(ChordFactory.getChordByName("Csus"), 1, guitar);
     Assert.AreEqual("1", tabChord.getFretNumber(1));
     Assert.AreEqual("1", tabChord.getFretNumber(2));
     Assert.AreEqual("0", tabChord.getFretNumber(3));
     Assert.AreEqual("3", tabChord.getFretNumber(4));
     Assert.AreEqual("3", tabChord.getFretNumber(5));
     Assert.AreEqual("X", tabChord.getFretNumber(6));
     tabChord = TabChordFactory.getTabByChord(ChordFactory.getChordByName("E6"), 1, guitar);
     Assert.AreEqual("0", tabChord.getFretNumber(6));
     Assert.AreEqual("2", tabChord.getFretNumber(5));
     Assert.AreEqual("2", tabChord.getFretNumber(4));
     Assert.AreEqual("1", tabChord.getFretNumber(3));
     Assert.AreEqual("2", tabChord.getFretNumber(2));
     Assert.AreEqual("0", tabChord.getFretNumber(1));
     tabChord = TabChordFactory.getTabByChord(ChordFactory.getChordByName("Dmaj9"), 1, guitar);
     Assert.AreEqual("X", tabChord.getFretNumber(6));
     Assert.AreEqual("X", tabChord.getFretNumber(5));
     Assert.AreEqual("0", tabChord.getFretNumber(4));
     Assert.AreEqual("2", tabChord.getFretNumber(3));
     Assert.AreEqual("2", tabChord.getFretNumber(2));
     Assert.AreEqual("2", tabChord.getFretNumber(1));
     tabChord = TabChordFactory.getTabByChord(ChordFactory.getChordByName("F7+"), 1, guitar);
     Assert.AreEqual("1", tabChord.getFretNumber(6));
     Assert.AreEqual("4", tabChord.getFretNumber(5));
     Assert.AreEqual("1", tabChord.getFretNumber(4));
     Assert.AreEqual("2", tabChord.getFretNumber(3));
     Assert.AreEqual("2", tabChord.getFretNumber(2));
     Assert.AreEqual("1", tabChord.getFretNumber(1));
     tabChord = TabChordFactory.getTabByChord(ChordFactory.getChordByName("Fm7(b5)"), 3, guitar);
     Assert.AreEqual("X", tabChord.getFretNumber(6));
     Assert.AreEqual("X", tabChord.getFretNumber(5));
     Assert.AreEqual("3", tabChord.getFretNumber(4));
     Assert.AreEqual("4", tabChord.getFretNumber(3));
     Assert.AreEqual("4", tabChord.getFretNumber(2));
     Assert.AreEqual("4", tabChord.getFretNumber(1));
 }
Ejemplo n.º 11
0
 public void ChordFactoryTest_getChrodByName()
 {
     _chord = ChordFactory.getChordByName("A");
     Assert.AreEqual("A, C#, E", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Am");
     Assert.AreEqual("A, C, E", _chord.getNotes());
     _chord = ChordFactory.getChordByName("A5");
     Assert.AreEqual("A, E", _chord.getNotes());
     _chord = ChordFactory.getChordByName("A6");
     Assert.AreEqual("A, C#, E, F#", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Ab");
     Assert.AreEqual("Ab, C, Eb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Abm");
     Assert.AreEqual("Ab, B, Eb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Ab5");
     Assert.AreEqual("Ab, Eb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Ab6");
     Assert.AreEqual("Ab, C, Eb, F", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Csus");
     Assert.AreEqual("C, F, G", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Csus2");
     Assert.AreEqual("C, D, G", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C7sus");
     Assert.AreEqual("C, F, G, Bb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Cdim");
     Assert.AreEqual("C, Eb, Gb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Cmaj7");
     Assert.AreEqual("C, E, G, B", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Cmaj9");
     Assert.AreEqual("C, E, G, B, D", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Cmaj7(b5)");
     Assert.AreEqual("C, E, Gb, B", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Cm(maj7)");
     Assert.AreEqual("C, Eb, G, B", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Cm9(maj7)");
     Assert.AreEqual("C, Eb, G, B, D", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C7");
     Assert.AreEqual("C, E, G, Bb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Cm7");
     Assert.AreEqual("C, Eb, G, Bb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C7(b9)");
     Assert.AreEqual("C, E, G, Bb, Db", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C7(#9)");
     Assert.AreEqual("C, E, G, Bb, Eb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C7+");
     Assert.AreEqual("C, E, Ab, Bb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C7+(b9)");
     Assert.AreEqual("C, E, Ab, Bb, Db", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C9+");
     Assert.AreEqual("C, E, Ab, Bb, D", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C9(#11)");
     Assert.AreEqual("C, E, G, Bb, D, Gb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C11");
     Assert.AreEqual("C, E, G, Bb, D, F", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Cm11");
     Assert.AreEqual("C, Eb, G, Bb, D, F", _chord.getNotes());
     _chord = ChordFactory.getChordByName("CM11");
     Assert.AreEqual("C, E, G, B, D, F", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C13");
     Assert.AreEqual("C, E, G, Bb, D, A", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C13(b9)");
     Assert.AreEqual("C, E, G, Bb, Db, A", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C13(#9)");
     Assert.AreEqual("C, E, G, Bb, Eb, A", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C13(b9b5)");
     Assert.AreEqual("C, E, Gb, Bb, Db, A", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C9");
     Assert.AreEqual("C, E, G, Bb, D", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C9(b5)");
     Assert.AreEqual("C, E, Gb, Bb, D", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Cm9");
     Assert.AreEqual("C, Eb, G, Bb, D", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C6");
     Assert.AreEqual("C, E, G, A", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Cm6");
     Assert.AreEqual("C, Eb, G, A", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C6/9");
     Assert.AreEqual("C, E, G, A, D", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Cm6/9");
     Assert.AreEqual("C, Eb, G, A, D", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C7");
     Assert.AreEqual("C, E, G, Bb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Cm7");
     Assert.AreEqual("C, Eb, G, Bb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C7(b5)");
     Assert.AreEqual("C, E, Gb, Bb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Cm7(b5)");
     Assert.AreEqual("C, Eb, Gb, Bb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C(b5)");
     Assert.AreEqual("C, E, Gb", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Bm7(b5)");
     Assert.AreEqual("B, D, F, A", _chord.getNotes());
     _chord = ChordFactory.getChordByName("Caug");
     Assert.AreEqual("C, E, Ab", _chord.getNotes());
     _chord = ChordFactory.getChordByName("C(add9)");
     Assert.AreEqual("C, E, G, D", _chord.getNotes());
     Assert.AreEqual("C(add9)", _chord.getName());
     //_chord = ChordFactory.getChordByName("C/G");
     //Assert.AreEqual("G, C, E, G", _chord.getNotes());
 }
Ejemplo n.º 12
0
        public void ChordFactoryTest_getChordRecomendationsTriads()
        {
            Note         key            = NoteFactory.getNoteByName("C");
            Mode         mode           = ModeFactory.getModeByName("Ionian");
            List <Chord> recomendations = ChordFactory.getChordRecomendationsTriads(key, mode);

            Assert.AreEqual("C", recomendations.ElementAt(0).getName());
            Assert.AreEqual("Dm", recomendations.ElementAt(1).getName());
            Assert.AreEqual("Em", recomendations.ElementAt(2).getName());
            Assert.AreEqual("F", recomendations.ElementAt(3).getName());
            Assert.AreEqual("G", recomendations.ElementAt(4).getName());
            Assert.AreEqual("Am", recomendations.ElementAt(5).getName());
            Assert.AreEqual("Bdim", recomendations.ElementAt(6).getName());

            key            = NoteFactory.getNoteByName("F");
            mode           = ModeFactory.getModeByName("Lydian");
            recomendations = ChordFactory.getChordRecomendationsTriads(key, mode);
            Assert.AreEqual("F", recomendations.ElementAt(0).getName());
            Assert.AreEqual("G", recomendations.ElementAt(1).getName());
            Assert.AreEqual("Am", recomendations.ElementAt(2).getName());
            Assert.AreEqual("Bdim", recomendations.ElementAt(3).getName());
            Assert.AreEqual("C", recomendations.ElementAt(4).getName());
            Assert.AreEqual("Dm", recomendations.ElementAt(5).getName());
            Assert.AreEqual("Em", recomendations.ElementAt(6).getName());

            key            = NoteFactory.getNoteByName("G");
            mode           = ModeFactory.getModeByName("Mixolydian");
            recomendations = ChordFactory.getChordRecomendationsTriads(key, mode);
            Assert.AreEqual("G", recomendations.ElementAt(0).getName());
            Assert.AreEqual("Am", recomendations.ElementAt(1).getName());
            Assert.AreEqual("Bdim", recomendations.ElementAt(2).getName());
            Assert.AreEqual("C", recomendations.ElementAt(3).getName());
            Assert.AreEqual("Dm", recomendations.ElementAt(4).getName());
            Assert.AreEqual("Em", recomendations.ElementAt(5).getName());
            Assert.AreEqual("F", recomendations.ElementAt(6).getName());

            key            = NoteFactory.getNoteByName("D");
            mode           = ModeFactory.getModeByName("Dorian");
            recomendations = ChordFactory.getChordRecomendationsTriads(key, mode);
            Assert.AreEqual("Dm", recomendations.ElementAt(0).getName());
            Assert.AreEqual("Em", recomendations.ElementAt(1).getName());
            Assert.AreEqual("F", recomendations.ElementAt(2).getName());
            Assert.AreEqual("G", recomendations.ElementAt(3).getName());
            Assert.AreEqual("Am", recomendations.ElementAt(4).getName());
            Assert.AreEqual("Bdim", recomendations.ElementAt(5).getName());
            Assert.AreEqual("C", recomendations.ElementAt(6).getName());

            key            = NoteFactory.getNoteByName("A");
            mode           = ModeFactory.getModeByName("Aeolian");
            recomendations = ChordFactory.getChordRecomendationsTriads(key, mode);
            Assert.AreEqual("Am", recomendations.ElementAt(0).getName());
            Assert.AreEqual("Bdim", recomendations.ElementAt(1).getName());
            Assert.AreEqual("C", recomendations.ElementAt(2).getName());
            Assert.AreEqual("Dm", recomendations.ElementAt(3).getName());
            Assert.AreEqual("Em", recomendations.ElementAt(4).getName());
            Assert.AreEqual("F", recomendations.ElementAt(5).getName());
            Assert.AreEqual("G", recomendations.ElementAt(6).getName());

            key            = NoteFactory.getNoteByName("E");
            mode           = ModeFactory.getModeByName("Phrygian");
            recomendations = ChordFactory.getChordRecomendationsTriads(key, mode);
            Assert.AreEqual("Em", recomendations.ElementAt(0).getName());
            Assert.AreEqual("F", recomendations.ElementAt(1).getName());
            Assert.AreEqual("G", recomendations.ElementAt(2).getName());
            Assert.AreEqual("Am", recomendations.ElementAt(3).getName());
            Assert.AreEqual("Bdim", recomendations.ElementAt(4).getName());
            Assert.AreEqual("C", recomendations.ElementAt(5).getName());
            Assert.AreEqual("Dm", recomendations.ElementAt(6).getName());

            key            = NoteFactory.getNoteByName("B");
            mode           = ModeFactory.getModeByName("Locrian");
            recomendations = ChordFactory.getChordRecomendationsTriads(key, mode);
            Assert.AreEqual("Bdim", recomendations.ElementAt(0).getName());
            Assert.AreEqual("C", recomendations.ElementAt(1).getName());
            Assert.AreEqual("Dm", recomendations.ElementAt(2).getName());
            Assert.AreEqual("Em", recomendations.ElementAt(3).getName());
            Assert.AreEqual("F", recomendations.ElementAt(4).getName());
            Assert.AreEqual("G", recomendations.ElementAt(5).getName());
            Assert.AreEqual("Am", recomendations.ElementAt(6).getName());
        }
Ejemplo n.º 13
0
        public static List <Chord> getChordRecomendationsByLast(Note key, Chord lastChord, Mode mode)
        {
            List <Chord> chords = new List <Chord>();
            List <Chord> fives  = new List <Chord>();
            List <Chord> sevens = new List <Chord>();
            List <Chord> sixes  = new List <Chord>();
            int          value;
            int          distance;
            Note         note;
            bool         foundDegree;
            bool         foundFifth   = false;
            bool         foundSeventh = false;
            bool         foundSixth   = false;

            // V -> I -> IV
            foundDegree = false;
            distance    = lastChord.getNoteAt(0).getValue() - key.getValue();
            if (distance < 12)
            {
                distance = distance + 12;
            }
            if (mode.containsInterval(7 + distance) || mode.containsInterval(7 + distance - 12))
            {
                value = lastChord.getNoteAt(0).getValue() + 7;
                if (value > 12)
                {
                    value = value - 12;
                }
                note        = NoteFactory.getNoteByValue(value, key);
                foundDegree = true;
            }
            // May add b5 and #5 recomendations back in

            /*
             * else if (mode.containsInterval(6))
             * {
             *  value = lastChord.getNoteAt(0).getValue() + 6;
             *  if (value > 12) { value = value - 12; }
             *  note = NoteFactory.getNoteByValue(value, key);
             *  foundDegree = true;
             * }
             * else if (mode.containsInterval(8))
             * {
             *  value = lastChord.getNoteAt(0).getValue() + 8;
             *  if (value > 12) { value = value - 12; }
             *  note = NoteFactory.getNoteByValue(value, key);
             *  foundDegree = true;
             * }
             */
            else
            {
                note = NoteFactory.getNoteByValue(key.getValue(), key);
            }
            if (foundDegree)
            {
                fives      = ChordFactory.getChordRecomendationsByTonic(key, note, mode);
                foundFifth = true;
            }

            // VII -> I -> II
            foundDegree = false;
            distance    = lastChord.getNoteAt(0).getValue() - key.getValue();
            if (distance < 12)
            {
                distance = distance + 12;
            }
            if (mode.containsInterval(10 + distance) || mode.containsInterval(10 + distance - 12))
            {
                value = lastChord.getNoteAt(0).getValue() + 10;
                if (value > 12)
                {
                    value = value - 12;
                }
                note        = NoteFactory.getNoteByValue(value, key);
                foundDegree = true;
            }
            else if (mode.containsInterval(11 + distance) || mode.containsInterval(11 + distance - 12))
            {
                value = lastChord.getNoteAt(0).getValue() + 11;
                if (value > 12)
                {
                    value = value - 12;
                }
                note        = NoteFactory.getNoteByValue(value, key);
                foundDegree = true;
            }
            else
            {
                note = NoteFactory.getNoteByValue(key.getValue(), key);
            }
            if (foundDegree)
            {
                sevens       = ChordFactory.getChordRecomendationsByTonic(key, note, mode);
                foundSeventh = true;
            }


            // VI -> I -> III
            foundDegree = false;
            distance    = lastChord.getNoteAt(0).getValue() - key.getValue();
            if (distance < 12)
            {
                distance = distance + 12;
            }
            if (mode.containsInterval(9 + distance) || mode.containsInterval(9 + distance - 12))
            {
                value = lastChord.getNoteAt(0).getValue() + 9;
                if (value > 12)
                {
                    value = value - 12;
                }
                note        = NoteFactory.getNoteByValue(value, key);
                foundDegree = true;
            }
            else if (mode.containsInterval(8 + distance) || mode.containsInterval(8 + distance - 12))
            {
                value = lastChord.getNoteAt(0).getValue() + 8;
                if (value > 12)
                {
                    value = value - 12;
                }
                note        = NoteFactory.getNoteByValue(value, key);
                foundDegree = true;
            }
            else
            {
                note = NoteFactory.getNoteByValue(key.getValue(), key);
            }
            if (foundDegree)
            {
                sixes      = ChordFactory.getChordRecomendationsByTonic(key, note, mode);
                foundSixth = true;
            }

            if (foundFifth)
            {
                chords.AddRange(fives);
            }
            if (foundSeventh)
            {
                chords.AddRange(sevens);
            }
            if (foundSixth)
            {
                chords.AddRange(sixes);
            }

            return(chords);
        }
Ejemplo n.º 14
0
        public static List <Chord> getChordRecomendationsByTonic(Note key, Note tonic, Mode mode)
        {
            int i = tonic.getValue() - key.getValue();

            if (i < 0)
            {
                i = i + 12;
            }
            List <Chord> chords = new List <Chord>();

            // Triads and five diad
            // "X" major 0 4 7
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName()));
            }

            // "Xm" minor 0 3 7
            if ((mode.containsInterval(3 + i) || (mode.containsInterval((3 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "m"));
            }

            // "Xdim" diminished 0 3 6
            if ((mode.containsInterval(3 + i) || (mode.containsInterval((3 + i) - 12))) &&
                (mode.containsInterval(6 + i) || (mode.containsInterval((6 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "dim"));
            }

            // "Xaug" augmented 0 4 8
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(8 + i) || (mode.containsInterval((8 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "aug"));
            }

            // "X(b5)" flat five 0 4 6
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(6 + i) || (mode.containsInterval((6 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "(b5)"));
            }

            // "X5" five diad 0 7
            if ((mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "5"));
            }

            // "Xsus" suspended 0 5 7
            if ((mode.containsInterval(5 + i) || (mode.containsInterval((5 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "sus"));
            }

            // suspended two 0 2 7
            if ((mode.containsInterval(2 + i) || (mode.containsInterval((2 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "sus2"));
            }

            // Sevens
            // "X7" seven 0 4 7 10
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "7"));
            }

            // "Xm7" minor seven 0 3 7 10
            if ((mode.containsInterval(3 + i) || (mode.containsInterval((3 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "m7"));
            }

            // "X7sus" suspended seven 0 5 7 10
            if ((mode.containsInterval(5 + i) || (mode.containsInterval((5 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "7sus"));
            }

            // "X7(b5)" suspended seven 0 4 6 10
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(6 + i) || (mode.containsInterval((6 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "7(b5)"));
            }

            // "Xm7(b5)" suspended seven 0 3 6 10
            if ((mode.containsInterval(3 + i) || (mode.containsInterval((3 + i) - 12))) &&
                (mode.containsInterval(6 + i) || (mode.containsInterval((6 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "m7(b5)"));
            }

            // "Xmaj7" major seven 0 4 7 11
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(11 + i) || (mode.containsInterval((11 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "maj7"));
            }

            // "Xm(maj7)" minor with major seven 0 3 7 11
            if ((mode.containsInterval(3 + i) || (mode.containsInterval((3 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(11 + i) || (mode.containsInterval((11 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "m(maj7)"));
            }

            // "Xmaj7(b5)" major seven flat five 0 4 6 11
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(6 + i) || (mode.containsInterval((6 + i) - 12))) &&
                (mode.containsInterval(11 + i) || (mode.containsInterval((11 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "maj7(b5)"));
            }

            // "X7+" augmented seven 0 4 8 10
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(8 + i) || (mode.containsInterval((8 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "7+"));
            }

            // "X7+(b9)" augmented seven 0 4 8 10 1
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(8 + i) || (mode.containsInterval((8 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))) &&
                (mode.containsInterval(1 + i) || (mode.containsInterval((1 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "7+(b9)"));
            }

            // Sixes
            // "X6" seven 0 4 7 9 2
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(9 + i) || (mode.containsInterval((9 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "6"));
            }

            // "X6/9" seven 0 4 7 9 2
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(9 + i) || (mode.containsInterval((9 + i) - 12))) &&
                (mode.containsInterval(2 + i) || (mode.containsInterval((2 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "6/9"));
            }

            // "Xm6" seven 0 3 7 9
            if ((mode.containsInterval(3 + i) || (mode.containsInterval((3 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(9 + i) || (mode.containsInterval((9 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "m6"));
            }

            // "Xm6/9" seven 0 3 7 9 2
            if ((mode.containsInterval(3 + i) || (mode.containsInterval((3 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(9 + i) || (mode.containsInterval((9 + i) - 12))) &&
                (mode.containsInterval(2 + i) || (mode.containsInterval((2 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "m6/9"));
            }

            // Nines
            // "X(add9)" add nine 0 4 7 2
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(2 + i) || (mode.containsInterval((2 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "(add9)"));
            }

            // "X9" nine 0 4 7 10 2
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))) &&
                (mode.containsInterval(2 + i) || (mode.containsInterval((2 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "9"));
            }

            // "Xmaj9" major nine 0 4 7 11 2
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(11 + i) || (mode.containsInterval((11 + i) - 12))) &&
                (mode.containsInterval(2 + i) || (mode.containsInterval((2 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "maj9"));
            }

            // "Xm9(maj7)" minor nine with major seven 0 3 7 11 2
            if ((mode.containsInterval(3 + i) || (mode.containsInterval((3 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(11 + i) || (mode.containsInterval((11 + i) - 12))) &&
                (mode.containsInterval(2 + i) || (mode.containsInterval((2 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "m9(maj7)"));
            }

            // "X7(b9)" seven flat nine 0 4 7 10 1
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))) &&
                (mode.containsInterval(2 + i) || (mode.containsInterval((1 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "7(b9)"));
            }

            // "X7(#9)" major seven flat five 0 4 7 10 3
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))) &&
                (mode.containsInterval(3 + i) || (mode.containsInterval((3 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "7(#9)"));
            }

            // "X9(#11)" nine with sharp eleven 0 4 7 10 2 6
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))) &&
                (mode.containsInterval(2 + i) || (mode.containsInterval((2 + i) - 12))) &&
                (mode.containsInterval(6 + i) || (mode.containsInterval((6 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "9(#11)"));
            }

            // "X9+" augmented nine 0 4 8 10 2
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(8 + i) || (mode.containsInterval((8 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))) &&
                (mode.containsInterval(2 + i) || (mode.containsInterval((2 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "9+"));
            }

            // "X9(b5)" nine flat five 0 4 6 10 2
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(6 + i) || (mode.containsInterval((6 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))) &&
                (mode.containsInterval(2 + i) || (mode.containsInterval((2 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "9(b5)"));
            }

            // Elevens
            // "X11" eleven 0 4 7 10 2 5
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))) &&
                (mode.containsInterval(2 + i) || (mode.containsInterval((2 + i) - 12))) &&
                (mode.containsInterval(5 + i) || (mode.containsInterval((5 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "11"));
            }

            // "Xm11" minor eleven 0 3 7 10 2 5
            if ((mode.containsInterval(3 + i) || (mode.containsInterval((3 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))) &&
                (mode.containsInterval(2 + i) || (mode.containsInterval((2 + i) - 12))) &&
                (mode.containsInterval(5 + i) || (mode.containsInterval((5 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "m11"));
            }

            // "XM11" major eleven 0 4 7 10 2 5
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(11 + i) || (mode.containsInterval((11 + i) - 12))) &&
                (mode.containsInterval(2 + i) || (mode.containsInterval((2 + i) - 12))) &&
                (mode.containsInterval(5 + i) || (mode.containsInterval((5 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "M11"));
            }

            // Thirteens
            // "X13" thirteen 0 4 7 10 2 9
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))) &&
                (mode.containsInterval(2 + i) || (mode.containsInterval((2 + i) - 12))) &&
                (mode.containsInterval(9 + i) || (mode.containsInterval((9 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "13"));
            }

            // "X13(b9)" thirteen flat nine 0 4 7 10 1 9
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))) &&
                (mode.containsInterval(1 + i) || (mode.containsInterval((1 + i) - 12))) &&
                (mode.containsInterval(9 + i) || (mode.containsInterval((9 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "13(b9)"));
            }

            // "X13(#9)" thirteen sharp nine 0 4 7 10 3 9
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(7 + i) || (mode.containsInterval((7 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))) &&
                (mode.containsInterval(3 + i) || (mode.containsInterval((3 + i) - 12))) &&
                (mode.containsInterval(9 + i) || (mode.containsInterval((9 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "13(#9)"));
            }

            // "X13(b9b5)" thirteen 0 4 6 10 1 9
            if ((mode.containsInterval(4 + i) || (mode.containsInterval((4 + i) - 12))) &&
                (mode.containsInterval(6 + i) || (mode.containsInterval((6 + i) - 12))) &&
                (mode.containsInterval(10 + i) || (mode.containsInterval((10 + i) - 12))) &&
                (mode.containsInterval(1 + i) || (mode.containsInterval((1 + i) - 12))) &&
                (mode.containsInterval(9 + i) || (mode.containsInterval((9 + i) - 12))))
            {
                chords.Add(ChordFactory.getChordByName(tonic.getName() + "13(b9b5)"));
            }

            return(chords);
        }