Exemplo n.º 1
0
        public SevenChord(JustNote baseNote, int[] theFormula, SevenChordMode mode = SevenChordMode.I, SevenChordInversion inv = SevenChordInversion.I)
        {
            ChordType = SevenChordTypes.SevenchordTypes.First(f => f.Value[0] == theFormula[0] && f.Value[1] == theFormula[1] && f.Value[2] == theFormula[2] && f.Value[3] == theFormula[3]).Key.ToString();

            ChordNotes[0] = baseNote;

            var tempNote = baseNote;

            for (int i = 1; i < 4; i++)
            {
                tempNote      = JustNote.moveNoteBySemitones(tempNote, theFormula[i - 1]);
                ChordNotes[i] = tempNote;
            }

            Mode = mode;

            switch (Mode)
            {
            case SevenChordMode.I:
                break;

            case SevenChordMode.II:
                ChordNotes[1] = JustNote.moveNoteBySemitones(ChordNotes[1], 12);
                ChordNotes[3] = JustNote.moveNoteBySemitones(ChordNotes[3], 12);
                break;

            case SevenChordMode.III:
                ChordNotes[2] = JustNote.moveNoteBySemitones(ChordNotes[2], 12);
                break;

            case SevenChordMode.IV:
                ChordNotes[1] = JustNote.moveNoteBySemitones(ChordNotes[1], 12);
                break;

            case SevenChordMode.V:
                ChordNotes[1] = JustNote.moveNoteBySemitones(ChordNotes[1], 12);
                ChordNotes[2] = JustNote.moveNoteBySemitones(ChordNotes[2], 12);
                break;

            case SevenChordMode.VI:
                ChordNotes[1] = JustNote.moveNoteBySemitones(ChordNotes[1], 24);
                ChordNotes[2] = JustNote.moveNoteBySemitones(ChordNotes[2], 12);
                break;

            default:
                break;
            }

            this.InverseForward(inv);
            Inversion = inv;
        }
        static public void playsomeTriads(List <TriadTransformationWithData> transdata, int times = 5)
        {
            for (int ttt = 0; ttt < times; ttt++)
            {
                var goodone      = transdata[Utils.FairRandom.Next(transdata.Count)];
                var interestings = goodone.ApplicationsOnVariosTriads; //.Where(tt => tt.StayInPlace == true).ToList();

                if (interestings.Count() == 0)
                {
                    return;
                }

                var item = interestings[Utils.FairRandom.Next(interestings.Count)];

                var testTriad = new Triad(
                    JustNote.getNoteFromNumber(48),
                    TriadTypes.GetChordFormula(item.InitialTriadType),
                    item.InitialTriadMode,
                    item.InitialTriadInversion
                    );

                using (var player = new Player())
                {
                    Pattern p1 = new Pattern($"T100 V0 I[Piano] {testTriad.ChordNotes[0].GetNFugueName()}q ");
                    Pattern p2 = new Pattern($"T100 V1 I[Flute] {testTriad.ChordNotes[1].GetNFugueName()}q ");
                    Pattern p3 = new Pattern($"T100 V2 I[Flute] {testTriad.ChordNotes[2].GetNFugueName()}q ");

                    player.Play(p1, p2, p3);
                }

                for (int i = 0; i < item.FullLoopDistance * 2; i++)
                {
                    Console.WriteLine("After :: " + " [" + goodone.Formula[0] + "  " + goodone.Formula[1] + "  " + goodone.Formula[2] + "] ");
                    Console.WriteLine(testTriad.ToString());

                    using (var player = new Player())
                    {
                        Pattern p1     = new Pattern($"T140 V0 I[Piano] {testTriad.ChordNotes[0].GetNFugueName()}w ");
                        Pattern p2     = new Pattern($"T140 V1 I[Flute] {testTriad.ChordNotes[1].GetNFugueName()}w ");
                        Pattern p3     = new Pattern($"T140 V2 I[Flute] {testTriad.ChordNotes[2].GetNFugueName()}w ");
                        int     k21111 = 0;
                        player.Play(p1, p2, p3);
                    }
                    int k1111 = 0;
                    TriadTransformation.ApplyATransformation(testTriad, goodone.Formula);
                }
            }
        }
        // TODO : Keep specific chord steps on their place
        public void InverseForward(TriadInversion inv)
        {
            var mode = TriadTypes.TriadModeFormula[Mode];

            var b = mode[(0 + (int)inv) % 3];
            var c = mode[(1 + (int)inv) % 3];
            var a = mode[(2 + (int)inv) % 3];

            while (ChordNotes[b].getNoteNumber() > ChordNotes[c].getNoteNumber())
            {
                ChordNotes[c] = JustNote.moveNoteBySemitones(ChordNotes[c], 12);
            }
            while (ChordNotes[c].getNoteNumber() > ChordNotes[a].getNoteNumber())
            {
                ChordNotes[a] = JustNote.moveNoteBySemitones(ChordNotes[a], 12);
            }

            Inversion = inv;
        }
