///<summary> /// Parses the given input using "simple" notation, or returns null if it cannot be parsed accordingly ///</summary> ///<remarks> /// This notation uses "3" for a major third, "b5" for a flat fifth, etc. Commonly used to describe the /// component intervals of chords. ///</remarks> private static Interval ParseSimple(string input) { var match = Regex.Match(input, @"^([b#]*)(\d+)$"); if (!match.Success) { return(null); } var generic = (Generic)int.Parse(match.Groups[2].Value) - 1; var reducedGeneric = ReducedGenericWidth(generic); var modifierPart = match.Groups[1].Value; var accidental = Accidental.Parse(modifierPart); var specific = SEMITONES_PER_OCTAVE * ((int)generic / NAMES_PER_OCTAVE) + MAJOR_SEMITONES[reducedGeneric] + accidental.Semitones; return(new Interval(generic, specific)); }
///<summary> /// Returns a new Pitch ///</summary> ///<param name="name">The <see cref="Name"/> of this Pitch's <see cref="Note"/></param> ///<param name="accidental">The <see cref="Accidental"/> of this Pitch's <see cref="Note"/></param> ///<param name="octave">The octave corresponding to this Pitch</param> public Pitch(Name name, Accidental accidental, int octave) { this.Note = new Note(name, accidental); this.Octave = octave; }
///<summary> /// Returns a new Note ///</summary> ///<param name="name">The <see cref="Name"/> associated with this Note</param> ///<param name="accidental">The <see cref="Accidental"/> modifying this Note</param> public Note(Name name, Accidental accidental) { this.Name = name; this.Accidental = accidental; }