public void ProgressionTest_changeTabPitch()
 {
     _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));
     _progression.changeTabPitch(1, 2);
     Assert.AreEqual("X", _progression.getTabNumber(1, 6));
     Assert.AreEqual("3", _progression.getTabNumber(1, 5));
     Assert.AreEqual("5", _progression.getTabNumber(1, 4));
     Assert.AreEqual("5", _progression.getTabNumber(1, 3));
     Assert.AreEqual("5", _progression.getTabNumber(1, 2));
     Assert.AreEqual("3", _progression.getTabNumber(1, 1));
 }
 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));
 }
Example #3
0
        public static Progression menuOne(Progression progression)
        {
            string inputError = "\nI'm sorry that was not a valid coice." +
                                "\nPlease try again.";
            bool   back = false;
            string answer;

            while (back == false)
            {
                System.Console.WriteLine("\nWhat would you like to do?" +
                                         "\n1) Change the key" +
                                         "\n2) Change the mode" +
                                         "\n3) Change the tuning" +
                                         "\n4) Back to main menu");
                answer = System.Console.ReadLine();
                if (answer == "1")
                {
                    progression = changeKey(progression);
                }
                else if (answer == "2")
                {
                    progression = changeMode(progression);
                }
                else if (answer == "3")
                {
                    progression = changeTuning(progression);
                }
                else if (answer == "4")
                {
                    back = true;
                }
                else
                {
                    System.Console.WriteLine(inputError);
                }
            }
            return(progression);
        }
Example #4
0
        public static void examineChords(Progression progression)
        {
            string inputError = "\nI'm sorry that was not a valid coice." +
                                "\nPlease try again.";
            string choice;
            bool   validChoice = false;

            while (validChoice == false)
            {
                int i;
                System.Console.WriteLine("\nWhat chord would you like to examine?");
                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())
                    {
                        validChoice = true;
                        System.Console.WriteLine("\nThe notes in " + progression.getChord(i - 1).getName() +
                                                 " are " + progression.getChord(i - 1).getNotes());

                        /*
                         * System.Console.WriteLine(progression.getChord(i - 1).getName() + " has the intervals " +
                         *  progression.getDegree());
                         * System.Console.WriteLine(progression.getChord(i - 1).getName() + " is the degree " +
                         *  progression.getChord(i - 1).getIntervals() + " from the key " + progression.getKey().getName());
                         */
                    }
                }
                if (validChoice == false)
                {
                    System.Console.WriteLine(inputError);
                }
            }
        }
Example #5
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);
        }
Example #6
0
        public static Progression changeKey(Progression progression)
        {
            string inputError = "\nI'm sorry that was not a valid coice." +
                                "\nPlease try again.";
            bool result = false;

            while (result == false)
            {
                System.Console.WriteLine("\nPlease enter the new key. Use '#' (number sign) " +
                                         "\nfor sharp and 'b' (lowercase b) for flat");
                string newKey = System.Console.ReadLine();
                result = NoteController.checkNoteName(newKey);
                if (result)
                {
                    progression.changeKey(NoteFactory.getNoteByName(newKey));
                    System.Console.WriteLine("\nKey has been changed to " + newKey);
                }
                else
                {
                    System.Console.WriteLine(inputError);
                }
            }
            return(progression);
        }
