public static string NameOf(int value) { if (value < 0) { throw new NoteFormatException(value); } return(NoteNames[PitchScaler.Scale(value)]); }
// notes are related if they are the same degree in a scale, regardless of octave public bool RelatedTo(Note other) { if (object.ReferenceEquals(other, null)) { throw new ArgumentNullException("other"); } return(PitchScaler.Scale(this.value) == PitchScaler.Scale(other.value)); }
public Note(int scaleDegree, int octave, MidiOctaveFormat format) { if (octave < -2) { throw new OctaveValueException(octave); } int octaveModifier = format == MidiOctaveFormat.Standard ? 2 : 1; this.value = PitchScaler.Scale(scaleDegree) + (Interval.Octave.Semitones * (octaveModifier + octave)); this.Duration = 1; }