public void ProgressionTest_getChord()
 {
     _progression = new Progression();
     _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());
 }
Exemplo n.º 2
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());
        }
 public void ProgressionTest_removeChord()
 {
     _progression = new Progression();
     _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 = new Progression();
     _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 = new Progression();
     _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());
 }
Exemplo n.º 6
0
        public static Progression replaceChord(Progression progression)
        {
            string inputError = "\nI'm sorry that was not a valid coice." +
                                "\nPlease try again.";
            string choice;
            bool   validChordPositionChoice;
            bool   validChordNameChoice;
            string newChordName;

            if (progression.getSize() == 0)
            {
                System.Console.WriteLine("\nThere are no chords in your progression.");
            }
            else
            {
                validChordPositionChoice = false;
                while (validChordPositionChoice == false)
                {
                    int i;
                    System.Console.WriteLine("\nWhat chord would you to replace?");
                    for (i = 1; i <= progression.getSize(); i++)
                    {
                        System.Console.WriteLine(i + ") " + progression.getChord(i - 1).getName());
                    }
                    choice = System.Console.ReadLine();
                    for (i = 1; i <= progression.getSize(); i++)
                    {
                        if (choice == i.ToString())
                        {
                            string oldChordName = progression.getChord(i - 1).getName();
                            validChordPositionChoice = true;
                            validChordNameChoice     = false;
                            while (validChordNameChoice == false)
                            {
                                System.Console.WriteLine("\nWhat chord would you like to replace " + progression.getChord(i - 1).getName() + " with?");
                                newChordName = System.Console.ReadLine();
                                if (ChordController.checkChordName(newChordName))
                                {
                                    validChordNameChoice = true;
                                    progression.replaceChord(i - 1, ChordFactory.getChordByName(newChordName));
                                    System.Console.WriteLine("\n" + oldChordName + " has been replaced with " + newChordName);
                                }
                                else
                                {
                                    System.Console.WriteLine(inputError);
                                }
                            }
                        }
                    }
                    if (validChordPositionChoice == false)
                    {
                        System.Console.WriteLine(inputError);
                    }
                }
            }
            return(progression);
        }
 public void ProgressionTest_getTabNumber()
 {
     _progression = new Progression();
     _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));
 }
        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 = new Progression();
     _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));
 }
Exemplo n.º 10
0
        public static Progression addChord(Progression progression)
        {
            string inputError = "\nI'm sorry that was not a valid coice." +
                                "\nPlease try again.";
            string newChordName;
            bool   result = false;

            while (result == false)
            {
                System.Console.WriteLine("\nWhat chord would you like to add?");
                newChordName = System.Console.ReadLine();
                if (ChordController.checkChordName(newChordName))
                {
                    result = true;
                    progression.addChord(ChordFactory.getChordByName(newChordName));
                    System.Console.WriteLine("\n" + progression.getChord(progression.getSize() - 1).getName() + " has been added to the progression.");
                }
                else
                {
                    System.Console.WriteLine(inputError);
                }
            }
            return(progression);
        }
        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);
        }
Exemplo n.º 12
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());
 }
Exemplo n.º 13
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("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("0", 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));
 }