示例#1
0
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            if (this.cmbNote.SelectedValue != null)
            {
                Note note = new Note((MasterNoteType)this.cmbNote.SelectedValue,
                                     this.cmbAccidentials.SelectedValue == null ? 0 :
                                     (Accidentials)this.cmbAccidentials.SelectedValue);

                this.txbResult.Text += "Note notation: " + note.GetNotation() + "\r\n";


                //Interval interval = new Interval(note, this.cmbIntervalType.SelectedValue == null ? 0 :
                //    (IntervalType)this.cmbIntervalType.SelectedValue);

                IntervalType xx = (from cc in intervals
                                   where cc.GetType().Name == cmbIntervalType.SelectedValue.ToString()
                                   select cc).First();

                Note upperNote = masterNoteRow.GetIntervalUp(note, xx).UpperNote;
                this.txbResult.Text += String.Format("The upper note of the interval is: {0}\r\n", upperNote.MasterNoteType.ToString() + upperNote.Accidentials.ToString());


                //this.txbResult.Text += String.Format("Next Upper Root: {0}\r\n", masterNoteRow.GetNextUpperNoteType((MasterNoteType)this.cmbNote.SelectedValue).ToString());
                //this.txbResult.Text += String.Format("Half Step Count to next upper note: {0}\r\n", masterNoteRow.StepsToUpper((MasterNoteType)this.cmbNote.SelectedValue).ToString());
                //this.txbResult.Text += String.Format("Next Lower Root: {0}\r\n", masterNoteRow.GetNextLowerNoteType((MasterNoteType)this.cmbNote.SelectedValue).ToString());
                //this.txbResult.Text += String.Format("Half Step Count to next lower note: {0}\r\n", masterNoteRow.StepsToLower((MasterNoteType)this.cmbNote.SelectedValue).ToString());

                //this.txbResult.Text += String.Format("Steps between your note and a C: {0}\r\n", masterNoteRow.StepsBetween(((MasterNoteType)this.cmbNote.SelectedValue), MasterNoteType.C));

                this.txbResult.Text += String.Format("Scale: \r\n");
                DiatonicScale majorScale = new DiatonicScale(note);
                foreach (Note scaleNote in majorScale.Notes)
                {
                    this.txbResult.Text += String.Format("{0}{1} ", scaleNote.MasterNoteType.ToString(), scaleNote.Accidentials.ToString());
                }

                Voicing majorTriad = new Voicing("major triad", new List <IntervalType>()
                {
                    new MajorThird(), new PerfectFifth()
                });
                majorTriad.GetMatchingChordNotes(majorScale);
                foreach (List <Note> notes in majorTriad.GetMatchingChordNotes(majorScale))
                {
                    this.txbResult.Text += String.Format("Matching chord: \r\n");
                    foreach (Note chordNote in notes)
                    {
                        this.txbResult.Text += chordNote.MasterNoteType.ToString() + chordNote.Accidentials.ToString() + " ";
                    }
                    this.txbResult.Text += String.Format("\r\n");
                }

                try
                {
                    Changes CsharpMaj7 = new Changes(new Note(MasterNoteType.C, Accidentials.sharp), new List <IntervalType>()
                    {
                        new MajorThird(), new PerfectFifth(), new MajorSeventh()
                    },
                                                     new List <IntervalType>());

                    //Changes Aflat7flat913 = new Changes(new Note(MasterNoteType.A, Accidentials.flat), new List<IntervalType>() { new MajorThird(), new MinorSeventh() },
                    //    new List<IntervalType>() { new MinorSecond(), new MajorSixth() });
                    this.txbResult.Text += CsharpMaj7.Name;
                    //this.txbResult.Text += Aflat7flat913.Name;
                    Changes CMajTriad = new Changes(new Note(MasterNoteType.C), new List <IntervalType>()
                    {
                        new MajorThird(), new PerfectFifth()
                    }, new List <IntervalType>());
                    this.txbResult.Text += CMajTriad.Name;
                }
                catch (Exception ex)
                {
                    this.txbResult.Text += ex.Message;
                }
            }
        }
示例#2
0
 public Mode(string name, Voicing voicing, IEnumerable <Interval> intervals)
 {
     Name      = name;
     Voicing   = voicing;
     Intervals = intervals;
 }