Example #7
0
        public static Progression moreRecomendations(Progression progression)
        {
            string inputError = "\nI'm sorry that was not a valid coice." +
                                "\nPlease try again.";

            List <Chord> recomendations = new List <Chord>();
            Note         tonic          = NoteFactory.getNoteByValue(progression.getKey().getValue(), progression.getKey());
            bool         validChoice    = false;
            string       choice;
            int          i;

            while (validChoice == false)
            {
                i = 1;
                System.Console.WriteLine("1) I (" + progression.getMode().getNote(0, progression.getKey()).getName() + ")");
                if (progression.getMode().containsInterval(1))
                {
                    System.Console.WriteLine((i + 1) + ") bII (" + progression.getMode().getNote(i, progression.getKey()).getName() + ")");
                    i++;
                }
                if (progression.getMode().containsInterval(2))
                {
                    System.Console.WriteLine((i + 1) + ") II (" + progression.getMode().getNote(i, progression.getKey()).getName() + ")");
                    i++;
                }
                if (progression.getMode().containsInterval(3))
                {
                    System.Console.WriteLine(((i + 1) + 1) + ") bIII (" + progression.getMode().getNote(i, progression.getKey()).getName() + ")");
                    i++;
                }
                if (progression.getMode().containsInterval(4))
                {
                    System.Console.WriteLine((i + 1) + ") III (" + progression.getMode().getNote(i, progression.getKey()).getName() + ")");
                    i++;
                }
                if (progression.getMode().containsInterval(5))
                {
                    System.Console.WriteLine((i + 1) + ") IV (" + progression.getMode().getNote(i, progression.getKey()).getName() + ")");
                    i++;
                }
                if (progression.getMode().containsInterval(6))
                {
                    System.Console.WriteLine((i + 1) + ") bV (" + progression.getMode().getNote(i, progression.getKey()).getName() + ")");
                    i++;
                }
                if (progression.getMode().containsInterval(7))
                {
                    System.Console.WriteLine((i + 1) + ") V (" + progression.getMode().getNote(i, progression.getKey()).getName() + ")");
                    i++;
                }
                if (progression.getMode().containsInterval(8))
                {
                    System.Console.WriteLine((i + 1) + ") bVI (" + progression.getMode().getNote(i, progression.getKey()).getName() + ")");
                    i++;
                }
                if (progression.getMode().containsInterval(9))
                {
                    System.Console.WriteLine((i + 1) + ") VI (" + progression.getMode().getNote(i, progression.getKey()).getName() + ")");
                    i++;
                }
                if (progression.getMode().containsInterval(10))
                {
                    System.Console.WriteLine((i + 1) + ") bVII (" + progression.getMode().getNote(i, progression.getKey()).getName() + ")");
                    i++;
                }
                if (progression.getMode().containsInterval(11))
                {
                    System.Console.WriteLine((i + 1) + ") VII (" + progression.getMode().getNote(i, progression.getKey()).getName() + ")");
                    i++;
                }
                choice = System.Console.ReadLine();
                for (i = 1; i <= progression.getMode().getSize(); i++)
                {
                    if (i.ToString() == choice)
                    {
                        validChoice = true;
                        tonic       = progression.getMode().getNote(i - 1, progression.getKey());
                    }
                }
                if (validChoice == false)
                {
                    System.Console.WriteLine(inputError);
                }
            }
            validChoice    = false;
            recomendations = ChordFactory.getChordRecomendationsByTonic(progression.getKey(), tonic, progression.getMode());
            while (validChoice == false)
            {
                for (i = 0; i < recomendations.Count(); i++)
                {
                    System.Console.WriteLine((i + 1).ToString() + ") " + recomendations.ElementAt(i).getName());
                    if (i + 1 == recomendations.Count())
                    {
                        System.Console.WriteLine((i + 2).ToString() + ") Back to chord menu");
                    }
                }
                choice = System.Console.ReadLine();

                for (i = 1; i <= recomendations.Count(); i++)
                {
                    if (i.ToString() == choice)
                    {
                        validChoice = true;
                        progression.addChord(recomendations.ElementAt(i - 1));
                        System.Console.WriteLine("\n" + progression.getChord(progression.getSize() - 1).getName() + " has been added to the progression.");
                    }
                    else if ((i + 1).ToString() == choice)
                    {
                        validChoice = true;
                    }
                }
                if (validChoice == false)
                {
                    System.Console.WriteLine(inputError);
                }
            }
            return(progression);
        }
