Pitch Class Sets
Compare collections of notes
A pitch class set is a no repeated collection (set) of notes without octaves (pitch classes).
Pitch classes are useful to identify musical structures (if two chords are related, for example)
Properties
Pcset.get
get(src: note[] | string | number)
Given a collection of notes, a pitch class chroma string or a pitch class number, it returns a properties object with the following attributes:
- num: the set number. Each pitch class set can be represented by an unique name between 0 and 4096. Those are the possible combinations of 12 different elements (pitch classes)
- chroma: the set number as binary string
- intervals: the list of intervals starting from C
- length: the number of notes
Example:
It is possible to obtain the properties from chroma or set number. All this function calls returns the same object:
Several shorthands (num
, chroma
, intervals`) are provided:
Intervals are always calculated from C
:
Notes and intervals
Pcset.notes
notes(pcset: string | number | string[]) => string[]
Given a pcset or a list of notes, it returns the sorted pitch class notes:
Querying
Pcset.isIncludedIn
isIncludedIn(parent: Set) => (note: string) => boolean
Test if a note is included in the given set. This function is currified:
Keep in mind that enharmonics are included:
Pcset.isSubsetOf
isSubsetOf(parent: Set) => (subset: Set) => boolean
Test if a set is a subset of another. This function is currified
Pcset.isSupersetOf
isSupersetOf(subset: Set) => (parent: Set) => boolean
Test if a set is a superset of another. This function is currified