Keys

Key lookup, mode detection, diatonic note sets, and sibling mode utilities.


Functions

diatonicNotes

diatonicNotes(key: string): ReadonlySet<string>

getKeyMode

getKeyMode(key: string): KeyMode

getKeyRoot

getKeyRoot(key: string): string

getRelativeMajor

getRelativeMajor(key: string): string | undefined

Maps any key to its ionian (major) sibling: - major key (degree 1): returns itself - dorian or other major-scale modes: returns the degree-1 entry with the same parent - harmonic_minor: returns the major key whose root is a minor third (3 semitones) above

getSiblingModes

getSiblingModes(key: string): string[]

Returns all keys in KEYS that belong to the same scale family (same parent root + same scaleFamily).

resolveKey

resolveKey(key: string): string

Converts a canonical key string (e.g. 'C major', 'A minor') to the short KEYS-object key (e.g. 'C', 'Am'). Leaves modal keys unchanged. Safe to call with already-short keys.


Types

KeyMode type

type KeyMode = "major" | "minor" | "dorian" | "aeolian" | "mixolydian"

ScaleFamily type

type ScaleFamily = "major" | "harmonic_minor"