Example #8
0
        public static Progression addRecomendedChord(Progression progression)
        {
            string inputError = "\nI'm sorry that was not a valid coice." +
                                "\nPlease try again.";
            int          i;
            string       choice;
            bool         validChoice    = false;
            Note         degree         = NoteFactory.getNoteByValue(progression.getKey().getValue(), progression.getKey());
            List <Chord> recomendations = new List <Chord>();

            if (progression.getSize() == 0)
            {
                recomendations = ChordFactory.getChordRecomendationsTriads(progression.getKey(), progression.getMode());
                while (validChoice == false)
                {
                    for (i = 0; i < recomendations.Count(); i++)
                    {
                        System.Console.WriteLine((i + 1).ToString() + ") " + recomendations.ElementAt(i).getName());
                        if (i + 1 == recomendations.Count())
                        {
                            System.Console.WriteLine((i + 2).ToString() + ") See more recomendations");
                        }
                    }
                    System.Console.WriteLine((i + 2).ToString() + ") Back to chord menu");
                    choice = System.Console.ReadLine();

                    for (i = 1; i <= recomendations.Count(); i++)
                    {
                        if (i.ToString() == choice)
                        {
                            validChoice = true;
                            progression.addChord(recomendations.ElementAt(i - 1));
                            System.Console.WriteLine("\n" + progression.getChord(progression.getSize() - 1).getName() + " has been added to the progression.");
                        }
                    }
                    if ((i).ToString() == choice)
                    {
                        validChoice = true;
                        progression = moreRecomendations(progression);
                    }
                    else if ((i + 1).ToString() == choice)
                    {
                        validChoice = true;
                    }
                    if (validChoice == false)
                    {
                        System.Console.WriteLine(inputError);
                    }
                }
            }
            else
            {
                recomendations = ChordFactory.getChordRecomendationsByLast(progression.getKey(), progression.getChord(progression.getSize() - 1), progression.getMode());
                while (validChoice == false)
                {
                    for (i = 0; i < recomendations.Count(); i++)
                    {
                        System.Console.WriteLine((i + 1).ToString() + ") " + recomendations.ElementAt(i).getName());
                        if (i + 1 == recomendations.Count())
                        {
                            System.Console.WriteLine((i + 2).ToString() + ") See more recomendations");
                        }
                    }
                    System.Console.WriteLine((i + 2).ToString() + ") Back to chord menu");
                    choice = System.Console.ReadLine();

                    for (i = 1; i <= recomendations.Count(); i++)
                    {
                        if (i.ToString() == choice)
                        {
                            validChoice = true;
                            progression.addChord(recomendations.ElementAt(i - 1));
                            System.Console.WriteLine("\n" + progression.getChord(progression.getSize() - 1).getName() + " has been added to the progression.");
                        }
                    }
                    if ((i).ToString() == choice)
                    {
                        validChoice = true;
                        progression = moreRecomendations(progression);
                    }
                    else if ((i + 1).ToString() == choice)
                    {
                        validChoice = true;
                    }
                    if (validChoice == false)
                    {
                        System.Console.WriteLine(inputError);
                    }
                }
            }
            return(progression);
        }
Example #9
0
        public static Progression changeMode(Progression progression)
        {
            string inputError = "\nI'm sorry that was not a valid coice." +
                                "\nPlease try again.";
            bool   result = false;
            string answer;

            while (result == false)
            {
                System.Console.WriteLine("\nWhat would you like the  new mode to be?" +
                                         "\n1) Lydian" +
                                         "\n2) Ionian" +
                                         "\n3) Mixolydian" +
                                         "\n4) Dorian" +
                                         "\n5) Aeolian" +
                                         "\n6) Phrygian" +
                                         "\n7) Locrian");
                answer = System.Console.ReadLine();
                if (answer == "1")
                {
                    progression.changeMode("Lydian");
                    result = true;
                    System.Console.WriteLine("\nThe mode has been changed to " + progression.getMode().getName());
                }
                else if (answer == "2")
                {
                    progression.changeMode("Ionian");
                    result = true;
                    System.Console.WriteLine("\nThe mode has been changed to " + progression.getMode().getName());
                }
                else if (answer == "3")
                {
                    progression.changeMode("Mixolydian");
                    result = true;
                    System.Console.WriteLine("\nThe mode has been changed to " + progression.getMode().getName());
                }
                else if (answer == "4")
                {
                    progression.changeMode("Dorian");
                    result = true;
                    System.Console.WriteLine("\nThe mode has been changed to " + progression.getMode().getName());
                }
                else if (answer == "5")
                {
                    progression.changeMode("Aeolian");
                    result = true;
                    System.Console.WriteLine("\nThe mode has been changed to " + progression.getMode().getName());
                }
                else if (answer == "6")
                {
                    progression.changeMode("Phrygian");
                    result = true;
                    System.Console.WriteLine("\nThe mode has been changed to " + progression.getMode().getName());
                }
                else if (answer == "7")
                {
                    progression.changeMode("Locrian");
                    result = true;
                    System.Console.WriteLine("\nThe mode has been changed to " + progression.getMode().getName());
                }
                else
                {
                    System.Console.WriteLine(inputError);
                }
            }
            return(progression);
        }
