Class ChordAnalyzer
Identifies chords from sets of pitches, and computes 12-bit pitch-class masks
(bit n set means pitch class n is present).
public static class ChordAnalyzer
- Inheritance
-
ChordAnalyzer
- Inherited Members
Methods
GetMask(NoteBuffer)
Computes the 12-bit pitch-class mask of the notes in buffer that sound.
Rests carry no pitch class and are ignored.
public static ushort GetMask(NoteBuffer buffer)
Parameters
bufferNoteBuffer
Returns
Exceptions
- ArgumentNullException
bufferis null.
GetMask(int*, int)
Computes the 12-bit pitch-class mask from a raw pointer to count MIDI pitches.
public static ushort GetMask(int* pitches, int count)
Parameters
Returns
- ushort
A mask where bit
nis set when pitch classnis present.
GetMask(ReadOnlySpan<int>)
Computes the 12-bit pitch-class mask of the given MIDI pitches.
public static ushort GetMask(ReadOnlySpan<int> pitches)
Parameters
pitchesReadOnlySpan<int>MIDI pitches (any integers; reduced modulo 12).
Returns
- ushort
A mask where bit
nis set when pitch classnis present.
Identify(NoteBuffer)
public static ChordInfo Identify(NoteBuffer buffer)
Parameters
bufferNoteBuffer
Returns
Exceptions
- ArgumentNullException
bufferis null.
Identify(ReadOnlySpan<NoteEvent>)
Identify chord from note events. Rests are silence, not chord tones, and are ignored.
public static ChordInfo Identify(ReadOnlySpan<NoteEvent> notes)
Parameters
notesReadOnlySpan<NoteEvent>
Returns
Identify(ReadOnlySpan<int>)
Identifies the chord formed by the given MIDI pitches (lowest pitch treated as bass).
public static ChordInfo Identify(ReadOnlySpan<int> pitches)
Parameters
pitchesReadOnlySpan<int>MIDI pitches; the minimum is used as the bass, both for sus/quartal disambiguation and to root the fully symmetric augmented and diminished-seventh chords.
Returns
- ChordInfo
The identified chord's root and quality.
Remarks
The root of a symmetric chord is therefore voicing-dependent: C-E-G# identifies as C augmented, E-G#-C as E augmented.
Identify(string)
Identify chord from a human-readable notation string. Examples: "C4 E4 G4" -> C major, "D4 F4 A4 C5" -> Dm7
public static ChordInfo Identify(string notation)
Parameters
notationstring
Returns
Exceptions
- ArgumentNullException
notationis null.