Beispiel #1
0
 /// <summary>
 /// Constructs a chord from its root note, pattern, and inversion.
 /// </summary>
 /// <param name="root">The root note of the chord.</param>
 /// <param name="pattern">The chord pattern.</param>
 /// <param name="inversion">The inversion, in [0..N-1] where N is the number of notes
 /// in pattern.</param>
 /// <exception cref="ArgumentOutOfRangeException">root is invalid or inversion is out of
 /// range.</exception>
 public Chord(NoteFamily root, Pattern pattern, int inversion)
 {
     root.Validate();
     if (inversion < 0 || inversion >= pattern.SemitoneSequence.Length)
     {
         throw new ArgumentOutOfRangeException("inversion out of range.");
     }
     this.root             = root;
     this.pattern          = pattern;
     this.inversion        = inversion;
     this.invertedSequence = InvertSequence(pattern.SemitoneSequence, inversion);
 }
Beispiel #2
0
 /// <summary>
 /// Constructs a chord from its root note, pattern, and inversion.
 /// </summary>
 /// <param name="root">The root note of the chord.</param>
 /// <param name="pattern">The chord pattern.</param>
 /// <param name="inversion">The inversion, in [0..N-1] where N is the number of notes
 /// in pattern.</param>
 /// <exception cref="ArgumentOutOfRangeException">root is invalid or inversion is out of
 /// range.</exception>
 public Chord(NoteFamily root, Pattern pattern, int inversion)
 {
     root.Validate();
     if (inversion < 0 || inversion >= pattern.SemitoneSequence.Length)
     {
         throw new ArgumentOutOfRangeException("inversion out of range.");
     }
     this.root = root;
     this.pattern = pattern;
     this.inversion = inversion;
     this.invertedSequence = InvertSequence(pattern.SemitoneSequence, inversion);
 }
Beispiel #3
0
 /// <summary>
 /// Returns the human-readable name of a note family.
 /// </summary>
 /// <param name="family">The family.</param>
 /// <exception cref="ArgumentOutOfRangeException">The family is out-of-range.</exception>
 public static string Name(this NoteFamily family)
 {
     family.Validate();
     return(NoteFamilyNames[(int)family]);
 }