Exemplo n.º 4
0
        public static List <Triad> GetAllPossibleTriads()
        {
            var listo = new List <Triad>();

            foreach (var item in TriadTypes.TriadsTypes)
            {
                for (int m = 0; m < 2; m++)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        var chordo = new Triad(JustNote.getNoteFromNumber(36), item.Value);
                        chordo.Mode = (TriadMode)m;
                        chordo.InverseForward((TriadInversion)i);
                        listo.Add(chordo);
                    }
                }
            }
            return(listo);
        }
Exemplo n.º 5
0
        // TODO : There will be placed all logic to create data from scratch.
        // It will not be used often 'cause data is static and will be stored in DB
        public static List <SevenChord> GetAllPossibleSevenChords()
        {
            var listo = new List <SevenChord>();

            foreach (var item in SevenChordTypes.SevenchordTypes)
            {
                for (int m = 0; m < 6; m++)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        var chordo = new SevenChord(JustNote.getNoteFromNumber(36), item.Value);
                        chordo.Mode = (SevenChordMode)m;
                        chordo.InverseForward((SevenChordInversion)i);
                        listo.Add(chordo);
                    }
                }
            }
            return(listo);
        }
Exemplo n.º 6
0
        static public void ResetChordRootStepsModeAndInversion(SevenChord chordo)
        {
            for (int n = 0; n < 4; n++)
            {
                for (int m = 0; m < 6; m++)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        var neuChord = new SevenChord(chordo.ChordNotes[n], GetChordFormula(chordo.ChordType), (SevenChordMode)m, (SevenChordInversion)i);

                        var notesNeu  = neuChord.ChordNotes.OrderBy(n2 => n2.getNoteNumber()).ToArray().Select(nn => nn.nameOfTheNote).ToList();
                        var notesOrig = chordo.ChordNotes.OrderBy(n2 => n2.getNoteNumber()).ToArray().Select(nn => nn.nameOfTheNote).ToList();

                        if (
                            notesNeu[0] == notesOrig[0] &&
                            notesNeu[1] == notesOrig[1] &&
                            notesNeu[2] == notesOrig[2] &&
                            notesNeu[3] == notesOrig[3]
                            )
                        {
                            JustNote[] notes = new JustNote[4];
                            notes[0] = chordo.ChordNotes[0];
                            notes[1] = chordo.ChordNotes[1];
                            notes[2] = chordo.ChordNotes[2];
                            notes[3] = chordo.ChordNotes[3];

                            chordo.ChordNotes[0] = notes.Where(no => no.nameOfTheNote == neuChord.ChordNotes[0].nameOfTheNote).First();
                            chordo.ChordNotes[1] = notes.Where(no => no.nameOfTheNote == neuChord.ChordNotes[1].nameOfTheNote).First();
                            chordo.ChordNotes[2] = notes.Where(no => no.nameOfTheNote == neuChord.ChordNotes[2].nameOfTheNote).First();
                            chordo.ChordNotes[3] = notes.Where(no => no.nameOfTheNote == neuChord.ChordNotes[3].nameOfTheNote).First();


                            chordo.Mode      = neuChord.Mode;
                            chordo.Inversion = neuChord.Inversion;
                            return;
                        }
                    }
                }
            }
        }
        static public void ResetTriadRootStepsModeAndInversion(Triad triad)
        {
            for (int n = 0; n < 3; n++)
            {
                for (int m = 0; m < 2; m++)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        var neuTriad = new Triad(triad.ChordNotes[n], GetChordFormula(triad.TriadType), (TriadMode)m, (TriadInversion)i);

                        var notesNeu  = neuTriad.ChordNotes.OrderBy(n2 => n2.getNoteNumber()).ToArray().Select(nn => nn.nameOfTheNote).ToList();
                        var notesOrig = triad.ChordNotes.OrderBy(n2 => n2.getNoteNumber()).ToArray().Select(nn => nn.nameOfTheNote).ToList();

                        if (
                            notesNeu[0] == notesOrig[0] &&
                            notesNeu[1] == notesOrig[1] &&
                            notesNeu[2] == notesOrig[2]
                            )
                        {
                            JustNote[] notes = new JustNote[4];
                            notes[0] = triad.ChordNotes[0];
                            notes[1] = triad.ChordNotes[1];
                            notes[2] = triad.ChordNotes[2];

                            triad.ChordNotes[0] = notes.Where(no => no.nameOfTheNote == neuTriad.ChordNotes[0].nameOfTheNote).First();
                            triad.ChordNotes[1] = notes.Where(no => no.nameOfTheNote == neuTriad.ChordNotes[1].nameOfTheNote).First();
                            triad.ChordNotes[2] = notes.Where(no => no.nameOfTheNote == neuTriad.ChordNotes[2].nameOfTheNote).First();

                            triad.Mode      = neuTriad.Mode;
                            triad.Inversion = neuTriad.Inversion;
                            return;
                        }
                    }
                }
            }
        }
