Table of Contents

Class ChordAnalyzer

Namespace
Celeritas.Core
Assembly
Celeritas.dll

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

buffer NoteBuffer

Returns

ushort

Exceptions

ArgumentNullException

buffer is 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

pitches int*

Pointer to the pitch array.

count int

Number of pitches to read.

Returns

ushort

A mask where bit n is set when pitch class n is present.

GetMask(ReadOnlySpan<int>)

Computes the 12-bit pitch-class mask of the given MIDI pitches.

public static ushort GetMask(ReadOnlySpan<int> pitches)

Parameters

pitches ReadOnlySpan<int>

MIDI pitches (any integers; reduced modulo 12).

Returns

ushort

A mask where bit n is set when pitch class n is present.

Identify(NoteBuffer)

public static ChordInfo Identify(NoteBuffer buffer)

Parameters

buffer NoteBuffer

Returns

ChordInfo

Exceptions

ArgumentNullException

buffer is 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

notes ReadOnlySpan<NoteEvent>

Returns

ChordInfo

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

pitches ReadOnlySpan<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

notation string

Returns

ChordInfo

Exceptions

ArgumentNullException

notation is null.