public override void Add <T>(T mess)
 {
     if (mess is GuitarChord)
     {
         Chords.Add((mess as GuitarChord).CloneToMemory(this, Owner.CurrentDifficulty));
     }
     else
     {
         base.Add(mess);
     }
 }
Exemplo n.º 2
0
        /*
         *  Finds all possible chords from sequence of chord notes
         */
        public void FindChords()
        {
            Chords.Clear();
            List <Note> myChordNotes = new List <Note>();

            for (int i = 0; i < chordNotes.Length; i++) // Creates iterable chord notes list
            {
                double avgMagnitude = 0;
                for (int j = 0; j < chordNotes[i].Count; j++) // Finds average magnitude of that note type and assigns it to magnitude of chord note
                {
                    avgMagnitude += chordNotes[i][j].Magnitude;
                }
                avgMagnitude /= chordNotes[i].Count;

                Note newChordNote = (Note)chordNotes[i][0].Clone();
                newChordNote.Magnitude = avgMagnitude;
                newChordNote.Octave    = chordNotes[i].Count;
                myChordNotes.Add(newChordNote);
            }

            for (int i = 0; i < chordNotes.Length; i++)
            {
                List <int> intervals = new List <int>();
                for (int j = 1; j < chordNotes.Length; j++) // Finds interval between adjacent notes
                {
                    int noteDifference = myChordNotes[j].NoteIndex - myChordNotes[0].NoteIndex;
                    if (noteDifference < 0)
                    {
                        noteDifference = 12 + noteDifference;
                    }
                    intervals.Add(noteDifference);
                }
                string chordQuality = Music.GetChordQuality(intervals, out int fifthOmitted); // Determines chord quality from intervals
                if (chordQuality != "N/A")
                {
                    Chords.Add(CreateChord(myChordNotes[0].Name, chordQuality, myChordNotes, fifthOmitted));
                }

                myChordNotes = NextChord(myChordNotes); // Iterates chord root note
            }
            AdjustChordProbabilities();
            Chords = Chords.OrderByDescending(x => x.Probability).ToList();
            if (Chords.Count > 0)
            {
                prevChord = Chords[0];
            }
        }
Exemplo n.º 3
0
 public APCIntance(IMidiOutput output, IMidiInput input)
 {
     outdevice = output;
     indevice  = input;
     indevice.MessageReceived += Message_Received;
     for (int row = 0; row < 64; row++)
     {
         Seq64.Add(row, false);
         Clips.Add(row, false);
     }
     for (int row = 0; row < 8; row++)
     {
         Seq8a.Add(row, new Dictionary <int, bool>());
         Seq8b.Add(row, new Dictionary <int, bool>());
         Chords.Add(row, new List <int>());
         for (int col = 0; col < 8; col++)
         {
             Seq8a[row].Add(col, false);
             Seq8b[row].Add(col, false);
         }
     }
     DrawPage(true);
 }