Example #10
0
        public static Progression menuThree(Progression progression)
        {
            string inputError = "\nI'm sorry that was not a valid coice." +
                                "\nPlease try again.";
            bool   back = false;
            string answer;

            while (back == false)
            {
                if (progression.getSize() == 0)
                {
                    System.Console.WriteLine("\nThere are no chords in your progression");
                }
                else
                {
                    System.Console.WriteLine("\nThe current tablature is:");
                    System.Console.WriteLine("  " + progression.getChordNames());
                    string spacing;
                    int    spacingSize;
                    string stringOne = "";
                    string stringTwo = "";
                    string stringThree = "";
                    string stringFour = "";
                    string stringFive = "";
                    string stringSix = "";
                    int    i, j;
                    // i = chord, j = string
                    for (i = 1; i <= progression.getSize(); i++)
                    {
                        spacingSize = progression.getChord(i - 1).getName().ToCharArray().Count();
                        spacing     = "";
                        for (j = 0; j < spacingSize; j++)
                        {
                            spacing = spacing + " ";
                        }
                        stringOne   = stringOne + " " + progression.getTabNumber(i, 1) + spacing;
                        stringTwo   = stringTwo + " " + progression.getTabNumber(i, 2) + spacing;
                        stringThree = stringThree + " " + progression.getTabNumber(i, 3) + spacing;
                        stringFour  = stringFour + " " + progression.getTabNumber(i, 4) + spacing;
                        stringFive  = stringFive + " " + progression.getTabNumber(i, 5) + spacing;
                        stringSix   = stringSix + " " + progression.getTabNumber(i, 6) + spacing;
                    }
                    System.Console.WriteLine("T" + stringOne);
                    System.Console.WriteLine("T" + stringTwo);
                    System.Console.WriteLine("A" + stringThree);
                    System.Console.WriteLine("A" + stringFour);
                    System.Console.WriteLine("B" + stringFive);
                    System.Console.WriteLine("B" + stringSix);
                }
                System.Console.WriteLine("\nWhat would you like to do?" +
                                         "\n1) Swap two chords" +
                                         "\n2) Increase the pitch of a chord" +
                                         "\n3) Decrease the pitch of a chord" +
                                         "\n4) Back to main menu");

                answer = System.Console.ReadLine();
                if (answer == "1")
                {
                    progression = swapChords(progression);
                }
                else if (answer == "2")
                {
                    progression = increasePitch(progression);
                }
                else if (answer == "3")
                {
                    progression = decreasePitch(progression);
                }
                else if (answer == "4")
                {
                    back = true;
                }
                else
                {
                    System.Console.WriteLine(inputError);
                }
            }
            return(progression);
        }
Example #11
0
        public static Progression menuTwo(Progression progression)
        {
            string inputError = "\nI'm sorry that was not a valid coice." +
                                "\nPlease try again.";
            bool   back = false;
            string answer;

            while (back == false)
            {
                if (progression.getSize() == 0)
                {
                    System.Console.WriteLine("\nThere are no chords in your progression");
                }
                else
                {
                    System.Console.WriteLine("\nThe current chords in your progression are: \n" + progression.getChordNames());
                }
                System.Console.WriteLine("\nWhat would you like to do?" +
                                         "\n1) Add a chord" +
                                         "\n2) Replace a chord" +
                                         "\n3) Swap two chords" +
                                         "\n4) Remove a chord" +
                                         "\n5) See more information about a chord" +
                                         "\n6) Add a chord by recomendation" +
                                         "\n7) Back to main menu");
                answer = System.Console.ReadLine();
                if (answer == "1")
                {
                    progression = addChord(progression);
                }
                else if (answer == "2")
                {
                    progression = replaceChord(progression);
                }
                else if (answer == "3")
                {
                    progression = swapChords(progression);
                }
                else if (answer == "4")
                {
                    progression = removeChord(progression);
                }
                else if (answer == "5")
                {
                    examineChords(progression);
                }
                else if (answer == "6")
                {
                    progression = addRecomendedChord(progression);
                }
                else if (answer == "7")
                {
                    back = true;
                }
                else
                {
                    System.Console.WriteLine(inputError);
                }
            }
            return(progression);
        }