interface Key { readonly type: "major" | "minor"; /** The tonic pitch class, like "F". Empty for an invalid key. */ readonly tonic: string; /** Number of accidentals in the key signature: positive for sharps, negative for flats. */ readonly alteration: number; /** The key signature as accidentals: "" (none), "bb" (two flats), "###" (three sharps). */ readonly keySignature: string; } interface KeyScale { readonly tonic: string; /** Roman numeral of each degree, like ["I", "II", "bIII", ...]. */ readonly grades: readonly string[]; /** Interval from the tonic to each degree, like ["1P", "2M", "3M", ...]. */ readonly intervals: readonly string[]; /** Notes of the scale, one per degree. */ readonly scale: readonly string[]; /** Triad of each degree, like ["F", "Gm", "Am", ...]. */ readonly triads: readonly string[]; /** Seventh chord of each degree, like ["Fmaj7", "Gm7", ...]. */ readonly chords: readonly string[]; /** Harmonic function of each chord: "T" (tonic), "SD" (subdominant) or "D" (dominant). Empty string if none. */ readonly chordsHarmonicFunction: readonly string[]; /** Scale that fits each chord, like ["F major", "G dorian", ...]. */ readonly chordScales: readonly string[]; /** Dominant seventh chord that resolves to each degree ("" if the degree has none), like ["", "D7", "E7", ...] for F major. */ readonly secondaryDominants: readonly string[]; /** The ii chord that precedes each secondary dominant ("" if none): a minor seventh, or a half-diminished chord when the target is minor. */ readonly secondaryDominantSupertonics: readonly string[]; /** Tritone substitution of each secondary dominant ("" if none): the dominant seventh a tritone away. */ readonly substituteDominants: readonly string[]; /** The minor seventh ii chord that precedes each substitute dominant ("" if none). */ readonly substituteDominantSupertonics: readonly string[]; /** @deprecated use secondaryDominantSupertonics */ readonly secondaryDominantsMinorRelative: readonly string[]; /** @deprecated use substituteDominantSupertonics */ readonly substituteDominantsMinorRelative: readonly string[]; } interface MajorKey extends Key, KeyScale { readonly type: "major"; /** Tonic of the relative minor key, like "D" for "F". */ readonly minorRelative: string; readonly scale: readonly string[]; readonly substituteDominants: readonly string[]; readonly secondaryDominantSupertonics: readonly string[]; /** @deprecated use substituteDominantSupertonics */ readonly substituteDominantsMinorRelative: readonly string[]; } interface MinorKey extends Key { readonly type: "minor"; /** Tonic of the relative major key, like "C" for "A". */ readonly relativeMajor: string; /** Natural minor (aeolian) scale and its chords. */ readonly natural: KeyScale; /** Harmonic minor scale and its chords. */ readonly harmonic: KeyScale; /** Melodic minor (ascending) scale and its chords. */ readonly melodic: KeyScale; } type KeyChord = { /** Chord symbol, like "Dm7". */ name: string; /** Functions the chord plays in the key: "T", "SD", "D", or "V/II", "ii/V", "subV/II", "subii/II" for secondary and substitute dominants. */ roles: string[]; }; /** * Get a major key: its signature, scale, triads, seventh chords, harmonic * functions and secondary and substitute dominants. For an invalid tonic * it returns a key with empty strings and arrays. * * @param tonic - the tonic note or pitch class, like "F" or "Bb" * @example * Key.majorKey("F").scale; // => ["F", "G", "A", "Bb", "C", "D", "E"] * Key.majorKey("F").chords; // => ["Fmaj7", "Gm7", "Am7", "Bbmaj7", "C7", "Dm7", "Em7b5"] * Key.majorKey("F").keySignature; // => "b" */ declare function majorKey(tonic: string): MajorKey; /** * Get the chords available in a major key, each with the roles it plays: * diatonic chords ("T", "SD", "D") and secondary and substitute dominants * with their supertonics ("V/II", "ii/V", "subV/II"...). Returns an empty * array for an invalid tonic. * * @param tonic - the tonic note or pitch class, like "C" * @returns array of { name: string, roles: string[] } * @example * Key.majorKeyChords("C").slice(0, 3); // => [{ name: "Cmaj7", roles: ["T"] }, { name: "Dm7", roles: ["SD"] }, { name: "Em7", roles: ["T"] }] */ declare function majorKeyChords(tonic: string): KeyChord[]; /** * Get the chords available in a minor key, each with the roles it plays. It * merges the chords of the natural, harmonic and melodic scales, so a chord * that appears in several scales has all its roles. Returns an empty array * for an invalid tonic. * * @param tonic - the tonic note or pitch class, like "A" * @returns array of { name: string, roles: string[] } * @example * Key.minorKeyChords("A").slice(0, 2); // => [{ name: "Am7", roles: ["T", "ii/bVII"] }, { name: "Bm7b5", roles: ["SD", "ii/I"] }] */ declare function minorKeyChords(tonic: string): KeyChord[]; /** * Get a minor key: its signature, relative major and the scale, chords and * dominants of its natural, harmonic and melodic forms. For an invalid tonic * it returns a key with empty strings and arrays. * * @param tnc - the tonic note or pitch class, like "A" * @example * Key.minorKey("A").relativeMajor; // => "C" * Key.minorKey("A").harmonic.scale; // => ["A", "B", "C", "D", "E", "F", "G#"] * Key.minorKey("A").natural.chords; // => ["Am7", "Bm7b5", "Cmaj7", "Dm7", "Em7", "Fmaj7", "G7"] */ declare function minorKey(tnc: string): MinorKey; /** * Get the tonic of the major key with the given key signature, or null if * the signature is not valid. * * @param sig - accidentals ("", "bb", "###") or a number of fifths (positive for sharps, negative for flats) * @example * Key.majorTonicFromKeySignature("###"); // => "A" * Key.majorTonicFromKeySignature(-2); // => "Bb" * Key.majorTonicFromKeySignature(""); // => "C" */ declare function majorTonicFromKeySignature(sig: string | number): string | null; /** @deprecated Use the named exports instead. */ declare const _default: { majorKey: typeof majorKey; majorTonicFromKeySignature: typeof majorTonicFromKeySignature; minorKey: typeof minorKey; }; export { Key, KeyChord, KeyScale, MajorKey, MinorKey, _default as default, majorKey, majorKeyChords, majorTonicFromKeySignature, minorKey, minorKeyChords }; //# sourceMappingURL=index.d.mts.map