Exemplo n.º 4
0
        private void Read(Stream CITFile)
        {
            CITFile.Position += 0x04;

            if (!CITFile.ReadString(4).Equals(Magic))
            {
                throw new Exception($"Invalid Identifier. Expected \"{Magic}\"");
            }

            uint   FileSize = BitConverter.ToUInt32(CITFile.ReadReverse(0, 4), 0);
            ushort ChordCount = BitConverter.ToUInt16(CITFile.ReadReverse(0, 2), 0), ScaleCount = BitConverter.ToUInt16(CITFile.ReadReverse(0, 2), 0);

            int[] ChordPointers = new int[ChordCount], ScalePairPointers = new int[ScaleCount];
            for (int i = 0; i < ChordCount; i++)
            {
                ChordPointers[i] = BitConverter.ToInt32(CITFile.ReadReverse(0, 4), 0);
                long PausePosition = CITFile.Position;
                CITFile.Position = ChordPointers[i];
                Chords.Add(new Chord((Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte()));
                CITFile.Position = PausePosition;
            }
            for (int i = 0; i < ScaleCount; i++)
            {
                ScalePairPointers[i] = BitConverter.ToInt32(CITFile.ReadReverse(0, 4), 0);
                long PausePosition = CITFile.Position;
                CITFile.Position = ScalePairPointers[i];
                int OffsetA = BitConverter.ToInt32(CITFile.ReadReverse(0, 4), 0);
                int OffsetB = BitConverter.ToInt32(CITFile.ReadReverse(0, 4), 0);
                CITFile.Position = OffsetA;
                Scale ScaleA = new Scale((Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte());
                CITFile.Position = OffsetB;
                Scale ScaleB = new Scale((Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte());
                Scales.Add(new Tuple <Scale, Scale>(ScaleA, ScaleB));
                CITFile.Position = PausePosition;
            }
        }
Exemplo n.º 5
0
        public void AddChords()
        {
            Random random = new Random();

            Chords.Add(new Chord("major", LEVEL.BEGINNER, new List <string>()
            {
                "Jazz", "Classical Music", "Rock"
            }, new List <int>()
            {
                4, 7
            }));
            Chords.Add(new Chord("7", LEVEL.BEGINNER, new List <string>()
            {
                "Jazz", "Rock", "Classical Music"
            }, new List <int>()
            {
                4, 7, 10
            }));
            Chords.Add(new Chord("minor", LEVEL.BEGINNER, new List <string>()
            {
                "Jazz", "Rock", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                3, 7
            }));
            Chords.Add(new Chord("m7", LEVEL.BEGINNER, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                3, 7, 10
            }));
            Chords.Add(new Chord("maj7", LEVEL.BEGINNER, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                4, 7, 11
            }));
            Chords.Add(new Chord("sus4", LEVEL.BEGINNER, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                5, 7
            }));
            Chords.Add(new Chord("sus2", LEVEL.BEGINNER, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                2, 7
            }));
            Chords.Add(new Chord("5", LEVEL.BEGINNER, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                7
            }));
            Chords.Add(new Chord("m3", LEVEL.BEGINNER, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                3
            }));
            Chords.Add(new Chord("3", LEVEL.BEGINNER, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                4
            }));
            Chords.Add(new Chord("b5", LEVEL.BEGINNER, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                6
            }));
            //BEGINNER
            Chords.Add(new Chord("maj9", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                2, 4, 7
            }));
            Chords.Add(new Chord("dim", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                3, 6
            }));
            Chords.Add(new Chord("aug", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Jazz", "Classical Music"
            }, new List <int>()
            {
                4, 8
            }));
            Chords.Add(new Chord("add9", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Rock", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                4, 7, 2
            }));
            Chords.Add(new Chord("dom7", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Rock", "Classical Music", "Jazz"
            }, new List <int>()
            {
                4, 7, 10
            }));
            Chords.Add(new Chord("aug7", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                4, 8, 10
            }));
            Chords.Add(new Chord("domt7b5", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                4, 6, 10
            }));
            Chords.Add(new Chord("dim7", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Jazz", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                3, 6, 9
            }));
            Chords.Add(new Chord("min(maj7)", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Jazz", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                3, 7, 10
            }));
            //INTERMEDIATE
            Chords.Add(new Chord("dim*", LEVEL.ADVANCED, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                3, 6, 10
            }));
            Chords.Add(new Chord("sus11", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                5, 7
            }));
            Chords.Add(new Chord("11", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music"
            }, new List <int>()
            {
                2, 5, 7, 10
            }));
            Chords.Add(new Chord("13", LEVEL.ADVANCED, new List <string>()
            {
                "Rock", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                2, 4, 5, 7, 10
            }));
            Chords.Add(new Chord("4", LEVEL.ADVANCED, new List <string>()
            {
                "Rock", "Classical Music", "Jazz"
            }, new List <int>()
            {
                5, 7
            }));
            Chords.Add(new Chord("6", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal", "Rock"
            }, new List <int>()
            {
                4, 7, 9
            }));
            Chords.Add(new Chord("7b5", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal", "Rock"
            }, new List <int>()
            {
                4, 6, 10
            }));
            Chords.Add(new Chord("9", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal", "Rock"
            }, new List <int>()
            {
                2, 4, 7, 10
            }));
            Chords.Add(new Chord("7b9", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal", "Rock"
            }, new List <int>()
            {
                1, 4, 7, 10
            }));
            Chords.Add(new Chord("79", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal", "Rock"
            }, new List <int>()
            {
                2, 4, 7, 10
            }));
            Chords.Add(new Chord("7#5", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal", "Rock"
            }, new List <int>()
            {
                8, 10
            }));
            //ADVANCED
        }