Exemplo n.º 8
0
        // TODO : Keep specific chord steps on their place
        public void InverseBackward(SevenChordInversion inv)
        {
            var mode = SevenChordTypes.SevenChordModeFormula[Mode];

            var b = mode[(3 + (int)inv) % 4];
            var c = mode[(2 + (int)inv) % 4];
            var d = mode[(1 + (int)inv) % 4];
            var a = mode[(0 + (int)inv) % 4];

            while (ChordNotes[b].getNoteNumber() < ChordNotes[c].getNoteNumber())
            {
                ChordNotes[c] = JustNote.moveNoteBySemitones(ChordNotes[c], -12);
            }
            while (ChordNotes[c].getNoteNumber() < ChordNotes[d].getNoteNumber())
            {
                ChordNotes[d] = JustNote.moveNoteBySemitones(ChordNotes[d], -12);
            }
            while (ChordNotes[d].getNoteNumber() < ChordNotes[a].getNoteNumber())
            {
                ChordNotes[a] = JustNote.moveNoteBySemitones(ChordNotes[a], -12);
            }

            Inversion = inv;
        }
Exemplo n.º 9
0
        public static List <TriadTransformationWithData> CalculateTransDataForTriads(List <int[]> triadsTransformations)
        {
            var TransData = new List <TriadTransformationWithData>();

            int counttt = 0;

            foreach (var item in triadsTransformations)
            {
                var a = new TriadTransformationWithData();
                a.Formula = item;
                a.ApplicationsOnVariosTriads = new List <TriadTransformationWithDetailedInfo>();

                foreach (var triadtype in TriadTypes.TriadsTypes.Keys)
                {
                    foreach (TriadMode mode in (TriadMode[])Enum.GetValues(typeof(TriadMode)))
                    {
                        foreach (TriadInversion inv in (TriadInversion[])Enum.GetValues(typeof(TriadInversion)))
                        {
                            var b = new TriadTransformationWithDetailedInfo();

                            b.InitialTriadType      = triadtype;
                            b.InitialTriadMode      = mode;
                            b.InitialTriadInversion = inv;

                            var testTriad = new Triad(JustNote.getNoteFromNumber(48), TriadTypes.GetChordFormula(triadtype), mode, inv);

                            b.TheApplications     = new List <TriadSignature>();
                            b.TheStepsTransitions = new List <TriadStepsTransition>();

                            var bb = new TriadSignature();
                            bb.ChordType = testTriad.TriadType;
                            bb.Mode      = testTriad.Mode;
                            bb.Inversion = testTriad.Inversion;
                            b.TheApplications.Add(bb);

                            var prevNotes = new JustNote[3];
                            for (int i = 0; i < 3; i++)
                            {
                                prevNotes[i] = testTriad.ChordNotes[i];
                            }

                            var prevSize = testTriad.GetChordSize();
                            var origSize = testTriad.GetChordSize();

                            int simpleLoopFound = 0;
                            int fullLoopFound   = 0;

                            int stepsTaken = 0;
                            while (TriadTransformation.ApplyATransformation(testTriad, a.Formula) && !b.Cyclic)
                            {
                                var bbb = new TriadSignature();
                                bbb.ChordType = testTriad.TriadType;
                                bbb.Mode      = testTriad.Mode;
                                bbb.Inversion = testTriad.Inversion;
                                b.TheApplications.Add(bbb);

                                var bbc = new TriadStepsTransition();
                                bbc.TonicMoved = testTriad.ChordNotes[0].getNoteNumber() - prevNotes[0].getNoteNumber();
                                bbc.ThirdMoved = testTriad.ChordNotes[1].getNoteNumber() - prevNotes[1].getNoteNumber();
                                bbc.FifthMoved = testTriad.ChordNotes[2].getNoteNumber() - prevNotes[2].getNoteNumber();

                                for (int i = 0; i < 3; i++)
                                {
                                    prevNotes[i] = JustNote.moveNoteBySemitones(prevNotes[i], a.Formula[i]);
                                }

                                if (prevNotes[0].getNoteNumber() == testTriad.ChordNotes[0].getNoteNumber())
                                {
                                    bbc.TonicInto = TriadStep.T;
                                }
                                else if (prevNotes[0].getNoteNumber() == testTriad.ChordNotes[1].getNoteNumber())
                                {
                                    bbc.TonicInto = TriadStep.III;
                                }
                                else if (prevNotes[0].getNoteNumber() == testTriad.ChordNotes[2].getNoteNumber())
                                {
                                    bbc.TonicInto = TriadStep.V;
                                }

                                if (prevNotes[1].getNoteNumber() == testTriad.ChordNotes[0].getNoteNumber())
                                {
                                    bbc.ThirdInto = TriadStep.T;
                                }
                                else if (prevNotes[1].getNoteNumber() == testTriad.ChordNotes[1].getNoteNumber())
                                {
                                    bbc.ThirdInto = TriadStep.III;
                                }
                                else if (prevNotes[1].getNoteNumber() == testTriad.ChordNotes[2].getNoteNumber())
                                {
                                    bbc.ThirdInto = TriadStep.V;
                                }

                                if (prevNotes[2].getNoteNumber() == testTriad.ChordNotes[0].getNoteNumber())
                                {
                                    bbc.FifthInto = TriadStep.T;
                                }
                                else if (prevNotes[2].getNoteNumber() == testTriad.ChordNotes[1].getNoteNumber())
                                {
                                    bbc.FifthInto = TriadStep.III;
                                }
                                else if (prevNotes[2].getNoteNumber() == testTriad.ChordNotes[2].getNoteNumber())
                                {
                                    bbc.FifthInto = TriadStep.V;
                                }

                                bbc.SizeDifference = testTriad.GetChordSize() - prevSize;
                                prevSize           = testTriad.GetChordSize();

                                b.TheStepsTransitions.Add(bbc);

                                for (int i = 0; i < 3; i++)
                                {
                                    prevNotes[i] = testTriad.ChordNotes[i];
                                }

                                stepsTaken++;

                                // TODO : More complicated and trusted way to determine exact cycle
                                if (testTriad.TriadType == triadtype)
                                {
                                    simpleLoopFound++;
                                }
                                if (testTriad.TriadType == triadtype && testTriad.Mode == mode && testTriad.Inversion == inv)
                                {
                                    fullLoopFound++;
                                }
                                if (fullLoopFound == 2)
                                {
                                    b.Cyclic = true;
                                }

                                if (stepsTaken > 27 && simpleLoopFound < 1)
                                {
                                    break;
                                }
                                if (stepsTaken > 55)
                                {
                                    break;
                                }
                            }


                            if (b.Cyclic)
                            {
                                b.LoopByTypeDistance = (stepsTaken / 2 + 1) / (simpleLoopFound / 2) - 1;
                                b.FullLoopDistance   = stepsTaken / 2;

                                var sum = b.TheStepsTransitions.Sum(st => st.TonicMoved);
                                if (sum == 0)
                                {
                                    b.StayInPlace = true;
                                }
                                else if (sum > 0)
                                {
                                    b.MovingUp = true;
                                }
                                else
                                {
                                    b.MovingDown = true;
                                }

                                b.TheApplications.RemoveRange(b.FullLoopDistance, b.TheApplications.Count - b.FullLoopDistance - 1);
                                b.TheStepsTransitions.RemoveRange((b.FullLoopDistance - 1), b.TheStepsTransitions.Count - b.FullLoopDistance);

                                if (origSize - prevSize == 0)
                                {
                                    b.SizeKept = true;
                                }

                                a.ApplicationsOnVariosTriads.Add(b);
                            }
                        }
                    }
                }
                if (a.ApplicationsOnVariosTriads.Count > 0)
                {
                    TransData.Add(a);
                }
                counttt++;
                Console.WriteLine(TransData.Count + " :: " + counttt + " :: " + " [" + a.Formula[0] + "  " + a.Formula[1] + "  " + a.Formula[2] + "] " + a.ApplicationsOnVariosTriads.Count);
            }


            return(TransData);
        }
 /// <summary>
 /// Takes a current note and steps in semitones need to be performed, then returns a new note being moved by those semitones from the origin
 /// </summary>
 /// <param name="note">Note we want to move</param>
 /// <param name="number">Number of semitone steps upward or downward</param>
 /// <returns></returns>
 public static JustNote moveNoteBySemitones(JustNote note, int number)
 {
     return(getNoteFromNumber(note.getNoteNumber() + number));
 }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            Utils.FairRandom = new Random();

            // Neeeded 'cause of symbols used to name chords
            // Without it works fine, but prints '?' all around
            Console.OutputEncoding = System.Text.Encoding.UTF8;


            /* TRIADS TESTING */
            var triads      = CalculateAllTransformations.GetAllPossibleTriads();
            int countTriads = triads.Count;

            var TriadsTransformations = CalculateAllTransformations.GetRawListOfAcceptableTransormations(triads);

            int initialTriadsTransormationsFound = TriadsTransformations.Count;

            TriadsTransformations = CalculateAllTransformations.SortAndDistintTheTransformations(TriadsTransformations);

            Console.WriteLine("\nTriads transformations ::: " + initialTriadsTransormationsFound + " -> " + TriadsTransformations.Count);

            triads.Sort(delegate(Triad tr1, Triad tr2) { return(tr1.GetChordSize().CompareTo(tr2.GetChordSize())); });

            Console.WriteLine();
            Console.WriteLine("Total triads variations count is: " + countTriads);
            Console.WriteLine();


            var TriadsTransData = CalculateAllTransformations.CalculateTransDataForTriads(TriadsTransformations);

            int triadsMaxDistance = 0;

            triadsMaxDistance = TriadsTransData.Max(t => t.ApplicationsOnVariosTriads.Max(tt => tt.FullLoopDistance));


            var stopme = 1;

            NFugueUsage.playsomeTriads(TriadsTransData, 5);


            stopme = 1;


            /* SEVEN CHORDS TESTING */
            var neg          = CalculateAllTransformations.GetAllPossibleSevenChords();
            int countChordos = neg.Count;

            var Transformations = CalculateAllTransformations.GetRawListOfAcceptableTransormations(neg);

            int initialTransormationsFound = Transformations.Count;

            Transformations = CalculateAllTransformations.SortAndDistintTheTransformations(Transformations);

            Console.WriteLine("\nSevenChords transformations ::: " + initialTransormationsFound + " -> " + Transformations.Count);


            neg.Sort(delegate(SevenChord ch1, SevenChord ch22) { return(ch1.GetChordSize().CompareTo(ch22.GetChordSize())); });

            Console.WriteLine();
            Console.WriteLine("Total chords variations count is: " + countChordos);
            Console.WriteLine();



            int counttt   = 0;
            var TransData = CalculateAllTransformations.CalculateTransDataForSevenChords(Transformations);
            // TODO: Inspect transformations on different chords for being equal

            int kk = 0;

            kk = TransData.Max(t => t.ApplicationsOnVariosChords.Max(tt => tt.FullLoopDistance));

            int kasdf = 0;


            kasdf = 1;
            var rand = new Random();

            //var goodone = TransData[rand.Next(TransData.Count)];
            //foreach (var item in goodone.ApplicationsOnVariosChords)
            //{

            //    //var testChord = new SevenChord(JustNote.getNoteFromNumber(48),
            //    //    SevenChordTypes.GetChordFormula(item.InitialChordType),
            //    //    item.InitialChordMode, item.InitialChordInversion);

            //    for (int i = 0; i < item.FullLoopDistance; i++)
            //    {

            //       // Console.WriteLine("After :: " + " [" + goodone.Formula[0] + "  " + goodone.Formula[1] + "  " + goodone.Formula[2] + "  " + goodone.Formula[3] + "] ");
            //       // Console.WriteLine(testChord.ToString());

            //        //using (var player = new Player())
            //        //{
            //        //    Pattern p1 = new Pattern($"T140 V0 I[Piano] {testChord.ChordNotes[0].GetNFugueName()}w ");
            //        //    Pattern p2 = new Pattern($"T140 V1 I[Flute] {testChord.ChordNotes[1].GetNFugueName()}w ");
            //        //    Pattern p3 = new Pattern($"T140 V2 I[Flute] {testChord.ChordNotes[2].GetNFugueName()}w ");
            //        //    Pattern p4 = new Pattern($"T140 V3 I[Flute] {testChord.ChordNotes[3].GetNFugueName()}w ");

            //        //    //player.Play(p1, p2, p3, p4);
            //        //}
            //        int k1111 = 0;
            //        //SevenChordTransformation.ApplyATransformation(testChord, goodone.Formula);
            //    }
            //}


            playsmthn();
            for (int i = 0; i < 5; i++)
            {
                playsmthn();
            }

            kasdf = 1;

            void playsmthn()
            {
                var goodone = TransData[rand.Next(TransData.Count)];

                var interestings = goodone.ApplicationsOnVariosChords; //.Where(tt => tt.StayInPlace == true).ToList();

                if (interestings.Count() == 0)
                {
                    return;
                }

                var item = interestings[rand.Next(interestings.Count)];

                var testChord = new SevenChord(JustNote.getNoteFromNumber(48),
                                               SevenChordTypes.GetChordFormula(item.InitialChordType),
                                               item.InitialChordMode, item.InitialChordInversion);

                using (var player = new Player())
                {
                    Pattern p1 = new Pattern($"T100 V0 I[Piano] {testChord.ChordNotes[0].GetNFugueName()}q ");
                    Pattern p2 = new Pattern($"T100 V1 I[Flute] {testChord.ChordNotes[1].GetNFugueName()}q ");
                    Pattern p3 = new Pattern($"T100 V2 I[Flute] {testChord.ChordNotes[2].GetNFugueName()}q ");
                    Pattern p4 = new Pattern($"T100 V3 I[Flute] {testChord.ChordNotes[3].GetNFugueName()}q ");

                    player.Play(p1, p2, p3, p4);
                }

                for (int i = 0; i < item.FullLoopDistance * 2; i++)
                {
                    Console.WriteLine("After :: " + " [" + goodone.Formula[0] + "  " + goodone.Formula[1] + "  " + goodone.Formula[2] + "  " + goodone.Formula[3] + "] ");
                    Console.WriteLine(testChord.ToString());

                    using (var player = new Player())
                    {
                        Pattern p1     = new Pattern($"T140 V0 I[Piano] {testChord.ChordNotes[0].GetNFugueName()}w ");
                        Pattern p2     = new Pattern($"T140 V1 I[Flute] {testChord.ChordNotes[1].GetNFugueName()}w ");
                        Pattern p3     = new Pattern($"T140 V2 I[Flute] {testChord.ChordNotes[2].GetNFugueName()}w ");
                        Pattern p4     = new Pattern($"T140 V3 I[Flute] {testChord.ChordNotes[3].GetNFugueName()}w ");
                        int     k21111 = 0;
                        player.Play(p1, p2, p3, p4);
                    }
                    int k1111 = 0;
                    SevenChordTransformation.ApplyATransformation(testChord, goodone.Formula);
                }
            }

            //foreach (var chordtype in SevenChordTypes.SevenchordTypes.Keys)
            //{
            //    var infos = new List<SimpleTransformationInfo>();
            //    foreach (var item in Transformations)
            //    {
            //        var testChord = new SevenChord(JustNote.getNoteFromNumber(48), SevenChordTypes.GetChordFormula(chordtype));

            //        var typeOfChord = testChord.ChordType;
            //        var typeOfChord2 = testChord.ChordType;

            //        var modeOfChord = testChord.Mode;
            //        var modeOfChord2 = testChord.Mode;

            //        var invOfChord = testChord.Inversion;
            //        var invOfChord2 = testChord.Inversion;


            //        int typeRepTwice = 0;
            //        int cycleCount = 0;
            //        if (item[0] == 0 && item[1] == 0 && item[2] == 0 && item[3] == -2)
            //        {
            //            // Console.WriteLine(testChord);
            //            // Console.WriteLine(SevenChord.DetermineChordType(testChord));
            //        }

            //        while (SevenChordTransformation.ApplyATransformation(testChord, new int[] { item[0], item[1], item[2], item[3] }))
            //        {
            //            typeOfChord2 = testChord.ChordType;
            //            modeOfChord2 = testChord.Mode;
            //            invOfChord2 = testChord.Inversion;


            //            if (typeOfChord2 == typeOfChord && modeOfChord2 == modeOfChord && invOfChord2 == invOfChord) typeRepTwice++;
            //            if (typeRepTwice == 2)
            //                break;

            //            if (item[0] == 0 && item[1] == 0 && item[2] == 0 && item[3] == -2)
            //            {
            //                // Console.WriteLine(testChord);
            //                // Console.WriteLine(SevenChord.DetermineChordType(testChord));
            //            }
            //            // Console.WriteLine(ch3);
            //            //Console.WriteLine(SevenChord.DetermineChordType(ch3));
            //            cycleCount++;

            //            if (cycleCount > 100)
            //                break;
            //        }

            //        if (typeRepTwice == 2)
            //        {
            //            var ku = new SimpleTransformationInfo();
            //            ku.count = cycleCount / 2 + 1;
            //            ku.mess = "The cycle [" + item[0] + "  " + item[1] + "  " + item[2] + "  " + item[3] + "] looped on " + (cycleCount / 2 + 1) + " turn.";

            //            infos.Add(ku);
            //            //Console.WriteLine("The cycle [" + item[0] + "  " + item[1] + "  " + item[2] + "  " + item[3] + "] looped on " + (cycleCount / 2 + 1) + " turn.");
            //        }
            //        else
            //        {
            //            //    if (cycleCount < 10 && cycleCount > 0)
            //            //        Console.WriteLine("The cycle [" + item[0] + "  " + item[1] + "  " + item[2] + "  " + item[3] + "] crashed on " + cycleCount + " turn.");
            //        }
            //    }
            //    infos.Sort(delegate (SimpleTransformationInfo ti1, SimpleTransformationInfo ti2) { return ti1.count.CompareTo(ti2.count); });

            //    var ninfos = infos.GroupBy(iii => iii.count).ToList();
            //    Console.WriteLine(chordtype + " loops by steps: ");
            //    ninfos.ForEach(niii => Console.WriteLine(niii.Key + ": " + niii.Count()));
            //}

            Console.Read();
        }