UNPKG

@tonaljs/progression

Version:

Build musical chord progressions

26 lines 873 B
// index.ts import { tokenize } from "@tonaljs/chord"; import { distance, transpose } from "@tonaljs/pitch-distance"; import { interval } from "@tonaljs/pitch-interval"; import { get as romanNumeral } from "@tonaljs/roman-numeral"; function fromRomanNumerals(tonic, chords) { const romanNumerals = chords.map(romanNumeral); return romanNumerals.map( (rn) => transpose(tonic, interval(rn)) + rn.chordType ); } function toRomanNumerals(tonic, chords) { return chords.map((chord) => { const [note, chordType] = tokenize(chord); const intervalName = distance(tonic, note); const roman = romanNumeral(interval(intervalName)); return roman.name + chordType; }); } var progression_default = { fromRomanNumerals, toRomanNumerals }; export { progression_default as default, fromRomanNumerals, toRomanNumerals }; //# sourceMappingURL=index.mjs.map