Table of Contents

Class PitchClassSetCatalog

Namespace
Celeritas.Core.Analysis
Assembly
Celeritas.dll

Optional, user-supplied catalog for mapping PCS prime forms to labels (e.g., Forte numbers). This project intentionally ships without any built-in Forte table.

public sealed class PitchClassSetCatalog
Inheritance
PitchClassSetCatalog
Inherited Members

Methods

Load(string)

Load a catalog from the JSON file at path.

public static PitchClassSetCatalog Load(string path)

Parameters

path string

Returns

PitchClassSetCatalog

LoadJson(string)

Load a catalog from a JSON string. Entries with a blank Forte label or empty prime form are skipped.

public static PitchClassSetCatalog LoadJson(string json)

Parameters

json string

Returns

PitchClassSetCatalog

Exceptions

ArgumentNullException

json is null.

InvalidDataException

json is not valid JSON.

NormalizePrimeForm(int[])

A prime form as the catalogue keeps it: every value folded into 0-11 and the set sorted ascending. The catalogue's entries and its lookups both go through this, so an entry written as [19, 15, 12] is stored, and found, as [0, 3, 7].

public static int[] NormalizePrimeForm(int[] primeForm)

Parameters

primeForm int[]

Returns

int[]

Exceptions

ArgumentNullException

primeForm is null.

PrimeFormKey(int[])

The text key a catalogue stores a prime form under — its pitch classes folded, sorted and joined with commas, so "0,3,7" for a minor triad however its notes were given.

public static string PrimeFormKey(int[] primeForm)

Parameters

primeForm int[]

Returns

string

Remarks

Normalises first, the way TryGetByPrimeForm(int[], out PitchClassSetCatalogEntry?) and LoadJson(string) do before they call this. It used to fold without sorting, so a caller building their own index with it from [7, 3, 0] got "7,3,0" — a key the catalogue has never stored anything under, since it sorts on load — and every lookup through it missed.

Exceptions

ArgumentNullException

primeForm is null.

TryGetByPrimeForm(int[], out PitchClassSetCatalogEntry?)

Looks up the entry for a prime form, in whatever order and octave its pitch classes are given; the form is normalised before the lookup, so [7, 3, 0] finds the minor triad.

public bool TryGetByPrimeForm(int[] primeForm, out PitchClassSetCatalogEntry? entry)

Parameters

primeForm int[]
entry PitchClassSetCatalogEntry

Returns

bool

Exceptions

ArgumentNullException

primeForm is null.