예제 #1
0
        /// <summary>
        ///   Intervals are often abbreviated with a P for perfect,
        ///   m for minor, M for major, d for diminished, A for
        ///   augmented, followed by the diatonic interval number.
        ///   The indication M and P are often omitted. The octave
        ///   is P8, and a unison is usually referred to simply as
        ///   "a unison" but can be labeled P1. The tritone, an
        ///   augmented fourth or diminished fifth is often π or TT.
        /// </summary>
        /// <remarks>
        ///   Examples: m1, m2, M3, TT, P8, A4, T, S, H, W, 1, 2, 3
        /// </remarks>
        /// <param name="name"></param>
        public Interval(String name)
        {
            this.lower = Pitch.MiddleC;
            this.upper = Pitch.MiddleC;

            switch (name.ToUpper())
            {
            case "S":
            case "H":
                this.upper = lower + 1; break;

            case "T":
            case "W":
                this.upper = lower + 2; break;

            case "A":
                this.upper = lower + 3; break;

            default:
                throw new ArgumentException();
            }
        }
예제 #2
0
 public Interval(Pitch a, Pitch b)
 {
     upper = new Pitch(System.Math.Max(a.Number, b.Number));
     lower = new Pitch(System.Math.Min(a.Number, b.Number));
 }
예제 #3
0
 public Interval(int semitones)
 {
     this.lower = Pitch.MiddleC;
     this.upper = lower + semitones;
 }
예제 #4
0
 public Interval(Pitch p, int semitones)
 {
     this.lower = p;
     this.upper = lower + semitones;
 }
예제 #5
0
 public bool Contains(Pitch pitch)
 {
     return(Contains(pitch.Note));
 }
예제 #6
0
 /// <summary>
 ///   Constructs a new Clef.
 /// </summary>
 /// <param name="name">The name of the Clef.</param>
 /// <param name="pitch">The pitch associated with the Clef.</param>
 /// <param name="line">The reference line in where the associated pitch is located.</param>
 public Clef(String name, Pitch pitch, int line)
 {
     this.name  = name;
     this.pitch = pitch;
     this.line  = line;
 }