@tonaljs/key 4.12.4 → 4.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["roman"],"sources":["../index.ts"],"sourcesContent":["import { simplify, transpose, transposeFifths } from \"@tonaljs/note\";\nimport { accToAlt, altToAcc, note } from \"@tonaljs/pitch-note\";\nimport { get as roman } from \"@tonaljs/roman-numeral\";\n\nconst Empty: readonly string[] = Object.freeze([] as string[]);\n\nexport interface Key {\n readonly type: \"major\" | \"minor\";\n /** The tonic pitch class, like \"F\". Empty for an invalid key. */\n readonly tonic: string;\n /** Number of accidentals in the key signature: positive for sharps, negative for flats. */\n readonly alteration: number;\n /** The key signature as accidentals: \"\" (none), \"bb\" (two flats), \"###\" (three sharps). */\n readonly keySignature: string;\n}\n\nconst NoKey: Key = {\n type: \"major\",\n tonic: \"\",\n alteration: 0,\n keySignature: \"\",\n};\n\nexport interface KeyScale {\n readonly tonic: string;\n /** Roman numeral of each degree, like [\"I\", \"II\", \"bIII\", ...]. */\n readonly grades: readonly string[];\n /** Interval from the tonic to each degree, like [\"1P\", \"2M\", \"3M\", ...]. */\n readonly intervals: readonly string[];\n /** Notes of the scale, one per degree. */\n readonly scale: readonly string[];\n /** Triad of each degree, like [\"F\", \"Gm\", \"Am\", ...]. */\n readonly triads: readonly string[];\n /** Seventh chord of each degree, like [\"Fmaj7\", \"Gm7\", ...]. */\n readonly chords: readonly string[];\n /** Harmonic function of each chord: \"T\" (tonic), \"SD\" (subdominant) or \"D\" (dominant). Empty string if none. */\n readonly chordsHarmonicFunction: readonly string[];\n /** Scale that fits each chord, like [\"F major\", \"G dorian\", ...]. */\n readonly chordScales: readonly string[];\n /** Dominant seventh chord that resolves to each degree (\"\" if the degree has none), like [\"\", \"D7\", \"E7\", ...] for F major. */\n readonly secondaryDominants: readonly string[];\n /** The ii chord that precedes each secondary dominant (\"\" if none): a minor seventh, or a half-diminished chord when the target is minor. */\n readonly secondaryDominantSupertonics: readonly string[];\n /** Tritone substitution of each secondary dominant (\"\" if none): the dominant seventh a tritone away, spelled a diminished fifth above it (Gb7 for C7) unless that needs a double flat or sharp (A7, not Bbb7, for Eb7). */\n readonly substituteDominants: readonly string[];\n /** The minor seventh ii chord that precedes each substitute dominant (\"\" if none). */\n readonly substituteDominantSupertonics: readonly string[];\n\n /** @deprecated use secondaryDominantSupertonics */\n readonly secondaryDominantsMinorRelative: readonly string[];\n /** @deprecated use substituteDominantSupertonics */\n readonly substituteDominantsMinorRelative: readonly string[];\n}\n\nconst NoKeyScale: KeyScale = {\n tonic: \"\",\n grades: Empty,\n intervals: Empty,\n scale: Empty,\n triads: Empty,\n chords: Empty,\n chordsHarmonicFunction: Empty,\n chordScales: Empty,\n secondaryDominants: Empty,\n secondaryDominantSupertonics: Empty,\n substituteDominantsMinorRelative: Empty,\n substituteDominants: Empty,\n substituteDominantSupertonics: Empty,\n secondaryDominantsMinorRelative: Empty,\n};\n\nexport interface MajorKey extends Key, KeyScale {\n readonly type: \"major\";\n /** Tonic of the relative minor key, like \"D\" for \"F\". */\n readonly minorRelative: string;\n readonly scale: readonly string[];\n readonly substituteDominants: readonly string[];\n readonly secondaryDominantSupertonics: readonly string[];\n /** @deprecated use substituteDominantSupertonics */\n readonly substituteDominantsMinorRelative: readonly string[];\n}\n\nconst NoMajorKey: MajorKey = {\n ...NoKey,\n ...NoKeyScale,\n type: \"major\",\n minorRelative: \"\",\n scale: Empty,\n substituteDominants: Empty,\n secondaryDominantSupertonics: Empty,\n substituteDominantsMinorRelative: Empty,\n};\n\nexport interface MinorKey extends Key {\n readonly type: \"minor\";\n /** Tonic of the relative major key, like \"C\" for \"A\". */\n readonly relativeMajor: string;\n /** Natural minor (aeolian) scale and its chords. */\n readonly natural: KeyScale;\n /** Harmonic minor scale and its chords. */\n readonly harmonic: KeyScale;\n /** Melodic minor (ascending) scale and its chords. */\n readonly melodic: KeyScale;\n}\n\nconst NoMinorKey: MinorKey = {\n ...NoKey,\n type: \"minor\",\n relativeMajor: \"\",\n natural: NoKeyScale,\n harmonic: NoKeyScale,\n melodic: NoKeyScale,\n};\n\nexport type KeyChord = {\n /** Chord symbol, like \"Dm7\". */\n name: string;\n /** Functions the chord plays in the key: \"T\", \"SD\", \"D\", or \"V/II\", \"ii/V\", \"subV/II\", \"subii/II\" for secondary and substitute dominants. */\n roles: string[];\n};\n\nconst mapScaleToType = (scale: string[], list: string[], sep = \"\") =>\n list.map((type, i) => `${scale[i]}${sep}${type}`);\n\nfunction keyScale(\n grades: string[],\n triads: string[],\n chordTypes: string[],\n harmonicFunctions: string[],\n chordScales: string[],\n) {\n return (tonic: string): KeyScale => {\n const intervals = grades.map((gr) => roman(gr).interval || \"\");\n const scale = intervals.map((interval) => transpose(tonic, interval));\n const chords = mapScaleToType(scale, chordTypes);\n const secondaryDominants = scale\n .map((note) => transpose(note, \"5P\"))\n .map((note) =>\n // A secondary dominant is a V chord which:\n // 1. is not diatonic to the key,\n // 2. it must have a diatonic root.\n scale.includes(note) && !chords.includes(note + \"7\") ? note + \"7\" : \"\",\n );\n\n const secondaryDominantSupertonics = supertonics(\n secondaryDominants,\n triads,\n );\n const substituteDominants = secondaryDominants.map((chord) =>\n chord ? substituteRoot(chord.slice(0, -1)) + \"7\" : \"\",\n );\n const substituteDominantSupertonics =\n substituteSupertonics(substituteDominants);\n\n return {\n tonic,\n grades,\n intervals,\n scale,\n triads: mapScaleToType(scale, triads),\n chords,\n chordsHarmonicFunction: harmonicFunctions.slice(),\n chordScales: mapScaleToType(scale, chordScales, \" \"),\n secondaryDominants,\n secondaryDominantSupertonics,\n substituteDominants,\n substituteDominantSupertonics,\n\n // deprecated aliases\n secondaryDominantsMinorRelative: secondaryDominantSupertonics,\n substituteDominantsMinorRelative: substituteDominantSupertonics,\n };\n };\n}\n\n// The root of a substitute dominant: a diminished fifth above the dominant's\n// root (Gb for C), or its simplest enharmonic when that has a double\n// accidental, as a lead sheet writes it (A, not Bbb, for Eb)\nfunction substituteRoot(dominantRoot: string) {\n const root = transpose(dominantRoot, \"5d\");\n return note(root).acc.length > 1 ? simplify(root) : root;\n}\n\n// The root of the ii chord of a dominant: a fifth above its root\nconst supertonicRoot = (dominant: string) =>\n transpose(dominant.slice(0, -1), \"5P\");\n\n// The ii of a secondary dominant takes its quality from the target: a ii-V\n// into a minor or diminished chord uses a half-diminished ii (Em7b5 A7 Dm),\n// and into a major or augmented chord a minor seventh ii (Gm7 C7 F)\nconst supertonics = (dominants: string[], targetTriads: string[]) =>\n dominants.map((chord, index) => {\n if (!chord) return \"\";\n const target = targetTriads[index];\n const isMinor = target === \"m\" || target === \"dim\";\n return supertonicRoot(chord) + (isMinor ? \"m7b5\" : \"m7\");\n });\n\n// A substitute dominant doesn't resolve to the key it points to (Eb7 resolves\n// to Dm, not Ab), so its ii is always a minor seventh: Bbm7 Eb7 Dm\nconst substituteSupertonics = (dominants: string[]) =>\n dominants.map((chord) => (chord ? supertonicRoot(chord) + \"m7\" : \"\"));\n\nconst distInFifths = (from: string, to: string) => {\n const f = note(from);\n const t = note(to);\n return f.empty || t.empty ? 0 : t.coord[0] - f.coord[0];\n};\n\nconst MajorScale = keyScale(\n \"I II III IV V VI VII\".split(\" \"),\n \" m m m dim\".split(\" \"),\n \"maj7 m7 m7 maj7 7 m7 m7b5\".split(\" \"),\n \"T SD T SD D T D\".split(\" \"),\n \"major,dorian,phrygian,lydian,mixolydian,minor,locrian\".split(\",\"),\n);\nconst NaturalScale = keyScale(\n \"I II bIII IV V bVI bVII\".split(\" \"),\n \"m dim m m \".split(\" \"),\n \"m7 m7b5 maj7 m7 m7 maj7 7\".split(\" \"),\n \"T SD T SD D SD SD\".split(\" \"),\n \"minor,locrian,major,dorian,phrygian,lydian,mixolydian\".split(\",\"),\n);\nconst HarmonicScale = keyScale(\n \"I II bIII IV V bVI VII\".split(\" \"),\n \"m dim aug m dim\".split(\" \"),\n \"mMaj7 m7b5 +maj7 m7 7 maj7 o7\".split(\" \"),\n \"T SD T SD D SD D\".split(\" \"),\n \"harmonic minor,locrian 6,major augmented,dorian #4,phrygian dominant,lydian #9,ultralocrian\".split(\n \",\",\n ),\n);\nconst MelodicScale = keyScale(\n \"I II bIII IV V VI VII\".split(\" \"),\n \"m m aug dim dim\".split(\" \"),\n \"m6 m7 +maj7 7 7 m7b5 m7b5\".split(\" \"),\n \"T SD T SD D \".split(\" \"),\n \"melodic minor,dorian b2,lydian augmented,lydian dominant,mixolydian b6,locrian #2,altered\".split(\n \",\",\n ),\n);\n\n/**\n * Get a major key: its signature, scale, triads, seventh chords, harmonic\n * functions and secondary and substitute dominants. For an invalid tonic\n * it returns a key with empty strings and arrays.\n *\n * @param tonic - the tonic note or pitch class, like \"F\" or \"Bb\"\n * @example\n * Key.majorKey(\"F\").scale; // => [\"F\", \"G\", \"A\", \"Bb\", \"C\", \"D\", \"E\"]\n * Key.majorKey(\"F\").chords; // => [\"Fmaj7\", \"Gm7\", \"Am7\", \"Bbmaj7\", \"C7\", \"Dm7\", \"Em7b5\"]\n * Key.majorKey(\"F\").keySignature; // => \"b\"\n */\nexport function majorKey(tonic: string): MajorKey {\n const pc = note(tonic).pc;\n if (!pc) return NoMajorKey;\n\n const keyScale = MajorScale(pc);\n const alteration = distInFifths(\"C\", pc);\n\n return {\n ...keyScale,\n type: \"major\",\n minorRelative: transpose(pc, \"-3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n };\n}\n\n/**\n * Get the chords available in a major key, each with the roles it plays:\n * diatonic chords (\"T\", \"SD\", \"D\") and secondary and substitute dominants\n * with their supertonics (\"V/II\", \"ii/V\", \"subV/II\"...). Returns an empty\n * array for an invalid tonic.\n *\n * @param tonic - the tonic note or pitch class, like \"C\"\n * @returns array of { name: string, roles: string[] }\n * @example\n * Key.majorKeyChords(\"C\").slice(0, 3); // => [{ name: \"Cmaj7\", roles: [\"T\"] }, { name: \"Dm7\", roles: [\"SD\"] }, { name: \"Em7\", roles: [\"T\"] }]\n */\nexport function majorKeyChords(tonic: string): KeyChord[] {\n const key = majorKey(tonic);\n const chords: KeyChord[] = [];\n keyChordsOf(key, chords);\n return chords;\n}\n\n/**\n * Get the chords available in a minor key, each with the roles it plays. It\n * merges the chords of the natural, harmonic and melodic scales, so a chord\n * that appears in several scales has all its roles. Returns an empty array\n * for an invalid tonic.\n *\n * @param tonic - the tonic note or pitch class, like \"A\"\n * @returns array of { name: string, roles: string[] }\n * @example\n * Key.minorKeyChords(\"A\").slice(0, 2); // => [{ name: \"Am7\", roles: [\"T\", \"ii/bVII\"] }, { name: \"Bm7b5\", roles: [\"SD\", \"ii/I\"] }]\n */\nexport function minorKeyChords(tonic: string): KeyChord[] {\n const key = minorKey(tonic);\n const chords: KeyChord[] = [];\n keyChordsOf(key.natural, chords);\n keyChordsOf(key.harmonic, chords);\n keyChordsOf(key.melodic, chords);\n return chords;\n}\n\nfunction keyChordsOf(key: KeyScale, chords: KeyChord[]) {\n const updateChord = (name: string, newRole: string) => {\n if (!name) return;\n let keyChord = chords.find((chord) => chord.name === name);\n if (!keyChord) {\n keyChord = { name, roles: [] };\n chords.push(keyChord);\n }\n if (newRole && !keyChord.roles.includes(newRole)) {\n keyChord.roles.push(newRole);\n }\n };\n\n key.chords.forEach((chordName, index) =>\n updateChord(chordName, key.chordsHarmonicFunction[index]),\n );\n key.secondaryDominants.forEach((chordName, index) =>\n updateChord(chordName, `V/${key.grades[index]}`),\n );\n key.secondaryDominantSupertonics.forEach((chordName, index) =>\n updateChord(chordName, `ii/${key.grades[index]}`),\n );\n key.substituteDominants.forEach((chordName, index) =>\n updateChord(chordName, `subV/${key.grades[index]}`),\n );\n key.substituteDominantSupertonics.forEach((chordName, index) =>\n updateChord(chordName, `subii/${key.grades[index]}`),\n );\n}\n\n/**\n * Get a minor key: its signature, relative major and the scale, chords and\n * dominants of its natural, harmonic and melodic forms. For an invalid tonic\n * it returns a key with empty strings and arrays.\n *\n * @param tnc - the tonic note or pitch class, like \"A\"\n * @example\n * Key.minorKey(\"A\").relativeMajor; // => \"C\"\n * Key.minorKey(\"A\").harmonic.scale; // => [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G#\"]\n * Key.minorKey(\"A\").natural.chords; // => [\"Am7\", \"Bm7b5\", \"Cmaj7\", \"Dm7\", \"Em7\", \"Fmaj7\", \"G7\"]\n */\nexport function minorKey(tnc: string): MinorKey {\n const pc = note(tnc).pc;\n if (!pc) return NoMinorKey;\n\n const alteration = distInFifths(\"C\", pc) - 3;\n return {\n type: \"minor\",\n tonic: pc,\n relativeMajor: transpose(pc, \"3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n natural: NaturalScale(pc),\n harmonic: HarmonicScale(pc),\n melodic: MelodicScale(pc),\n };\n}\n\n/**\n * Get the tonic of the major key with the given key signature, or null if\n * the signature is not valid.\n *\n * @param sig - accidentals (\"\", \"bb\", \"###\") or a number of fifths (positive for sharps, negative for flats)\n * @example\n * Key.majorTonicFromKeySignature(\"###\"); // => \"A\"\n * Key.majorTonicFromKeySignature(-2); // => \"Bb\"\n * Key.majorTonicFromKeySignature(\"\"); // => \"C\"\n */\nexport function majorTonicFromKeySignature(\n sig: string | number,\n): string | null {\n if (typeof sig === \"number\") {\n return transposeFifths(\"C\", sig);\n } else if (typeof sig === \"string\" && /^(b*|#*)$/.test(sig)) {\n return transposeFifths(\"C\", accToAlt(sig));\n }\n return null;\n}\n\n/** @deprecated Use the named exports instead. */\nexport default { majorKey, majorTonicFromKeySignature, minorKey };\n"],"mappings":";;;;AAIA,MAAM,QAA2B,OAAO,OAAO,CAAC,CAAa;AAY7D,MAAM,QAAa;CACjB,MAAM;CACN,OAAO;CACP,YAAY;CACZ,cAAc;AAChB;AAiCA,MAAM,aAAuB;CAC3B,OAAO;CACP,QAAQ;CACR,WAAW;CACX,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,wBAAwB;CACxB,aAAa;CACb,oBAAoB;CACpB,8BAA8B;CAC9B,kCAAkC;CAClC,qBAAqB;CACrB,+BAA+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A8B,SAAS,WAAW,UACpD,YAAY,WAAW,SAAS,IAAI,OAAO,QAAQ,CACrD;AACF;;;;;;;;;;;;AAaA,SAAgB,SAAS,KAAuB;CAC9C,MAAM,KAAK,KAAK,GAAG,CAAC,CAAC;CACrB,IAAI,CAAC,IAAI,OAAO;CAEhB,MAAM,aAAa,aAAa,KAAK,EAAE,IAAI;CAC3C,OAAO;EACL,MAAM;EACN,OAAO;EACP,eAAe,UAAU,IAAI,IAAI;EACjC;EACA,cAAc,SAAS,UAAU;EACjC,SAAS,aAAa,EAAE;EACxB,UAAU,cAAc,EAAE;EAC1B,SAAS,aAAa,EAAE;CAC1B;AACF;;;;;;;;;;;AAYA,SAAgB,2BACd,KACe;CACf,IAAI,OAAO,QAAQ,UACjB,OAAO,gBAAgB,KAAK,GAAG;MAC1B,IAAI,OAAO,QAAQ,YAAY,YAAY,KAAK,GAAG,GACxD,OAAO,gBAAgB,KAAK,SAAS,GAAG,CAAC;CAE3C,OAAO;AACT;;AAGA,IAAA,cAAe;CAAE;CAAU;CAA4B;AAAS"}
1
+ {"version":3,"file":"index.mjs","names":["getChord","scaleType","roman","getChord","roman","chordSubstitutes","getChord","roman"],"sources":["../analyze.ts","../substitutes.ts","../pivot.ts","../index.ts"],"sourcesContent":["import {\n get as getChord,\n chordScale,\n chordScales,\n tokenize,\n} from \"@tonaljs/chord\";\nimport { transpose } from \"@tonaljs/note\";\nimport { distance } from \"@tonaljs/pitch-distance\";\nimport { interval } from \"@tonaljs/pitch-interval\";\nimport { note } from \"@tonaljs/pitch-note\";\nimport { fromRomanNumerals } from \"@tonaljs/progression\";\nimport { get as roman } from \"@tonaljs/roman-numeral\";\nimport { get as scaleType } from \"@tonaljs/scale-type\";\nimport type { KeyScale } from \"./index\";\n\n/** Where a reading of a chord in a key comes from. */\nexport type ChordSource =\n | \"diatonic\"\n | \"secondary dominant\"\n | \"tritone substitute\"\n | \"related ii\"\n | \"borrowed\"\n | \"backdoor\"\n | \"passing diminished\"\n | \"common-tone diminished\"\n | \"chromatic\";\n\n/** One reading of a chord in a key, as returned by `Key.analyzeChord`. */\nexport interface ChordReading {\n /** The chord as given, like \"A7\". */\n chord: string;\n /** The reading as the books write it: \"ii7\", \"V7/ii\", \"subV7/I\", \"ii7/V\", \"bVIImaj7\". */\n numeral: string;\n /** The chord's numeral on the key's tonic, like \"VI7\" for \"A7\" in C. */\n degree: string;\n /** Where the reading comes from: \"diatonic\", \"secondary dominant\", \"borrowed\"... */\n source: ChordSource;\n /** Harmonic function: \"T\" (tonic), \"SD\" (subdominant), \"D\" (dominant) or \"\". */\n function: \"T\" | \"SD\" | \"D\" | \"\";\n /** The scale the chord comes from, like \"C harmonic minor\" or \"C mixolydian\"; \"\" if none. */\n scale: string;\n /** The numeral the chord leads to, like \"ii\" for \"V7/ii\"; \"\" if none. */\n target: string;\n /** With a target and a next chord: \"functioning\" if the next chord is on the target, \"non-functioning\" if not; \"\" otherwise. */\n resolution: \"functioning\" | \"non-functioning\" | \"\";\n /** The chord scale for this reading, like \"A mixolydian b6\". */\n chordScale: string;\n}\n\n/** Options of `Key.analyzeChord`. */\nexport interface AnalyzeChordOptions {\n /** The chord before, like \"Em7\". */\n previous?: string;\n /** The chord after, like \"Dm7\". */\n next?: string;\n}\n\ntype KeyForms = {\n tonic: string;\n minor: boolean;\n /** The key's own scales: major, or natural, harmonic and melodic minor. */\n own: Source[];\n /** Parallel scales a chord can be borrowed from, in order. */\n parallel: Source[];\n /** The key's chord on each degree, for the case of a target. */\n triads: string[];\n grades: readonly string[];\n scale: readonly string[];\n};\n\ntype Source = {\n name: string;\n notes: readonly string[];\n functions: readonly string[];\n /** A mode, not a key: only a source when nothing else reads the chord. */\n mode?: boolean;\n};\n\ntype Parsed = {\n name: string;\n root: string;\n type: string;\n quality: string;\n family: string;\n intervals: string[];\n notes: string[];\n chromas: number[];\n symbol: string;\n};\n\nconst MODES = [\"dorian\", \"phrygian\", \"lydian\", \"mixolydian\", \"locrian\"];\n\nconst SOURCE_ORDER: ChordSource[] = [\n \"diatonic\",\n \"secondary dominant\",\n \"related ii\",\n \"borrowed\",\n \"tritone substitute\",\n \"backdoor\",\n \"passing diminished\",\n \"common-tone diminished\",\n \"chromatic\",\n];\n\nconst NEEDS_NEIGHBOUR: ChordSource[] = [\n \"related ii\",\n \"backdoor\",\n \"passing diminished\",\n \"common-tone diminished\",\n];\n\nconst chroma = (name: string) => note(name).chroma;\nconst mod12 = (n: number) => ((n % 12) + 12) % 12;\n\nexport function parse(name: string | undefined): Parsed | undefined {\n if (typeof name !== \"string\") return undefined;\n const [root, type] = tokenize(name);\n if (!root) return undefined;\n const symbol = root + type;\n const chord = getChord(symbol);\n if (chord.empty || !chord.notes.length) return undefined;\n return {\n name,\n root: chord.tonic ?? root,\n type,\n quality: chord.quality,\n family: chord.family,\n intervals: chord.intervals,\n notes: chord.notes,\n chromas: chord.notes.map(chroma),\n symbol,\n };\n}\n\nfunction scaleNotes(tonic: string, type: string): string[] {\n return scaleType(type).intervals.map((ivl) => transpose(tonic, ivl));\n}\n\nexport function keyForms(\n key: string,\n majorKey: (tonic: string) => KeyScale,\n minorKey: (tonic: string) => {\n natural: KeyScale;\n harmonic: KeyScale;\n melodic: KeyScale;\n },\n): KeyForms | undefined {\n if (typeof key !== \"string\") return undefined;\n const [tonicName, type = \"major\", ...rest] = key.trim().split(/\\s+/);\n if (rest.length || (type !== \"major\" && type !== \"minor\")) return undefined;\n const tonic = note(tonicName).pc;\n if (!tonic) return undefined;\n\n const major = majorKey(tonic);\n const minor = minorKey(tonic);\n const fromKey = (name: string, scale: KeyScale): Source => ({\n name: `${tonic} ${name}`,\n notes: scale.scale,\n functions: scale.chordsHarmonicFunction,\n });\n const majorSource = fromKey(\"major\", major);\n const minorSources = [\n fromKey(\"minor\", minor.natural),\n fromKey(\"harmonic minor\", minor.harmonic),\n fromKey(\"melodic minor\", minor.melodic),\n ];\n // the modes closest to the key first (fewest notes outside it), and among\n // them the flatter one: mixolydian before lydian in a major key\n const main = type === \"major\" ? major.scale : minor.natural.scale;\n const outside = (notes: string[]) =>\n notes.filter((n) => !main.includes(n)).length;\n const flats = (notes: string[]) =>\n notes.reduce((sum, n) => sum + note(n).alt, 0);\n const modes = MODES.map((mode) => ({\n name: `${tonic} ${mode}`,\n notes: scaleNotes(tonic, mode),\n functions: [] as string[],\n mode: true,\n })).sort(\n (a, b) =>\n outside(a.notes) - outside(b.notes) || flats(a.notes) - flats(b.notes),\n );\n\n if (type === \"major\") {\n return {\n tonic,\n minor: false,\n own: [majorSource],\n parallel: [...minorSources, ...modes],\n triads: [\"\", \"m\", \"m\", \"\", \"\", \"m\", \"dim\"],\n grades: major.grades,\n scale: major.scale,\n };\n }\n return {\n tonic,\n minor: true,\n own: minorSources,\n parallel: [majorSource, ...modes],\n // natural minor triads, with the major V of the harmonic form\n triads: [\"m\", \"dim\", \"\", \"m\", \"\", \"\", \"\"],\n grades: minor.natural.grades,\n scale: minor.natural.scale,\n };\n}\n\n// The roman numeral of a root on the tonic: \"bVII\", \"#IV\"\nfunction degreeOf(tonic: string, root: string): string {\n return roman(interval(distance(tonic, root))).name ?? \"\";\n}\n\nconst isLower = (chord: Parsed) =>\n chord.quality === \"Minor\" || chord.quality === \"Diminished\";\n\nconst isAscii = (s: string) => /^[\\x20-\\x7e]*$/.test(s);\n\n// The chord type written after a numeral: as written after an uppercase\n// numeral, and after a lowercase one the spelling that gives the chord back\n// with Progression.fromRomanNumerals: the written type without its leading\n// \"m\", or an alias without it, or the shortest alias\nfunction typeAfter(chord: Parsed): string {\n if (!isLower(chord)) return chord.type;\n const target = getChord(\"C\" + chord.type).chroma;\n const works = (suffix: string) => {\n const [back] = fromRomanNumerals(\"C\", [\"i\" + suffix]);\n return !!back && getChord(back).chroma === target;\n };\n const strip = (s: string) => s.replace(/^(m(?!aj)|-)/, \"\");\n const aliases = getChord(\"C\" + chord.type).aliases.filter(isAscii);\n const written = strip(chord.type);\n if (written !== chord.type && works(written)) return written;\n const stripped = aliases.filter((a) => strip(a) !== a).map(strip);\n const first = stripped.find(works);\n if (first !== undefined) return first;\n const shortest = [...aliases].sort((a, b) => a.length - b.length).find(works);\n return shortest ?? chord.type;\n}\n\nexport function numeralOf(tonic: string, chord: Parsed): string {\n const degree = degreeOf(tonic, chord.root);\n if (!degree) return \"\";\n return (isLower(chord) ? degree.toLowerCase() : degree) + typeAfter(chord);\n}\n\nconst inScale = (chord: Parsed, notes: readonly string[]) =>\n chord.notes.every((n) => notes.includes(n));\n\nconst isDominant = (chord: Parsed) => chord.family === \"dominant\";\nconst isMajorTriad = (chord: Parsed) =>\n chord.intervals.length === 3 &&\n chord.intervals.includes(\"3M\") &&\n chord.intervals.includes(\"5P\");\nconst isDim7 = (chord: Parsed) =>\n chord.intervals.length === 4 &&\n [\"3m\", \"5d\", \"7d\"].every((i) => chord.intervals.includes(i));\nconst isTwo = (chord: Parsed) =>\n chord.intervals.includes(\"3m\") && chord.intervals.includes(\"7m\");\n\ntype Target = { root: string; numeral: string; minor: boolean };\n\n// The targets of secondary dominants: every degree but the tonic whose chord\n// in the key is a major or minor triad\nfunction targets(key: KeyForms): Target[] {\n return key.scale\n .map((root, i) => {\n const triad = key.triads[i];\n const grade = key.grades[i];\n const minor = triad === \"m\";\n return { root, minor, numeral: minor ? grade.toLowerCase() : grade, i };\n })\n .filter((t) => t.i > 0 && key.triads[t.i] !== \"dim\")\n .map(({ root, numeral, minor }) => ({ root, numeral, minor }));\n}\n\nfunction tonicTarget(key: KeyForms): Target {\n return {\n root: key.tonic,\n numeral: key.minor ? \"i\" : \"I\",\n minor: key.minor,\n };\n}\n\n// The numeral of a degree of the key, with the case of the next chord when\n// given, or of the key's chord on it\nfunction targetOn(key: KeyForms, root: string, chord?: Parsed): string {\n const index = key.scale.findIndex((n) => chroma(n) === chroma(root));\n if (index === -1) return \"\";\n const grade = key.grades[index];\n const lower = chord ? isLower(chord) : key.triads[index] === \"m\";\n return lower ? grade.toLowerCase() : grade;\n}\n\nfunction resolution(\n targetRoot: string,\n next: Parsed | undefined,\n): ChordReading[\"resolution\"] {\n if (!next) return \"\";\n return chroma(next.root) === chroma(targetRoot)\n ? \"functioning\"\n : \"non-functioning\";\n}\n\nconst lydianDominant = (chord: Parsed, key: string) =>\n chordScales(chord.symbol).includes(\"lydian dominant\")\n ? `${chord.root} lydian dominant`\n : chordScale(chord.symbol, { key });\n\nfunction secondaryDominants(key: KeyForms, chord: Parsed): Target[] {\n if (!isDominant(chord) && !isMajorTriad(chord)) return [];\n return targets(key).filter((t) => transpose(t.root, \"5P\") === chord.root);\n}\n\nexport function analyze(\n key: KeyForms,\n chordName: string,\n options: AnalyzeChordOptions = {},\n): ChordReading[] {\n const chord = parse(chordName);\n if (!chord) return [];\n const next = parse(options.next);\n const previous = parse(options.previous);\n const keyName = `${key.tonic} ${key.minor ? \"minor\" : \"major\"}`;\n const degree = numeralOf(key.tonic, chord);\n const readings: ChordReading[] = [];\n const add = ({\n source,\n ...reading\n }: Partial<ChordReading> & Pick<ChordReading, \"source\">) =>\n readings.push({\n chord: chordName,\n numeral: degree,\n degree,\n source,\n function: \"\",\n scale: \"\",\n target: \"\",\n resolution: \"\",\n chordScale: chordScale(chord.symbol, { key: keyName }),\n ...reading,\n });\n\n // 1. diatonic\n const own = key.own.find(\n (s) => inScale(chord, s.notes) && s.notes.includes(chord.root),\n );\n if (own) {\n const index = own.notes.indexOf(chord.root);\n let fn = (own.functions[index] ?? \"\") as ChordReading[\"function\"];\n // vi before V (vi V I) leans to the subdominant\n if (\n !key.minor &&\n index === 5 &&\n next &&\n chroma(next.root) === chroma(key.scale[4])\n ) {\n fn = \"SD\";\n }\n add({\n source: \"diatonic\",\n function: fn,\n scale: own.name,\n chordScale: chordScale(chord.symbol, { key: own.name }),\n });\n }\n\n if (!own) {\n // 2. secondary dominants\n for (const t of secondaryDominants(key, chord)) {\n add({\n source: \"secondary dominant\",\n numeral: `V${chord.type}/${t.numeral}`,\n function: \"D\",\n target: t.numeral,\n resolution: resolution(t.root, next),\n });\n }\n\n // 3. tritone substitutes\n if (isDominant(chord)) {\n for (const t of [tonicTarget(key), ...targets(key)]) {\n if (mod12(chroma(t.root) + 1) !== chroma(chord.root)) continue;\n add({\n source: \"tritone substitute\",\n numeral: `subV${chord.type}/${t.numeral}`,\n function: \"D\",\n target: t.numeral,\n resolution: resolution(t.root, next),\n chordScale: lydianDominant(chord, keyName),\n });\n }\n }\n }\n\n // 4. related ii: before a secondary dominant\n if (next && isTwo(chord) && transpose(next.root, \"5P\") === chord.root) {\n const nextTargets = key.own.some(\n (s) => inScale(next, s.notes) && s.notes.includes(next.root),\n )\n ? []\n : secondaryDominants(key, next);\n for (const t of nextTargets) {\n add({\n source: \"related ii\",\n numeral: `ii${typeAfter(chord)}/${t.numeral}`,\n function: \"SD\",\n target: t.numeral,\n resolution: \"functioning\",\n chordScale: chordScale(chord.symbol, {\n key: `${t.root} ${t.minor ? \"minor\" : \"major\"}`,\n }),\n });\n }\n }\n\n // 6. backdoor: a dominant a whole step below the tonic, before the tonic\n if (\n next &&\n isDominant(chord) &&\n mod12(chroma(key.tonic) - 2) === chroma(chord.root) &&\n chroma(next.root) === chroma(key.tonic)\n ) {\n add({\n source: \"backdoor\",\n function: \"D\",\n target: key.minor ? \"i\" : \"I\",\n resolution: \"functioning\",\n chordScale: lydianDominant(chord, keyName),\n });\n }\n\n if (isDim7(chord)) {\n const onDegree = (c: Parsed) =>\n key.own.some((s) => s.notes.some((n) => chroma(n) === chroma(c.root)));\n\n // 7. passing diminished: up a half step to a degree of the key, a\n // rootless dominant 7b9 of it (C#o7 Dm7)\n if (\n next &&\n onDegree(next) &&\n chord.chromas.includes(mod12(chroma(next.root) - 1))\n ) {\n const target = targetOn(key, next.root, next);\n const tonic = chroma(next.root) === chroma(key.tonic);\n add({\n source: \"passing diminished\",\n numeral: tonic\n ? `vii${typeAfter(chord)}`\n : `vii${typeAfter(chord)}/${target}`,\n function: \"D\",\n target,\n resolution: \"functioning\",\n chordScale: chordScale(chord.symbol),\n });\n }\n\n // 7b. passing diminished between two chords a whole step apart, going\n // down (Em7 Ebo7 Dm7)\n if (\n previous &&\n next &&\n onDegree(next) &&\n chroma(previous.root) === mod12(chroma(chord.root) + 1) &&\n chroma(next.root) === mod12(chroma(chord.root) - 1)\n ) {\n add({\n source: \"passing diminished\",\n target: targetOn(key, next.root, next),\n resolution: \"functioning\",\n chordScale: chordScale(chord.symbol),\n });\n }\n\n // common-tone diminished: on the root of the chord next to it (C Co7 C)\n const embellished = [next, previous].find(\n (c) => c && onDegree(c) && chroma(c.root) === chroma(chord.root),\n );\n if (embellished) {\n add({\n source: \"common-tone diminished\",\n target: targetOn(key, embellished.root, embellished),\n resolution: next\n ? chroma(next.root) === chroma(chord.root)\n ? \"functioning\"\n : \"non-functioning\"\n : \"\",\n chordScale: chordScale(chord.symbol),\n });\n }\n }\n\n if (!own) {\n // 5. borrowed: from the parallel key, or from a parallel mode when\n // nothing else reads the chord\n const source = key.parallel.find(\n (s) =>\n (!s.mode || !readings.length) &&\n inScale(chord, s.notes) &&\n s.notes.includes(chord.root),\n );\n if (source) {\n const index = source.notes.indexOf(chord.root);\n add({\n source: \"borrowed\",\n function: (source.functions[index] ?? \"\") as ChordReading[\"function\"],\n scale: source.name,\n chordScale: chordScale(chord.symbol, { key: source.name }),\n });\n }\n }\n\n // 8. chromatic\n if (!readings.length) add({ source: \"chromatic\" });\n\n // a secondary dominant after its related ii is confirmed (Em7b5 A7)\n const afterTwo =\n previous &&\n isTwo(previous) &&\n transpose(chord.root, \"5P\") === previous.root;\n\n const confirmed = (r: ChordReading) =>\n r.resolution === \"functioning\" ||\n NEEDS_NEIGHBOUR.includes(r.source) ||\n (!!afterTwo && r.source === \"secondary dominant\");\n\n return readings\n .map((r, i) => ({ r, i }))\n .sort(\n (a, b) =>\n Number(confirmed(b.r)) - Number(confirmed(a.r)) ||\n SOURCE_ORDER.indexOf(a.r.source) - SOURCE_ORDER.indexOf(b.r.source) ||\n a.i - b.i,\n )\n .map(({ r }) => r);\n}\n","import {\n get as getChord,\n substitutes as chordSubstitutes,\n type Substitute,\n type SubstituteKind,\n} from \"@tonaljs/chord\";\nimport { transpose } from \"@tonaljs/note\";\nimport { note } from \"@tonaljs/pitch-note\";\nimport { get as roman } from \"@tonaljs/roman-numeral\";\nimport { keyForms, numeralOf, parse } from \"./analyze\";\nimport type { KeyScale } from \"./index\";\n\n/** A chord borrowed from a parallel scale, as returned by `Key.borrowedChords`. */\nexport interface BorrowedChord {\n /** The chord, like \"Abmaj7\". */\n chord: string;\n /** Its numeral in the key, like \"bVImaj7\". */\n numeral: string;\n /** The scale it comes from, like \"C minor\" or \"C phrygian\". */\n from: string;\n /** The numerals of the key's chords it replaces, like [\"iv\"]. */\n replaces: string[];\n}\n\n/** The kind of a substitute in a key, as returned by `Key.substitutes`. */\nexport type KeySubstituteKind = SubstituteKind | \"diatonic\" | \"borrowed\";\n\n/** A substitute in a key: the chords that take a chord's place, and its kind. */\nexport interface KeySubstitute {\n chords: string[];\n kind: KeySubstituteKind;\n}\n\n/** Options of `Key.substitutes`. */\nexport interface KeySubstitutesOptions {\n /** The chord after, like \"Dm7\": adds the approach chords to it. */\n next?: string;\n /** Only these kinds, like [\"diatonic\", \"borrowed\"]. */\n kinds?: KeySubstituteKind[];\n /**\n * The related ii is an m7b5. By default, when the dominant's target (a 4th\n * up) is a minor chord of the key, or the dominant has a b9.\n */\n minor?: boolean;\n}\n\n// The same pitch classes (a chord's `chroma` is its type's, from the root)\nconst pcs = (name: string) =>\n getChord(name)\n .notes.map((n) => note(n).chroma)\n .sort((a, b) => a - b)\n .join(\",\");\n\ntype Borrowing = [ivl: string, type: string, from: string, replaces: string[]];\n\n// Pease, Jazz Composition (pp. 75-76): modal interchange into a major key\nconst INTO_MAJOR: Borrowing[] = [\n [\"2M\", \"m7b5\", \"minor\", [\"ii7\"]],\n [\"3m\", \"maj7\", \"minor\", [\"IV\", \"V7\"]],\n [\"4P\", \"m7\", \"minor\", [\"IV\"]],\n [\"4P\", \"m6\", \"minor\", [\"IV\"]],\n [\"5P\", \"m7\", \"minor\", [\"V7\"]],\n [\"6m\", \"maj7\", \"minor\", [\"iv\"]],\n [\"7m\", \"7\", \"minor\", [\"iv\"]],\n [\"2m\", \"maj7\", \"phrygian\", [\"iv\"]],\n [\"7m\", \"maj7\", \"mixolydian\", [\"IV\"]],\n [\"1P\", \"maj7#11\", \"lydian\", [\"I\"]],\n];\n\n// Into a minor key, from the parallel major: Jazzology (ch. 7, \"Modal\n// Interchange in Minor Keys\"): the major tonic (Picardy 3rd), the most\n// common, and the ii7 for the ii7b5; Pease (Jazz Composition, p. 76): the\n// IVmaj7 for the IV7 (from major into Dorian)\nconst INTO_MINOR: Borrowing[] = [\n [\"1P\", \"maj7\", \"major\", [\"i\"]],\n [\"2M\", \"m7\", \"major\", [\"ii7b5\"]],\n [\"4P\", \"maj7\", \"major\", [\"IV7\"]],\n];\n\ntype KeyFns = {\n majorKey: (tonic: string) => KeyScale;\n minorKey: (tonic: string) => { natural: KeyScale };\n};\n\nexport function borrowedChordsOf(key: string, fns: KeyFns): BorrowedChord[] {\n const forms = keyForms(key, fns.majorKey, fns.minorKey as never);\n if (!forms) return [];\n const { tonic } = forms;\n const table = forms.minor ? INTO_MINOR : INTO_MAJOR;\n return table.map(([ivl, type, from, replaces]) => {\n const chord = note(transpose(tonic, ivl)).pc + type;\n return {\n chord,\n numeral: numeralOf(tonic, parse(chord)!),\n from: `${tonic} ${from}`,\n replaces: replaces.slice(),\n };\n });\n}\n\n// Does a chord play a numeral of the key: the same root (as a degree of the\n// key, with its alteration), the same 3rd (case), and a dominant for an\n// uppercase numeral with a 7?\nfunction plays(tonic: string, chordName: string, numeral: string): boolean {\n const r = roman(numeral);\n const chord = getChord(chordName);\n if (r.empty || chord.empty || !chord.tonic) return false;\n const expected = transpose(tonic, r.interval);\n if (note(expected).chroma !== note(chord.tonic).chroma) return false;\n const ivls = chord.intervals;\n const third = r.major ? \"3M\" : \"3m\";\n if (!ivls.includes(third)) return false;\n if (r.major && r.chordType === \"7\") return ivls.includes(\"7m\");\n return true;\n}\n\nexport function keySubstitutes(\n key: string,\n chordName: string,\n options: KeySubstitutesOptions,\n fns: KeyFns,\n): KeySubstitute[] {\n const forms = keyForms(key, fns.majorKey, fns.minorKey as never);\n const parsed = parse(chordName);\n if (!forms || !parsed) return [];\n const { kinds } = options;\n const wants = (kind: KeySubstituteKind) => !kinds || kinds.includes(kind);\n\n // the related ii is minor when the dominant's target is a minor chord\n let minor = options.minor;\n if (minor === undefined) {\n const target = note(transpose(parsed.root, \"4P\")).pc;\n const i = forms.scale.indexOf(target);\n if (i !== -1 && forms.triads[i] === \"m\") minor = true;\n }\n const chordKinds = kinds?.filter(\n (k): k is SubstituteKind => k !== \"diatonic\" && k !== \"borrowed\",\n );\n const result: KeySubstitute[] = chordSubstitutes(chordName, {\n next: options.next,\n kinds: chordKinds,\n minor,\n }).map((s: Substitute) => ({ chords: s.chords, kind: s.kind }));\n\n // diatonic: the key's chords with the same function, triads for a triad\n const scale = forms.minor\n ? fns.minorKey(forms.tonic).natural\n : fns.majorKey(forms.tonic);\n if (wants(\"diatonic\")) {\n const triad = parsed.intervals.length === 3;\n const chords = triad ? scale.triads : scale.chords;\n // a chord of the key: its root a degree, its notes in the scale\n const degree = scale.scale.indexOf(note(parsed.root).pc);\n const inKey = parsed.notes.every((n) => scale.scale.includes(note(n).pc));\n if (degree !== -1 && inKey) {\n const fn = scale.chordsHarmonicFunction[degree];\n scale.chordsHarmonicFunction.forEach((f, i) => {\n if (i !== degree && f === fn) {\n result.push({ chords: [chords[i]], kind: \"diatonic\" });\n }\n });\n }\n }\n\n // borrowed: the chords that replace the chord's numeral\n if (wants(\"borrowed\")) {\n for (const b of borrowedChordsOf(key, fns)) {\n const same = pcs(b.chord) === pcs(parsed.symbol);\n if (\n !same &&\n b.replaces.some((n) => plays(forms.tonic, parsed.symbol, n))\n ) {\n result.push({ chords: [b.chord], kind: \"borrowed\" });\n }\n }\n }\n return result;\n}\n","import { get as getChord } from \"@tonaljs/chord\";\nimport { note } from \"@tonaljs/pitch-note\";\nimport type { ChordReading, ChordSource } from \"./analyze\";\nimport type { KeyScale } from \"./index\";\n\n/** A chord two keys share, as returned by `Key.pivotChords`. */\nexport interface PivotChord {\n /** The chord, spelled in the destination key (or in the key it belongs to). */\n chord: string;\n /** Its numeral in the first key, like \"iii\". */\n from: string;\n /** Its numeral in the second key, like \"vi\". */\n to: string;\n /** Where its reading in the first key comes from: \"diatonic\", \"secondary dominant\"... */\n fromSource: ChordSource;\n /** Where its reading in the second key comes from. */\n toSource: ChordSource;\n}\n\n/** Options of `Key.pivotChords`. */\nexport interface PivotChordsOptions {\n /** 7th chords instead of triads. */\n sevenths?: boolean;\n /**\n * Also the chords of one key that have a functional reading in the other\n * (secondary dominants, borrowed from the parallel major or minor...): D7\n * is V7/V in C and V7 in G.\n */\n chromatic?: boolean;\n}\n\ntype KeyFns = {\n majorKey: (tonic: string) => KeyScale;\n minorKey: (tonic: string) => {\n natural: KeyScale;\n harmonic: KeyScale;\n melodic: KeyScale;\n };\n analyzeChord: (key: string, chord: string) => ChordReading[];\n};\n\n// The root pitch class and the type: the same chord, whatever its spelling\nconst identity = (name: string) => {\n const chord = getChord(name);\n return `${note(chord.tonic ?? \"\").chroma}|${chord.chroma}`;\n};\n\n// A key's chords, each once: the major's, or the three minor forms'\nfunction keyChords(key: string, sevenths: boolean, fns: KeyFns) {\n const [tonic, type = \"major\", ...rest] = key.trim().split(/\\s+/);\n if (rest.length || (type !== \"major\" && type !== \"minor\")) return undefined;\n if (note(tonic).empty) return undefined;\n const minor = type === \"minor\" ? fns.minorKey(tonic) : undefined;\n const scales = minor\n ? [minor.natural, minor.harmonic, minor.melodic]\n : [fns.majorKey(tonic)];\n const chords: string[] = [];\n const seen = new Set<string>();\n for (const scale of scales) {\n for (const chord of sevenths ? scale.chords : scale.triads) {\n const id = identity(chord);\n if (!seen.has(id)) {\n seen.add(id);\n chords.push(chord);\n }\n }\n }\n return chords;\n}\n\nexport function pivotChordsOf(\n from: string,\n to: string,\n options: PivotChordsOptions,\n fns: KeyFns,\n): PivotChord[] {\n if (typeof from !== \"string\" || typeof to !== \"string\") return [];\n const sevenths = !!options.sevenths;\n const a = keyChords(from, sevenths, fns);\n const b = keyChords(to, sevenths, fns);\n if (!a || !b) return [];\n const inB = new Map(b.map((c) => [identity(c), c]));\n const inA = new Set(a.map(identity));\n\n const diatonic = (key: string, chord: string) =>\n fns.analyzeChord(key, chord).find((r) => r.source === \"diatonic\");\n // a reading that isn't chromatic, and borrowed only from the parallel\n // major or minor (not from a mode)\n const functional = (key: string, chord: string) =>\n fns\n .analyzeChord(key, chord)\n .find(\n (r) =>\n r.source !== \"chromatic\" &&\n (r.source !== \"borrowed\" || / (major|minor)$/.test(r.scale)),\n );\n\n const result: PivotChord[] = [];\n for (const chord of a) {\n const shared = inB.get(identity(chord));\n if (!shared) continue;\n const ra = diatonic(from, chord);\n const rb = diatonic(to, shared);\n if (!ra || !rb) continue;\n result.push({\n chord: shared,\n from: ra.numeral,\n to: rb.numeral,\n fromSource: \"diatonic\",\n toSource: \"diatonic\",\n });\n }\n if (!options.chromatic) return result;\n\n // the chords of one key with a functional reading in the other\n for (const chord of a) {\n if (inB.has(identity(chord))) continue;\n const ra = diatonic(from, chord);\n const rb = functional(to, chord);\n if (!ra || !rb) continue;\n result.push({\n chord,\n from: ra.numeral,\n to: rb.numeral,\n fromSource: \"diatonic\",\n toSource: rb.source,\n });\n }\n for (const chord of b) {\n if (inA.has(identity(chord))) continue;\n const ra = functional(from, chord);\n const rb = diatonic(to, chord);\n if (!ra || !rb) continue;\n result.push({\n chord,\n from: ra.numeral,\n to: rb.numeral,\n fromSource: ra.source,\n toSource: \"diatonic\",\n });\n }\n return result;\n}\n","import { tritoneSubstitute } from \"@tonaljs/chord\";\nimport { transpose, transposeFifths } from \"@tonaljs/note\";\nimport { accToAlt, altToAcc, note } from \"@tonaljs/pitch-note\";\nimport { get as roman } from \"@tonaljs/roman-numeral\";\nimport {\n analyze,\n type AnalyzeChordOptions,\n type ChordReading,\n keyForms,\n} from \"./analyze\";\n\nimport {\n type BorrowedChord,\n borrowedChordsOf,\n type KeySubstitute,\n type KeySubstitutesOptions,\n keySubstitutes,\n} from \"./substitutes\";\n\nimport {\n type PivotChord,\n pivotChordsOf,\n type PivotChordsOptions,\n} from \"./pivot\";\n\nexport type { AnalyzeChordOptions, ChordReading, ChordSource } from \"./analyze\";\nexport type { PivotChord, PivotChordsOptions } from \"./pivot\";\nexport type {\n BorrowedChord,\n KeySubstitute,\n KeySubstituteKind,\n KeySubstitutesOptions,\n} from \"./substitutes\";\n\nconst Empty: readonly string[] = Object.freeze([] as string[]);\n\nexport interface Key {\n readonly type: \"major\" | \"minor\";\n /** The tonic pitch class, like \"F\". Empty for an invalid key. */\n readonly tonic: string;\n /** Number of accidentals in the key signature: positive for sharps, negative for flats. */\n readonly alteration: number;\n /** The key signature as accidentals: \"\" (none), \"bb\" (two flats), \"###\" (three sharps). */\n readonly keySignature: string;\n}\n\nconst NoKey: Key = {\n type: \"major\",\n tonic: \"\",\n alteration: 0,\n keySignature: \"\",\n};\n\nexport interface KeyScale {\n readonly tonic: string;\n /** Roman numeral of each degree, like [\"I\", \"II\", \"bIII\", ...]. */\n readonly grades: readonly string[];\n /** Interval from the tonic to each degree, like [\"1P\", \"2M\", \"3M\", ...]. */\n readonly intervals: readonly string[];\n /** Notes of the scale, one per degree. */\n readonly scale: readonly string[];\n /** Triad of each degree, like [\"F\", \"Gm\", \"Am\", ...]. */\n readonly triads: readonly string[];\n /** Seventh chord of each degree, like [\"Fmaj7\", \"Gm7\", ...]. */\n readonly chords: readonly string[];\n /** Harmonic function of each chord: \"T\" (tonic), \"SD\" (subdominant) or \"D\" (dominant). Empty string if none. */\n readonly chordsHarmonicFunction: readonly string[];\n /** Scale that fits each chord, like [\"F major\", \"G dorian\", ...]. */\n readonly chordScales: readonly string[];\n /** Dominant seventh chord that resolves to each degree (\"\" if the degree has none), like [\"\", \"D7\", \"E7\", ...] for F major. */\n readonly secondaryDominants: readonly string[];\n /** The ii chord that precedes each secondary dominant (\"\" if none): a minor seventh, or a half-diminished chord when the target is minor. */\n readonly secondaryDominantSupertonics: readonly string[];\n /** Tritone substitution of each secondary dominant (\"\" if none): the dominant seventh a tritone away, spelled a diminished fifth above it (Gb7 for C7) unless that needs a double flat or sharp (A7, not Bbb7, for Eb7). */\n readonly substituteDominants: readonly string[];\n /** The minor seventh ii chord that precedes each substitute dominant (\"\" if none). */\n readonly substituteDominantSupertonics: readonly string[];\n\n /** @deprecated use secondaryDominantSupertonics */\n readonly secondaryDominantsMinorRelative: readonly string[];\n /** @deprecated use substituteDominantSupertonics */\n readonly substituteDominantsMinorRelative: readonly string[];\n}\n\nconst NoKeyScale: KeyScale = {\n tonic: \"\",\n grades: Empty,\n intervals: Empty,\n scale: Empty,\n triads: Empty,\n chords: Empty,\n chordsHarmonicFunction: Empty,\n chordScales: Empty,\n secondaryDominants: Empty,\n secondaryDominantSupertonics: Empty,\n substituteDominantsMinorRelative: Empty,\n substituteDominants: Empty,\n substituteDominantSupertonics: Empty,\n secondaryDominantsMinorRelative: Empty,\n};\n\nexport interface MajorKey extends Key, KeyScale {\n readonly type: \"major\";\n /** Tonic of the relative minor key, like \"D\" for \"F\". */\n readonly minorRelative: string;\n readonly scale: readonly string[];\n readonly substituteDominants: readonly string[];\n readonly secondaryDominantSupertonics: readonly string[];\n /** @deprecated use substituteDominantSupertonics */\n readonly substituteDominantsMinorRelative: readonly string[];\n}\n\nconst NoMajorKey: MajorKey = {\n ...NoKey,\n ...NoKeyScale,\n type: \"major\",\n minorRelative: \"\",\n scale: Empty,\n substituteDominants: Empty,\n secondaryDominantSupertonics: Empty,\n substituteDominantsMinorRelative: Empty,\n};\n\nexport interface MinorKey extends Key {\n readonly type: \"minor\";\n /** Tonic of the relative major key, like \"C\" for \"A\". */\n readonly relativeMajor: string;\n /** Natural minor (aeolian) scale and its chords. */\n readonly natural: KeyScale;\n /** Harmonic minor scale and its chords. */\n readonly harmonic: KeyScale;\n /** Melodic minor (ascending) scale and its chords. */\n readonly melodic: KeyScale;\n}\n\nconst NoMinorKey: MinorKey = {\n ...NoKey,\n type: \"minor\",\n relativeMajor: \"\",\n natural: NoKeyScale,\n harmonic: NoKeyScale,\n melodic: NoKeyScale,\n};\n\nexport type KeyChord = {\n /** Chord symbol, like \"Dm7\". */\n name: string;\n /** Functions the chord plays in the key: \"T\", \"SD\", \"D\", or \"V/II\", \"ii/V\", \"subV/II\", \"subii/II\" for secondary and substitute dominants. */\n roles: string[];\n};\n\nconst mapScaleToType = (scale: string[], list: string[], sep = \"\") =>\n list.map((type, i) => `${scale[i]}${sep}${type}`);\n\nfunction keyScale(\n grades: string[],\n triads: string[],\n chordTypes: string[],\n harmonicFunctions: string[],\n chordScales: string[],\n) {\n return (tonic: string): KeyScale => {\n const intervals = grades.map((gr) => roman(gr).interval || \"\");\n const scale = intervals.map((interval) => transpose(tonic, interval));\n const chords = mapScaleToType(scale, chordTypes);\n const secondaryDominants = scale\n .map((note) => transpose(note, \"5P\"))\n .map((note) =>\n // A secondary dominant is a V chord which:\n // 1. is not diatonic to the key,\n // 2. it must have a diatonic root.\n scale.includes(note) && !chords.includes(note + \"7\") ? note + \"7\" : \"\",\n );\n\n const secondaryDominantSupertonics = supertonics(\n secondaryDominants,\n triads,\n );\n const substituteDominants = secondaryDominants.map((chord) =>\n chord ? tritoneSubstitute(chord) : \"\",\n );\n const substituteDominantSupertonics =\n substituteSupertonics(substituteDominants);\n\n return {\n tonic,\n grades,\n intervals,\n scale,\n triads: mapScaleToType(scale, triads),\n chords,\n chordsHarmonicFunction: harmonicFunctions.slice(),\n chordScales: mapScaleToType(scale, chordScales, \" \"),\n secondaryDominants,\n secondaryDominantSupertonics,\n substituteDominants,\n substituteDominantSupertonics,\n\n // deprecated aliases\n secondaryDominantsMinorRelative: secondaryDominantSupertonics,\n substituteDominantsMinorRelative: substituteDominantSupertonics,\n };\n };\n}\n\n// The root of the ii chord of a dominant: a fifth above its root\nconst supertonicRoot = (dominant: string) =>\n transpose(dominant.slice(0, -1), \"5P\");\n\n// The ii of a secondary dominant takes its quality from the target: a ii-V\n// into a minor or diminished chord uses a half-diminished ii (Em7b5 A7 Dm),\n// and into a major or augmented chord a minor seventh ii (Gm7 C7 F)\nconst supertonics = (dominants: string[], targetTriads: string[]) =>\n dominants.map((chord, index) => {\n if (!chord) return \"\";\n const target = targetTriads[index];\n const isMinor = target === \"m\" || target === \"dim\";\n return supertonicRoot(chord) + (isMinor ? \"m7b5\" : \"m7\");\n });\n\n// A substitute dominant doesn't resolve to the key it points to (Eb7 resolves\n// to Dm, not Ab), so its ii is always a minor seventh: Bbm7 Eb7 Dm\nconst substituteSupertonics = (dominants: string[]) =>\n dominants.map((chord) => (chord ? supertonicRoot(chord) + \"m7\" : \"\"));\n\nconst distInFifths = (from: string, to: string) => {\n const f = note(from);\n const t = note(to);\n return f.empty || t.empty ? 0 : t.coord[0] - f.coord[0];\n};\n\nconst MajorScale = keyScale(\n \"I II III IV V VI VII\".split(\" \"),\n \" m m m dim\".split(\" \"),\n \"maj7 m7 m7 maj7 7 m7 m7b5\".split(\" \"),\n \"T SD T SD D T D\".split(\" \"),\n \"major,dorian,phrygian,lydian,mixolydian,minor,locrian\".split(\",\"),\n);\nconst NaturalScale = keyScale(\n \"I II bIII IV V bVI bVII\".split(\" \"),\n \"m dim m m \".split(\" \"),\n \"m7 m7b5 maj7 m7 m7 maj7 7\".split(\" \"),\n \"T SD T SD D SD SD\".split(\" \"),\n \"minor,locrian,major,dorian,phrygian,lydian,mixolydian\".split(\",\"),\n);\nconst HarmonicScale = keyScale(\n \"I II bIII IV V bVI VII\".split(\" \"),\n \"m dim aug m dim\".split(\" \"),\n \"mMaj7 m7b5 +maj7 m7 7 maj7 o7\".split(\" \"),\n \"T SD T SD D SD D\".split(\" \"),\n \"harmonic minor,locrian 6,major augmented,dorian #4,phrygian dominant,lydian #9,ultralocrian\".split(\n \",\",\n ),\n);\nconst MelodicScale = keyScale(\n \"I II bIII IV V VI VII\".split(\" \"),\n \"m m aug dim dim\".split(\" \"),\n \"m6 m7 +maj7 7 7 m7b5 m7b5\".split(\" \"),\n \"T SD T SD D \".split(\" \"),\n \"melodic minor,dorian b2,lydian augmented,lydian dominant,mixolydian b6,locrian #2,altered\".split(\n \",\",\n ),\n);\n\n/**\n * Get a major key: its signature, scale, triads, seventh chords, harmonic\n * functions and secondary and substitute dominants. For an invalid tonic\n * it returns a key with empty strings and arrays.\n *\n * @param tonic - the tonic note or pitch class, like \"F\" or \"Bb\"\n * @example\n * Key.majorKey(\"F\").scale; // => [\"F\", \"G\", \"A\", \"Bb\", \"C\", \"D\", \"E\"]\n * Key.majorKey(\"F\").chords; // => [\"Fmaj7\", \"Gm7\", \"Am7\", \"Bbmaj7\", \"C7\", \"Dm7\", \"Em7b5\"]\n * Key.majorKey(\"F\").keySignature; // => \"b\"\n */\nexport function majorKey(tonic: string): MajorKey {\n const pc = note(tonic).pc;\n if (!pc) return NoMajorKey;\n\n const keyScale = MajorScale(pc);\n const alteration = distInFifths(\"C\", pc);\n\n return {\n ...keyScale,\n type: \"major\",\n minorRelative: transpose(pc, \"-3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n };\n}\n\n/**\n * Get the chords available in a major key, each with the roles it plays:\n * diatonic chords (\"T\", \"SD\", \"D\") and secondary and substitute dominants\n * with their supertonics (\"V/II\", \"ii/V\", \"subV/II\"...). Returns an empty\n * array for an invalid tonic.\n *\n * @param tonic - the tonic note or pitch class, like \"C\"\n * @returns array of { name: string, roles: string[] }\n * @example\n * Key.majorKeyChords(\"C\").slice(0, 3); // => [{ name: \"Cmaj7\", roles: [\"T\"] }, { name: \"Dm7\", roles: [\"SD\"] }, { name: \"Em7\", roles: [\"T\"] }]\n */\nexport function majorKeyChords(tonic: string): KeyChord[] {\n const key = majorKey(tonic);\n const chords: KeyChord[] = [];\n keyChordsOf(key, chords);\n return chords;\n}\n\n/**\n * Get the chords available in a minor key, each with the roles it plays. It\n * merges the chords of the natural, harmonic and melodic scales, so a chord\n * that appears in several scales has all its roles. Returns an empty array\n * for an invalid tonic.\n *\n * @param tonic - the tonic note or pitch class, like \"A\"\n * @returns array of { name: string, roles: string[] }\n * @example\n * Key.minorKeyChords(\"A\").slice(0, 2); // => [{ name: \"Am7\", roles: [\"T\", \"ii/bVII\"] }, { name: \"Bm7b5\", roles: [\"SD\", \"ii/I\"] }]\n */\nexport function minorKeyChords(tonic: string): KeyChord[] {\n const key = minorKey(tonic);\n const chords: KeyChord[] = [];\n keyChordsOf(key.natural, chords);\n keyChordsOf(key.harmonic, chords);\n keyChordsOf(key.melodic, chords);\n return chords;\n}\n\nfunction keyChordsOf(key: KeyScale, chords: KeyChord[]) {\n const updateChord = (name: string, newRole: string) => {\n if (!name) return;\n let keyChord = chords.find((chord) => chord.name === name);\n if (!keyChord) {\n keyChord = { name, roles: [] };\n chords.push(keyChord);\n }\n if (newRole && !keyChord.roles.includes(newRole)) {\n keyChord.roles.push(newRole);\n }\n };\n\n key.chords.forEach((chordName, index) =>\n updateChord(chordName, key.chordsHarmonicFunction[index]),\n );\n key.secondaryDominants.forEach((chordName, index) =>\n updateChord(chordName, `V/${key.grades[index]}`),\n );\n key.secondaryDominantSupertonics.forEach((chordName, index) =>\n updateChord(chordName, `ii/${key.grades[index]}`),\n );\n key.substituteDominants.forEach((chordName, index) =>\n updateChord(chordName, `subV/${key.grades[index]}`),\n );\n key.substituteDominantSupertonics.forEach((chordName, index) =>\n updateChord(chordName, `subii/${key.grades[index]}`),\n );\n}\n\n/**\n * Get a minor key: its signature, relative major and the scale, chords and\n * dominants of its natural, harmonic and melodic forms. For an invalid tonic\n * it returns a key with empty strings and arrays.\n *\n * @param tnc - the tonic note or pitch class, like \"A\"\n * @example\n * Key.minorKey(\"A\").relativeMajor; // => \"C\"\n * Key.minorKey(\"A\").harmonic.scale; // => [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G#\"]\n * Key.minorKey(\"A\").natural.chords; // => [\"Am7\", \"Bm7b5\", \"Cmaj7\", \"Dm7\", \"Em7\", \"Fmaj7\", \"G7\"]\n */\nexport function minorKey(tnc: string): MinorKey {\n const pc = note(tnc).pc;\n if (!pc) return NoMinorKey;\n\n const alteration = distInFifths(\"C\", pc) - 3;\n return {\n type: \"minor\",\n tonic: pc,\n relativeMajor: transpose(pc, \"3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n natural: NaturalScale(pc),\n harmonic: HarmonicScale(pc),\n melodic: MelodicScale(pc),\n };\n}\n\n/**\n * Get the tonic of the major key with the given key signature, or null if\n * the signature is not valid.\n *\n * @param sig - accidentals (\"\", \"bb\", \"###\") or a number of fifths (positive for sharps, negative for flats)\n * @example\n * Key.majorTonicFromKeySignature(\"###\"); // => \"A\"\n * Key.majorTonicFromKeySignature(-2); // => \"Bb\"\n * Key.majorTonicFromKeySignature(\"\"); // => \"C\"\n */\nexport function majorTonicFromKeySignature(\n sig: string | number,\n): string | null {\n if (typeof sig === \"number\") {\n return transposeFifths(\"C\", sig);\n } else if (typeof sig === \"string\" && /^(b*|#*)$/.test(sig)) {\n return transposeFifths(\"C\", accToAlt(sig));\n }\n return null;\n}\n\n/**\n * Analyse a chord in a key: every reading of what the chord does there,\n * ranked, the first being the default. Each reading has its numeral as the\n * books write it (\"V7/ii\", \"subV7/I\", \"ii7/V\", \"bVIImaj7\"), the chord's plain\n * numeral on the tonic (`degree`), its source, harmonic function (\"T\", \"SD\",\n * \"D\" or \"\"), the scale it comes from, the numeral it leads to (`target`),\n * whether the next chord goes there (`resolution`) and a chord scale chosen\n * by function. Returns `[]` for an invalid key or chord; a valid chord always\n * has at least one reading.\n *\n * The key is \"C major\", \"A minor\" or a tonic alone (\"C\", major). A minor key\n * has the chords of its natural, harmonic and melodic forms. A slash chord is\n * read without its bass. The readings, by source:\n *\n * - \"diatonic\": every note in a scale of the key, root on a degree.\n * - \"secondary dominant\": a dominant or major triad a fifth above a degree\n * whose chord is major or minor, not the tonic (\"A7\" in C is \"V7/ii\").\n * - \"tritone substitute\": a dominant a half step above one of those degrees\n * or the tonic (\"Db7\" in C is \"subV7/I\"); chord scale lydian dominant.\n * - \"related ii\": a m7 or m7b5 a fifth above a next chord that is a\n * secondary dominant (\"Am7\" before \"D7\" in C is \"ii7/V\").\n * - \"borrowed\": in the parallel key (major or the minor forms), or in a\n * parallel mode when nothing else reads the chord (\"Fm7\" in C is \"iv7\").\n * - \"backdoor\": a dominant a whole step below the tonic, before the tonic.\n * - \"passing diminished\": a dim7 a half step below a next chord on a degree\n * (\"C#o7\" before \"Dm7\" is \"viio7/ii\"), or between two chords a whole step\n * apart going down (\"Em7 Ebo7 Dm7\").\n * - \"common-tone diminished\": a dim7 on the root of the chord before or after.\n * - \"chromatic\": when nothing else matches.\n *\n * Ranking: readings the neighbours confirm first (the next chord on the\n * target, a related ii, a backdoor or diminished chord, a secondary dominant\n * after its related ii), then by source in the order above. The vi of a\n * major key before the V is \"SD\" instead of \"T\".\n *\n * @param key - the key, like \"C major\" or \"A minor\"\n * @param chord - the chord symbol, like \"A7\"\n * @param options - `previous` and `next`, the chords around it\n * @example\n * Key.analyzeChord(\"C major\", \"A7\", { next: \"Dm7\" })[0].numeral; // => \"V7/ii\"\n * Key.analyzeChord(\"C major\", \"Bb7\", { next: \"C\" }).map((r) => r.source); // => [\"backdoor\", \"borrowed\", \"tritone substitute\"]\n * Key.analyzeChord(\"C major\", \"Am7\", { next: \"D7\" }).map((r) => r.numeral); // => [\"ii7/V\", \"vi7\"]\n * Key.analyzeChord(\"A minor\", \"E7\")[0].scale; // => \"A harmonic minor\"\n */\nexport function analyzeChord(\n key: string,\n chord: string,\n options?: AnalyzeChordOptions,\n): ChordReading[] {\n const forms = keyForms(key, MajorScale, minorKey);\n return forms ? analyze(forms, chord, options) : [];\n}\n\n/**\n * Get the chords a key borrows from its parallel scales (modal interchange),\n * as Pease lists them, with their numeral, the scale they come from and the\n * numerals of the key's chords they replace. In a major key (C):\n *\n * - from C minor: Dm7b5 (ii7b5) for ii7; Ebmaj7 (bIIImaj7) for IV or V7;\n * Fm7 and Fm6 (iv7, iv6) for IV; Gm7 (v7) for V7; Abmaj7 (bVImaj7) and\n * Bb7 (bVII7) for iv;\n * - from C phrygian: Dbmaj7 (bIImaj7) for iv;\n * - from C mixolydian: Bbmaj7 (bVIImaj7) for IV;\n * - from C lydian: Cmaj7#11 (Imaj7#11), a tonic alias.\n *\n * In a minor key, from the parallel major (Jazzology, and Pease's Ionian\n * into Dorian): Imaj7 for i (the Picardy 3rd, the most common), iim7 for\n * ii7b5, and IVmaj7 for IV7. It returns `[]` for an invalid key.\n *\n * @param key - a key name, like \"C major\" (or \"C\") or \"A minor\"\n * @example\n * Key.borrowedChords(\"C major\")[0]; // => { chord: \"Dm7b5\", numeral: \"ii7b5\", from: \"C minor\", replaces: [\"ii7\"] }\n * Key.borrowedChords(\"C major\").map((b) => b.chord); // => [\"Dm7b5\", \"Ebmaj7\", \"Fm7\", \"Fm6\", \"Gm7\", \"Abmaj7\", \"Bb7\", \"Dbmaj7\", \"Bbmaj7\", \"Cmaj7#11\"]\n * Key.borrowedChords(\"A minor\").map((b) => b.chord); // => [\"Amaj7\", \"Bm7\", \"Dmaj7\"]\n */\nexport function borrowedChords(key: string): BorrowedChord[] {\n return borrowedChordsOf(key, { majorKey: MajorScale, minorKey });\n}\n\n/**\n * Get the substitutes of a chord in a key: `Chord.substitutes`, then the\n * key's own, each as `{ chords, kind }`:\n *\n * - \"diatonic\": the key's chords with the same harmonic function\n * (`chordsHarmonicFunction`), triads for a triad and 7th chords otherwise:\n * Em7 and Am7 for Cmaj7 in C, Dm7 for Fmaj7, Bm7b5 for G7. Only for a chord\n * of the key: its root a degree and its notes in the scale (the natural\n * minor's, in a minor key);\n * - \"borrowed\": the chords of `Key.borrowedChords` that replace the chord's\n * numeral (by root, 3rd, and a dominant for \"V7\").\n *\n * The related ii of a dominant is an m7b5 when its target (a 4th up) is a\n * minor chord of the key, unless `minor` says otherwise: Bm7b5 for E7 in C.\n * `kinds` keeps only those kinds. It returns `[]` for an invalid key or a\n * chord without root.\n *\n * @param key - a key name, like \"C major\" (or \"C\") or \"A minor\"\n * @param chord - the chord symbol, like \"G7\"\n * @param options - `next`: the chord after; `kinds`; `minor`\n * @example\n * Key.substitutes(\"C major\", \"Fmaj7\").map((s) => `${s.kind}: ${s.chords}`);\n * // => [\"contained: Am\", \"diatonic: Dm7\", \"borrowed: Ebmaj7\", \"borrowed: Fm7\", \"borrowed: Fm6\", \"borrowed: Bbmaj7\"]\n * Key.substitutes(\"C major\", \"E7\", { kinds: [\"related ii\"] }); // => [{ chords: [\"Bm7b5\", \"E7\"], kind: \"related ii\" }]\n */\nexport function substitutes(\n key: string,\n chord: string,\n options: KeySubstitutesOptions = {},\n): KeySubstitute[] {\n return keySubstitutes(key, chord, options, {\n majorKey: MajorScale,\n minorKey,\n });\n}\n\n/**\n * Get the chords two keys share (pivot chords, to modulate from one to the\n * other), with the numeral of each in both keys (as `Key.analyzeChord`\n * writes it). Triads by default, 7th chords with `sevenths`. A minor key has\n * the chords of its natural, harmonic and melodic forms. Chords match by\n * root and type, whatever their spelling, and are spelled as in the second\n * key, in the order of the first key's chords.\n *\n * With `chromatic`, then the chords of one key that have a functional\n * reading in the other: the first reading of `Key.analyzeChord` that isn't\n * \"chromatic\" or borrowed from a mode (borrowed from the parallel major or\n * minor counts). D7 is V7/V in C and V7 in G. The chords of the first key\n * come first, then the second's. `fromSource` and `toSource` say where each\n * reading comes from. It returns `[]` for an invalid key.\n *\n * @param from - a key name, like \"C major\" (or \"C\") or \"A minor\"\n * @param to - the other key\n * @param options - `sevenths`, `chromatic`\n * @example\n * Key.pivotChords(\"C major\", \"G major\").map((p) => `${p.chord}: ${p.from} ${p.to}`); // => [\"C: I IV\", \"Em: iii vi\", \"G: V I\", \"Am: vi ii\"]\n * Key.pivotChords(\"C major\", \"G major\", { sevenths: true }).map((p) => p.chord); // => [\"Cmaj7\", \"Em7\", \"Am7\"]\n * Key.pivotChords(\"C major\", \"G major\", { chromatic: true }).slice(4).map((p) => `${p.chord}: ${p.from} ${p.to}`); // => [\"Dm: ii v\", \"F: IV bVII\", \"D: V/V V\"]\n */\nexport function pivotChords(\n from: string,\n to: string,\n options: PivotChordsOptions = {},\n): PivotChord[] {\n return pivotChordsOf(from, to, options, {\n majorKey: MajorScale,\n minorKey,\n analyzeChord,\n });\n}\n\n/** @deprecated Use the named exports instead. */\nexport default { majorKey, majorTonicFromKeySignature, minorKey };\n"],"mappings":";;;;;;;;;AA0FA,MAAM,QAAQ;CAAC;CAAU;CAAY;CAAU;CAAc;AAAS;AAEtE,MAAM,eAA8B;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,kBAAiC;CACrC;CACA;CACA;CACA;AACF;AAEA,MAAM,UAAU,SAAiB,KAAK,IAAI,CAAC,CAAC;AAC5C,MAAM,SAAS,OAAgB,IAAI,KAAM,MAAM;AAE/C,SAAgB,MAAM,MAA8C;CAClE,IAAI,OAAO,SAAS,UAAU,OAAO,KAAA;CACrC,MAAM,CAAC,MAAM,QAAQ,SAAS,IAAI;CAClC,IAAI,CAAC,MAAM,OAAO,KAAA;CAClB,MAAM,SAAS,OAAO;CACtB,MAAM,QAAQA,IAAS,MAAM;CAC7B,IAAI,MAAM,SAAS,CAAC,MAAM,MAAM,QAAQ,OAAO,KAAA;CAC/C,OAAO;EACL;EACA,MAAM,MAAM,SAAS;EACrB;EACA,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,WAAW,MAAM;EACjB,OAAO,MAAM;EACb,SAAS,MAAM,MAAM,IAAI,MAAM;EAC/B;CACF;AACF;AAEA,SAAS,WAAW,OAAe,MAAwB;CACzD,OAAOC,MAAU,IAAI,CAAC,CAAC,UAAU,KAAK,QAAQ,UAAU,OAAO,GAAG,CAAC;AACrE;AAEA,SAAgB,SACd,KACA,UACA,UAKsB;CACtB,IAAI,OAAO,QAAQ,UAAU,OAAO,KAAA;CACpC,MAAM,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3
+ "version": "4.14.0",
4
4
  "description": "Functions to work with musical keys",
5
5
  "keywords": [
6
6
  "key",
@@ -15,13 +15,17 @@
15
15
  ],
16
16
  "types": "dist/index.d.ts",
17
17
  "dependencies": {
18
- "@tonaljs/pitch-note": "6.2.1",
18
+ "@tonaljs/chord": "6.8.0",
19
19
  "@tonaljs/note": "4.14.0",
20
- "@tonaljs/roman-numeral": "4.10.3"
20
+ "@tonaljs/pitch-distance": "5.1.3",
21
+ "@tonaljs/pitch-interval": "6.4.1",
22
+ "@tonaljs/pitch-note": "6.2.1",
23
+ "@tonaljs/progression": "4.11.9",
24
+ "@tonaljs/roman-numeral": "4.10.3",
25
+ "@tonaljs/scale-type": "4.10.2"
21
26
  },
22
27
  "devDependencies": {
23
- "@tonaljs/chord": "6.7.0",
24
- "@tonaljs/scale": "4.16.0"
28
+ "@tonaljs/scale": "4.17.0"
25
29
  },
26
30
  "author": "danigb@gmail.com",
27
31
  "license": "MIT",