コード例 #1
0
 public HarmonyNode(NoteData key, int degree, int[] scale)
 {
     this.degree      = degree;
     this.meanNote    = new NoteData(key.Index + GetSum(scale, 0, degree));;
     this.thirdNote   = new NoteData(meanNote.Index + GetSum(scale, degree, 2));
     this.fourthNote  = new NoteData(meanNote.Index + GetSum(scale, degree, 3));
     this.fifthNote   = new NoteData(meanNote.Index + GetSum(scale, degree, 4));
     this.seventhNote = new NoteData(meanNote.Index + GetSum(scale, degree, 6));
     type             = CalculateChordType();
     this.baseScale   = scale;
 }
コード例 #2
0
        public Harmony(int meanIndex, int[] scale)
        {
            baseScale = scale;
            var newNodes = new ObservableCollection <HarmonyNode>();
            var meanNote = new NoteData(meanIndex);
            int degree   = 0;

            foreach (int ii in MusicalScale.ToValue(baseScale))
            {
                try
                {
                    newNodes.Add(new HarmonyNode(meanNote, degree++, baseScale));
                }
                catch (Exception e)
                {
                    Debug.Write(e.Message);
                }
            }

            Nodes = newNodes;
        }