Exemplo n.º 1
0
            private Accidental GetAccidental(int index, int noteValue)
            {
                var pitchValue      = (Mode.ModeIntervals[index].Semitones + Root.SemitonesAboveC).RollingRange(11);
                var accidentalValue = (pitchValue - noteValue);

                switch (accidentalValue)
                {
                case -11:
                    accidentalValue = 1;
                    break;

                case -10:
                    accidentalValue = 2;
                    break;

                case 11:
                    accidentalValue = -1;
                    break;

                case 10:
                    accidentalValue = -2;
                    break;
                }
                return(Accidentals.Single(a => a.SemitonesAwayFromNatural == accidentalValue));
            }
Exemplo n.º 2
0
            public Pitch GetPitchByIntervalBelow(Interval interval)
            {
                var noteIndex = (Note.Index() - (interval.NoteIndex - 1)).RollingRange(6);
                var note      = Utilities.GetNoteByIndex(noteIndex);

                var semitones = SemitonesAboveC - interval.Semitones - note.SemitonesAboveC;

                if (semitones < -2)
                {
                    semitones += 12;
                }
                else if (semitones > 2)
                {
                    semitones -= 12;
                }
                var accidental = Accidentals.Single(a => a.SemitonesAwayFromNatural == semitones);

                return(new Pitch(note, accidental));
            }