API / MusicTheory
Chord record
A chord: a root, a
ChordType, optional extensions and an inversion. Immutable: every method that changes something returns a new chord. Notes are spelled from the root by interval, so the third of F# major is A#, the seventh of Bb7 is Ab and the #9 of E7#9 is F##.Constructors
Chord(Note root, ChordQuality quality)Creates a root-position triad of the given quality (suspended is sus4, power is root and fifth).
Throws ArgumentNullException root is null.
Throws ArgumentOutOfRangeException quality is undefined.
Chord(Note root, ChordType type)Creates a root-position chord of the given type.
Throws ArgumentNullException root is null.
Throws ArgumentOutOfRangeException type is undefined.
Properties
Note Root { get; }The root (its octave places the chord).
ChordType Type { get; }The chord type.
ChordQuality Quality { get; }The triad family, derived from
Chord.Type: a minor 7th is minor, a 7sus4 suspended.ChordInversion Inversion { get; }Which chord tone is in the bass.
IReadOnlyList<Interval> Extensions { get; }The extensions added with
Chord.AddExtension, in order.IReadOnlyList<Interval> Intervals { get; }The intervals above the root: the type's, with each extension replacing the chord tone of the same degree (a ♭9 replaces the 9th, a ♭5 the 5th) or added when the degree is absent.
Methods
Chord AddExtension(int intervalNumber, IntervalQuality quality)Returns a new chord with an extension:
AddExtension(9, Minor) on C7 gives C7♭9; on a triad, AddExtension(7, Minor) gives the dominant seventh. See Chord.Intervals for the rule.intervalNumber- The degree, 2 or more (9 for a ninth).
quality- Its quality.
Throws ArgumentOutOfRangeException The number is below 2 or does not take that quality.
bool Equals(Chord? other)Note GetBassNote()The bass note: the root, third, fifth or seventh depending on
Chord.Inversion.Chord? GetEnharmonicEquivalent()The same chord on the usual enharmonic root (C# → Db), or null when the root has none.
int GetHashCode()IEnumerable<Note> GetNotes()The chord tones in root position, root first, ascending.
IEnumerable<Note> GetNotesInInversion()The notes in inversion order, bass first: the tones below the bass move up an octave (C/E is E4 G4 C5).
string GetSlashChordNotation()Root and bass only:
C/E for C major in first inversion, C in root position.string GetSymbol(ChordSymbolStyle? style = null)The symbol in the given style (ASCII by default):
Cmaj7, F#m/A, C7b9.Throws InvalidOperationException See Chord.ToChordSymbol.
ChordSymbol ToChordSymbol()The chord as a lead-sheet symbol with its slash bass. Extensions that turn the chord into another type are folded into it (a triad plus a minor 7th is
C7, C7 plus a ♭9 is C7b9); the rest become tensions (C7#11).Throws InvalidOperationException The extensions are not lead-sheet tensions (an added 2nd, say); Chord.Intervals still describes the chord.
string ToString()The ASCII symbol, or the root and intervals when there is none:
C4 (M3 P5 M2).Chord Transpose(Interval interval)Transposes the root (and so every note) by a spelled interval.
Chord WithInversion(ChordInversion inversion)A new chord with the given inversion.
Throws ArgumentOutOfRangeException The inversion is undefined or needs more notes than the chord has (a third inversion needs a seventh).