Table of Contents

Class ChordLibrary

Namespace
Celeritas.Core
Assembly
Celeritas.dll

Lookup table mapping 12-bit pitch-class masks to recognized chords.

public static class ChordLibrary
Inheritance
ChordLibrary
Inherited Members

Properties

NoteNames

Note names indexed by pitch class (0=C .. 11=B), using sharp spellings.

public static IReadOnlyList<string> NoteNames { get; }

Property Value

IReadOnlyList<string>

Methods

GetChord(ushort)

Returns the chord for a 12-bit pitch-class mask, or an Unknown chord if the mask matches no known template.

public static ChordInfo GetChord(ushort mask)

Parameters

mask ushort

Returns

ChordInfo

Remarks

A mask is a set of pitch classes and nothing else, so where several qualities share one set this can only answer whichever was registered first. It therefore never returns Sus4 or Quartal (both share Sus2's set), nor Major6 or Minor6 (which share the sets of the sevenths a minor third below them), and it roots the symmetrical augmented and diminished-seventh chords on the lowest registered root rather than on the bass. Use Identify(ReadOnlySpan<int>) to have the bass note decide, which is what tells those readings apart.

GetPitchClass(string)

Get pitch class (0-11) from note name. Throws on unrecognized names instead of silently defaulting to C.

public static byte GetPitchClass(string noteName)

Parameters

noteName string

Returns

byte

TryGetChord(ushort, out ChordInfo)

Tries to resolve a 12-bit pitch-class mask to a known chord.

public static bool TryGetChord(ushort mask, out ChordInfo chord)

Parameters

mask ushort

12-bit pitch-class mask (0-4095).

chord ChordInfo

The matched chord, or an Unknown chord if none.

Returns

bool

true if a chord was found; otherwise false.