From 173e78076b1c205333e8df58eff19a91ebf2373a Mon Sep 17 00:00:00 2001 From: Jim McStanton Date: Wed, 7 Oct 2020 20:38:56 -0500 Subject: [PATCH] Reworking chord detection to be order independent. Resolves #160. --- docs/CONTRIBUTING.md | 2 +- packages/chord-detect/index.ts | 52 ++++++++++++++++++++----- packages/chord-detect/package.json | 2 + packages/chord-detect/test.ts | 14 +++++-- packages/tonal/browser/tonal.min.js | 2 +- packages/tonal/browser/tonal.min.js.map | 2 +- 6 files changed, 58 insertions(+), 16 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 418e3f7a..8a7c201d 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -32,7 +32,7 @@ If you are adding new functionality or fixing a bug, please add a test for it. yarn test:ci ``` -#### How to add a new module +### How to add a new module To create a new module: diff --git a/packages/chord-detect/index.ts b/packages/chord-detect/index.ts index 85ecd287..e7faec34 100644 --- a/packages/chord-detect/index.ts +++ b/packages/chord-detect/index.ts @@ -1,5 +1,7 @@ import { all } from "@tonaljs/chord-type"; -import { note } from "@tonaljs/core"; +import { note, distance } from "@tonaljs/core"; +import { name, sortedNames } from "@tonaljs/note"; +import { simplify } from "@tonaljs/interval"; import { modes } from "@tonaljs/pcset"; interface FoundChord { @@ -20,7 +22,9 @@ const namedSet = (notes: string[]) => { }; export function detect(source: string[]): string[] { - const notes = source.map((n) => note(n).pc).filter((x) => x); + const notes = sortedNames(source) + .map((n) => note(n).pc) + .filter((x) => x); if (note.length === 0) { return []; } @@ -33,12 +37,41 @@ export function detect(source: string[]): string[] { .map((chord) => chord.name); } +// Assumes that chord is presorted +function findRoot(chord: string[]): string { + let foundRoot = null; + chord.every((note) => { + const workComplete = chord.some((otherNote) => { + const interval = simplify(distance(note, otherNote)); + const orderedNotes = sortedNames([note, otherNote]); + if (interval === "5P") { + foundRoot = orderedNotes[0]; + return foundRoot; // Loop is complete + } else if (interval === "4P") { + foundRoot = orderedNotes[1]; + return foundRoot; // Loop is complete + } + return false; // continue looping + }); + // Continue looping if the root note was not found + return !workComplete; + }); + if (foundRoot) { + return foundRoot; + } else { + // Defaults to the old behavior if the chord is complex and the root note cannot be easily found + return chord[0]; + } +} + +// assumes that notes is presorted function findExactMatches(notes: string[], weight: number): FoundChord[] { - const tonic = notes[0]; - const tonicChroma = note(tonic).chroma; + const root = findRoot(notes); const noteName = namedSet(notes); - // we need to test all chormas to get the correct baseNote + // we need to test all chromas to get the correct baseNote const allModes = modes(notes, false); + const baseNote = notes[0]; + const baseChroma = note(baseNote).chroma; const found: FoundChord[] = []; allModes.forEach((mode, index) => { @@ -47,15 +80,16 @@ function findExactMatches(notes: string[], weight: number): FoundChord[] { chordTypes.forEach((chordType) => { const chordName = chordType.aliases[0]; - const baseNote = noteName(index); - const isInversion = index !== tonicChroma; + const rootNote = noteName(index); + const isInversion = note(rootNote).chroma !== baseChroma; + if (isInversion) { found.push({ weight: 0.5 * weight, - name: `${baseNote}${chordName}/${tonic}`, + name: `${rootNote}${chordName}/${baseNote}`, }); } else { - found.push({ weight: 1 * weight, name: `${baseNote}${chordName}` }); + found.push({ weight: 1 * weight, name: `${root}${chordName}` }); } }); }); diff --git a/packages/chord-detect/package.json b/packages/chord-detect/package.json index 91aa8e3f..11a667e1 100644 --- a/packages/chord-detect/package.json +++ b/packages/chord-detect/package.json @@ -17,6 +17,8 @@ "dependencies": { "@tonaljs/chord-type": "^3.6.0", "@tonaljs/core": "^3.5.4", + "@tonaljs/interval": "^3.5.4", + "@tonaljs/note": "^3.5.4", "@tonaljs/pcset": "^3.5.4" }, "author": "danigb@gmail.com", diff --git a/packages/chord-detect/test.ts b/packages/chord-detect/test.ts index 735d6ff1..ddc54b90 100644 --- a/packages/chord-detect/test.ts +++ b/packages/chord-detect/test.ts @@ -2,14 +2,20 @@ import { detect } from "./index"; describe("@tonal/chord-detect", () => { test("detect", () => { - expect(detect(["D", "F#", "A", "C"])).toEqual(["D7"]); - expect(detect(["F#", "A", "C", "D"])).toEqual(["D7/F#"]); - expect(detect(["A", "C", "D", "F#"])).toEqual(["D7/A"]); - expect(detect(["E", "G#", "B", "C#"])).toEqual(["E6", "C#m7/E"]); + expect(detect(["D", "F#", "A", "C"])).toEqual(["D7/C"]); + expect(detect(["D3", "F#4", "A3", "C4"])).toEqual(["D7"]); + expect(detect(["F#4", "A3", "C4", "D3"])).toEqual(["D7"]); + expect(detect(["F#2", "A3", "C4", "D3"])).toEqual(["D7/F#"]); + expect(detect(["A3", "C4", "D3", "F#4"])).toEqual(["D7"]); + expect(detect(["A2", "C4", "D3", "F#4"])).toEqual(["D7/A"]); + expect(detect(["E3", "G#4", "B4", "C#4"])).toEqual(["E6", "C#m7/E"]); + expect(detect(["C4", "E4", "G4"])).toEqual(["CM", "Em#5/C"]); + expect(detect(["E4", "G4", "C5"])).toEqual(["Gm#5", "CM/E"]); }); test("(regression) detect aug", () => { expect(detect(["C", "E", "G#"])).toEqual(["Caug", "Eaug/C", "G#aug/C"]); + expect(detect(["E", "G#", "C"])).toEqual(["Caug", "Eaug/C", "G#aug/C"]); }); test("edge cases", () => { diff --git a/packages/tonal/browser/tonal.min.js b/packages/tonal/browser/tonal.min.js index edf42703..28d37b32 100644 --- a/packages/tonal/browser/tonal.min.js +++ b/packages/tonal/browser/tonal.min.js @@ -1,2 +1,2 @@ -var Tonal=function(){"use strict";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;const e=(e,n)=>Array(Math.abs(n)+1).join(e);function n(e,n,t){return function(...r){return console.warn(`${e} is deprecated. Use ${n}.`),t.apply(this,r)}}function t(e){return null!==e&&"object"==typeof e&&"string"==typeof e.name}function r(e){return null!==e&&"object"==typeof e&&"number"==typeof e.step&&"number"==typeof e.alt}const o=[0,2,4,-1,1,3,5],a=o.map(e=>Math.floor(7*e/12));function m(e){const{step:n,alt:t,oct:r,dir:m=1}=e,i=o[n]+7*t;if(void 0===r)return[m*i];return[m*i,m*(r-a[n]-4*t)]}const i=[3,0,4,1,5,2,6];function c(e){const[n,t,r]=e,o=i[function(e){const n=(e+1)%7;return n<0?7+n:n}(n)],m=Math.floor((n+1)/7);if(void 0===t)return{step:o,alt:m,dir:r};return{step:o,alt:m,oct:t+4*m+a[o],dir:r}}const s={empty:!0,name:"",pc:"",acc:""},u=new Map,l=e=>"CDEFGAB".charAt(e),d=n=>n<0?e("b",-n):e("#",n),P=e=>"b"===e[0]?-e.length:e.length;function M(e){const n=u.get(e);if(n)return n;const o="string"==typeof e?function(e){const n=p(e);if(""===n[0]||""!==n[3])return s;const t=n[0],r=n[1],o=n[2],a=(t.charCodeAt(0)+3)%7,i=P(r),c=o.length?+o:void 0,u=m({step:a,alt:i,oct:c}),l=t+r+o,d=t+r,M=(b[a]+i+120)%12,f=void 0===c?(g=b[a]+i,A=12,(g%A+A)%A-1188):b[a]+i+12*(c+1),h=f>=0&&f<=127?f:null,y=void 0===c?null:440*Math.pow(2,(f-69)/12);var g,A;return{empty:!1,acc:r,alt:i,chroma:M,coord:u,freq:y,height:f,letter:t,midi:h,name:l,oct:c,pc:d,step:a}}(e):r(e)?M(function(e){const{step:n,alt:t,oct:r}=e,o=l(n);if(!o)return"";const a=o+d(t);return r||0===r?a+r:a}(e)):t(e)?M(e.name):s;return u.set(e,o),o}const f=/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;function p(e){const n=f.exec(e);return[n[1].toUpperCase(),n[2].replace(/x/g,"##"),n[3],n[4]]}function h(e){return M(c(e))}const b=[0,2,4,5,7,9,11];const y={empty:!0,name:"",acc:""},g=new RegExp("^([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})|(AA|A|P|M|m|d|dd)([-+]?\\d+)$");function A(e){const n=g.exec(""+e);return null===n?["",""]:n[1]?[n[1],n[2]]:[n[4],n[3]]}const v={};function j(n){return"string"==typeof n?v[n]||(v[n]=function(e){const n=A(e);if(""===n[0])return y;const t=+n[0],r=n[1],o=(Math.abs(t)-1)%7,a=N[o];if("M"===a&&"P"===r)return y;const i="M"===a?"majorable":"perfectable",c=""+t+r,s=t<0?-1:1,u=8===t||-8===t?t:s*(o+1),l=function(e,n){return"M"===n&&"majorable"===e||"P"===n&&"perfectable"===e?0:"m"===n&&"majorable"===e?-1:/^A+$/.test(n)?n.length:/^d+$/.test(n)?-1*("perfectable"===e?n.length:n.length+1):0}(i,r),d=Math.floor((Math.abs(t)-1)/7),P=s*(I[o]+l+12*d),M=(s*(I[o]+l)%12+12)%12,f=m({step:o,alt:l,oct:d,dir:s});return{empty:!1,name:c,num:t,q:r,step:o,alt:l,dir:s,type:i,simple:u,semitones:P,chroma:M,coord:f,oct:d}}(n)):r(n)?j(function(n){const{step:t,alt:r,oct:o=0,dir:a}=n;if(!a)return"";return(a<0?"-":"")+(t+1+7*o)+function(n,t){return 0===t?"majorable"===n?"M":"P":-1===t&&"majorable"===n?"m":t>0?e("A",t):e("d","perfectable"===n?t:t+1)}("M"===N[t]?"majorable":"perfectable",r)}(n)):t(n)?j(n.name):y}const I=[0,2,4,5,7,9,11],N="PMMPPMM";function x(e){const[n,t=0]=e;return j(c(7*n+12*t<0?[-n,-t,-1]:[n,t,1]))}function T(e,n){const t=M(e),r=j(n);if(t.empty||r.empty)return"";const o=t.coord,a=r.coord;return h(1===o.length?[o[0]+a[0]]:[o[0]+a[0],o[1]+a[1]]).name}function D(e,n){const t=M(e),r=M(n);if(t.empty||r.empty)return"";const o=t.coord,a=r.coord,m=a[0]-o[0];return x([m,2===o.length&&2===a.length?a[1]-o[1]:-Math.floor(7*m/12)]).name}var O=Object.freeze({__proto__:null,accToAlt:P,altToAcc:d,coordToInterval:x,coordToNote:h,decode:c,deprecate:n,distance:D,encode:m,fillStr:e,interval:j,isNamed:t,isPitch:r,note:M,stepToLetter:l,tokenizeInterval:A,tokenizeNote:p,transpose:T});const w=(e,n)=>Array(n+1).join(e),S=/^(_{1,}|=|\^{1,}|)([abcdefgABCDEFG])([,']*)$/;function V(e){const n=S.exec(e);return n?[n[1],n[2],n[3]]:["","",""]}function C(e){const[n,t,r]=V(e);if(""===t)return"";let o=4;for(let e=0;e96?t.toUpperCase()+a+(o+1):t+a+o}function $(e){const n=M(e);if(n.empty||!n.oct)return"";const{letter:t,acc:r,oct:o}=n;return("b"===r[0]?r.replace(/b/g,"_"):r.replace(/#/g,"^"))+(o>4?t.toLowerCase():t)+(5===o?"":o>4?w("'",o-5):w(",",4-o))}var q={abcToScientificNotation:C,scientificToAbcNotation:$,tokenize:V,transpose:function(e,n){return $(T(C(e),n))},distance:function(e,n){return D(C(e),C(n))}};function k(e){return e.map(e=>M(e)).filter(e=>!e.empty).sort((e,n)=>e.height-n.height).map(e=>e.name)}var E=Object.freeze({__proto__:null,compact:function(e){return e.filter(e=>0===e||e)},permutations:function e(n){return 0===n.length?[[]]:e(n.slice(1)).reduce((e,t)=>e.concat(n.map((e,r)=>{const o=t.slice();return o.splice(r,0,n[0]),o})),[])},range:function(e,n){return e0===n||e!==t[n-1])}});function _(e,n){return e0===e||e)}var R={compact:z,permutations:function e(n){return 0===n.length?[[]]:e(n.slice(1)).reduce((e,t)=>e.concat(n.map((e,r)=>{const o=t.slice();return o.splice(r,0,n[0]),o})),[])},range:_,rotate:F,shuffle:function(e,n=Math.random){let t,r,o=e.length;for(;o;)t=Math.floor(n()*o--),r=e[o],e[o]=e[t],e[t]=r;return e}};const U={empty:!0,name:"",setNum:0,chroma:"000000000000",normalized:"000000000000",intervals:[]},B=e=>Number(e).toString(2),G=e=>parseInt(e,2),K=/^[01]{12}$/;function L(e){return K.test(e)}const H={[U.chroma]:U};function J(e){const n=L(e)?e:"number"==typeof(t=e)&&t>=0&&t<=4095?B(e):Array.isArray(e)?function(e){if(0===e.length)return U.chroma;let n;const t=[0,0,0,0,0,0,0,0,0,0,0,0];for(let r=0;re&&L(e.chroma))(e)?e.chroma:U.chroma;var t;return H[n]=H[n]||function(e){const n=G(e),t=function(e){const n=e.split("");return n.map((e,t)=>F(t,n).join(""))}(e).map(G).filter(e=>e>=2048).sort()[0],r=B(t),o=X(e);return{empty:!1,name:"",setNum:n,chroma:e,normalized:r,intervals:o}}(n)}const Q=n("Pcset.pcset","Pcset.get",J),W=["1P","2m","2M","3m","3M","4P","5d","5P","6m","6M","7m","7M"];function X(e){const n=[];for(let t=0;t<12;t++)"1"===e.charAt(t)&&n.push(W[t]);return n}function Y(e,n=!0){const t=J(e).chroma.split("");return z(t.map((e,r)=>{const o=F(r,t);return n&&"0"===o[0]?null:o.join("")}))}function Z(e){const n=J(e).setNum;return e=>{const t=J(e).setNum;return n&&n!==t&&(t&n)===t}}function ee(e){const n=J(e).setNum;return e=>{const t=J(e).setNum;return n&&n!==t&&(t|n)===t}}function ne(e){const n=J(e);return e=>{const t=M(e);return n&&!t.empty&&"1"===n.chroma.charAt(t.chroma)}}var te={get:J,chroma:e=>J(e).chroma,num:e=>J(e).setNum,intervals:e=>J(e).intervals,chromas:function(){return _(2048,4095).map(B)},isSupersetOf:ee,isSubsetOf:Z,isNoteIncludedIn:ne,isEqual:function(e,n){return J(e).setNum===J(n).setNum},filter:function(e){const n=ne(e);return e=>e.filter(n)},modes:Y,pcset:Q};const re={...U,name:"",quality:"Unknown",intervals:[],aliases:[]};let oe=[],ae={};function me(e){return ae[e]||re}const ie=n("ChordType.chordType","ChordType.get",me);function ce(){return oe.slice()}const se=n("ChordType.entries","ChordType.all",ce);function ue(e,n,t){const r=function(e){const n=n=>-1!==e.indexOf(n);return n("5A")?"Augmented":n("3M")?"Major":n("5d")?"Diminished":n("3m")?"Minor":"Unknown"}(e),o={...J(e),name:t||"",quality:r,intervals:e,aliases:n};oe.push(o),o.name&&(ae[o.name]=o),ae[o.setNum]=o,ae[o.chroma]=o,o.aliases.forEach(e=>function(e,n){ae[n]=e}(o,e))}[["1P 3M 5P","major","M ^ "],["1P 3M 5P 7M","major seventh","maj7 Δ ma7 M7 Maj7 ^7"],["1P 3M 5P 7M 9M","major ninth","maj9 Δ9 ^9"],["1P 3M 5P 7M 9M 13M","major thirteenth","maj13 Maj13 ^13"],["1P 3M 5P 6M","sixth","6 add6 add13 M6"],["1P 3M 5P 6M 9M","sixth/ninth","6/9 69 M69"],["1P 3M 6m 7M","major seventh flat sixth","M7b6 ^7b6"],["1P 3M 5P 7M 11A","major seventh sharp eleventh","maj#4 Δ#4 Δ#11 M7#11 ^7#11 maj7#11"],["1P 3m 5P","minor","m min -"],["1P 3m 5P 7m","minor seventh","m7 min7 mi7 -7"],["1P 3m 5P 7M","minor/major seventh","m/ma7 m/maj7 mM7 mMaj7 m/M7 -Δ7 mΔ -^7"],["1P 3m 5P 6M","minor sixth","m6 -6"],["1P 3m 5P 7m 9M","minor ninth","m9 -9"],["1P 3m 5P 7M 9M","minor/major ninth","mM9 mMaj9 -^9"],["1P 3m 5P 7m 9M 11P","minor eleventh","m11 -11"],["1P 3m 5P 7m 9M 13M","minor thirteenth","m13 -13"],["1P 3m 5d","diminished","dim ° o"],["1P 3m 5d 7d","diminished seventh","dim7 °7 o7"],["1P 3m 5d 7m","half-diminished","m7b5 ø -7b5 h7 h"],["1P 3M 5P 7m","dominant seventh","7 dom"],["1P 3M 5P 7m 9M","dominant ninth","9"],["1P 3M 5P 7m 9M 13M","dominant thirteenth","13"],["1P 3M 5P 7m 11A","lydian dominant seventh","7#11 7#4"],["1P 3M 5P 7m 9m","dominant flat ninth","7b9"],["1P 3M 5P 7m 9A","dominant sharp ninth","7#9"],["1P 3M 7m 9m","altered","alt7"],["1P 4P 5P","suspended fourth","sus4 sus"],["1P 2M 5P","suspended second","sus2"],["1P 4P 5P 7m","suspended fourth seventh","7sus4 7sus"],["1P 5P 7m 9M 11P","eleventh","11"],["1P 4P 5P 7m 9m","suspended fourth flat ninth","b9sus phryg 7b9sus 7b9sus4"],["1P 5P","fifth","5"],["1P 3M 5A","augmented","aug + +5 ^#5"],["1P 3m 5A","minor augmented","m#5 -#5 m+"],["1P 3M 5A 7M","augmented seventh","maj7#5 maj7+5 +maj7 ^7#5"],["1P 3M 5P 7M 9M 11A","major sharp eleventh (lydian)","maj9#11 Δ9#11 ^9#11"],["1P 2M 4P 5P","","sus24 sus4add9"],["1P 3M 5A 7M 9M","","maj9#5 Maj9#5"],["1P 3M 5A 7m","","7#5 +7 7+ 7aug aug7"],["1P 3M 5A 7m 9A","","7#5#9 7#9#5 7alt"],["1P 3M 5A 7m 9M","","9#5 9+"],["1P 3M 5A 7m 9M 11A","","9#5#11"],["1P 3M 5A 7m 9m","","7#5b9 7b9#5"],["1P 3M 5A 7m 9m 11A","","7#5b9#11"],["1P 3M 5A 9A","","+add#9"],["1P 3M 5A 9M","","M#5add9 +add9"],["1P 3M 5P 6M 11A","","M6#11 M6b5 6#11 6b5"],["1P 3M 5P 6M 7M 9M","","M7add13"],["1P 3M 5P 6M 9M 11A","","69#11"],["1P 3m 5P 6M 9M","","m69 -69"],["1P 3M 5P 6m 7m","","7b6"],["1P 3M 5P 7M 9A 11A","","maj7#9#11"],["1P 3M 5P 7M 9M 11A 13M","","M13#11 maj13#11 M13+4 M13#4"],["1P 3M 5P 7M 9m","","M7b9"],["1P 3M 5P 7m 11A 13m","","7#11b13 7b5b13"],["1P 3M 5P 7m 13M","","7add6 67 7add13"],["1P 3M 5P 7m 9A 11A","","7#9#11 7b5#9 7#9b5"],["1P 3M 5P 7m 9A 11A 13M","","13#9#11"],["1P 3M 5P 7m 9A 11A 13m","","7#9#11b13"],["1P 3M 5P 7m 9A 13M","","13#9"],["1P 3M 5P 7m 9A 13m","","7#9b13"],["1P 3M 5P 7m 9M 11A","","9#11 9+4 9#4"],["1P 3M 5P 7m 9M 11A 13M","","13#11 13+4 13#4"],["1P 3M 5P 7m 9M 11A 13m","","9#11b13 9b5b13"],["1P 3M 5P 7m 9m 11A","","7b9#11 7b5b9 7b9b5"],["1P 3M 5P 7m 9m 11A 13M","","13b9#11"],["1P 3M 5P 7m 9m 11A 13m","","7b9b13#11 7b9#11b13 7b5b9b13"],["1P 3M 5P 7m 9m 13M","","13b9"],["1P 3M 5P 7m 9m 13m","","7b9b13"],["1P 3M 5P 7m 9m 9A","","7b9#9"],["1P 3M 5P 9M","","Madd9 2 add9 add2"],["1P 3M 5P 9m","","Maddb9"],["1P 3M 5d","","Mb5"],["1P 3M 5d 6M 7m 9M","","13b5"],["1P 3M 5d 7M","","M7b5"],["1P 3M 5d 7M 9M","","M9b5"],["1P 3M 5d 7m","","7b5"],["1P 3M 5d 7m 9M","","9b5"],["1P 3M 7m","","7no5"],["1P 3M 7m 13m","","7b13"],["1P 3M 7m 9M","","9no5"],["1P 3M 7m 9M 13M","","13no5"],["1P 3M 7m 9M 13m","","9b13"],["1P 3m 4P 5P","","madd4"],["1P 3m 5P 6m 7M","","mMaj7b6"],["1P 3m 5P 6m 7M 9M","","mMaj9b6"],["1P 3m 5P 7m 11P","","m7add11 m7add4"],["1P 3m 5P 9M","","madd9"],["1P 3m 5d 6M 7M","","o7M7"],["1P 3m 5d 7M","","oM7"],["1P 3m 6m 7M","","mb6M7"],["1P 3m 6m 7m","","m7#5"],["1P 3m 6m 7m 9M","","m9#5"],["1P 3m 6m 7m 9M 11P","","m11A"],["1P 3m 6m 9m","","mb6b9"],["1P 2M 3m 5d 7m","","m9b5"],["1P 4P 5A 7M","","M7#5sus4"],["1P 4P 5A 7M 9M","","M9#5sus4"],["1P 4P 5A 7m","","7#5sus4"],["1P 4P 5P 7M","","M7sus4"],["1P 4P 5P 7M 9M","","M9sus4"],["1P 4P 5P 7m 9M","","9sus4 9sus"],["1P 4P 5P 7m 9M 13M","","13sus4 13sus"],["1P 4P 5P 7m 9m 13m","","7sus4b9b13 7b9b13sus4"],["1P 4P 7m 10m","","4 quartal"],["1P 5P 7m 9m 11P","","11b9"]].forEach(([e,n,t])=>ue(e.split(" "),t.split(" "),n)),oe.sort((e,n)=>e.setNum-n.setNum);var le={names:function(){return oe.map(e=>e.name).filter(e=>e)},symbols:function(){return oe.map(e=>e.aliases[0]).filter(e=>e)},get:me,all:ce,add:ue,removeAll:function(){oe=[],ae={}},keys:function(){return Object.keys(ae)},entries:se,chordType:ie};const de={...U,intervals:[],aliases:[]};let Pe=[],Me={};function fe(){return Pe.map(e=>e.name)}function pe(e){return Me[e]||de}const he=n("ScaleDictionary.scaleType","ScaleType.get",pe);function be(){return Pe.slice()}const ye=n("ScaleDictionary.entries","ScaleType.all",be);function ge(e,n,t=[]){const r={...J(e),name:n,intervals:e,aliases:t};return Pe.push(r),Me[r.name]=r,Me[r.setNum]=r,Me[r.chroma]=r,r.aliases.forEach(e=>function(e,n){Me[n]=e}(r,e)),r}[["1P 2M 3M 5P 6M","major pentatonic","pentatonic"],["1P 3M 4P 5P 7M","ionian pentatonic"],["1P 3M 4P 5P 7m","mixolydian pentatonic","indian"],["1P 2M 4P 5P 6M","ritusen"],["1P 2M 4P 5P 7m","egyptian"],["1P 3M 4P 5d 7m","neopolitan major pentatonic"],["1P 3m 4P 5P 6m","vietnamese 1"],["1P 2m 3m 5P 6m","pelog"],["1P 2m 4P 5P 6m","kumoijoshi"],["1P 2M 3m 5P 6m","hirajoshi"],["1P 2m 4P 5d 7m","iwato"],["1P 2m 4P 5P 7m","in-sen"],["1P 3M 4A 5P 7M","lydian pentatonic","chinese"],["1P 3m 4P 6m 7m","malkos raga"],["1P 3m 4P 5d 7m","locrian pentatonic","minor seven flat five pentatonic"],["1P 3m 4P 5P 7m","minor pentatonic","vietnamese 2"],["1P 3m 4P 5P 6M","minor six pentatonic"],["1P 2M 3m 5P 6M","flat three pentatonic","kumoi"],["1P 2M 3M 5P 6m","flat six pentatonic"],["1P 2m 3M 5P 6M","scriabin"],["1P 3M 5d 6m 7m","whole tone pentatonic"],["1P 3M 4A 5A 7M","lydian #5P pentatonic"],["1P 3M 4A 5P 7m","lydian dominant pentatonic"],["1P 3m 4P 5P 7M","minor #7M pentatonic"],["1P 3m 4d 5d 7m","super locrian pentatonic"],["1P 2M 3m 4P 5P 7M","minor hexatonic"],["1P 2A 3M 5P 5A 7M","augmented"],["1P 2M 3m 3M 5P 6M","major blues"],["1P 2M 4P 5P 6M 7m","piongio"],["1P 2m 3M 4A 6M 7m","prometheus neopolitan"],["1P 2M 3M 4A 6M 7m","prometheus"],["1P 2m 3M 5d 6m 7m","mystery #1"],["1P 2m 3M 4P 5A 6M","six tone symmetric"],["1P 2M 3M 4A 5A 7m","whole tone","messiaen's mode #1"],["1P 2m 4P 4A 5P 7M","messiaen's mode #5"],["1P 3m 4P 5d 5P 7m","minor blues","blues"],["1P 2M 3M 4P 5d 6m 7m","locrian major","arabian"],["1P 2m 3M 4A 5P 6m 7M","double harmonic lydian"],["1P 2M 3m 4P 5P 6m 7M","harmonic minor"],["1P 2m 3m 4d 5d 6m 7m","altered","super locrian","diminished whole tone","pomeroy"],["1P 2M 3m 4P 5d 6m 7m","locrian #2","half-diminished","aeolian b5"],["1P 2M 3M 4P 5P 6m 7m","mixolydian b6","melodic minor fifth mode","hindu"],["1P 2M 3M 4A 5P 6M 7m","lydian dominant","lydian b7","overtone"],["1P 2M 3M 4A 5P 6M 7M","lydian"],["1P 2M 3M 4A 5A 6M 7M","lydian augmented"],["1P 2m 3m 4P 5P 6M 7m","dorian b2","phrygian #6","melodic minor second mode"],["1P 2M 3m 4P 5P 6M 7M","melodic minor"],["1P 2m 3m 4P 5d 6m 7m","locrian"],["1P 2m 3m 4d 5d 6m 7d","ultralocrian","superlocrian bb7","·superlocrian diminished"],["1P 2m 3m 4P 5d 6M 7m","locrian 6","locrian natural 6","locrian sharp 6"],["1P 2A 3M 4P 5P 5A 7M","augmented heptatonic"],["1P 2M 3m 5d 5P 6M 7m","romanian minor"],["1P 2M 3m 4A 5P 6M 7m","dorian #4"],["1P 2M 3m 4A 5P 6M 7M","lydian diminished"],["1P 2m 3m 4P 5P 6m 7m","phrygian"],["1P 2M 3M 4A 5A 7m 7M","leading whole tone"],["1P 2M 3M 4A 5P 6m 7m","lydian minor"],["1P 2m 3M 4P 5P 6m 7m","phrygian dominant","spanish","phrygian major"],["1P 2m 3m 4P 5P 6m 7M","balinese"],["1P 2m 3m 4P 5P 6M 7M","neopolitan major"],["1P 2M 3m 4P 5P 6m 7m","aeolian","minor"],["1P 2M 3M 4P 5P 6m 7M","harmonic major"],["1P 2m 3M 4P 5P 6m 7M","double harmonic major","gypsy"],["1P 2M 3m 4P 5P 6M 7m","dorian"],["1P 2M 3m 4A 5P 6m 7M","hungarian minor"],["1P 2A 3M 4A 5P 6M 7m","hungarian major"],["1P 2m 3M 4P 5d 6M 7m","oriental"],["1P 2m 3m 3M 4A 5P 7m","flamenco"],["1P 2m 3m 4A 5P 6m 7M","todi raga"],["1P 2M 3M 4P 5P 6M 7m","mixolydian","dominant"],["1P 2m 3M 4P 5d 6m 7M","persian"],["1P 2M 3M 4P 5P 6M 7M","major","ionian"],["1P 2m 3M 5d 6m 7m 7M","enigmatic"],["1P 2M 3M 4P 5A 6M 7M","major augmented","major #5","ionian augmented","ionian #5"],["1P 2A 3M 4A 5P 6M 7M","lydian #9"],["1P 2m 2M 4P 4A 5P 6m 7M","messiaen's mode #4"],["1P 2m 3M 4P 4A 5P 6m 7M","purvi raga"],["1P 2m 3m 3M 4P 5P 6m 7m","spanish heptatonic"],["1P 2M 3M 4P 5P 6M 7m 7M","bebop"],["1P 2M 3m 3M 4P 5P 6M 7m","bebop minor"],["1P 2M 3M 4P 5P 5A 6M 7M","bebop major"],["1P 2m 3m 4P 5d 5P 6m 7m","bebop locrian"],["1P 2M 3m 4P 5P 6m 7m 7M","minor bebop"],["1P 2M 3m 4P 5d 6m 6M 7M","diminished","whole-half diminished"],["1P 2M 3M 4P 5d 5P 6M 7M","ichikosucho"],["1P 2M 3m 4P 5P 6m 6M 7M","minor six diminished"],["1P 2m 3m 3M 4A 5P 6M 7m","half-whole diminished","dominant diminished","messiaen's mode #2"],["1P 3m 3M 4P 5P 6M 7m 7M","kafi raga"],["1P 2M 3M 4P 4A 5A 6A 7M","messiaen's mode #6"],["1P 2M 3m 3M 4P 5d 5P 6M 7m","composite blues"],["1P 2M 3m 3M 4A 5P 6m 7m 7M","messiaen's mode #3"],["1P 2m 2M 3m 4P 4A 5P 6m 6M 7M","messiaen's mode #7"],["1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M","chromatic"]].forEach(([e,n,...t])=>ge(e.split(" "),n,t));var Ae={names:fe,get:pe,all:be,add:ge,removeAll:function(){Pe=[],Me={}},keys:function(){return Object.keys(Me)},entries:ye,scaleType:he};const ve={empty:!0,name:"",symbol:"",root:"",rootDegree:0,type:"",tonic:null,setNum:NaN,quality:"Unknown",chroma:"",normalized:"",aliases:[],notes:[],intervals:[]},je=/^(6|64|7|9|11|13)$/;function Ie(e){const[n,t,r,o]=p(e);return""===n?["",e]:"A"===n&&"ug"===o?["","aug"]:o||"4"!==r&&"5"!==r?je.test(r)?[n+t,r+o]:[n+t+r,o]:[n+t,r]}function Ne(e){if(""===e)return ve;if(Array.isArray(e)&&2===e.length)return xe(e[1],e[0]);{const[n,t]=Ie(e),r=xe(t,n);return r.empty?xe(e):r}}function xe(e,n,t){const r=me(e),o=M(n||""),a=M(t||"");if(r.empty||n&&o.empty||t&&a.empty)return ve;const m=D(o.pc,a.pc),i=r.intervals.indexOf(m)+1;if(!a.empty&&!i)return ve;const c=Array.from(r.intervals);for(let e=1;eT(o,e));e=-1!==r.aliases.indexOf(e)?e:r.aliases[0];const u=`${o.empty?"":o.pc}${e}${a.empty||i<=1?"":"/"+a.pc}`,l=`${n?o.pc+" ":""}${r.name}${i>1&&t?" over "+a.pc:""}`;return{...r,name:l,symbol:u,type:r.name,root:a.name,intervals:c,rootDegree:i,tonic:o.name,notes:s}}var Te={getChord:xe,get:Ne,detect:function(e){const n=e.map(e=>M(e).pc).filter(e=>e);return 0===M.length?[]:function(e,n){const t=e[0],r=M(t).chroma,o=(e=>{const n=e.reduce((e,n)=>{const t=M(n).chroma;return void 0!==t&&(e[t]=e[t]||M(n).name),e},{});return e=>n[e]})(e),a=Y(e,!1),m=[];return a.forEach((e,a)=>{ce().filter(n=>n.chroma===e).forEach(e=>{const i=e.aliases[0],c=o(a);a!==r?m.push({weight:.5*n,name:`${c}${i}/${t}`}):m.push({weight:1*n,name:`${c}${i}`})})}),m}(n,1).filter(e=>e.weight).sort((e,n)=>n.weight-e.weight).map(e=>e.name)},chordScales:function(e){const n=ee(Ne(e).chroma);return be().filter(e=>n(e.chroma)).map(e=>e.name)},extended:function(e){const n=Ne(e),t=ee(n.chroma);return ce().filter(e=>t(e.chroma)).map(e=>n.tonic+e.aliases[0])},reduced:function(e){const n=Ne(e),t=Z(n.chroma);return ce().filter(e=>t(e.chroma)).map(e=>n.tonic+e.aliases[0])},tokenize:Ie,transpose:function(e,n){const[t,r]=Ie(e);return t?T(t,n)+r:e},chord:n("Chord.chord","Chord.get",Ne)};const De=[];[[.125,"dl",["large","duplex longa","maxima","octuple","octuple whole"]],[.25,"l",["long","longa"]],[.5,"d",["double whole","double","breve"]],[1,"w",["whole","semibreve"]],[2,"h",["half","minim"]],[4,"q",["quarter","crotchet"]],[8,"e",["eighth","quaver"]],[16,"s",["sixteenth","semiquaver"]],[32,"t",["thirty-second","demisemiquaver"]],[64,"sf",["sixty-fourth","hemidemisemiquaver"]],[128,"h",["hundred twenty-eighth"]],[256,"th",["two hundred fifty-sixth"]]].forEach(([e,n,t])=>function(e,n,t){De.push({empty:!1,dots:"",name:"",value:1/e,fraction:e<1?[1/e,1]:[1,e],shorthand:n,names:t})}(e,n,t));const Oe={empty:!0,name:"",value:0,fraction:[0,0],shorthand:"",dots:"",names:[]};const we=/^([^.]+)(\.*)$/;function Se(e){const[n,t,r]=we.exec(e)||[],o=De.find(e=>e.shorthand===t||e.names.includes(t));if(!o)return Oe;const a=function(e,n){const t=Math.pow(2,n);let r=e[0]*t,o=e[1]*t;const a=r;for(let e=0;e(n.names.forEach(n=>e.push(n)),e),[])},shorthands:function(){return De.map(e=>e.shorthand)},get:Se,value:e=>Se(e).value,fraction:e=>Se(e).fraction};const Ce=j;const $e=[1,2,2,3,3,4,5,5,6,6,7,7],qe="P m M m M P d P m M m M".split(" ");const ke=D,Ee=ze((e,n)=>[e[0]+n[0],e[1]+n[1]]),_e=ze((e,n)=>[e[0]-n[0],e[1]-n[1]]);var Fe={names:function(){return"1P 2M 3M 4P 5P 6m 7m".split(" ")},get:Ce,name:e=>j(e).name,num:e=>j(e).num,semitones:e=>j(e).semitones,quality:e=>j(e).q,fromSemitones:function(e){const n=e<0?-1:1,t=Math.abs(e),r=t%12,o=Math.floor(t/12);return n*($e[r]+7*o)+qe[r]},distance:ke,invert:function(e){const n=j(e);return n.empty?"":j({step:(7-n.step)%7,alt:"perfectable"===n.type?-n.alt:-(n.alt+1),oct:n.oct,dir:n.dir}).name},simplify:function(e){const n=j(e);return n.empty?"":n.simple+n.q},add:Ee,addTo:e=>n=>Ee(e,n),substract:_e};function ze(e){return(n,t)=>{const r=j(n).coord,o=j(t).coord;if(r&&o){return x(e(r,o)).name}}}function Re(e){return+e>=0&&+e<=127}function Ue(e){if(Re(e))return+e;const n=M(e);return n.empty?null:n.midi}const Be=Math.log(2),Ge=Math.log(440);function Ke(e){const n=12*(Math.log(e)-Ge)/Be+69;return Math.round(100*n)/100}const Le="C C# D D# E F F# G G# A A# B".split(" "),He="C Db D Eb E F Gb G Ab A Bb B".split(" ");function Je(e,n={}){if(isNaN(e)||e===-1/0||e===1/0)return"";e=Math.round(e);const t=(!0===n.sharps?Le:He)[e%12];if(n.pitchClass)return t;return t+(Math.floor(e/12)-1)}var Qe={isMidi:Re,toMidi:Ue,midiToFreq:function(e,n=440){return Math.pow(2,(e-69)/12)*n},midiToNoteName:Je,freqToMidi:Ke};const We=["C","D","E","F","G","A","B"],Xe=e=>e.name,Ye=e=>e.map(M).filter(e=>!e.empty);const Ze=M;const en=T,nn=T,tn=e=>n=>en(n,e),rn=tn,on=e=>n=>en(e,n),an=on;function mn(e,n){const t=Ze(e);if(t.empty)return"";const[r,o]=t.coord;return h(void 0===o?[r+n]:[r+n,o]).name}const cn=mn,sn=(e,n)=>e.height-n.height;function un(e,n){return n=n||sn,Ye(e).sort(n).map(Xe)}function ln(e){return un(e,sn).filter((e,n,t)=>0===n||e!==t[n-1])}const dn=Mn(!0),Pn=Mn(!1);function Mn(e){return n=>{const t=Ze(n);if(t.empty)return"";const r=e?t.alt>0:t.alt<0,o=null===t.midi;return Je(t.midi||t.chroma,{sharps:r,pitchClass:o})}}var fn={names:function(e){return void 0===e?We.slice():Array.isArray(e)?Ye(e).map(Xe):[]},get:Ze,name:e=>Ze(e).name,pitchClass:e=>Ze(e).pc,accidentals:e=>Ze(e).acc,octave:e=>Ze(e).oct,midi:e=>Ze(e).midi,ascending:sn,descending:(e,n)=>n.height-e.height,sortedNames:un,sortedUniqNames:ln,fromMidi:function(e){return Je(e)},fromMidiSharps:function(e){return Je(e,{sharps:!0})},freq:e=>Ze(e).freq,fromFreq:function(e){return Je(Ke(e))},fromFreqSharps:function(e){return Je(Ke(e),{sharps:!0})},chroma:e=>Ze(e).chroma,transpose:en,tr:nn,transposeBy:tn,trBy:rn,transposeFrom:on,trFrom:an,transposeFifths:mn,trFifths:cn,simplify:dn,enharmonic:Pn};const pn={empty:!0,name:"",chordType:""},hn={};function bn(e){return"string"==typeof e?hn[e]||(hn[e]=function(e){const[n,t,r,o]=(a=e,gn.exec(a)||["","","",""]);var a;if(!r)return pn;const m=r.toUpperCase(),i=vn.indexOf(m),c=P(t),s=1;return{empty:!1,name:n,roman:r,interval:j({step:i,alt:c,dir:s}).name,acc:t,chordType:o,alt:c,step:i,major:r===m,oct:0,dir:s}}(e)):"number"==typeof e?bn(vn[e]||""):r(e)?bn(d((n=e).alt)+vn[n.step]):t(e)?bn(e.name):pn;var n}const yn=n("RomanNumeral.romanNumeral","RomanNumeral.get",bn);const gn=/^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;const An="I II III IV V VI VII",vn=An.split(" "),jn=An.toLowerCase().split(" ");var In={names:function(e=!0){return(e?vn:jn).slice()},get:bn,romanNumeral:yn};const Nn=Object.freeze([]),xn={type:"major",tonic:"",alteration:0,keySignature:""},Tn={tonic:"",grades:Nn,intervals:Nn,scale:Nn,chords:Nn,chordsHarmonicFunction:Nn,chordScales:Nn},Dn={...xn,...Tn,type:"major",minorRelative:"",scale:Nn,secondaryDominants:Nn,secondaryDominantsMinorRelative:Nn,substituteDominants:Nn,substituteDominantsMinorRelative:Nn},On={...xn,type:"minor",relativeMajor:"",natural:Tn,harmonic:Tn,melodic:Tn},wn=(e,n,t="")=>n.map((n,r)=>`${e[r]}${t}${n}`);function Sn(e,n,t,r){return o=>{const a=e.map(e=>bn(e).interval||""),m=a.map(e=>T(o,e));return{tonic:o,grades:e,intervals:a,scale:m,chords:wn(m,n),chordsHarmonicFunction:t.slice(),chordScales:wn(m,r," ")}}}const Vn=(e,n)=>{const t=M(e),r=M(n);return t.empty||r.empty?0:r.coord[0]-t.coord[0]},Cn=Sn("I II III IV V VI VII".split(" "),"maj7 m7 m7 maj7 7 m7 m7b5".split(" "),"T SD T SD D T D".split(" "),"major,dorian,phrygian,lydian,mixolydian,minor,locrian".split(",")),$n=Sn("I II bIII IV V bVI bVII".split(" "),"m7 m7b5 maj7 m7 m7 maj7 7".split(" "),"T SD T SD D SD SD".split(" "),"minor,locrian,major,dorian,phrygian,lydian,mixolydian".split(",")),qn=Sn("I II bIII IV V bVI VII".split(" "),"mMaj7 m7b5 +maj7 m7 7 maj7 o7".split(" "),"T SD T SD D SD D".split(" "),"harmonic minor,locrian 6,major augmented,lydian diminished,phrygian dominant,lydian #9,ultralocrian".split(",")),kn=Sn("I II bIII IV V VI VII".split(" "),"m6 m7 +maj7 7 7 m7b5 m7b5".split(" "),"T SD T SD D ".split(" "),"melodic minor,dorian b2,lydian augmented,lydian dominant,mixolydian b6,locrian #2,altered".split(","));var En={majorKey:function(e){const n=M(e).pc;if(!n)return Dn;const t=Cn(n),r=Vn("C",n),o=n=>{const t=bn(n);return t.empty?"":T(e,t.interval)+t.chordType};return{...t,type:"major",minorRelative:T(n,"-3m"),alteration:r,keySignature:d(r),secondaryDominants:"- VI7 VII7 I7 II7 III7 -".split(" ").map(o),secondaryDominantsMinorRelative:"- IIIm7b5 IV#m7 Vm7 VIm7 VIIm7b5 -".split(" ").map(o),substituteDominants:"- bIII7 IV7 bV7 bVI7 bVII7 -".split(" ").map(o),substituteDominantsMinorRelative:"- IIIm7 Im7 IIbm7 VIm7 IVm7 -".split(" ").map(o)}},majorTonicFromKeySignature:function(e){return"number"==typeof e?mn("C",e):"string"==typeof e&&/^b+|#+$/.test(e)?mn("C",P(e)):null},minorKey:function(e){const n=M(e).pc;if(!n)return On;const t=Vn("C",n)-3;return{type:"minor",tonic:n,relativeMajor:T(n,"3m"),alteration:t,keySignature:d(t),natural:$n(n),harmonic:qn(n),melodic:kn(n)}}};const _n={...U,name:"",alt:0,modeNum:NaN,triad:"",seventh:"",aliases:[]},Fn=[[0,2773,0,"ionian","","Maj7","major"],[1,2902,2,"dorian","m","m7"],[2,3418,4,"phrygian","m","m7"],[3,2741,-1,"lydian","","Maj7"],[4,2774,1,"mixolydian","","7"],[5,2906,3,"aeolian","m","m7","minor"],[6,3434,5,"locrian","dim","m7b5"]].map((function(e){const[n,t,r,o,a,m,i]=e,c=i?[i]:[],s=Number(t).toString(2);return{empty:!1,intervals:X(s),modeNum:n,chroma:s,normalized:s,name:o,setNum:t,alt:r,triad:a,seventh:m,aliases:c}})),zn={};function Rn(e){return"string"==typeof e?zn[e.toLowerCase()]||_n:e&&e.name?Rn(e.name):_n}Fn.forEach(e=>{zn[e.name]=e,e.aliases.forEach(n=>{zn[n]=e})});const Un=n("Mode.mode","Mode.get",Rn);function Bn(){return Fn.slice()}var Gn={get:Rn,names:function(){return Fn.map(e=>e.name)},all:Bn,entries:n("Mode.mode","Mode.all",Bn),mode:Un};var Kn={fromRomanNumerals:function(e,n){return n.map(bn).map(n=>T(e,j(n))+n.chordType)},toRomanNumerals:function(e,n){return n.map(n=>{const[t,r]=Ie(n);return bn(j(D(e,t))).name+r})}};function Ln(e){const n=z(e.map(Ue));return e.length&&n.length===e.length?n.reduce((e,n)=>{const t=e[e.length-1];return e.concat(_(t,n).slice(1))},[n[0]]):[]}var Hn={numeric:Ln,chromatic:function(e,n){return Ln(e).map(e=>Je(e,n))}};const Jn={empty:!0,name:"",type:"",tonic:null,setNum:NaN,chroma:"",normalized:"",aliases:[],notes:[],intervals:[]};function Qn(e){if("string"!=typeof e)return["",""];const n=e.indexOf(" "),t=M(e.substring(0,n));if(t.empty){const n=M(e);return n.empty?["",e]:[n.name,""]}const r=e.substring(t.name.length+1);return[t.name,r.length?r:""]}function Wn(e){const n=Array.isArray(e)?e:Qn(e),t=M(n[0]).name,r=pe(n[1]);if(r.empty)return Jn;const o=r.name,a=t?r.intervals.map(e=>T(t,e)):[],m=t?t+" "+o:o;return{...r,name:m,type:o,tonic:t,notes:a}}var Xn={get:Wn,names:fe,extended:function(e){const n=ee(Wn(e).chroma);return be().filter(e=>n(e.chroma)).map(e=>e.name)},modeNames:function(e){const n=Wn(e);if(n.empty)return[];const t=n.tonic?n.notes:n.intervals;return Y(n.chroma).map((e,n)=>{const r=Wn(e).name;return r?[t[n],r]:["",""]}).filter(e=>e[0])},reduced:function(e){const n=Z(Wn(e).chroma);return be().filter(e=>n(e.chroma)).map(e=>e.name)},scaleChords:function(e){const n=Z(Wn(e).chroma);return ce().filter(e=>n(e.chroma)).map(e=>e.aliases[0])},scaleNotes:function(e){const n=e.map(e=>M(e).pc).filter(e=>e),t=n[0],r=ln(n);return F(r.indexOf(t),r)},tokenize:Qn,scale:n("Scale.scale","Scale.get",Wn)};const Yn={empty:!0,name:"",upper:void 0,lower:void 0,type:void 0,additive:[]},Zn=["4/4","3/4","2/4","2/2","12/8","9/8","6/8","3/8"];const et=/^(\d?\d(?:\+\d)*)\/(\d)$/,nt=new Map;function tt(e){if("string"==typeof e){const[n,t,r]=et.exec(e)||[];return tt([t,r])}const[n,t]=e,r=+t;if("number"==typeof n)return[n,r];const o=n.split("+").map(e=>+e);return 1===o.length?[o[0],r]:[o,r]}var rt={names:function(){return Zn.slice()},parse:tt,get:function(e){const n=nt.get(e);if(n)return n;const t=function([e,n]){const t=Array.isArray(e)?e.reduce((e,n)=>e+n,0):e,r=n;if(0===t||0===r)return Yn;const o=Array.isArray(e)?`${e.join("+")}/${n}`:`${e}/${n}`,a=Array.isArray(e)?e:[];return{empty:!1,name:o,type:4===r||2===r?"simple":8===r&&t%3==0?"compound":"irregular",upper:t,lower:r,additive:a}}(tt(e));return nt.set(e,t),t}};var ot,at,mt=(function(e,n){!function(e,n,t,r,o,a,m,i,c,s,u,l,d,P,M,f,p,h,b,y){function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function A(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var v=g(n),j=A(t),I=g(r),N=g(o),x=g(a),T=A(m),D=g(i),O=g(c),w=g(s),S=g(u),V=g(l),C=g(d),$=g(P),q=g(M),k=g(f),E=g(p),_=g(h),F=g(b),z=g(y),R=T,U=$.default,B=N.default,G=F.default;Object.keys(m).forEach((function(n){"default"!==n&&Object.defineProperty(e,n,{enumerable:!0,get:function(){return m[n]}})})),Object.defineProperty(e,"AbcNotation",{enumerable:!0,get:function(){return v.default}}),e.Array=j,Object.defineProperty(e,"Chord",{enumerable:!0,get:function(){return I.default}}),Object.defineProperty(e,"ChordType",{enumerable:!0,get:function(){return N.default}}),Object.defineProperty(e,"Collection",{enumerable:!0,get:function(){return x.default}}),e.Core=T,Object.defineProperty(e,"DurationValue",{enumerable:!0,get:function(){return D.default}}),Object.defineProperty(e,"Interval",{enumerable:!0,get:function(){return O.default}}),Object.defineProperty(e,"Key",{enumerable:!0,get:function(){return w.default}}),Object.defineProperty(e,"Midi",{enumerable:!0,get:function(){return S.default}}),Object.defineProperty(e,"Mode",{enumerable:!0,get:function(){return V.default}}),Object.defineProperty(e,"Note",{enumerable:!0,get:function(){return C.default}}),Object.defineProperty(e,"Pcset",{enumerable:!0,get:function(){return $.default}}),Object.defineProperty(e,"Progression",{enumerable:!0,get:function(){return q.default}}),Object.defineProperty(e,"Range",{enumerable:!0,get:function(){return k.default}}),Object.defineProperty(e,"RomanNumeral",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(e,"Scale",{enumerable:!0,get:function(){return _.default}}),Object.defineProperty(e,"ScaleType",{enumerable:!0,get:function(){return F.default}}),Object.defineProperty(e,"TimeSignature",{enumerable:!0,get:function(){return z.default}}),e.ChordDictionary=B,e.PcSet=U,e.ScaleDictionary=G,e.Tonal=R,Object.defineProperty(e,"__esModule",{value:!0})}(n,q,E,Te,le,R,O,Ve,Fe,En,Qe,Gn,fn,te,Kn,Hn,In,Xn,Ae,rt)}(ot={exports:{}},ot.exports),ot.exports);return(at=mt)&&at.__esModule&&Object.prototype.hasOwnProperty.call(at,"default")?at.default:at}(); +var Tonal=function(){"use strict";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;const e=(e,n)=>Array(Math.abs(n)+1).join(e);function n(e,n,t){return function(...r){return console.warn(`${e} is deprecated. Use ${n}.`),t.apply(this,r)}}function t(e){return null!==e&&"object"==typeof e&&"string"==typeof e.name}function r(e){return null!==e&&"object"==typeof e&&"number"==typeof e.step&&"number"==typeof e.alt}const o=[0,2,4,-1,1,3,5],a=o.map(e=>Math.floor(7*e/12));function m(e){const{step:n,alt:t,oct:r,dir:m=1}=e,i=o[n]+7*t;if(void 0===r)return[m*i];return[m*i,m*(r-a[n]-4*t)]}const i=[3,0,4,1,5,2,6];function c(e){const[n,t,r]=e,o=i[function(e){const n=(e+1)%7;return n<0?7+n:n}(n)],m=Math.floor((n+1)/7);if(void 0===t)return{step:o,alt:m,dir:r};return{step:o,alt:m,oct:t+4*m+a[o],dir:r}}const s={empty:!0,name:"",pc:"",acc:""},u=new Map,l=e=>"CDEFGAB".charAt(e),P=n=>n<0?e("b",-n):e("#",n),d=e=>"b"===e[0]?-e.length:e.length;function M(e){const n=u.get(e);if(n)return n;const o="string"==typeof e?function(e){const n=p(e);if(""===n[0]||""!==n[3])return s;const t=n[0],r=n[1],o=n[2],a=(t.charCodeAt(0)+3)%7,i=d(r),c=o.length?+o:void 0,u=m({step:a,alt:i,oct:c}),l=t+r+o,P=t+r,M=(b[a]+i+120)%12,f=void 0===c?(g=b[a]+i,A=12,(g%A+A)%A-1188):b[a]+i+12*(c+1),h=f>=0&&f<=127?f:null,y=void 0===c?null:440*Math.pow(2,(f-69)/12);var g,A;return{empty:!1,acc:r,alt:i,chroma:M,coord:u,freq:y,height:f,letter:t,midi:h,name:l,oct:c,pc:P,step:a}}(e):r(e)?M(function(e){const{step:n,alt:t,oct:r}=e,o=l(n);if(!o)return"";const a=o+P(t);return r||0===r?a+r:a}(e)):t(e)?M(e.name):s;return u.set(e,o),o}const f=/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;function p(e){const n=f.exec(e);return[n[1].toUpperCase(),n[2].replace(/x/g,"##"),n[3],n[4]]}function h(e){return M(c(e))}const b=[0,2,4,5,7,9,11];const y={empty:!0,name:"",acc:""},g=new RegExp("^([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})|(AA|A|P|M|m|d|dd)([-+]?\\d+)$");function A(e){const n=g.exec(""+e);return null===n?["",""]:n[1]?[n[1],n[2]]:[n[4],n[3]]}const v={};function j(n){return"string"==typeof n?v[n]||(v[n]=function(e){const n=A(e);if(""===n[0])return y;const t=+n[0],r=n[1],o=(Math.abs(t)-1)%7,a=N[o];if("M"===a&&"P"===r)return y;const i="M"===a?"majorable":"perfectable",c=""+t+r,s=t<0?-1:1,u=8===t||-8===t?t:s*(o+1),l=function(e,n){return"M"===n&&"majorable"===e||"P"===n&&"perfectable"===e?0:"m"===n&&"majorable"===e?-1:/^A+$/.test(n)?n.length:/^d+$/.test(n)?-1*("perfectable"===e?n.length:n.length+1):0}(i,r),P=Math.floor((Math.abs(t)-1)/7),d=s*(I[o]+l+12*P),M=(s*(I[o]+l)%12+12)%12,f=m({step:o,alt:l,oct:P,dir:s});return{empty:!1,name:c,num:t,q:r,step:o,alt:l,dir:s,type:i,simple:u,semitones:d,chroma:M,coord:f,oct:P}}(n)):r(n)?j(function(n){const{step:t,alt:r,oct:o=0,dir:a}=n;if(!a)return"";return(a<0?"-":"")+(t+1+7*o)+function(n,t){return 0===t?"majorable"===n?"M":"P":-1===t&&"majorable"===n?"m":t>0?e("A",t):e("d","perfectable"===n?t:t+1)}("M"===N[t]?"majorable":"perfectable",r)}(n)):t(n)?j(n.name):y}const I=[0,2,4,5,7,9,11],N="PMMPPMM";function x(e){const[n,t=0]=e;return j(c(7*n+12*t<0?[-n,-t,-1]:[n,t,1]))}function T(e,n){const t=M(e),r=j(n);if(t.empty||r.empty)return"";const o=t.coord,a=r.coord;return h(1===o.length?[o[0]+a[0]]:[o[0]+a[0],o[1]+a[1]]).name}function D(e,n){const t=M(e),r=M(n);if(t.empty||r.empty)return"";const o=t.coord,a=r.coord,m=a[0]-o[0];return x([m,2===o.length&&2===a.length?a[1]-o[1]:-Math.floor(7*m/12)]).name}var O=Object.freeze({__proto__:null,accToAlt:d,altToAcc:P,coordToInterval:x,coordToNote:h,decode:c,deprecate:n,distance:D,encode:m,fillStr:e,interval:j,isNamed:t,isPitch:r,note:M,stepToLetter:l,tokenizeInterval:A,tokenizeNote:p,transpose:T});const w=(e,n)=>Array(n+1).join(e),S=/^(_{1,}|=|\^{1,}|)([abcdefgABCDEFG])([,']*)$/;function V(e){const n=S.exec(e);return n?[n[1],n[2],n[3]]:["","",""]}function C(e){const[n,t,r]=V(e);if(""===t)return"";let o=4;for(let e=0;e96?t.toUpperCase()+a+(o+1):t+a+o}function $(e){const n=M(e);if(n.empty||!n.oct)return"";const{letter:t,acc:r,oct:o}=n;return("b"===r[0]?r.replace(/b/g,"_"):r.replace(/#/g,"^"))+(o>4?t.toLowerCase():t)+(5===o?"":o>4?w("'",o-5):w(",",4-o))}var q={abcToScientificNotation:C,scientificToAbcNotation:$,tokenize:V,transpose:function(e,n){return $(T(C(e),n))},distance:function(e,n){return D(C(e),C(n))}};function k(e){return e.map(e=>M(e)).filter(e=>!e.empty).sort((e,n)=>e.height-n.height).map(e=>e.name)}var E=Object.freeze({__proto__:null,compact:function(e){return e.filter(e=>0===e||e)},permutations:function e(n){return 0===n.length?[[]]:e(n.slice(1)).reduce((e,t)=>e.concat(n.map((e,r)=>{const o=t.slice();return o.splice(r,0,n[0]),o})),[])},range:function(e,n){return e0===n||e!==t[n-1])}});function _(e,n){return e0===e||e)}var R={compact:z,permutations:function e(n){return 0===n.length?[[]]:e(n.slice(1)).reduce((e,t)=>e.concat(n.map((e,r)=>{const o=t.slice();return o.splice(r,0,n[0]),o})),[])},range:_,rotate:F,shuffle:function(e,n=Math.random){let t,r,o=e.length;for(;o;)t=Math.floor(n()*o--),r=e[o],e[o]=e[t],e[t]=r;return e}};const U={empty:!0,name:"",setNum:0,chroma:"000000000000",normalized:"000000000000",intervals:[]},B=e=>Number(e).toString(2),G=e=>parseInt(e,2),K=/^[01]{12}$/;function L(e){return K.test(e)}const H={[U.chroma]:U};function J(e){const n=L(e)?e:"number"==typeof(t=e)&&t>=0&&t<=4095?B(e):Array.isArray(e)?function(e){if(0===e.length)return U.chroma;let n;const t=[0,0,0,0,0,0,0,0,0,0,0,0];for(let r=0;re&&L(e.chroma))(e)?e.chroma:U.chroma;var t;return H[n]=H[n]||function(e){const n=G(e),t=function(e){const n=e.split("");return n.map((e,t)=>F(t,n).join(""))}(e).map(G).filter(e=>e>=2048).sort()[0],r=B(t),o=X(e);return{empty:!1,name:"",setNum:n,chroma:e,normalized:r,intervals:o}}(n)}const Q=n("Pcset.pcset","Pcset.get",J),W=["1P","2m","2M","3m","3M","4P","5d","5P","6m","6M","7m","7M"];function X(e){const n=[];for(let t=0;t<12;t++)"1"===e.charAt(t)&&n.push(W[t]);return n}function Y(e,n=!0){const t=J(e).chroma.split("");return z(t.map((e,r)=>{const o=F(r,t);return n&&"0"===o[0]?null:o.join("")}))}function Z(e){const n=J(e).setNum;return e=>{const t=J(e).setNum;return n&&n!==t&&(t&n)===t}}function ee(e){const n=J(e).setNum;return e=>{const t=J(e).setNum;return n&&n!==t&&(t|n)===t}}function ne(e){const n=J(e);return e=>{const t=M(e);return n&&!t.empty&&"1"===n.chroma.charAt(t.chroma)}}var te={get:J,chroma:e=>J(e).chroma,num:e=>J(e).setNum,intervals:e=>J(e).intervals,chromas:function(){return _(2048,4095).map(B)},isSupersetOf:ee,isSubsetOf:Z,isNoteIncludedIn:ne,isEqual:function(e,n){return J(e).setNum===J(n).setNum},filter:function(e){const n=ne(e);return e=>e.filter(n)},modes:Y,pcset:Q};const re={...U,name:"",quality:"Unknown",intervals:[],aliases:[]};let oe=[],ae={};function me(e){return ae[e]||re}const ie=n("ChordType.chordType","ChordType.get",me);function ce(){return oe.slice()}const se=n("ChordType.entries","ChordType.all",ce);function ue(e,n,t){const r=function(e){const n=n=>-1!==e.indexOf(n);return n("5A")?"Augmented":n("3M")?"Major":n("5d")?"Diminished":n("3m")?"Minor":"Unknown"}(e),o={...J(e),name:t||"",quality:r,intervals:e,aliases:n};oe.push(o),o.name&&(ae[o.name]=o),ae[o.setNum]=o,ae[o.chroma]=o,o.aliases.forEach(e=>function(e,n){ae[n]=e}(o,e))}[["1P 3M 5P","major","M ^ "],["1P 3M 5P 7M","major seventh","maj7 Δ ma7 M7 Maj7 ^7"],["1P 3M 5P 7M 9M","major ninth","maj9 Δ9 ^9"],["1P 3M 5P 7M 9M 13M","major thirteenth","maj13 Maj13 ^13"],["1P 3M 5P 6M","sixth","6 add6 add13 M6"],["1P 3M 5P 6M 9M","sixth/ninth","6/9 69 M69"],["1P 3M 6m 7M","major seventh flat sixth","M7b6 ^7b6"],["1P 3M 5P 7M 11A","major seventh sharp eleventh","maj#4 Δ#4 Δ#11 M7#11 ^7#11 maj7#11"],["1P 3m 5P","minor","m min -"],["1P 3m 5P 7m","minor seventh","m7 min7 mi7 -7"],["1P 3m 5P 7M","minor/major seventh","m/ma7 m/maj7 mM7 mMaj7 m/M7 -Δ7 mΔ -^7"],["1P 3m 5P 6M","minor sixth","m6 -6"],["1P 3m 5P 7m 9M","minor ninth","m9 -9"],["1P 3m 5P 7M 9M","minor/major ninth","mM9 mMaj9 -^9"],["1P 3m 5P 7m 9M 11P","minor eleventh","m11 -11"],["1P 3m 5P 7m 9M 13M","minor thirteenth","m13 -13"],["1P 3m 5d","diminished","dim ° o"],["1P 3m 5d 7d","diminished seventh","dim7 °7 o7"],["1P 3m 5d 7m","half-diminished","m7b5 ø -7b5 h7 h"],["1P 3M 5P 7m","dominant seventh","7 dom"],["1P 3M 5P 7m 9M","dominant ninth","9"],["1P 3M 5P 7m 9M 13M","dominant thirteenth","13"],["1P 3M 5P 7m 11A","lydian dominant seventh","7#11 7#4"],["1P 3M 5P 7m 9m","dominant flat ninth","7b9"],["1P 3M 5P 7m 9A","dominant sharp ninth","7#9"],["1P 3M 7m 9m","altered","alt7"],["1P 4P 5P","suspended fourth","sus4 sus"],["1P 2M 5P","suspended second","sus2"],["1P 4P 5P 7m","suspended fourth seventh","7sus4 7sus"],["1P 5P 7m 9M 11P","eleventh","11"],["1P 4P 5P 7m 9m","suspended fourth flat ninth","b9sus phryg 7b9sus 7b9sus4"],["1P 5P","fifth","5"],["1P 3M 5A","augmented","aug + +5 ^#5"],["1P 3m 5A","minor augmented","m#5 -#5 m+"],["1P 3M 5A 7M","augmented seventh","maj7#5 maj7+5 +maj7 ^7#5"],["1P 3M 5P 7M 9M 11A","major sharp eleventh (lydian)","maj9#11 Δ9#11 ^9#11"],["1P 2M 4P 5P","","sus24 sus4add9"],["1P 3M 5A 7M 9M","","maj9#5 Maj9#5"],["1P 3M 5A 7m","","7#5 +7 7+ 7aug aug7"],["1P 3M 5A 7m 9A","","7#5#9 7#9#5 7alt"],["1P 3M 5A 7m 9M","","9#5 9+"],["1P 3M 5A 7m 9M 11A","","9#5#11"],["1P 3M 5A 7m 9m","","7#5b9 7b9#5"],["1P 3M 5A 7m 9m 11A","","7#5b9#11"],["1P 3M 5A 9A","","+add#9"],["1P 3M 5A 9M","","M#5add9 +add9"],["1P 3M 5P 6M 11A","","M6#11 M6b5 6#11 6b5"],["1P 3M 5P 6M 7M 9M","","M7add13"],["1P 3M 5P 6M 9M 11A","","69#11"],["1P 3m 5P 6M 9M","","m69 -69"],["1P 3M 5P 6m 7m","","7b6"],["1P 3M 5P 7M 9A 11A","","maj7#9#11"],["1P 3M 5P 7M 9M 11A 13M","","M13#11 maj13#11 M13+4 M13#4"],["1P 3M 5P 7M 9m","","M7b9"],["1P 3M 5P 7m 11A 13m","","7#11b13 7b5b13"],["1P 3M 5P 7m 13M","","7add6 67 7add13"],["1P 3M 5P 7m 9A 11A","","7#9#11 7b5#9 7#9b5"],["1P 3M 5P 7m 9A 11A 13M","","13#9#11"],["1P 3M 5P 7m 9A 11A 13m","","7#9#11b13"],["1P 3M 5P 7m 9A 13M","","13#9"],["1P 3M 5P 7m 9A 13m","","7#9b13"],["1P 3M 5P 7m 9M 11A","","9#11 9+4 9#4"],["1P 3M 5P 7m 9M 11A 13M","","13#11 13+4 13#4"],["1P 3M 5P 7m 9M 11A 13m","","9#11b13 9b5b13"],["1P 3M 5P 7m 9m 11A","","7b9#11 7b5b9 7b9b5"],["1P 3M 5P 7m 9m 11A 13M","","13b9#11"],["1P 3M 5P 7m 9m 11A 13m","","7b9b13#11 7b9#11b13 7b5b9b13"],["1P 3M 5P 7m 9m 13M","","13b9"],["1P 3M 5P 7m 9m 13m","","7b9b13"],["1P 3M 5P 7m 9m 9A","","7b9#9"],["1P 3M 5P 9M","","Madd9 2 add9 add2"],["1P 3M 5P 9m","","Maddb9"],["1P 3M 5d","","Mb5"],["1P 3M 5d 6M 7m 9M","","13b5"],["1P 3M 5d 7M","","M7b5"],["1P 3M 5d 7M 9M","","M9b5"],["1P 3M 5d 7m","","7b5"],["1P 3M 5d 7m 9M","","9b5"],["1P 3M 7m","","7no5"],["1P 3M 7m 13m","","7b13"],["1P 3M 7m 9M","","9no5"],["1P 3M 7m 9M 13M","","13no5"],["1P 3M 7m 9M 13m","","9b13"],["1P 3m 4P 5P","","madd4"],["1P 3m 5P 6m 7M","","mMaj7b6"],["1P 3m 5P 6m 7M 9M","","mMaj9b6"],["1P 3m 5P 7m 11P","","m7add11 m7add4"],["1P 3m 5P 9M","","madd9"],["1P 3m 5d 6M 7M","","o7M7"],["1P 3m 5d 7M","","oM7"],["1P 3m 6m 7M","","mb6M7"],["1P 3m 6m 7m","","m7#5"],["1P 3m 6m 7m 9M","","m9#5"],["1P 3m 6m 7m 9M 11P","","m11A"],["1P 3m 6m 9m","","mb6b9"],["1P 2M 3m 5d 7m","","m9b5"],["1P 4P 5A 7M","","M7#5sus4"],["1P 4P 5A 7M 9M","","M9#5sus4"],["1P 4P 5A 7m","","7#5sus4"],["1P 4P 5P 7M","","M7sus4"],["1P 4P 5P 7M 9M","","M9sus4"],["1P 4P 5P 7m 9M","","9sus4 9sus"],["1P 4P 5P 7m 9M 13M","","13sus4 13sus"],["1P 4P 5P 7m 9m 13m","","7sus4b9b13 7b9b13sus4"],["1P 4P 7m 10m","","4 quartal"],["1P 5P 7m 9m 11P","","11b9"]].forEach(([e,n,t])=>ue(e.split(" "),t.split(" "),n)),oe.sort((e,n)=>e.setNum-n.setNum);var le={names:function(){return oe.map(e=>e.name).filter(e=>e)},symbols:function(){return oe.map(e=>e.aliases[0]).filter(e=>e)},get:me,all:ce,add:ue,removeAll:function(){oe=[],ae={}},keys:function(){return Object.keys(ae)},entries:se,chordType:ie};function Pe(e){return+e>=0&&+e<=127}function de(e){if(Pe(e))return+e;const n=M(e);return n.empty?null:n.midi}const Me=Math.log(2),fe=Math.log(440);function pe(e){const n=12*(Math.log(e)-fe)/Me+69;return Math.round(100*n)/100}const he="C C# D D# E F F# G G# A A# B".split(" "),be="C Db D Eb E F Gb G Ab A Bb B".split(" ");function ye(e,n={}){if(isNaN(e)||e===-1/0||e===1/0)return"";e=Math.round(e);const t=(!0===n.sharps?he:be)[e%12];if(n.pitchClass)return t;return t+(Math.floor(e/12)-1)}var ge={isMidi:Pe,toMidi:de,midiToFreq:function(e,n=440){return Math.pow(2,(e-69)/12)*n},midiToNoteName:ye,freqToMidi:pe};const Ae=["C","D","E","F","G","A","B"],ve=e=>e.name,je=e=>e.map(M).filter(e=>!e.empty);const Ie=M;const Ne=T,xe=T,Te=e=>n=>Ne(n,e),De=Te,Oe=e=>n=>Ne(e,n),we=Oe;function Se(e,n){const t=Ie(e);if(t.empty)return"";const[r,o]=t.coord;return h(void 0===o?[r+n]:[r+n,o]).name}const Ve=Se,Ce=(e,n)=>e.height-n.height;function $e(e,n){return n=n||Ce,je(e).sort(n).map(ve)}function qe(e){return $e(e,Ce).filter((e,n,t)=>0===n||e!==t[n-1])}const ke=_e(!0),Ee=_e(!1);function _e(e){return n=>{const t=Ie(n);if(t.empty)return"";const r=e?t.alt>0:t.alt<0,o=null===t.midi;return ye(t.midi||t.chroma,{sharps:r,pitchClass:o})}}var Fe={names:function(e){return void 0===e?Ae.slice():Array.isArray(e)?je(e).map(ve):[]},get:Ie,name:e=>Ie(e).name,pitchClass:e=>Ie(e).pc,accidentals:e=>Ie(e).acc,octave:e=>Ie(e).oct,midi:e=>Ie(e).midi,ascending:Ce,descending:(e,n)=>n.height-e.height,sortedNames:$e,sortedUniqNames:qe,fromMidi:function(e){return ye(e)},fromMidiSharps:function(e){return ye(e,{sharps:!0})},freq:e=>Ie(e).freq,fromFreq:function(e){return ye(pe(e))},fromFreqSharps:function(e){return ye(pe(e),{sharps:!0})},chroma:e=>Ie(e).chroma,transpose:Ne,tr:xe,transposeBy:Te,trBy:De,transposeFrom:Oe,trFrom:we,transposeFifths:Se,trFifths:Ve,simplify:ke,enharmonic:Ee};const ze=j;function Re(e){const n=j(e);return n.empty?"":n.simple+n.q}const Ue=[1,2,2,3,3,4,5,5,6,6,7,7],Be="P m M m M P d P m M m M".split(" ");const Ge=D,Ke=Je((e,n)=>[e[0]+n[0],e[1]+n[1]]),Le=Je((e,n)=>[e[0]-n[0],e[1]-n[1]]);var He={names:function(){return"1P 2M 3M 4P 5P 6m 7m".split(" ")},get:ze,name:e=>j(e).name,num:e=>j(e).num,semitones:e=>j(e).semitones,quality:e=>j(e).q,fromSemitones:function(e){const n=e<0?-1:1,t=Math.abs(e),r=t%12,o=Math.floor(t/12);return n*(Ue[r]+7*o)+Be[r]},distance:Ge,invert:function(e){const n=j(e);return n.empty?"":j({step:(7-n.step)%7,alt:"perfectable"===n.type?-n.alt:-(n.alt+1),oct:n.oct,dir:n.dir}).name},simplify:Re,add:Ke,addTo:e=>n=>Ke(e,n),substract:Le};function Je(e){return(n,t)=>{const r=j(n).coord,o=j(t).coord;if(r&&o){return x(e(r,o)).name}}}const Qe={...U,intervals:[],aliases:[]};let We=[],Xe={};function Ye(){return We.map(e=>e.name)}function Ze(e){return Xe[e]||Qe}const en=n("ScaleDictionary.scaleType","ScaleType.get",Ze);function nn(){return We.slice()}const tn=n("ScaleDictionary.entries","ScaleType.all",nn);function rn(e,n,t=[]){const r={...J(e),name:n,intervals:e,aliases:t};return We.push(r),Xe[r.name]=r,Xe[r.setNum]=r,Xe[r.chroma]=r,r.aliases.forEach(e=>function(e,n){Xe[n]=e}(r,e)),r}[["1P 2M 3M 5P 6M","major pentatonic","pentatonic"],["1P 3M 4P 5P 7M","ionian pentatonic"],["1P 3M 4P 5P 7m","mixolydian pentatonic","indian"],["1P 2M 4P 5P 6M","ritusen"],["1P 2M 4P 5P 7m","egyptian"],["1P 3M 4P 5d 7m","neopolitan major pentatonic"],["1P 3m 4P 5P 6m","vietnamese 1"],["1P 2m 3m 5P 6m","pelog"],["1P 2m 4P 5P 6m","kumoijoshi"],["1P 2M 3m 5P 6m","hirajoshi"],["1P 2m 4P 5d 7m","iwato"],["1P 2m 4P 5P 7m","in-sen"],["1P 3M 4A 5P 7M","lydian pentatonic","chinese"],["1P 3m 4P 6m 7m","malkos raga"],["1P 3m 4P 5d 7m","locrian pentatonic","minor seven flat five pentatonic"],["1P 3m 4P 5P 7m","minor pentatonic","vietnamese 2"],["1P 3m 4P 5P 6M","minor six pentatonic"],["1P 2M 3m 5P 6M","flat three pentatonic","kumoi"],["1P 2M 3M 5P 6m","flat six pentatonic"],["1P 2m 3M 5P 6M","scriabin"],["1P 3M 5d 6m 7m","whole tone pentatonic"],["1P 3M 4A 5A 7M","lydian #5P pentatonic"],["1P 3M 4A 5P 7m","lydian dominant pentatonic"],["1P 3m 4P 5P 7M","minor #7M pentatonic"],["1P 3m 4d 5d 7m","super locrian pentatonic"],["1P 2M 3m 4P 5P 7M","minor hexatonic"],["1P 2A 3M 5P 5A 7M","augmented"],["1P 2M 3m 3M 5P 6M","major blues"],["1P 2M 4P 5P 6M 7m","piongio"],["1P 2m 3M 4A 6M 7m","prometheus neopolitan"],["1P 2M 3M 4A 6M 7m","prometheus"],["1P 2m 3M 5d 6m 7m","mystery #1"],["1P 2m 3M 4P 5A 6M","six tone symmetric"],["1P 2M 3M 4A 5A 7m","whole tone","messiaen's mode #1"],["1P 2m 4P 4A 5P 7M","messiaen's mode #5"],["1P 3m 4P 5d 5P 7m","minor blues","blues"],["1P 2M 3M 4P 5d 6m 7m","locrian major","arabian"],["1P 2m 3M 4A 5P 6m 7M","double harmonic lydian"],["1P 2M 3m 4P 5P 6m 7M","harmonic minor"],["1P 2m 3m 4d 5d 6m 7m","altered","super locrian","diminished whole tone","pomeroy"],["1P 2M 3m 4P 5d 6m 7m","locrian #2","half-diminished","aeolian b5"],["1P 2M 3M 4P 5P 6m 7m","mixolydian b6","melodic minor fifth mode","hindu"],["1P 2M 3M 4A 5P 6M 7m","lydian dominant","lydian b7","overtone"],["1P 2M 3M 4A 5P 6M 7M","lydian"],["1P 2M 3M 4A 5A 6M 7M","lydian augmented"],["1P 2m 3m 4P 5P 6M 7m","dorian b2","phrygian #6","melodic minor second mode"],["1P 2M 3m 4P 5P 6M 7M","melodic minor"],["1P 2m 3m 4P 5d 6m 7m","locrian"],["1P 2m 3m 4d 5d 6m 7d","ultralocrian","superlocrian bb7","·superlocrian diminished"],["1P 2m 3m 4P 5d 6M 7m","locrian 6","locrian natural 6","locrian sharp 6"],["1P 2A 3M 4P 5P 5A 7M","augmented heptatonic"],["1P 2M 3m 5d 5P 6M 7m","romanian minor"],["1P 2M 3m 4A 5P 6M 7m","dorian #4"],["1P 2M 3m 4A 5P 6M 7M","lydian diminished"],["1P 2m 3m 4P 5P 6m 7m","phrygian"],["1P 2M 3M 4A 5A 7m 7M","leading whole tone"],["1P 2M 3M 4A 5P 6m 7m","lydian minor"],["1P 2m 3M 4P 5P 6m 7m","phrygian dominant","spanish","phrygian major"],["1P 2m 3m 4P 5P 6m 7M","balinese"],["1P 2m 3m 4P 5P 6M 7M","neopolitan major"],["1P 2M 3m 4P 5P 6m 7m","aeolian","minor"],["1P 2M 3M 4P 5P 6m 7M","harmonic major"],["1P 2m 3M 4P 5P 6m 7M","double harmonic major","gypsy"],["1P 2M 3m 4P 5P 6M 7m","dorian"],["1P 2M 3m 4A 5P 6m 7M","hungarian minor"],["1P 2A 3M 4A 5P 6M 7m","hungarian major"],["1P 2m 3M 4P 5d 6M 7m","oriental"],["1P 2m 3m 3M 4A 5P 7m","flamenco"],["1P 2m 3m 4A 5P 6m 7M","todi raga"],["1P 2M 3M 4P 5P 6M 7m","mixolydian","dominant"],["1P 2m 3M 4P 5d 6m 7M","persian"],["1P 2M 3M 4P 5P 6M 7M","major","ionian"],["1P 2m 3M 5d 6m 7m 7M","enigmatic"],["1P 2M 3M 4P 5A 6M 7M","major augmented","major #5","ionian augmented","ionian #5"],["1P 2A 3M 4A 5P 6M 7M","lydian #9"],["1P 2m 2M 4P 4A 5P 6m 7M","messiaen's mode #4"],["1P 2m 3M 4P 4A 5P 6m 7M","purvi raga"],["1P 2m 3m 3M 4P 5P 6m 7m","spanish heptatonic"],["1P 2M 3M 4P 5P 6M 7m 7M","bebop"],["1P 2M 3m 3M 4P 5P 6M 7m","bebop minor"],["1P 2M 3M 4P 5P 5A 6M 7M","bebop major"],["1P 2m 3m 4P 5d 5P 6m 7m","bebop locrian"],["1P 2M 3m 4P 5P 6m 7m 7M","minor bebop"],["1P 2M 3m 4P 5d 6m 6M 7M","diminished","whole-half diminished"],["1P 2M 3M 4P 5d 5P 6M 7M","ichikosucho"],["1P 2M 3m 4P 5P 6m 6M 7M","minor six diminished"],["1P 2m 3m 3M 4A 5P 6M 7m","half-whole diminished","dominant diminished","messiaen's mode #2"],["1P 3m 3M 4P 5P 6M 7m 7M","kafi raga"],["1P 2M 3M 4P 4A 5A 6A 7M","messiaen's mode #6"],["1P 2M 3m 3M 4P 5d 5P 6M 7m","composite blues"],["1P 2M 3m 3M 4A 5P 6m 7m 7M","messiaen's mode #3"],["1P 2m 2M 3m 4P 4A 5P 6m 6M 7M","messiaen's mode #7"],["1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M","chromatic"]].forEach(([e,n,...t])=>rn(e.split(" "),n,t));var on={names:Ye,get:Ze,all:nn,add:rn,removeAll:function(){We=[],Xe={}},keys:function(){return Object.keys(Xe)},entries:tn,scaleType:en};const an={empty:!0,name:"",symbol:"",root:"",rootDegree:0,type:"",tonic:null,setNum:NaN,quality:"Unknown",chroma:"",normalized:"",aliases:[],notes:[],intervals:[]},mn=/^(6|64|7|9|11|13)$/;function cn(e){const[n,t,r,o]=p(e);return""===n?["",e]:"A"===n&&"ug"===o?["","aug"]:o||"4"!==r&&"5"!==r?mn.test(r)?[n+t,r+o]:[n+t+r,o]:[n+t,r]}function sn(e){if(""===e)return an;if(Array.isArray(e)&&2===e.length)return un(e[1],e[0]);{const[n,t]=cn(e),r=un(t,n);return r.empty?un(e):r}}function un(e,n,t){const r=me(e),o=M(n||""),a=M(t||"");if(r.empty||n&&o.empty||t&&a.empty)return an;const m=D(o.pc,a.pc),i=r.intervals.indexOf(m)+1;if(!a.empty&&!i)return an;const c=Array.from(r.intervals);for(let e=1;eT(o,e));e=-1!==r.aliases.indexOf(e)?e:r.aliases[0];const u=`${o.empty?"":o.pc}${e}${a.empty||i<=1?"":"/"+a.pc}`,l=`${n?o.pc+" ":""}${r.name}${i>1&&t?" over "+a.pc:""}`;return{...r,name:l,symbol:u,type:r.name,root:a.name,intervals:c,rootDegree:i,tonic:o.name,notes:s}}var ln={getChord:un,get:sn,detect:function(e){const n=$e(e).map(e=>M(e).pc).filter(e=>e);return 0===M.length?[]:function(e,n){const t=function(e){let n=null;return e.every(t=>!e.some(e=>{const r=Re(D(t,e)),o=$e([t,e]);return"5P"===r?(n=o[0],n):"4P"===r&&(n=o[1],n)})),n||e[0]}(e),r=(e=>{const n=e.reduce((e,n)=>{const t=M(n).chroma;return void 0!==t&&(e[t]=e[t]||M(n).name),e},{});return e=>n[e]})(e),o=Y(e,!1),a=e[0],m=M(a).chroma,i=[];return o.forEach((e,o)=>{ce().filter(n=>n.chroma===e).forEach(e=>{const c=e.aliases[0],s=r(o);M(s).chroma!==m?i.push({weight:.5*n,name:`${s}${c}/${a}`}):i.push({weight:1*n,name:`${t}${c}`})})}),i}(n,1).filter(e=>e.weight).sort((e,n)=>n.weight-e.weight).map(e=>e.name)},chordScales:function(e){const n=ee(sn(e).chroma);return nn().filter(e=>n(e.chroma)).map(e=>e.name)},extended:function(e){const n=sn(e),t=ee(n.chroma);return ce().filter(e=>t(e.chroma)).map(e=>n.tonic+e.aliases[0])},reduced:function(e){const n=sn(e),t=Z(n.chroma);return ce().filter(e=>t(e.chroma)).map(e=>n.tonic+e.aliases[0])},tokenize:cn,transpose:function(e,n){const[t,r]=cn(e);return t?T(t,n)+r:e},chord:n("Chord.chord","Chord.get",sn)};const Pn=[];[[.125,"dl",["large","duplex longa","maxima","octuple","octuple whole"]],[.25,"l",["long","longa"]],[.5,"d",["double whole","double","breve"]],[1,"w",["whole","semibreve"]],[2,"h",["half","minim"]],[4,"q",["quarter","crotchet"]],[8,"e",["eighth","quaver"]],[16,"s",["sixteenth","semiquaver"]],[32,"t",["thirty-second","demisemiquaver"]],[64,"sf",["sixty-fourth","hemidemisemiquaver"]],[128,"h",["hundred twenty-eighth"]],[256,"th",["two hundred fifty-sixth"]]].forEach(([e,n,t])=>function(e,n,t){Pn.push({empty:!1,dots:"",name:"",value:1/e,fraction:e<1?[1/e,1]:[1,e],shorthand:n,names:t})}(e,n,t));const dn={empty:!0,name:"",value:0,fraction:[0,0],shorthand:"",dots:"",names:[]};const Mn=/^([^.]+)(\.*)$/;function fn(e){const[n,t,r]=Mn.exec(e)||[],o=Pn.find(e=>e.shorthand===t||e.names.includes(t));if(!o)return dn;const a=function(e,n){const t=Math.pow(2,n);let r=e[0]*t,o=e[1]*t;const a=r;for(let e=0;e(n.names.forEach(n=>e.push(n)),e),[])},shorthands:function(){return Pn.map(e=>e.shorthand)},get:fn,value:e=>fn(e).value,fraction:e=>fn(e).fraction};const hn={empty:!0,name:"",chordType:""},bn={};function yn(e){return"string"==typeof e?bn[e]||(bn[e]=function(e){const[n,t,r,o]=(a=e,An.exec(a)||["","","",""]);var a;if(!r)return hn;const m=r.toUpperCase(),i=jn.indexOf(m),c=d(t),s=1;return{empty:!1,name:n,roman:r,interval:j({step:i,alt:c,dir:s}).name,acc:t,chordType:o,alt:c,step:i,major:r===m,oct:0,dir:s}}(e)):"number"==typeof e?yn(jn[e]||""):r(e)?yn(P((n=e).alt)+jn[n.step]):t(e)?yn(e.name):hn;var n}const gn=n("RomanNumeral.romanNumeral","RomanNumeral.get",yn);const An=/^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;const vn="I II III IV V VI VII",jn=vn.split(" "),In=vn.toLowerCase().split(" ");var Nn={names:function(e=!0){return(e?jn:In).slice()},get:yn,romanNumeral:gn};const xn=Object.freeze([]),Tn={type:"major",tonic:"",alteration:0,keySignature:""},Dn={tonic:"",grades:xn,intervals:xn,scale:xn,chords:xn,chordsHarmonicFunction:xn,chordScales:xn},On={...Tn,...Dn,type:"major",minorRelative:"",scale:xn,secondaryDominants:xn,secondaryDominantsMinorRelative:xn,substituteDominants:xn,substituteDominantsMinorRelative:xn},wn={...Tn,type:"minor",relativeMajor:"",natural:Dn,harmonic:Dn,melodic:Dn},Sn=(e,n,t="")=>n.map((n,r)=>`${e[r]}${t}${n}`);function Vn(e,n,t,r){return o=>{const a=e.map(e=>yn(e).interval||""),m=a.map(e=>T(o,e));return{tonic:o,grades:e,intervals:a,scale:m,chords:Sn(m,n),chordsHarmonicFunction:t.slice(),chordScales:Sn(m,r," ")}}}const Cn=(e,n)=>{const t=M(e),r=M(n);return t.empty||r.empty?0:r.coord[0]-t.coord[0]},$n=Vn("I II III IV V VI VII".split(" "),"maj7 m7 m7 maj7 7 m7 m7b5".split(" "),"T SD T SD D T D".split(" "),"major,dorian,phrygian,lydian,mixolydian,minor,locrian".split(",")),qn=Vn("I II bIII IV V bVI bVII".split(" "),"m7 m7b5 maj7 m7 m7 maj7 7".split(" "),"T SD T SD D SD SD".split(" "),"minor,locrian,major,dorian,phrygian,lydian,mixolydian".split(",")),kn=Vn("I II bIII IV V bVI VII".split(" "),"mMaj7 m7b5 +maj7 m7 7 maj7 o7".split(" "),"T SD T SD D SD D".split(" "),"harmonic minor,locrian 6,major augmented,lydian diminished,phrygian dominant,lydian #9,ultralocrian".split(",")),En=Vn("I II bIII IV V VI VII".split(" "),"m6 m7 +maj7 7 7 m7b5 m7b5".split(" "),"T SD T SD D ".split(" "),"melodic minor,dorian b2,lydian augmented,lydian dominant,mixolydian b6,locrian #2,altered".split(","));var _n={majorKey:function(e){const n=M(e).pc;if(!n)return On;const t=$n(n),r=Cn("C",n),o=n=>{const t=yn(n);return t.empty?"":T(e,t.interval)+t.chordType};return{...t,type:"major",minorRelative:T(n,"-3m"),alteration:r,keySignature:P(r),secondaryDominants:"- VI7 VII7 I7 II7 III7 -".split(" ").map(o),secondaryDominantsMinorRelative:"- IIIm7b5 IV#m7 Vm7 VIm7 VIIm7b5 -".split(" ").map(o),substituteDominants:"- bIII7 IV7 bV7 bVI7 bVII7 -".split(" ").map(o),substituteDominantsMinorRelative:"- IIIm7 Im7 IIbm7 VIm7 IVm7 -".split(" ").map(o)}},majorTonicFromKeySignature:function(e){return"number"==typeof e?Se("C",e):"string"==typeof e&&/^b+|#+$/.test(e)?Se("C",d(e)):null},minorKey:function(e){const n=M(e).pc;if(!n)return wn;const t=Cn("C",n)-3;return{type:"minor",tonic:n,relativeMajor:T(n,"3m"),alteration:t,keySignature:P(t),natural:qn(n),harmonic:kn(n),melodic:En(n)}}};const Fn={...U,name:"",alt:0,modeNum:NaN,triad:"",seventh:"",aliases:[]},zn=[[0,2773,0,"ionian","","Maj7","major"],[1,2902,2,"dorian","m","m7"],[2,3418,4,"phrygian","m","m7"],[3,2741,-1,"lydian","","Maj7"],[4,2774,1,"mixolydian","","7"],[5,2906,3,"aeolian","m","m7","minor"],[6,3434,5,"locrian","dim","m7b5"]].map((function(e){const[n,t,r,o,a,m,i]=e,c=i?[i]:[],s=Number(t).toString(2);return{empty:!1,intervals:X(s),modeNum:n,chroma:s,normalized:s,name:o,setNum:t,alt:r,triad:a,seventh:m,aliases:c}})),Rn={};function Un(e){return"string"==typeof e?Rn[e.toLowerCase()]||Fn:e&&e.name?Un(e.name):Fn}zn.forEach(e=>{Rn[e.name]=e,e.aliases.forEach(n=>{Rn[n]=e})});const Bn=n("Mode.mode","Mode.get",Un);function Gn(){return zn.slice()}var Kn={get:Un,names:function(){return zn.map(e=>e.name)},all:Gn,entries:n("Mode.mode","Mode.all",Gn),mode:Bn};var Ln={fromRomanNumerals:function(e,n){return n.map(yn).map(n=>T(e,j(n))+n.chordType)},toRomanNumerals:function(e,n){return n.map(n=>{const[t,r]=cn(n);return yn(j(D(e,t))).name+r})}};function Hn(e){const n=z(e.map(de));return e.length&&n.length===e.length?n.reduce((e,n)=>{const t=e[e.length-1];return e.concat(_(t,n).slice(1))},[n[0]]):[]}var Jn={numeric:Hn,chromatic:function(e,n){return Hn(e).map(e=>ye(e,n))}};const Qn={empty:!0,name:"",type:"",tonic:null,setNum:NaN,chroma:"",normalized:"",aliases:[],notes:[],intervals:[]};function Wn(e){if("string"!=typeof e)return["",""];const n=e.indexOf(" "),t=M(e.substring(0,n));if(t.empty){const n=M(e);return n.empty?["",e]:[n.name,""]}const r=e.substring(t.name.length+1);return[t.name,r.length?r:""]}function Xn(e){const n=Array.isArray(e)?e:Wn(e),t=M(n[0]).name,r=Ze(n[1]);if(r.empty)return Qn;const o=r.name,a=t?r.intervals.map(e=>T(t,e)):[],m=t?t+" "+o:o;return{...r,name:m,type:o,tonic:t,notes:a}}var Yn={get:Xn,names:Ye,extended:function(e){const n=ee(Xn(e).chroma);return nn().filter(e=>n(e.chroma)).map(e=>e.name)},modeNames:function(e){const n=Xn(e);if(n.empty)return[];const t=n.tonic?n.notes:n.intervals;return Y(n.chroma).map((e,n)=>{const r=Xn(e).name;return r?[t[n],r]:["",""]}).filter(e=>e[0])},reduced:function(e){const n=Z(Xn(e).chroma);return nn().filter(e=>n(e.chroma)).map(e=>e.name)},scaleChords:function(e){const n=Z(Xn(e).chroma);return ce().filter(e=>n(e.chroma)).map(e=>e.aliases[0])},scaleNotes:function(e){const n=e.map(e=>M(e).pc).filter(e=>e),t=n[0],r=qe(n);return F(r.indexOf(t),r)},tokenize:Wn,scale:n("Scale.scale","Scale.get",Xn)};const Zn={empty:!0,name:"",upper:void 0,lower:void 0,type:void 0,additive:[]},et=["4/4","3/4","2/4","2/2","12/8","9/8","6/8","3/8"];const nt=/^(\d?\d(?:\+\d)*)\/(\d)$/,tt=new Map;function rt(e){if("string"==typeof e){const[n,t,r]=nt.exec(e)||[];return rt([t,r])}const[n,t]=e,r=+t;if("number"==typeof n)return[n,r];const o=n.split("+").map(e=>+e);return 1===o.length?[o[0],r]:[o,r]}var ot={names:function(){return et.slice()},parse:rt,get:function(e){const n=tt.get(e);if(n)return n;const t=function([e,n]){const t=Array.isArray(e)?e.reduce((e,n)=>e+n,0):e,r=n;if(0===t||0===r)return Zn;const o=Array.isArray(e)?`${e.join("+")}/${n}`:`${e}/${n}`,a=Array.isArray(e)?e:[];return{empty:!1,name:o,type:4===r||2===r?"simple":8===r&&t%3==0?"compound":"irregular",upper:t,lower:r,additive:a}}(rt(e));return tt.set(e,t),t}};var at,mt,it=(function(e,n){!function(e,n,t,r,o,a,m,i,c,s,u,l,P,d,M,f,p,h,b,y){function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function A(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var v=g(n),j=A(t),I=g(r),N=g(o),x=g(a),T=A(m),D=g(i),O=g(c),w=g(s),S=g(u),V=g(l),C=g(P),$=g(d),q=g(M),k=g(f),E=g(p),_=g(h),F=g(b),z=g(y),R=T,U=$.default,B=N.default,G=F.default;Object.keys(m).forEach((function(n){"default"!==n&&Object.defineProperty(e,n,{enumerable:!0,get:function(){return m[n]}})})),Object.defineProperty(e,"AbcNotation",{enumerable:!0,get:function(){return v.default}}),e.Array=j,Object.defineProperty(e,"Chord",{enumerable:!0,get:function(){return I.default}}),Object.defineProperty(e,"ChordType",{enumerable:!0,get:function(){return N.default}}),Object.defineProperty(e,"Collection",{enumerable:!0,get:function(){return x.default}}),e.Core=T,Object.defineProperty(e,"DurationValue",{enumerable:!0,get:function(){return D.default}}),Object.defineProperty(e,"Interval",{enumerable:!0,get:function(){return O.default}}),Object.defineProperty(e,"Key",{enumerable:!0,get:function(){return w.default}}),Object.defineProperty(e,"Midi",{enumerable:!0,get:function(){return S.default}}),Object.defineProperty(e,"Mode",{enumerable:!0,get:function(){return V.default}}),Object.defineProperty(e,"Note",{enumerable:!0,get:function(){return C.default}}),Object.defineProperty(e,"Pcset",{enumerable:!0,get:function(){return $.default}}),Object.defineProperty(e,"Progression",{enumerable:!0,get:function(){return q.default}}),Object.defineProperty(e,"Range",{enumerable:!0,get:function(){return k.default}}),Object.defineProperty(e,"RomanNumeral",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(e,"Scale",{enumerable:!0,get:function(){return _.default}}),Object.defineProperty(e,"ScaleType",{enumerable:!0,get:function(){return F.default}}),Object.defineProperty(e,"TimeSignature",{enumerable:!0,get:function(){return z.default}}),e.ChordDictionary=B,e.PcSet=U,e.ScaleDictionary=G,e.Tonal=R,Object.defineProperty(e,"__esModule",{value:!0})}(n,q,E,ln,le,R,O,pn,He,_n,ge,Kn,Fe,te,Ln,Jn,Nn,Yn,on,ot)}(at={exports:{}},at.exports),at.exports);return(mt=it)&&mt.__esModule&&Object.prototype.hasOwnProperty.call(mt,"default")?mt.default:mt}(); //# sourceMappingURL=tonal.min.js.map diff --git a/packages/tonal/browser/tonal.min.js.map b/packages/tonal/browser/tonal.min.js.map index e5aec51e..f115c418 100644 --- a/packages/tonal/browser/tonal.min.js.map +++ b/packages/tonal/browser/tonal.min.js.map @@ -1 +1 @@ -{"version":3,"file":"tonal.min.js","sources":["../../core/dist/index.es.js","../../abc-notation/dist/index.es.js","../../array/dist/index.es.js","../../collection/dist/index.es.js","../../pcset/dist/index.es.js","../../chord-type/dist/index.es.js","../../scale-type/dist/index.es.js","../../chord/dist/index.es.js","../../chord-detect/dist/index.es.js","../../duration-value/dist/index.es.js","../../interval/dist/index.es.js","../../midi/dist/index.es.js","../../note/dist/index.es.js","../../roman-numeral/dist/index.es.js","../../key/dist/index.es.js","../../mode/dist/index.es.js","../../progression/dist/index.es.js","../../range/dist/index.es.js","../../scale/dist/index.es.js","../../time-signature/dist/index.es.js","../dist/index.js"],"sourcesContent":["/**\r\n * Fill a string with a repeated character\r\n *\r\n * @param character\r\n * @param repetition\r\n */\r\nconst fillStr = (s, n) => Array(Math.abs(n) + 1).join(s);\r\nfunction deprecate(original, alternative, fn) {\r\n return function (...args) {\r\n // tslint:disable-next-line\r\n console.warn(`${original} is deprecated. Use ${alternative}.`);\r\n return fn.apply(this, args);\r\n };\r\n}\n\nfunction isNamed(src) {\r\n return src !== null && typeof src === \"object\" && typeof src.name === \"string\"\r\n ? true\r\n : false;\r\n}\n\nfunction isPitch(pitch) {\r\n return pitch !== null &&\r\n typeof pitch === \"object\" &&\r\n typeof pitch.step === \"number\" &&\r\n typeof pitch.alt === \"number\"\r\n ? true\r\n : false;\r\n}\r\n// The number of fifths of [C, D, E, F, G, A, B]\r\nconst FIFTHS = [0, 2, 4, -1, 1, 3, 5];\r\n// The number of octaves it span each step\r\nconst STEPS_TO_OCTS = FIFTHS.map((fifths) => Math.floor((fifths * 7) / 12));\r\nfunction encode(pitch) {\r\n const { step, alt, oct, dir = 1 } = pitch;\r\n const f = FIFTHS[step] + 7 * alt;\r\n if (oct === undefined) {\r\n return [dir * f];\r\n }\r\n const o = oct - STEPS_TO_OCTS[step] - 4 * alt;\r\n return [dir * f, dir * o];\r\n}\r\n// We need to get the steps from fifths\r\n// Fifths for CDEFGAB are [ 0, 2, 4, -1, 1, 3, 5 ]\r\n// We add 1 to fifths to avoid negative numbers, so:\r\n// for [\"F\", \"C\", \"G\", \"D\", \"A\", \"E\", \"B\"] we have:\r\nconst FIFTHS_TO_STEPS = [3, 0, 4, 1, 5, 2, 6];\r\nfunction decode(coord) {\r\n const [f, o, dir] = coord;\r\n const step = FIFTHS_TO_STEPS[unaltered(f)];\r\n const alt = Math.floor((f + 1) / 7);\r\n if (o === undefined) {\r\n return { step, alt, dir };\r\n }\r\n const oct = o + 4 * alt + STEPS_TO_OCTS[step];\r\n return { step, alt, oct, dir };\r\n}\r\n// Return the number of fifths as if it were unaltered\r\nfunction unaltered(f) {\r\n const i = (f + 1) % 7;\r\n return i < 0 ? 7 + i : i;\r\n}\n\nconst NoNote = { empty: true, name: \"\", pc: \"\", acc: \"\" };\r\nconst cache = new Map();\r\nconst stepToLetter = (step) => \"CDEFGAB\".charAt(step);\r\nconst altToAcc = (alt) => alt < 0 ? fillStr(\"b\", -alt) : fillStr(\"#\", alt);\r\nconst accToAlt = (acc) => acc[0] === \"b\" ? -acc.length : acc.length;\r\n/**\r\n * Given a note literal (a note name or a note object), returns the Note object\r\n * @example\r\n * note('Bb4') // => { name: \"Bb4\", midi: 70, chroma: 10, ... }\r\n */\r\nfunction note(src) {\r\n const cached = cache.get(src);\r\n if (cached) {\r\n return cached;\r\n }\r\n const value = typeof src === \"string\"\r\n ? parse(src)\r\n : isPitch(src)\r\n ? note(pitchName(src))\r\n : isNamed(src)\r\n ? note(src.name)\r\n : NoNote;\r\n cache.set(src, value);\r\n return value;\r\n}\r\nconst REGEX = /^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\\d*)\\s*(.*)$/;\r\n/**\r\n * @private\r\n */\r\nfunction tokenizeNote(str) {\r\n const m = REGEX.exec(str);\r\n return [m[1].toUpperCase(), m[2].replace(/x/g, \"##\"), m[3], m[4]];\r\n}\r\n/**\r\n * @private\r\n */\r\nfunction coordToNote(noteCoord) {\r\n return note(decode(noteCoord));\r\n}\r\nconst mod = (n, m) => ((n % m) + m) % m;\r\nconst SEMI = [0, 2, 4, 5, 7, 9, 11];\r\nfunction parse(noteName) {\r\n const tokens = tokenizeNote(noteName);\r\n if (tokens[0] === \"\" || tokens[3] !== \"\") {\r\n return NoNote;\r\n }\r\n const letter = tokens[0];\r\n const acc = tokens[1];\r\n const octStr = tokens[2];\r\n const step = (letter.charCodeAt(0) + 3) % 7;\r\n const alt = accToAlt(acc);\r\n const oct = octStr.length ? +octStr : undefined;\r\n const coord = encode({ step, alt, oct });\r\n const name = letter + acc + octStr;\r\n const pc = letter + acc;\r\n const chroma = (SEMI[step] + alt + 120) % 12;\r\n const height = oct === undefined\r\n ? mod(SEMI[step] + alt, 12) - 12 * 99\r\n : SEMI[step] + alt + 12 * (oct + 1);\r\n const midi = height >= 0 && height <= 127 ? height : null;\r\n const freq = oct === undefined ? null : Math.pow(2, (height - 69) / 12) * 440;\r\n return {\r\n empty: false,\r\n acc,\r\n alt,\r\n chroma,\r\n coord,\r\n freq,\r\n height,\r\n letter,\r\n midi,\r\n name,\r\n oct,\r\n pc,\r\n step,\r\n };\r\n}\r\nfunction pitchName(props) {\r\n const { step, alt, oct } = props;\r\n const letter = stepToLetter(step);\r\n if (!letter) {\r\n return \"\";\r\n }\r\n const pc = letter + altToAcc(alt);\r\n return oct || oct === 0 ? pc + oct : pc;\r\n}\n\nconst NoInterval = { empty: true, name: \"\", acc: \"\" };\r\n// shorthand tonal notation (with quality after number)\r\nconst INTERVAL_TONAL_REGEX = \"([-+]?\\\\d+)(d{1,4}|m|M|P|A{1,4})\";\r\n// standard shorthand notation (with quality before number)\r\nconst INTERVAL_SHORTHAND_REGEX = \"(AA|A|P|M|m|d|dd)([-+]?\\\\d+)\";\r\nconst REGEX$1 = new RegExp(\"^\" + INTERVAL_TONAL_REGEX + \"|\" + INTERVAL_SHORTHAND_REGEX + \"$\");\r\n/**\r\n * @private\r\n */\r\nfunction tokenizeInterval(str) {\r\n const m = REGEX$1.exec(`${str}`);\r\n if (m === null) {\r\n return [\"\", \"\"];\r\n }\r\n return m[1] ? [m[1], m[2]] : [m[4], m[3]];\r\n}\r\nconst cache$1 = {};\r\n/**\r\n * Get interval properties. It returns an object with:\r\n *\r\n * - name: the interval name\r\n * - num: the interval number\r\n * - type: 'perfectable' or 'majorable'\r\n * - q: the interval quality (d, m, M, A)\r\n * - dir: interval direction (1 ascending, -1 descending)\r\n * - simple: the simplified number\r\n * - semitones: the size in semitones\r\n * - chroma: the interval chroma\r\n *\r\n * @param {string} interval - the interval name\r\n * @return {Object} the interval properties\r\n *\r\n * @example\r\n * import { interval } from '@tonaljs/core'\r\n * interval('P5').semitones // => 7\r\n * interval('m3').type // => 'majorable'\r\n */\r\nfunction interval(src) {\r\n return typeof src === \"string\"\r\n ? cache$1[src] || (cache$1[src] = parse$1(src))\r\n : isPitch(src)\r\n ? interval(pitchName$1(src))\r\n : isNamed(src)\r\n ? interval(src.name)\r\n : NoInterval;\r\n}\r\nconst SIZES = [0, 2, 4, 5, 7, 9, 11];\r\nconst TYPES = \"PMMPPMM\";\r\nfunction parse$1(str) {\r\n const tokens = tokenizeInterval(str);\r\n if (tokens[0] === \"\") {\r\n return NoInterval;\r\n }\r\n const num = +tokens[0];\r\n const q = tokens[1];\r\n const step = (Math.abs(num) - 1) % 7;\r\n const t = TYPES[step];\r\n if (t === \"M\" && q === \"P\") {\r\n return NoInterval;\r\n }\r\n const type = t === \"M\" ? \"majorable\" : \"perfectable\";\r\n const name = \"\" + num + q;\r\n const dir = num < 0 ? -1 : 1;\r\n const simple = num === 8 || num === -8 ? num : dir * (step + 1);\r\n const alt = qToAlt(type, q);\r\n const oct = Math.floor((Math.abs(num) - 1) / 7);\r\n const semitones = dir * (SIZES[step] + alt + 12 * oct);\r\n const chroma = (((dir * (SIZES[step] + alt)) % 12) + 12) % 12;\r\n const coord = encode({ step, alt, oct, dir });\r\n return {\r\n empty: false,\r\n name,\r\n num,\r\n q,\r\n step,\r\n alt,\r\n dir,\r\n type,\r\n simple,\r\n semitones,\r\n chroma,\r\n coord,\r\n oct,\r\n };\r\n}\r\n/**\r\n * @private\r\n */\r\nfunction coordToInterval(coord) {\r\n const [f, o = 0] = coord;\r\n const isDescending = f * 7 + o * 12 < 0;\r\n const ivl = isDescending ? [-f, -o, -1] : [f, o, 1];\r\n return interval(decode(ivl));\r\n}\r\nfunction qToAlt(type, q) {\r\n return (q === \"M\" && type === \"majorable\") ||\r\n (q === \"P\" && type === \"perfectable\")\r\n ? 0\r\n : q === \"m\" && type === \"majorable\"\r\n ? -1\r\n : /^A+$/.test(q)\r\n ? q.length\r\n : /^d+$/.test(q)\r\n ? -1 * (type === \"perfectable\" ? q.length : q.length + 1)\r\n : 0;\r\n}\r\n// return the interval name of a pitch\r\nfunction pitchName$1(props) {\r\n const { step, alt, oct = 0, dir } = props;\r\n if (!dir) {\r\n return \"\";\r\n }\r\n const num = step + 1 + 7 * oct;\r\n const d = dir < 0 ? \"-\" : \"\";\r\n const type = TYPES[step] === \"M\" ? \"majorable\" : \"perfectable\";\r\n const name = d + num + altToQ(type, alt);\r\n return name;\r\n}\r\nfunction altToQ(type, alt) {\r\n if (alt === 0) {\r\n return type === \"majorable\" ? \"M\" : \"P\";\r\n }\r\n else if (alt === -1 && type === \"majorable\") {\r\n return \"m\";\r\n }\r\n else if (alt > 0) {\r\n return fillStr(\"A\", alt);\r\n }\r\n else {\r\n return fillStr(\"d\", type === \"perfectable\" ? alt : alt + 1);\r\n }\r\n}\n\n/**\r\n * Transpose a note by an interval.\r\n *\r\n * @param {string} note - the note or note name\r\n * @param {string} interval - the interval or interval name\r\n * @return {string} the transposed note name or empty string if not valid notes\r\n * @example\r\n * import { tranpose } from \"@tonaljs/core\"\r\n * transpose(\"d3\", \"3M\") // => \"F#3\"\r\n * transpose(\"D\", \"3M\") // => \"F#\"\r\n * [\"C\", \"D\", \"E\", \"F\", \"G\"].map(pc => transpose(pc, \"M3)) // => [\"E\", \"F#\", \"G#\", \"A\", \"B\"]\r\n */\r\nfunction transpose(noteName, intervalName) {\r\n const note$1 = note(noteName);\r\n const interval$1 = interval(intervalName);\r\n if (note$1.empty || interval$1.empty) {\r\n return \"\";\r\n }\r\n const noteCoord = note$1.coord;\r\n const intervalCoord = interval$1.coord;\r\n const tr = noteCoord.length === 1\r\n ? [noteCoord[0] + intervalCoord[0]]\r\n : [noteCoord[0] + intervalCoord[0], noteCoord[1] + intervalCoord[1]];\r\n return coordToNote(tr).name;\r\n}\r\n/**\r\n * Find the interval distance between two notes or coord classes.\r\n *\r\n * To find distance between coord classes, both notes must be coord classes and\r\n * the interval is always ascending\r\n *\r\n * @param {Note|string} from - the note or note name to calculate distance from\r\n * @param {Note|string} to - the note or note name to calculate distance to\r\n * @return {string} the interval name or empty string if not valid notes\r\n *\r\n */\r\nfunction distance(fromNote, toNote) {\r\n const from = note(fromNote);\r\n const to = note(toNote);\r\n if (from.empty || to.empty) {\r\n return \"\";\r\n }\r\n const fcoord = from.coord;\r\n const tcoord = to.coord;\r\n const fifths = tcoord[0] - fcoord[0];\r\n const octs = fcoord.length === 2 && tcoord.length === 2\r\n ? tcoord[1] - fcoord[1]\r\n : -Math.floor((fifths * 7) / 12);\r\n return coordToInterval([fifths, octs]).name;\r\n}\n\nexport { accToAlt, altToAcc, coordToInterval, coordToNote, decode, deprecate, distance, encode, fillStr, interval, isNamed, isPitch, note, stepToLetter, tokenizeInterval, tokenizeNote, transpose };\n//# sourceMappingURL=index.es.js.map\n","import { note, transpose as transpose$1, distance as distance$1 } from '@tonaljs/core';\n\nconst fillStr = (character, times) => Array(times + 1).join(character);\r\nconst REGEX = /^(_{1,}|=|\\^{1,}|)([abcdefgABCDEFG])([,']*)$/;\r\nfunction tokenize(str) {\r\n const m = REGEX.exec(str);\r\n if (!m) {\r\n return [\"\", \"\", \"\"];\r\n }\r\n return [m[1], m[2], m[3]];\r\n}\r\n/**\r\n * Convert a (string) note in ABC notation into a (string) note in scientific notation\r\n *\r\n * @example\r\n * abcToScientificNotation(\"c\") // => \"C5\"\r\n */\r\nfunction abcToScientificNotation(str) {\r\n const [acc, letter, oct] = tokenize(str);\r\n if (letter === \"\") {\r\n return \"\";\r\n }\r\n let o = 4;\r\n for (let i = 0; i < oct.length; i++) {\r\n o += oct.charAt(i) === \",\" ? -1 : 1;\r\n }\r\n const a = acc[0] === \"_\"\r\n ? acc.replace(/_/g, \"b\")\r\n : acc[0] === \"^\"\r\n ? acc.replace(/\\^/g, \"#\")\r\n : \"\";\r\n return letter.charCodeAt(0) > 96\r\n ? letter.toUpperCase() + a + (o + 1)\r\n : letter + a + o;\r\n}\r\n/**\r\n * Convert a (string) note in scientific notation into a (string) note in ABC notation\r\n *\r\n * @example\r\n * scientificToAbcNotation(\"C#4\") // => \"^C\"\r\n */\r\nfunction scientificToAbcNotation(str) {\r\n const n = note(str);\r\n if (n.empty || !n.oct) {\r\n return \"\";\r\n }\r\n const { letter, acc, oct } = n;\r\n const a = acc[0] === \"b\" ? acc.replace(/b/g, \"_\") : acc.replace(/#/g, \"^\");\r\n const l = oct > 4 ? letter.toLowerCase() : letter;\r\n const o = oct === 5 ? \"\" : oct > 4 ? fillStr(\"'\", oct - 5) : fillStr(\",\", 4 - oct);\r\n return a + l + o;\r\n}\r\nfunction transpose(note, interval) {\r\n return scientificToAbcNotation(transpose$1(abcToScientificNotation(note), interval));\r\n}\r\nfunction distance(from, to) {\r\n return distance$1(abcToScientificNotation(from), abcToScientificNotation(to));\r\n}\r\nvar index = {\r\n abcToScientificNotation,\r\n scientificToAbcNotation,\r\n tokenize,\r\n transpose,\r\n distance,\r\n};\n\nexport default index;\nexport { abcToScientificNotation, distance, scientificToAbcNotation, tokenize, transpose };\n//# sourceMappingURL=index.es.js.map\n","import { note } from '@tonaljs/core';\n\n// ascending range\r\nfunction ascR(b, n) {\r\n const a = [];\r\n // tslint:disable-next-line:curly\r\n for (; n--; a[n] = n + b)\r\n ;\r\n return a;\r\n}\r\n// descending range\r\nfunction descR(b, n) {\r\n const a = [];\r\n // tslint:disable-next-line:curly\r\n for (; n--; a[n] = b - n)\r\n ;\r\n return a;\r\n}\r\n/**\r\n * Creates a numeric range\r\n *\r\n * @param {number} from\r\n * @param {number} to\r\n * @return {Array}\r\n *\r\n * @example\r\n * range(-2, 2) // => [-2, -1, 0, 1, 2]\r\n * range(2, -2) // => [2, 1, 0, -1, -2]\r\n */\r\nfunction range(from, to) {\r\n return from < to ? ascR(from, to - from + 1) : descR(from, from - to + 1);\r\n}\r\n/**\r\n * Rotates a list a number of times. It\"s completly agnostic about the\r\n * contents of the list.\r\n *\r\n * @param {Integer} times - the number of rotations\r\n * @param {Array} array\r\n * @return {Array} the rotated array\r\n *\r\n * @example\r\n * rotate(1, [1, 2, 3]) // => [2, 3, 1]\r\n */\r\nfunction rotate(times, arr) {\r\n const len = arr.length;\r\n const n = ((times % len) + len) % len;\r\n return arr.slice(n, len).concat(arr.slice(0, n));\r\n}\r\n/**\r\n * Return a copy of the array with the null values removed\r\n * @function\r\n * @param {Array} array\r\n * @return {Array}\r\n *\r\n * @example\r\n * compact([\"a\", \"b\", null, \"c\"]) // => [\"a\", \"b\", \"c\"]\r\n */\r\nfunction compact(arr) {\r\n return arr.filter((n) => n === 0 || n);\r\n}\r\n/**\r\n * Sort an array of notes in ascending order. Pitch classes are listed\r\n * before notes. Any string that is not a note is removed.\r\n *\r\n * @param {string[]} notes\r\n * @return {string[]} sorted array of notes\r\n *\r\n * @example\r\n * sortedNoteNames(['c2', 'c5', 'c1', 'c0', 'c6', 'c'])\r\n * // => ['C', 'C0', 'C1', 'C2', 'C5', 'C6']\r\n * sortedNoteNames(['c', 'F', 'G', 'a', 'b', 'h', 'J'])\r\n * // => ['C', 'F', 'G', 'A', 'B']\r\n */\r\nfunction sortedNoteNames(notes) {\r\n const valid = notes.map((n) => note(n)).filter((n) => !n.empty);\r\n return valid.sort((a, b) => a.height - b.height).map((n) => n.name);\r\n}\r\n/**\r\n * Get sorted notes with duplicates removed. Pitch classes are listed\r\n * before notes.\r\n *\r\n * @function\r\n * @param {string[]} array\r\n * @return {string[]} unique sorted notes\r\n *\r\n * @example\r\n * Array.sortedUniqNoteNames(['a', 'b', 'c2', '1p', 'p2', 'c2', 'b', 'c', 'c3' ])\r\n * // => [ 'C', 'A', 'B', 'C2', 'C3' ]\r\n */\r\nfunction sortedUniqNoteNames(arr) {\r\n return sortedNoteNames(arr).filter((n, i, a) => i === 0 || n !== a[i - 1]);\r\n}\r\n/**\r\n * Randomizes the order of the specified array in-place, using the Fisher–Yates shuffle.\r\n *\r\n * @function\r\n * @param {Array} array\r\n * @return {Array} the array shuffled\r\n *\r\n * @example\r\n * shuffle([\"C\", \"D\", \"E\", \"F\"]) // => [...]\r\n */\r\nfunction shuffle(arr, rnd = Math.random) {\r\n let i;\r\n let t;\r\n let m = arr.length;\r\n while (m) {\r\n i = Math.floor(rnd() * m--);\r\n t = arr[m];\r\n arr[m] = arr[i];\r\n arr[i] = t;\r\n }\r\n return arr;\r\n}\r\n/**\r\n * Get all permutations of an array\r\n *\r\n * @param {Array} array - the array\r\n * @return {Array} an array with all the permutations\r\n * @example\r\n * permutations([\"a\", \"b\", \"c\"])) // =>\r\n * [\r\n * [\"a\", \"b\", \"c\"],\r\n * [\"b\", \"a\", \"c\"],\r\n * [\"b\", \"c\", \"a\"],\r\n * [\"a\", \"c\", \"b\"],\r\n * [\"c\", \"a\", \"b\"],\r\n * [\"c\", \"b\", \"a\"]\r\n * ]\r\n */\r\nfunction permutations(arr) {\r\n if (arr.length === 0) {\r\n return [[]];\r\n }\r\n return permutations(arr.slice(1)).reduce((acc, perm) => {\r\n return acc.concat(arr.map((e, pos) => {\r\n const newPerm = perm.slice();\r\n newPerm.splice(pos, 0, arr[0]);\r\n return newPerm;\r\n }));\r\n }, []);\r\n}\n\nexport { compact, permutations, range, rotate, shuffle, sortedNoteNames, sortedUniqNoteNames };\n//# sourceMappingURL=index.es.js.map\n","// ascending range\r\nfunction ascR(b, n) {\r\n const a = [];\r\n // tslint:disable-next-line:curly\r\n for (; n--; a[n] = n + b)\r\n ;\r\n return a;\r\n}\r\n// descending range\r\nfunction descR(b, n) {\r\n const a = [];\r\n // tslint:disable-next-line:curly\r\n for (; n--; a[n] = b - n)\r\n ;\r\n return a;\r\n}\r\n/**\r\n * Creates a numeric range\r\n *\r\n * @param {number} from\r\n * @param {number} to\r\n * @return {Array}\r\n *\r\n * @example\r\n * range(-2, 2) // => [-2, -1, 0, 1, 2]\r\n * range(2, -2) // => [2, 1, 0, -1, -2]\r\n */\r\nfunction range(from, to) {\r\n return from < to ? ascR(from, to - from + 1) : descR(from, from - to + 1);\r\n}\r\n/**\r\n * Rotates a list a number of times. It\"s completly agnostic about the\r\n * contents of the list.\r\n *\r\n * @param {Integer} times - the number of rotations\r\n * @param {Array} collection\r\n * @return {Array} the rotated collection\r\n *\r\n * @example\r\n * rotate(1, [1, 2, 3]) // => [2, 3, 1]\r\n */\r\nfunction rotate(times, arr) {\r\n const len = arr.length;\r\n const n = ((times % len) + len) % len;\r\n return arr.slice(n, len).concat(arr.slice(0, n));\r\n}\r\n/**\r\n * Return a copy of the collection with the null values removed\r\n * @function\r\n * @param {Array} collection\r\n * @return {Array}\r\n *\r\n * @example\r\n * compact([\"a\", \"b\", null, \"c\"]) // => [\"a\", \"b\", \"c\"]\r\n */\r\nfunction compact(arr) {\r\n return arr.filter((n) => n === 0 || n);\r\n}\r\n/**\r\n * Randomizes the order of the specified collection in-place, using the Fisher–Yates shuffle.\r\n *\r\n * @function\r\n * @param {Array} collection\r\n * @return {Array} the collection shuffled\r\n *\r\n * @example\r\n * shuffle([\"C\", \"D\", \"E\", \"F\"]) // => [...]\r\n */\r\nfunction shuffle(arr, rnd = Math.random) {\r\n let i;\r\n let t;\r\n let m = arr.length;\r\n while (m) {\r\n i = Math.floor(rnd() * m--);\r\n t = arr[m];\r\n arr[m] = arr[i];\r\n arr[i] = t;\r\n }\r\n return arr;\r\n}\r\n/**\r\n * Get all permutations of an collection\r\n *\r\n * @param {Array} collection - the collection\r\n * @return {Array} an collection with all the permutations\r\n * @example\r\n * permutations([\"a\", \"b\", \"c\"])) // =>\r\n * [\r\n * [\"a\", \"b\", \"c\"],\r\n * [\"b\", \"a\", \"c\"],\r\n * [\"b\", \"c\", \"a\"],\r\n * [\"a\", \"c\", \"b\"],\r\n * [\"c\", \"a\", \"b\"],\r\n * [\"c\", \"b\", \"a\"]\r\n * ]\r\n */\r\nfunction permutations(arr) {\r\n if (arr.length === 0) {\r\n return [[]];\r\n }\r\n return permutations(arr.slice(1)).reduce((acc, perm) => {\r\n return acc.concat(arr.map((e, pos) => {\r\n const newPerm = perm.slice();\r\n newPerm.splice(pos, 0, arr[0]);\r\n return newPerm;\r\n }));\r\n }, []);\r\n}\r\nvar index = {\r\n compact,\r\n permutations,\r\n range,\r\n rotate,\r\n shuffle,\r\n};\n\nexport default index;\nexport { compact, permutations, range, rotate, shuffle };\n//# sourceMappingURL=index.es.js.map\n","import { range, compact, rotate } from '@tonaljs/collection';\nimport { deprecate, note, interval } from '@tonaljs/core';\n\nconst EmptyPcset = {\r\n empty: true,\r\n name: \"\",\r\n setNum: 0,\r\n chroma: \"000000000000\",\r\n normalized: \"000000000000\",\r\n intervals: [],\r\n};\r\n// UTILITIES\r\nconst setNumToChroma = (num) => Number(num).toString(2);\r\nconst chromaToNumber = (chroma) => parseInt(chroma, 2);\r\nconst REGEX = /^[01]{12}$/;\r\nfunction isChroma(set) {\r\n return REGEX.test(set);\r\n}\r\nconst isPcsetNum = (set) => typeof set === \"number\" && set >= 0 && set <= 4095;\r\nconst isPcset = (set) => set && isChroma(set.chroma);\r\nconst cache = { [EmptyPcset.chroma]: EmptyPcset };\r\n/**\r\n * Get the pitch class set of a collection of notes or set number or chroma\r\n */\r\nfunction get(src) {\r\n const chroma = isChroma(src)\r\n ? src\r\n : isPcsetNum(src)\r\n ? setNumToChroma(src)\r\n : Array.isArray(src)\r\n ? listToChroma(src)\r\n : isPcset(src)\r\n ? src.chroma\r\n : EmptyPcset.chroma;\r\n return (cache[chroma] = cache[chroma] || chromaToPcset(chroma));\r\n}\r\n/**\r\n * Use Pcset.properties\r\n * @function\r\n * @deprecated\r\n */\r\nconst pcset = deprecate(\"Pcset.pcset\", \"Pcset.get\", get);\r\n/**\r\n * Get pitch class set chroma\r\n * @function\r\n * @example\r\n * Pcset.chroma([\"c\", \"d\", \"e\"]); //=> \"101010000000\"\r\n */\r\nconst chroma = (set) => get(set).chroma;\r\n/**\r\n * Get intervals (from C) of a set\r\n * @function\r\n * @example\r\n * Pcset.intervals([\"c\", \"d\", \"e\"]); //=>\r\n */\r\nconst intervals = (set) => get(set).intervals;\r\n/**\r\n * Get pitch class set number\r\n * @function\r\n * @example\r\n * Pcset.num([\"c\", \"d\", \"e\"]); //=> 2192\r\n */\r\nconst num = (set) => get(set).setNum;\r\nconst IVLS = [\r\n \"1P\",\r\n \"2m\",\r\n \"2M\",\r\n \"3m\",\r\n \"3M\",\r\n \"4P\",\r\n \"5d\",\r\n \"5P\",\r\n \"6m\",\r\n \"6M\",\r\n \"7m\",\r\n \"7M\",\r\n];\r\n/**\r\n * @private\r\n * Get the intervals of a pcset *starting from C*\r\n * @param {Set} set - the pitch class set\r\n * @return {IntervalName[]} an array of interval names or an empty array\r\n * if not a valid pitch class set\r\n */\r\nfunction chromaToIntervals(chroma) {\r\n const intervals = [];\r\n for (let i = 0; i < 12; i++) {\r\n // tslint:disable-next-line:curly\r\n if (chroma.charAt(i) === \"1\")\r\n intervals.push(IVLS[i]);\r\n }\r\n return intervals;\r\n}\r\n/**\r\n * Get a list of all possible pitch class sets (all possible chromas) *having\r\n * C as root*. There are 2048 different chromas. If you want them with another\r\n * note you have to transpose it\r\n *\r\n * @see http://allthescales.org/\r\n * @return {Array} an array of possible chromas from '10000000000' to '11111111111'\r\n */\r\nfunction chromas() {\r\n return range(2048, 4095).map(setNumToChroma);\r\n}\r\n/**\r\n * Given a a list of notes or a pcset chroma, produce the rotations\r\n * of the chroma discarding the ones that starts with \"0\"\r\n *\r\n * This is used, for example, to get all the modes of a scale.\r\n *\r\n * @param {Array|string} set - the list of notes or pitchChr of the set\r\n * @param {boolean} normalize - (Optional, true by default) remove all\r\n * the rotations that starts with \"0\"\r\n * @return {Array} an array with all the modes of the chroma\r\n *\r\n * @example\r\n * Pcset.modes([\"C\", \"D\", \"E\"]).map(Pcset.intervals)\r\n */\r\nfunction modes(set, normalize = true) {\r\n const pcs = get(set);\r\n const binary = pcs.chroma.split(\"\");\r\n return compact(binary.map((_, i) => {\r\n const r = rotate(i, binary);\r\n return normalize && r[0] === \"0\" ? null : r.join(\"\");\r\n }));\r\n}\r\n/**\r\n * Test if two pitch class sets are numentical\r\n *\r\n * @param {Array|string} set1 - one of the pitch class sets\r\n * @param {Array|string} set2 - the other pitch class set\r\n * @return {boolean} true if they are equal\r\n * @example\r\n * Pcset.isEqual([\"c2\", \"d3\"], [\"c5\", \"d2\"]) // => true\r\n */\r\nfunction isEqual(s1, s2) {\r\n return get(s1).setNum === get(s2).setNum;\r\n}\r\n/**\r\n * Create a function that test if a collection of notes is a\r\n * subset of a given set\r\n *\r\n * The function is curryfied.\r\n *\r\n * @param {PcsetChroma|NoteName[]} set - the superset to test against (chroma or\r\n * list of notes)\r\n * @return{function(PcsetChroma|NoteNames[]): boolean} a function accepting a set\r\n * to test against (chroma or list of notes)\r\n * @example\r\n * const inCMajor = Pcset.isSubsetOf([\"C\", \"E\", \"G\"])\r\n * inCMajor([\"e6\", \"c4\"]) // => true\r\n * inCMajor([\"e6\", \"c4\", \"d3\"]) // => false\r\n */\r\nfunction isSubsetOf(set) {\r\n const s = get(set).setNum;\r\n return (notes) => {\r\n const o = get(notes).setNum;\r\n // tslint:disable-next-line: no-bitwise\r\n return s && s !== o && (o & s) === o;\r\n };\r\n}\r\n/**\r\n * Create a function that test if a collection of notes is a\r\n * superset of a given set (it contains all notes and at least one more)\r\n *\r\n * @param {Set} set - an array of notes or a chroma set string to test against\r\n * @return {(subset: Set): boolean} a function that given a set\r\n * returns true if is a subset of the first one\r\n * @example\r\n * const extendsCMajor = Pcset.isSupersetOf([\"C\", \"E\", \"G\"])\r\n * extendsCMajor([\"e6\", \"a\", \"c4\", \"g2\"]) // => true\r\n * extendsCMajor([\"c6\", \"e4\", \"g3\"]) // => false\r\n */\r\nfunction isSupersetOf(set) {\r\n const s = get(set).setNum;\r\n return (notes) => {\r\n const o = get(notes).setNum;\r\n // tslint:disable-next-line: no-bitwise\r\n return s && s !== o && (o | s) === o;\r\n };\r\n}\r\n/**\r\n * Test if a given pitch class set includes a note\r\n *\r\n * @param {Array} set - the base set to test against\r\n * @param {string} note - the note to test\r\n * @return {boolean} true if the note is included in the pcset\r\n *\r\n * Can be partially applied\r\n *\r\n * @example\r\n * const isNoteInCMajor = isNoteIncludedIn(['C', 'E', 'G'])\r\n * isNoteInCMajor('C4') // => true\r\n * isNoteInCMajor('C#4') // => false\r\n */\r\nfunction isNoteIncludedIn(set) {\r\n const s = get(set);\r\n return (noteName) => {\r\n const n = note(noteName);\r\n return s && !n.empty && s.chroma.charAt(n.chroma) === \"1\";\r\n };\r\n}\r\n/** @deprecated use: isNoteIncludedIn */\r\nconst includes = isNoteIncludedIn;\r\n/**\r\n * Filter a list with a pitch class set\r\n *\r\n * @param {Array|string} set - the pitch class set notes\r\n * @param {Array|string} notes - the note list to be filtered\r\n * @return {Array} the filtered notes\r\n *\r\n * @example\r\n * Pcset.filter([\"C\", \"D\", \"E\"], [\"c2\", \"c#2\", \"d2\", \"c3\", \"c#3\", \"d3\"]) // => [ \"c2\", \"d2\", \"c3\", \"d3\" ])\r\n * Pcset.filter([\"C2\"], [\"c2\", \"c#2\", \"d2\", \"c3\", \"c#3\", \"d3\"]) // => [ \"c2\", \"c3\" ])\r\n */\r\nfunction filter(set) {\r\n const isIncluded = isNoteIncludedIn(set);\r\n return (notes) => {\r\n return notes.filter(isIncluded);\r\n };\r\n}\r\nvar index = {\r\n get,\r\n chroma,\r\n num,\r\n intervals,\r\n chromas,\r\n isSupersetOf,\r\n isSubsetOf,\r\n isNoteIncludedIn,\r\n isEqual,\r\n filter,\r\n modes,\r\n // deprecated\r\n pcset,\r\n};\r\n//// PRIVATE ////\r\nfunction chromaRotations(chroma) {\r\n const binary = chroma.split(\"\");\r\n return binary.map((_, i) => rotate(i, binary).join(\"\"));\r\n}\r\nfunction chromaToPcset(chroma) {\r\n const setNum = chromaToNumber(chroma);\r\n const normalizedNum = chromaRotations(chroma)\r\n .map(chromaToNumber)\r\n .filter((n) => n >= 2048)\r\n .sort()[0];\r\n const normalized = setNumToChroma(normalizedNum);\r\n const intervals = chromaToIntervals(chroma);\r\n return {\r\n empty: false,\r\n name: \"\",\r\n setNum,\r\n chroma,\r\n normalized,\r\n intervals,\r\n };\r\n}\r\nfunction listToChroma(set) {\r\n if (set.length === 0) {\r\n return EmptyPcset.chroma;\r\n }\r\n let pitch;\r\n const binary = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\r\n // tslint:disable-next-line:prefer-for-of\r\n for (let i = 0; i < set.length; i++) {\r\n pitch = note(set[i]);\r\n // tslint:disable-next-line: curly\r\n if (pitch.empty)\r\n pitch = interval(set[i]);\r\n // tslint:disable-next-line: curly\r\n if (!pitch.empty)\r\n binary[pitch.chroma] = 1;\r\n }\r\n return binary.join(\"\");\r\n}\n\nexport default index;\nexport { EmptyPcset, chromaToIntervals, chromas, filter, get, includes, isEqual, isNoteIncludedIn, isSubsetOf, isSupersetOf, modes, pcset };\n//# sourceMappingURL=index.es.js.map\n","import { deprecate } from '@tonaljs/core';\nimport { get as get$1, EmptyPcset } from '@tonaljs/pcset';\n\n/**\r\n * @private\r\n * Chord List\r\n * Source: https://en.wikibooks.org/wiki/Music_Theory/Complete_List_of_Chord_Patterns\r\n * Format: [\"intervals\", \"full name\", \"abrv1 abrv2\"]\r\n */\r\nconst CHORDS = [\r\n // ==Major==\r\n [\"1P 3M 5P\", \"major\", \"M ^ \"],\r\n [\"1P 3M 5P 7M\", \"major seventh\", \"maj7 Δ ma7 M7 Maj7 ^7\"],\r\n [\"1P 3M 5P 7M 9M\", \"major ninth\", \"maj9 Δ9 ^9\"],\r\n [\"1P 3M 5P 7M 9M 13M\", \"major thirteenth\", \"maj13 Maj13 ^13\"],\r\n [\"1P 3M 5P 6M\", \"sixth\", \"6 add6 add13 M6\"],\r\n [\"1P 3M 5P 6M 9M\", \"sixth/ninth\", \"6/9 69 M69\"],\r\n [\"1P 3M 6m 7M\", \"major seventh flat sixth\", \"M7b6 ^7b6\"],\r\n [\r\n \"1P 3M 5P 7M 11A\",\r\n \"major seventh sharp eleventh\",\r\n \"maj#4 Δ#4 Δ#11 M7#11 ^7#11 maj7#11\",\r\n ],\r\n // ==Minor==\r\n // '''Normal'''\r\n [\"1P 3m 5P\", \"minor\", \"m min -\"],\r\n [\"1P 3m 5P 7m\", \"minor seventh\", \"m7 min7 mi7 -7\"],\r\n [\r\n \"1P 3m 5P 7M\",\r\n \"minor/major seventh\",\r\n \"m/ma7 m/maj7 mM7 mMaj7 m/M7 -Δ7 mΔ -^7\",\r\n ],\r\n [\"1P 3m 5P 6M\", \"minor sixth\", \"m6 -6\"],\r\n [\"1P 3m 5P 7m 9M\", \"minor ninth\", \"m9 -9\"],\r\n [\"1P 3m 5P 7M 9M\", \"minor/major ninth\", \"mM9 mMaj9 -^9\"],\r\n [\"1P 3m 5P 7m 9M 11P\", \"minor eleventh\", \"m11 -11\"],\r\n [\"1P 3m 5P 7m 9M 13M\", \"minor thirteenth\", \"m13 -13\"],\r\n // '''Diminished'''\r\n [\"1P 3m 5d\", \"diminished\", \"dim ° o\"],\r\n [\"1P 3m 5d 7d\", \"diminished seventh\", \"dim7 °7 o7\"],\r\n [\"1P 3m 5d 7m\", \"half-diminished\", \"m7b5 ø -7b5 h7 h\"],\r\n // ==Dominant/Seventh==\r\n // '''Normal'''\r\n [\"1P 3M 5P 7m\", \"dominant seventh\", \"7 dom\"],\r\n [\"1P 3M 5P 7m 9M\", \"dominant ninth\", \"9\"],\r\n [\"1P 3M 5P 7m 9M 13M\", \"dominant thirteenth\", \"13\"],\r\n [\"1P 3M 5P 7m 11A\", \"lydian dominant seventh\", \"7#11 7#4\"],\r\n // '''Altered'''\r\n [\"1P 3M 5P 7m 9m\", \"dominant flat ninth\", \"7b9\"],\r\n [\"1P 3M 5P 7m 9A\", \"dominant sharp ninth\", \"7#9\"],\r\n [\"1P 3M 7m 9m\", \"altered\", \"alt7\"],\r\n // '''Suspended'''\r\n [\"1P 4P 5P\", \"suspended fourth\", \"sus4 sus\"],\r\n [\"1P 2M 5P\", \"suspended second\", \"sus2\"],\r\n [\"1P 4P 5P 7m\", \"suspended fourth seventh\", \"7sus4 7sus\"],\r\n [\"1P 5P 7m 9M 11P\", \"eleventh\", \"11\"],\r\n [\r\n \"1P 4P 5P 7m 9m\",\r\n \"suspended fourth flat ninth\",\r\n \"b9sus phryg 7b9sus 7b9sus4\",\r\n ],\r\n // ==Other==\r\n [\"1P 5P\", \"fifth\", \"5\"],\r\n [\"1P 3M 5A\", \"augmented\", \"aug + +5 ^#5\"],\r\n [\"1P 3m 5A\", \"minor augmented\", \"m#5 -#5 m+\"],\r\n [\"1P 3M 5A 7M\", \"augmented seventh\", \"maj7#5 maj7+5 +maj7 ^7#5\"],\r\n [\r\n \"1P 3M 5P 7M 9M 11A\",\r\n \"major sharp eleventh (lydian)\",\r\n \"maj9#11 Δ9#11 ^9#11\",\r\n ],\r\n // ==Legacy==\r\n [\"1P 2M 4P 5P\", \"\", \"sus24 sus4add9\"],\r\n [\"1P 3M 5A 7M 9M\", \"\", \"maj9#5 Maj9#5\"],\r\n [\"1P 3M 5A 7m\", \"\", \"7#5 +7 7+ 7aug aug7\"],\r\n [\"1P 3M 5A 7m 9A\", \"\", \"7#5#9 7#9#5 7alt\"],\r\n [\"1P 3M 5A 7m 9M\", \"\", \"9#5 9+\"],\r\n [\"1P 3M 5A 7m 9M 11A\", \"\", \"9#5#11\"],\r\n [\"1P 3M 5A 7m 9m\", \"\", \"7#5b9 7b9#5\"],\r\n [\"1P 3M 5A 7m 9m 11A\", \"\", \"7#5b9#11\"],\r\n [\"1P 3M 5A 9A\", \"\", \"+add#9\"],\r\n [\"1P 3M 5A 9M\", \"\", \"M#5add9 +add9\"],\r\n [\"1P 3M 5P 6M 11A\", \"\", \"M6#11 M6b5 6#11 6b5\"],\r\n [\"1P 3M 5P 6M 7M 9M\", \"\", \"M7add13\"],\r\n [\"1P 3M 5P 6M 9M 11A\", \"\", \"69#11\"],\r\n [\"1P 3m 5P 6M 9M\", \"\", \"m69 -69\"],\r\n [\"1P 3M 5P 6m 7m\", \"\", \"7b6\"],\r\n [\"1P 3M 5P 7M 9A 11A\", \"\", \"maj7#9#11\"],\r\n [\"1P 3M 5P 7M 9M 11A 13M\", \"\", \"M13#11 maj13#11 M13+4 M13#4\"],\r\n [\"1P 3M 5P 7M 9m\", \"\", \"M7b9\"],\r\n [\"1P 3M 5P 7m 11A 13m\", \"\", \"7#11b13 7b5b13\"],\r\n [\"1P 3M 5P 7m 13M\", \"\", \"7add6 67 7add13\"],\r\n [\"1P 3M 5P 7m 9A 11A\", \"\", \"7#9#11 7b5#9 7#9b5\"],\r\n [\"1P 3M 5P 7m 9A 11A 13M\", \"\", \"13#9#11\"],\r\n [\"1P 3M 5P 7m 9A 11A 13m\", \"\", \"7#9#11b13\"],\r\n [\"1P 3M 5P 7m 9A 13M\", \"\", \"13#9\"],\r\n [\"1P 3M 5P 7m 9A 13m\", \"\", \"7#9b13\"],\r\n [\"1P 3M 5P 7m 9M 11A\", \"\", \"9#11 9+4 9#4\"],\r\n [\"1P 3M 5P 7m 9M 11A 13M\", \"\", \"13#11 13+4 13#4\"],\r\n [\"1P 3M 5P 7m 9M 11A 13m\", \"\", \"9#11b13 9b5b13\"],\r\n [\"1P 3M 5P 7m 9m 11A\", \"\", \"7b9#11 7b5b9 7b9b5\"],\r\n [\"1P 3M 5P 7m 9m 11A 13M\", \"\", \"13b9#11\"],\r\n [\"1P 3M 5P 7m 9m 11A 13m\", \"\", \"7b9b13#11 7b9#11b13 7b5b9b13\"],\r\n [\"1P 3M 5P 7m 9m 13M\", \"\", \"13b9\"],\r\n [\"1P 3M 5P 7m 9m 13m\", \"\", \"7b9b13\"],\r\n [\"1P 3M 5P 7m 9m 9A\", \"\", \"7b9#9\"],\r\n [\"1P 3M 5P 9M\", \"\", \"Madd9 2 add9 add2\"],\r\n [\"1P 3M 5P 9m\", \"\", \"Maddb9\"],\r\n [\"1P 3M 5d\", \"\", \"Mb5\"],\r\n [\"1P 3M 5d 6M 7m 9M\", \"\", \"13b5\"],\r\n [\"1P 3M 5d 7M\", \"\", \"M7b5\"],\r\n [\"1P 3M 5d 7M 9M\", \"\", \"M9b5\"],\r\n [\"1P 3M 5d 7m\", \"\", \"7b5\"],\r\n [\"1P 3M 5d 7m 9M\", \"\", \"9b5\"],\r\n [\"1P 3M 7m\", \"\", \"7no5\"],\r\n [\"1P 3M 7m 13m\", \"\", \"7b13\"],\r\n [\"1P 3M 7m 9M\", \"\", \"9no5\"],\r\n [\"1P 3M 7m 9M 13M\", \"\", \"13no5\"],\r\n [\"1P 3M 7m 9M 13m\", \"\", \"9b13\"],\r\n [\"1P 3m 4P 5P\", \"\", \"madd4\"],\r\n [\"1P 3m 5P 6m 7M\", \"\", \"mMaj7b6\"],\r\n [\"1P 3m 5P 6m 7M 9M\", \"\", \"mMaj9b6\"],\r\n [\"1P 3m 5P 7m 11P\", \"\", \"m7add11 m7add4\"],\r\n [\"1P 3m 5P 9M\", \"\", \"madd9\"],\r\n [\"1P 3m 5d 6M 7M\", \"\", \"o7M7\"],\r\n [\"1P 3m 5d 7M\", \"\", \"oM7\"],\r\n [\"1P 3m 6m 7M\", \"\", \"mb6M7\"],\r\n [\"1P 3m 6m 7m\", \"\", \"m7#5\"],\r\n [\"1P 3m 6m 7m 9M\", \"\", \"m9#5\"],\r\n [\"1P 3m 6m 7m 9M 11P\", \"\", \"m11A\"],\r\n [\"1P 3m 6m 9m\", \"\", \"mb6b9\"],\r\n [\"1P 2M 3m 5d 7m\", \"\", \"m9b5\"],\r\n [\"1P 4P 5A 7M\", \"\", \"M7#5sus4\"],\r\n [\"1P 4P 5A 7M 9M\", \"\", \"M9#5sus4\"],\r\n [\"1P 4P 5A 7m\", \"\", \"7#5sus4\"],\r\n [\"1P 4P 5P 7M\", \"\", \"M7sus4\"],\r\n [\"1P 4P 5P 7M 9M\", \"\", \"M9sus4\"],\r\n [\"1P 4P 5P 7m 9M\", \"\", \"9sus4 9sus\"],\r\n [\"1P 4P 5P 7m 9M 13M\", \"\", \"13sus4 13sus\"],\r\n [\"1P 4P 5P 7m 9m 13m\", \"\", \"7sus4b9b13 7b9b13sus4\"],\r\n [\"1P 4P 7m 10m\", \"\", \"4 quartal\"],\r\n [\"1P 5P 7m 9m 11P\", \"\", \"11b9\"],\r\n];\n\nconst NoChordType = {\r\n ...EmptyPcset,\r\n name: \"\",\r\n quality: \"Unknown\",\r\n intervals: [],\r\n aliases: [],\r\n};\r\nlet dictionary = [];\r\nlet index = {};\r\n/**\r\n * Given a chord name or chroma, return the chord properties\r\n * @param {string} source - chord name or pitch class set chroma\r\n * @example\r\n * import { get } from 'tonaljs/chord-type'\r\n * get('major') // => { name: 'major', ... }\r\n */\r\nfunction get(type) {\r\n return index[type] || NoChordType;\r\n}\r\nconst chordType = deprecate(\"ChordType.chordType\", \"ChordType.get\", get);\r\n/**\r\n * Get all chord (long) names\r\n */\r\nfunction names() {\r\n return dictionary.map((chord) => chord.name).filter((x) => x);\r\n}\r\n/**\r\n * Get all chord symbols\r\n */\r\nfunction symbols() {\r\n return dictionary.map((chord) => chord.aliases[0]).filter((x) => x);\r\n}\r\n/**\r\n * Keys used to reference chord types\r\n */\r\nfunction keys() {\r\n return Object.keys(index);\r\n}\r\n/**\r\n * Return a list of all chord types\r\n */\r\nfunction all() {\r\n return dictionary.slice();\r\n}\r\nconst entries = deprecate(\"ChordType.entries\", \"ChordType.all\", all);\r\n/**\r\n * Clear the dictionary\r\n */\r\nfunction removeAll() {\r\n dictionary = [];\r\n index = {};\r\n}\r\n/**\r\n * Add a chord to the dictionary.\r\n * @param intervals\r\n * @param aliases\r\n * @param [fullName]\r\n */\r\nfunction add(intervals, aliases, fullName) {\r\n const quality = getQuality(intervals);\r\n const chord = {\r\n ...get$1(intervals),\r\n name: fullName || \"\",\r\n quality,\r\n intervals,\r\n aliases,\r\n };\r\n dictionary.push(chord);\r\n if (chord.name) {\r\n index[chord.name] = chord;\r\n }\r\n index[chord.setNum] = chord;\r\n index[chord.chroma] = chord;\r\n chord.aliases.forEach((alias) => addAlias(chord, alias));\r\n}\r\nfunction addAlias(chord, alias) {\r\n index[alias] = chord;\r\n}\r\nfunction getQuality(intervals) {\r\n const has = (interval) => intervals.indexOf(interval) !== -1;\r\n return has(\"5A\")\r\n ? \"Augmented\"\r\n : has(\"3M\")\r\n ? \"Major\"\r\n : has(\"5d\")\r\n ? \"Diminished\"\r\n : has(\"3m\")\r\n ? \"Minor\"\r\n : \"Unknown\";\r\n}\r\nCHORDS.forEach(([ivls, fullName, names]) => add(ivls.split(\" \"), names.split(\" \"), fullName));\r\ndictionary.sort((a, b) => a.setNum - b.setNum);\r\nvar index$1 = {\r\n names,\r\n symbols,\r\n get,\r\n all,\r\n add,\r\n removeAll,\r\n keys,\r\n // deprecated\r\n entries,\r\n chordType,\r\n};\n\nexport default index$1;\nexport { add, addAlias, all, chordType, entries, get, keys, names, removeAll, symbols };\n//# sourceMappingURL=index.es.js.map\n","import { deprecate } from '@tonaljs/core';\nimport { EmptyPcset, get as get$1 } from '@tonaljs/pcset';\n\n// SCALES\r\n// Format: [\"intervals\", \"name\", \"alias1\", \"alias2\", ...]\r\nconst SCALES = [\r\n // 5-note scales\r\n [\"1P 2M 3M 5P 6M\", \"major pentatonic\", \"pentatonic\"],\r\n [\"1P 3M 4P 5P 7M\", \"ionian pentatonic\"],\r\n [\"1P 3M 4P 5P 7m\", \"mixolydian pentatonic\", \"indian\"],\r\n [\"1P 2M 4P 5P 6M\", \"ritusen\"],\r\n [\"1P 2M 4P 5P 7m\", \"egyptian\"],\r\n [\"1P 3M 4P 5d 7m\", \"neopolitan major pentatonic\"],\r\n [\"1P 3m 4P 5P 6m\", \"vietnamese 1\"],\r\n [\"1P 2m 3m 5P 6m\", \"pelog\"],\r\n [\"1P 2m 4P 5P 6m\", \"kumoijoshi\"],\r\n [\"1P 2M 3m 5P 6m\", \"hirajoshi\"],\r\n [\"1P 2m 4P 5d 7m\", \"iwato\"],\r\n [\"1P 2m 4P 5P 7m\", \"in-sen\"],\r\n [\"1P 3M 4A 5P 7M\", \"lydian pentatonic\", \"chinese\"],\r\n [\"1P 3m 4P 6m 7m\", \"malkos raga\"],\r\n [\"1P 3m 4P 5d 7m\", \"locrian pentatonic\", \"minor seven flat five pentatonic\"],\r\n [\"1P 3m 4P 5P 7m\", \"minor pentatonic\", \"vietnamese 2\"],\r\n [\"1P 3m 4P 5P 6M\", \"minor six pentatonic\"],\r\n [\"1P 2M 3m 5P 6M\", \"flat three pentatonic\", \"kumoi\"],\r\n [\"1P 2M 3M 5P 6m\", \"flat six pentatonic\"],\r\n [\"1P 2m 3M 5P 6M\", \"scriabin\"],\r\n [\"1P 3M 5d 6m 7m\", \"whole tone pentatonic\"],\r\n [\"1P 3M 4A 5A 7M\", \"lydian #5P pentatonic\"],\r\n [\"1P 3M 4A 5P 7m\", \"lydian dominant pentatonic\"],\r\n [\"1P 3m 4P 5P 7M\", \"minor #7M pentatonic\"],\r\n [\"1P 3m 4d 5d 7m\", \"super locrian pentatonic\"],\r\n // 6-note scales\r\n [\"1P 2M 3m 4P 5P 7M\", \"minor hexatonic\"],\r\n [\"1P 2A 3M 5P 5A 7M\", \"augmented\"],\r\n [\"1P 2M 3m 3M 5P 6M\", \"major blues\"],\r\n [\"1P 2M 4P 5P 6M 7m\", \"piongio\"],\r\n [\"1P 2m 3M 4A 6M 7m\", \"prometheus neopolitan\"],\r\n [\"1P 2M 3M 4A 6M 7m\", \"prometheus\"],\r\n [\"1P 2m 3M 5d 6m 7m\", \"mystery #1\"],\r\n [\"1P 2m 3M 4P 5A 6M\", \"six tone symmetric\"],\r\n [\"1P 2M 3M 4A 5A 7m\", \"whole tone\", \"messiaen's mode #1\"],\r\n [\"1P 2m 4P 4A 5P 7M\", \"messiaen's mode #5\"],\r\n [\"1P 3m 4P 5d 5P 7m\", \"minor blues\", \"blues\"],\r\n // 7-note scales\r\n [\"1P 2M 3M 4P 5d 6m 7m\", \"locrian major\", \"arabian\"],\r\n [\"1P 2m 3M 4A 5P 6m 7M\", \"double harmonic lydian\"],\r\n [\"1P 2M 3m 4P 5P 6m 7M\", \"harmonic minor\"],\r\n [\r\n \"1P 2m 3m 4d 5d 6m 7m\",\r\n \"altered\",\r\n \"super locrian\",\r\n \"diminished whole tone\",\r\n \"pomeroy\",\r\n ],\r\n [\"1P 2M 3m 4P 5d 6m 7m\", \"locrian #2\", \"half-diminished\", \"aeolian b5\"],\r\n [\r\n \"1P 2M 3M 4P 5P 6m 7m\",\r\n \"mixolydian b6\",\r\n \"melodic minor fifth mode\",\r\n \"hindu\",\r\n ],\r\n [\"1P 2M 3M 4A 5P 6M 7m\", \"lydian dominant\", \"lydian b7\", \"overtone\"],\r\n [\"1P 2M 3M 4A 5P 6M 7M\", \"lydian\"],\r\n [\"1P 2M 3M 4A 5A 6M 7M\", \"lydian augmented\"],\r\n [\r\n \"1P 2m 3m 4P 5P 6M 7m\",\r\n \"dorian b2\",\r\n \"phrygian #6\",\r\n \"melodic minor second mode\",\r\n ],\r\n [\"1P 2M 3m 4P 5P 6M 7M\", \"melodic minor\"],\r\n [\"1P 2m 3m 4P 5d 6m 7m\", \"locrian\"],\r\n [\r\n \"1P 2m 3m 4d 5d 6m 7d\",\r\n \"ultralocrian\",\r\n \"superlocrian bb7\",\r\n \"·superlocrian diminished\",\r\n ],\r\n [\"1P 2m 3m 4P 5d 6M 7m\", \"locrian 6\", \"locrian natural 6\", \"locrian sharp 6\"],\r\n [\"1P 2A 3M 4P 5P 5A 7M\", \"augmented heptatonic\"],\r\n [\"1P 2M 3m 5d 5P 6M 7m\", \"romanian minor\"],\r\n [\"1P 2M 3m 4A 5P 6M 7m\", \"dorian #4\"],\r\n [\"1P 2M 3m 4A 5P 6M 7M\", \"lydian diminished\"],\r\n [\"1P 2m 3m 4P 5P 6m 7m\", \"phrygian\"],\r\n [\"1P 2M 3M 4A 5A 7m 7M\", \"leading whole tone\"],\r\n [\"1P 2M 3M 4A 5P 6m 7m\", \"lydian minor\"],\r\n [\"1P 2m 3M 4P 5P 6m 7m\", \"phrygian dominant\", \"spanish\", \"phrygian major\"],\r\n [\"1P 2m 3m 4P 5P 6m 7M\", \"balinese\"],\r\n [\"1P 2m 3m 4P 5P 6M 7M\", \"neopolitan major\"],\r\n [\"1P 2M 3m 4P 5P 6m 7m\", \"aeolian\", \"minor\"],\r\n [\"1P 2M 3M 4P 5P 6m 7M\", \"harmonic major\"],\r\n [\"1P 2m 3M 4P 5P 6m 7M\", \"double harmonic major\", \"gypsy\"],\r\n [\"1P 2M 3m 4P 5P 6M 7m\", \"dorian\"],\r\n [\"1P 2M 3m 4A 5P 6m 7M\", \"hungarian minor\"],\r\n [\"1P 2A 3M 4A 5P 6M 7m\", \"hungarian major\"],\r\n [\"1P 2m 3M 4P 5d 6M 7m\", \"oriental\"],\r\n [\"1P 2m 3m 3M 4A 5P 7m\", \"flamenco\"],\r\n [\"1P 2m 3m 4A 5P 6m 7M\", \"todi raga\"],\r\n [\"1P 2M 3M 4P 5P 6M 7m\", \"mixolydian\", \"dominant\"],\r\n [\"1P 2m 3M 4P 5d 6m 7M\", \"persian\"],\r\n [\"1P 2M 3M 4P 5P 6M 7M\", \"major\", \"ionian\"],\r\n [\"1P 2m 3M 5d 6m 7m 7M\", \"enigmatic\"],\r\n [\r\n \"1P 2M 3M 4P 5A 6M 7M\",\r\n \"major augmented\",\r\n \"major #5\",\r\n \"ionian augmented\",\r\n \"ionian #5\",\r\n ],\r\n [\"1P 2A 3M 4A 5P 6M 7M\", \"lydian #9\"],\r\n // 8-note scales\r\n [\"1P 2m 2M 4P 4A 5P 6m 7M\", \"messiaen's mode #4\"],\r\n [\"1P 2m 3M 4P 4A 5P 6m 7M\", \"purvi raga\"],\r\n [\"1P 2m 3m 3M 4P 5P 6m 7m\", \"spanish heptatonic\"],\r\n [\"1P 2M 3M 4P 5P 6M 7m 7M\", \"bebop\"],\r\n [\"1P 2M 3m 3M 4P 5P 6M 7m\", \"bebop minor\"],\r\n [\"1P 2M 3M 4P 5P 5A 6M 7M\", \"bebop major\"],\r\n [\"1P 2m 3m 4P 5d 5P 6m 7m\", \"bebop locrian\"],\r\n [\"1P 2M 3m 4P 5P 6m 7m 7M\", \"minor bebop\"],\r\n [\"1P 2M 3m 4P 5d 6m 6M 7M\", \"diminished\", \"whole-half diminished\"],\r\n [\"1P 2M 3M 4P 5d 5P 6M 7M\", \"ichikosucho\"],\r\n [\"1P 2M 3m 4P 5P 6m 6M 7M\", \"minor six diminished\"],\r\n [\r\n \"1P 2m 3m 3M 4A 5P 6M 7m\",\r\n \"half-whole diminished\",\r\n \"dominant diminished\",\r\n \"messiaen's mode #2\",\r\n ],\r\n [\"1P 3m 3M 4P 5P 6M 7m 7M\", \"kafi raga\"],\r\n [\"1P 2M 3M 4P 4A 5A 6A 7M\", \"messiaen's mode #6\"],\r\n // 9-note scales\r\n [\"1P 2M 3m 3M 4P 5d 5P 6M 7m\", \"composite blues\"],\r\n [\"1P 2M 3m 3M 4A 5P 6m 7m 7M\", \"messiaen's mode #3\"],\r\n // 10-note scales\r\n [\"1P 2m 2M 3m 4P 4A 5P 6m 6M 7M\", \"messiaen's mode #7\"],\r\n // 12-note scales\r\n [\"1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M\", \"chromatic\"],\r\n];\n\nconst NoScaleType = {\r\n ...EmptyPcset,\r\n intervals: [],\r\n aliases: [],\r\n};\r\nlet dictionary = [];\r\nlet index = {};\r\nfunction names() {\r\n return dictionary.map((scale) => scale.name);\r\n}\r\n/**\r\n * Given a scale name or chroma, return the scale properties\r\n *\r\n * @param {string} type - scale name or pitch class set chroma\r\n * @example\r\n * import { get } from 'tonaljs/scale-type'\r\n * get('major') // => { name: 'major', ... }\r\n */\r\nfunction get(type) {\r\n return index[type] || NoScaleType;\r\n}\r\nconst scaleType = deprecate(\"ScaleDictionary.scaleType\", \"ScaleType.get\", get);\r\n/**\r\n * Return a list of all scale types\r\n */\r\nfunction all() {\r\n return dictionary.slice();\r\n}\r\nconst entries = deprecate(\"ScaleDictionary.entries\", \"ScaleType.all\", all);\r\n/**\r\n * Keys used to reference scale types\r\n */\r\nfunction keys() {\r\n return Object.keys(index);\r\n}\r\n/**\r\n * Clear the dictionary\r\n */\r\nfunction removeAll() {\r\n dictionary = [];\r\n index = {};\r\n}\r\n/**\r\n * Add a scale into dictionary\r\n * @param intervals\r\n * @param name\r\n * @param aliases\r\n */\r\nfunction add(intervals, name, aliases = []) {\r\n const scale = { ...get$1(intervals), name, intervals, aliases };\r\n dictionary.push(scale);\r\n index[scale.name] = scale;\r\n index[scale.setNum] = scale;\r\n index[scale.chroma] = scale;\r\n scale.aliases.forEach((alias) => addAlias(scale, alias));\r\n return scale;\r\n}\r\nfunction addAlias(scale, alias) {\r\n index[alias] = scale;\r\n}\r\nSCALES.forEach(([ivls, name, ...aliases]) => add(ivls.split(\" \"), name, aliases));\r\nvar index$1 = {\r\n names,\r\n get,\r\n all,\r\n add,\r\n removeAll,\r\n keys,\r\n // deprecated\r\n entries,\r\n scaleType,\r\n};\n\nexport default index$1;\nexport { NoScaleType, add, addAlias, all, entries, get, keys, names, removeAll, scaleType };\n//# sourceMappingURL=index.es.js.map\n","import { detect } from '@tonaljs/chord-detect';\nexport { detect } from '@tonaljs/chord-detect';\nimport { get as get$1, all as all$1 } from '@tonaljs/chord-type';\nimport { tokenizeNote, note, distance, transpose as transpose$1, deprecate } from '@tonaljs/core';\nimport { isSupersetOf, isSubsetOf } from '@tonaljs/pcset';\nimport { all } from '@tonaljs/scale-type';\n\nconst NoChord = {\r\n empty: true,\r\n name: \"\",\r\n symbol: \"\",\r\n root: \"\",\r\n rootDegree: 0,\r\n type: \"\",\r\n tonic: null,\r\n setNum: NaN,\r\n quality: \"Unknown\",\r\n chroma: \"\",\r\n normalized: \"\",\r\n aliases: [],\r\n notes: [],\r\n intervals: [],\r\n};\r\n// 6, 64, 7, 9, 11 and 13 are consider part of the chord\r\n// (see https://github.com/danigb/tonal/issues/55)\r\nconst NUM_TYPES = /^(6|64|7|9|11|13)$/;\r\n/**\r\n * Tokenize a chord name. It returns an array with the tonic and chord type\r\n * If not tonic is found, all the name is considered the chord name.\r\n *\r\n * This function does NOT check if the chord type exists or not. It only tries\r\n * to split the tonic and chord type.\r\n *\r\n * @function\r\n * @param {string} name - the chord name\r\n * @return {Array} an array with [tonic, type]\r\n * @example\r\n * tokenize(\"Cmaj7\") // => [ \"C\", \"maj7\" ]\r\n * tokenize(\"C7\") // => [ \"C\", \"7\" ]\r\n * tokenize(\"mMaj7\") // => [ null, \"mMaj7\" ]\r\n * tokenize(\"Cnonsense\") // => [ null, \"nonsense\" ]\r\n */\r\nfunction tokenize(name) {\r\n const [letter, acc, oct, type] = tokenizeNote(name);\r\n if (letter === \"\") {\r\n return [\"\", name];\r\n }\r\n // aug is augmented (see https://github.com/danigb/tonal/issues/55)\r\n if (letter === \"A\" && type === \"ug\") {\r\n return [\"\", \"aug\"];\r\n }\r\n // see: https://github.com/tonaljs/tonal/issues/70\r\n if (!type && (oct === \"4\" || oct === \"5\")) {\r\n return [letter + acc, oct];\r\n }\r\n if (NUM_TYPES.test(oct)) {\r\n return [letter + acc, oct + type];\r\n }\r\n else {\r\n return [letter + acc + oct, type];\r\n }\r\n}\r\n/**\r\n * Get a Chord from a chord name.\r\n */\r\nfunction get(src) {\r\n if (src === \"\") {\r\n return NoChord;\r\n }\r\n if (Array.isArray(src) && src.length === 2) {\r\n return getChord(src[1], src[0]);\r\n }\r\n else {\r\n const [tonic, type] = tokenize(src);\r\n const chord = getChord(type, tonic);\r\n return chord.empty ? getChord(src) : chord;\r\n }\r\n}\r\n/**\r\n * Get chord properties\r\n *\r\n * @param typeName - the chord type name\r\n * @param [tonic] - Optional tonic\r\n * @param [root] - Optional root (requires a tonic)\r\n */\r\nfunction getChord(typeName, optionalTonic, optionalRoot) {\r\n const type = get$1(typeName);\r\n const tonic = note(optionalTonic || \"\");\r\n const root = note(optionalRoot || \"\");\r\n if (type.empty ||\r\n (optionalTonic && tonic.empty) ||\r\n (optionalRoot && root.empty)) {\r\n return NoChord;\r\n }\r\n const rootInterval = distance(tonic.pc, root.pc);\r\n const rootDegree = type.intervals.indexOf(rootInterval) + 1;\r\n if (!root.empty && !rootDegree) {\r\n return NoChord;\r\n }\r\n const intervals = Array.from(type.intervals);\r\n for (let i = 1; i < rootDegree; i++) {\r\n const num = intervals[0][0];\r\n const quality = intervals[0][1];\r\n const newNum = parseInt(num, 10) + 7;\r\n intervals.push(`${newNum}${quality}`);\r\n intervals.shift();\r\n }\r\n const notes = tonic.empty\r\n ? []\r\n : intervals.map((i) => transpose$1(tonic, i));\r\n typeName = type.aliases.indexOf(typeName) !== -1 ? typeName : type.aliases[0];\r\n const symbol = `${tonic.empty ? \"\" : tonic.pc}${typeName}${root.empty || rootDegree <= 1 ? \"\" : \"/\" + root.pc}`;\r\n const name = `${optionalTonic ? tonic.pc + \" \" : \"\"}${type.name}${rootDegree > 1 && optionalRoot ? \" over \" + root.pc : \"\"}`;\r\n return {\r\n ...type,\r\n name,\r\n symbol,\r\n type: type.name,\r\n root: root.name,\r\n intervals,\r\n rootDegree,\r\n tonic: tonic.name,\r\n notes,\r\n };\r\n}\r\nconst chord = deprecate(\"Chord.chord\", \"Chord.get\", get);\r\n/**\r\n * Transpose a chord name\r\n *\r\n * @param {string} chordName - the chord name\r\n * @return {string} the transposed chord\r\n *\r\n * @example\r\n * transpose('Dm7', 'P4') // => 'Gm7\r\n */\r\nfunction transpose(chordName, interval) {\r\n const [tonic, type] = tokenize(chordName);\r\n if (!tonic) {\r\n return chordName;\r\n }\r\n return transpose$1(tonic, interval) + type;\r\n}\r\n/**\r\n * Get all scales where the given chord fits\r\n *\r\n * @example\r\n * chordScales('C7b9')\r\n * // => [\"phrygian dominant\", \"flamenco\", \"spanish heptatonic\", \"half-whole diminished\", \"chromatic\"]\r\n */\r\nfunction chordScales(name) {\r\n const s = get(name);\r\n const isChordIncluded = isSupersetOf(s.chroma);\r\n return all()\r\n .filter((scale) => isChordIncluded(scale.chroma))\r\n .map((scale) => scale.name);\r\n}\r\n/**\r\n * Get all chords names that are a superset of the given one\r\n * (has the same notes and at least one more)\r\n *\r\n * @function\r\n * @example\r\n * extended(\"CMaj7\")\r\n * // => [ 'Cmaj#4', 'Cmaj7#9#11', 'Cmaj9', 'CM7add13', 'Cmaj13', 'Cmaj9#11', 'CM13#11', 'CM7b9' ]\r\n */\r\nfunction extended(chordName) {\r\n const s = get(chordName);\r\n const isSuperset = isSupersetOf(s.chroma);\r\n return all$1()\r\n .filter((chord) => isSuperset(chord.chroma))\r\n .map((chord) => s.tonic + chord.aliases[0]);\r\n}\r\n/**\r\n * Find all chords names that are a subset of the given one\r\n * (has less notes but all from the given chord)\r\n *\r\n * @example\r\n */\r\nfunction reduced(chordName) {\r\n const s = get(chordName);\r\n const isSubset = isSubsetOf(s.chroma);\r\n return all$1()\r\n .filter((chord) => isSubset(chord.chroma))\r\n .map((chord) => s.tonic + chord.aliases[0]);\r\n}\r\nvar index = {\r\n getChord,\r\n get,\r\n detect,\r\n chordScales,\r\n extended,\r\n reduced,\r\n tokenize,\r\n transpose,\r\n // deprecate\r\n chord,\r\n};\n\nexport default index;\nexport { chord, chordScales, extended, get, getChord, reduced, tokenize, transpose };\n//# sourceMappingURL=index.es.js.map\n","import { all } from '@tonaljs/chord-type';\nimport { note } from '@tonaljs/core';\nimport { modes } from '@tonaljs/pcset';\n\nconst namedSet = (notes) => {\r\n const pcToName = notes.reduce((record, n) => {\r\n const chroma = note(n).chroma;\r\n if (chroma !== undefined) {\r\n record[chroma] = record[chroma] || note(n).name;\r\n }\r\n return record;\r\n }, {});\r\n return (chroma) => pcToName[chroma];\r\n};\r\nfunction detect(source) {\r\n const notes = source.map((n) => note(n).pc).filter((x) => x);\r\n if (note.length === 0) {\r\n return [];\r\n }\r\n const found = findExactMatches(notes, 1);\r\n return found\r\n .filter((chord) => chord.weight)\r\n .sort((a, b) => b.weight - a.weight)\r\n .map((chord) => chord.name);\r\n}\r\nfunction findExactMatches(notes, weight) {\r\n const tonic = notes[0];\r\n const tonicChroma = note(tonic).chroma;\r\n const noteName = namedSet(notes);\r\n // we need to test all chormas to get the correct baseNote\r\n const allModes = modes(notes, false);\r\n const found = [];\r\n allModes.forEach((mode, index) => {\r\n // some chords could have the same chroma but different interval spelling\r\n const chordTypes = all().filter((chordType) => chordType.chroma === mode);\r\n chordTypes.forEach((chordType) => {\r\n const chordName = chordType.aliases[0];\r\n const baseNote = noteName(index);\r\n const isInversion = index !== tonicChroma;\r\n if (isInversion) {\r\n found.push({\r\n weight: 0.5 * weight,\r\n name: `${baseNote}${chordName}/${tonic}`,\r\n });\r\n }\r\n else {\r\n found.push({ weight: 1 * weight, name: `${baseNote}${chordName}` });\r\n }\r\n });\r\n });\r\n return found;\r\n}\r\nvar index = { detect };\n\nexport default index;\nexport { detect };\n//# sourceMappingURL=index.es.js.map\n","// source: https://en.wikipedia.org/wiki/Note_value\r\nconst DATA = [\r\n [\r\n 0.125,\r\n \"dl\",\r\n [\"large\", \"duplex longa\", \"maxima\", \"octuple\", \"octuple whole\"],\r\n ],\r\n [0.25, \"l\", [\"long\", \"longa\"]],\r\n [0.5, \"d\", [\"double whole\", \"double\", \"breve\"]],\r\n [1, \"w\", [\"whole\", \"semibreve\"]],\r\n [2, \"h\", [\"half\", \"minim\"]],\r\n [4, \"q\", [\"quarter\", \"crotchet\"]],\r\n [8, \"e\", [\"eighth\", \"quaver\"]],\r\n [16, \"s\", [\"sixteenth\", \"semiquaver\"]],\r\n [32, \"t\", [\"thirty-second\", \"demisemiquaver\"]],\r\n [64, \"sf\", [\"sixty-fourth\", \"hemidemisemiquaver\"]],\r\n [128, \"h\", [\"hundred twenty-eighth\"]],\r\n [256, \"th\", [\"two hundred fifty-sixth\"]],\r\n];\n\nconst VALUES = [];\r\nDATA.forEach(([denominator, shorthand, names]) => add(denominator, shorthand, names));\r\nconst NoDuration = {\r\n empty: true,\r\n name: \"\",\r\n value: 0,\r\n fraction: [0, 0],\r\n shorthand: \"\",\r\n dots: \"\",\r\n names: [],\r\n};\r\nfunction names() {\r\n return VALUES.reduce((names, duration) => {\r\n duration.names.forEach((name) => names.push(name));\r\n return names;\r\n }, []);\r\n}\r\nfunction shorthands() {\r\n return VALUES.map((dur) => dur.shorthand);\r\n}\r\nconst REGEX = /^([^.]+)(\\.*)$/;\r\nfunction get(name) {\r\n const [_, simple, dots] = REGEX.exec(name) || [];\r\n const base = VALUES.find((dur) => dur.shorthand === simple || dur.names.includes(simple));\r\n if (!base) {\r\n return NoDuration;\r\n }\r\n const fraction = calcDots(base.fraction, dots.length);\r\n const value = fraction[0] / fraction[1];\r\n return { ...base, name, dots, value, fraction };\r\n}\r\nconst value = (name) => get(name).value;\r\nconst fraction = (name) => get(name).fraction;\r\nvar index = { names, shorthands, get, value, fraction };\r\n//// PRIVATE ////\r\nfunction add(denominator, shorthand, names) {\r\n VALUES.push({\r\n empty: false,\r\n dots: \"\",\r\n name: \"\",\r\n value: 1 / denominator,\r\n fraction: denominator < 1 ? [1 / denominator, 1] : [1, denominator],\r\n shorthand,\r\n names,\r\n });\r\n}\r\nfunction calcDots(fraction, dots) {\r\n const pow = Math.pow(2, dots);\r\n let numerator = fraction[0] * pow;\r\n let denominator = fraction[1] * pow;\r\n const base = numerator;\r\n // add fractions\r\n for (let i = 0; i < dots; i++) {\r\n numerator += base / Math.pow(2, i + 1);\r\n }\r\n // simplify\r\n while (numerator % 2 === 0 && denominator % 2 === 0) {\r\n numerator /= 2;\r\n denominator /= 2;\r\n }\r\n return [numerator, denominator];\r\n}\n\nexport default index;\nexport { fraction, get, names, shorthands, value };\n//# sourceMappingURL=index.es.js.map\n","import { interval, distance as distance$1, coordToInterval } from '@tonaljs/core';\n\n/**\r\n * Get the natural list of names\r\n */\r\nfunction names() {\r\n return \"1P 2M 3M 4P 5P 6m 7m\".split(\" \");\r\n}\r\n/**\r\n * Get properties of an interval\r\n *\r\n * @function\r\n * @example\r\n * Interval.get('P4') // => {\"alt\": 0, \"dir\": 1, \"name\": \"4P\", \"num\": 4, \"oct\": 0, \"q\": \"P\", \"semitones\": 5, \"simple\": 4, \"step\": 3, \"type\": \"perfectable\"}\r\n */\r\nconst get = interval;\r\n/**\r\n * Get name of an interval\r\n *\r\n * @function\r\n * @example\r\n * Interval.name('4P') // => \"4P\"\r\n * Interval.name('P4') // => \"4P\"\r\n * Interval.name('C4') // => \"\"\r\n */\r\nconst name = (name) => interval(name).name;\r\n/**\r\n * Get semitones of an interval\r\n * @function\r\n * @example\r\n * Interval.semitones('P4') // => 5\r\n */\r\nconst semitones = (name) => interval(name).semitones;\r\n/**\r\n * Get quality of an interval\r\n * @function\r\n * @example\r\n * Interval.quality('P4') // => \"P\"\r\n */\r\nconst quality = (name) => interval(name).q;\r\n/**\r\n * Get number of an interval\r\n * @function\r\n * @example\r\n * Interval.num('P4') // => 4\r\n */\r\nconst num = (name) => interval(name).num;\r\n/**\r\n * Get the simplified version of an interval.\r\n *\r\n * @function\r\n * @param {string} interval - the interval to simplify\r\n * @return {string} the simplified interval\r\n *\r\n * @example\r\n * Interval.simplify(\"9M\") // => \"2M\"\r\n * Interval.simplify(\"2M\") // => \"2M\"\r\n * Interval.simplify(\"-2M\") // => \"7m\"\r\n * [\"8P\", \"9M\", \"10M\", \"11P\", \"12P\", \"13M\", \"14M\", \"15P\"].map(Interval.simplify)\r\n * // => [ \"8P\", \"2M\", \"3M\", \"4P\", \"5P\", \"6M\", \"7M\", \"8P\" ]\r\n */\r\nfunction simplify(name) {\r\n const i = interval(name);\r\n return i.empty ? \"\" : i.simple + i.q;\r\n}\r\n/**\r\n * Get the inversion (https://en.wikipedia.org/wiki/Inversion_(music)#Intervals)\r\n * of an interval.\r\n *\r\n * @function\r\n * @param {string} interval - the interval to invert in interval shorthand\r\n * notation or interval array notation\r\n * @return {string} the inverted interval\r\n *\r\n * @example\r\n * Interval.invert(\"3m\") // => \"6M\"\r\n * Interval.invert(\"2M\") // => \"7m\"\r\n */\r\nfunction invert(name) {\r\n const i = interval(name);\r\n if (i.empty) {\r\n return \"\";\r\n }\r\n const step = (7 - i.step) % 7;\r\n const alt = i.type === \"perfectable\" ? -i.alt : -(i.alt + 1);\r\n return interval({ step, alt, oct: i.oct, dir: i.dir }).name;\r\n}\r\n// interval numbers\r\nconst IN = [1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7];\r\n// interval qualities\r\nconst IQ = \"P m M m M P d P m M m M\".split(\" \");\r\n/**\r\n * Get interval name from semitones number. Since there are several interval\r\n * names for the same number, the name it's arbitrary, but deterministic.\r\n *\r\n * @param {Integer} num - the number of semitones (can be negative)\r\n * @return {string} the interval name\r\n * @example\r\n * Interval.fromSemitones(7) // => \"5P\"\r\n * Interval.fromSemitones(-7) // => \"-5P\"\r\n */\r\nfunction fromSemitones(semitones) {\r\n const d = semitones < 0 ? -1 : 1;\r\n const n = Math.abs(semitones);\r\n const c = n % 12;\r\n const o = Math.floor(n / 12);\r\n return d * (IN[c] + 7 * o) + IQ[c];\r\n}\r\n/**\r\n * Find interval between two notes\r\n *\r\n * @example\r\n * Interval.distance(\"C4\", \"G4\"); // => \"5P\"\r\n */\r\nconst distance = distance$1;\r\n/**\r\n * Adds two intervals\r\n *\r\n * @function\r\n * @param {string} interval1\r\n * @param {string} interval2\r\n * @return {string} the added interval name\r\n * @example\r\n * Interval.add(\"3m\", \"5P\") // => \"7m\"\r\n */\r\nconst add = combinator((a, b) => [a[0] + b[0], a[1] + b[1]]);\r\n/**\r\n * Returns a function that adds an interval\r\n *\r\n * @function\r\n * @example\r\n * ['1P', '2M', '3M'].map(Interval.addTo('5P')) // => [\"5P\", \"6M\", \"7M\"]\r\n */\r\nconst addTo = (interval) => (other) => add(interval, other);\r\n/**\r\n * Subtracts two intervals\r\n *\r\n * @function\r\n * @param {string} minuendInterval\r\n * @param {string} subtrahendInterval\r\n * @return {string} the substracted interval name\r\n * @example\r\n * Interval.substract('5P', '3M') // => '3m'\r\n * Interval.substract('3M', '5P') // => '-3m'\r\n */\r\nconst substract = combinator((a, b) => [a[0] - b[0], a[1] - b[1]]);\r\nvar index = {\r\n names,\r\n get,\r\n name,\r\n num,\r\n semitones,\r\n quality,\r\n fromSemitones,\r\n distance,\r\n invert,\r\n simplify,\r\n add,\r\n addTo,\r\n substract,\r\n};\r\nfunction combinator(fn) {\r\n return (a, b) => {\r\n const coordA = interval(a).coord;\r\n const coordB = interval(b).coord;\r\n if (coordA && coordB) {\r\n const coord = fn(coordA, coordB);\r\n return coordToInterval(coord).name;\r\n }\r\n };\r\n}\n\nexport default index;\nexport { add, addTo, distance, fromSemitones, get, invert, name, names, num, quality, semitones, simplify, substract };\n//# sourceMappingURL=index.es.js.map\n","import { note } from '@tonaljs/core';\n\nfunction isMidi(arg) {\r\n return +arg >= 0 && +arg <= 127;\r\n}\r\n/**\r\n * Get the note midi number (a number between 0 and 127)\r\n *\r\n * It returns undefined if not valid note name\r\n *\r\n * @function\r\n * @param {string|number} note - the note name or midi number\r\n * @return {Integer} the midi number or undefined if not valid note\r\n * @example\r\n * import { toMidi } from '@tonaljs/midi'\r\n * toMidi(\"C4\") // => 60\r\n * toMidi(60) // => 60\r\n * toMidi('60') // => 60\r\n */\r\nfunction toMidi(note$1) {\r\n if (isMidi(note$1)) {\r\n return +note$1;\r\n }\r\n const n = note(note$1);\r\n return n.empty ? null : n.midi;\r\n}\r\n/**\r\n * Get the frequency in hertzs from midi number\r\n *\r\n * @param {number} midi - the note midi number\r\n * @param {number} [tuning = 440] - A4 tuning frequency in Hz (440 by default)\r\n * @return {number} the frequency or null if not valid note midi\r\n * @example\r\n * import { midiToFreq} from '@tonaljs/midi'\r\n * midiToFreq(69) // => 440\r\n */\r\nfunction midiToFreq(midi, tuning = 440) {\r\n return Math.pow(2, (midi - 69) / 12) * tuning;\r\n}\r\nconst L2 = Math.log(2);\r\nconst L440 = Math.log(440);\r\n/**\r\n * Get the midi number from a frequency in hertz. The midi number can\r\n * contain decimals (with two digits precission)\r\n *\r\n * @param {number} frequency\r\n * @return {number}\r\n * @example\r\n * import { freqToMidi} from '@tonaljs/midi'\r\n * freqToMidi(220)); //=> 57\r\n * freqToMidi(261.62)); //=> 60\r\n * freqToMidi(261)); //=> 59.96\r\n */\r\nfunction freqToMidi(freq) {\r\n const v = (12 * (Math.log(freq) - L440)) / L2 + 69;\r\n return Math.round(v * 100) / 100;\r\n}\r\nconst SHARPS = \"C C# D D# E F F# G G# A A# B\".split(\" \");\r\nconst FLATS = \"C Db D Eb E F Gb G Ab A Bb B\".split(\" \");\r\n/**\r\n * Given a midi number, returns a note name. The altered notes will have\r\n * flats unless explicitly set with the optional `useSharps` parameter.\r\n *\r\n * @function\r\n * @param {number} midi - the midi note number\r\n * @param {Object} options = default: `{ sharps: false, pitchClass: false }`\r\n * @param {boolean} useSharps - (Optional) set to true to use sharps instead of flats\r\n * @return {string} the note name\r\n * @example\r\n * import { midiToNoteName } from '@tonaljs/midi'\r\n * midiToNoteName(61) // => \"Db4\"\r\n * midiToNoteName(61, { pitchClass: true }) // => \"Db\"\r\n * midiToNoteName(61, { sharps: true }) // => \"C#4\"\r\n * midiToNoteName(61, { pitchClass: true, sharps: true }) // => \"C#\"\r\n * // it rounds to nearest note\r\n * midiToNoteName(61.7) // => \"D4\"\r\n */\r\nfunction midiToNoteName(midi, options = {}) {\r\n if (isNaN(midi) || midi === -Infinity || midi === Infinity)\r\n return \"\";\r\n midi = Math.round(midi);\r\n const pcs = options.sharps === true ? SHARPS : FLATS;\r\n const pc = pcs[midi % 12];\r\n if (options.pitchClass) {\r\n return pc;\r\n }\r\n const o = Math.floor(midi / 12) - 1;\r\n return pc + o;\r\n}\r\nvar index = { isMidi, toMidi, midiToFreq, midiToNoteName, freqToMidi };\n\nexport default index;\nexport { freqToMidi, isMidi, midiToFreq, midiToNoteName, toMidi };\n//# sourceMappingURL=index.es.js.map\n","import { note, transpose as transpose$1, coordToNote } from '@tonaljs/core';\nimport { midiToNoteName, freqToMidi } from '@tonaljs/midi';\n\nconst NAMES = [\"C\", \"D\", \"E\", \"F\", \"G\", \"A\", \"B\"];\r\nconst toName = (n) => n.name;\r\nconst onlyNotes = (array) => array.map(note).filter((n) => !n.empty);\r\n/**\r\n * Return the natural note names without octave\r\n * @function\r\n * @example\r\n * Note.names(); // => [\"C\", \"D\", \"E\", \"F\", \"G\", \"A\", \"B\"]\r\n */\r\nfunction names(array) {\r\n if (array === undefined) {\r\n return NAMES.slice();\r\n }\r\n else if (!Array.isArray(array)) {\r\n return [];\r\n }\r\n else {\r\n return onlyNotes(array).map(toName);\r\n }\r\n}\r\n/**\r\n * Get a note from a note name\r\n *\r\n * @function\r\n * @example\r\n * Note.get('Bb4') // => { name: \"Bb4\", midi: 70, chroma: 10, ... }\r\n */\r\nconst get = note;\r\n/**\r\n * Get the note name\r\n * @function\r\n */\r\nconst name = (note) => get(note).name;\r\n/**\r\n * Get the note pitch class name\r\n * @function\r\n */\r\nconst pitchClass = (note) => get(note).pc;\r\n/**\r\n * Get the note accidentals\r\n * @function\r\n */\r\nconst accidentals = (note) => get(note).acc;\r\n/**\r\n * Get the note octave\r\n * @function\r\n */\r\nconst octave = (note) => get(note).oct;\r\n/**\r\n * Get the note midi\r\n * @function\r\n */\r\nconst midi = (note) => get(note).midi;\r\n/**\r\n * Get the note midi\r\n * @function\r\n */\r\nconst freq = (note) => get(note).freq;\r\n/**\r\n * Get the note chroma\r\n * @function\r\n */\r\nconst chroma = (note) => get(note).chroma;\r\n/**\r\n * Given a midi number, returns a note name. Uses flats for altered notes.\r\n *\r\n * @function\r\n * @param {number} midi - the midi note number\r\n * @return {string} the note name\r\n * @example\r\n * Note.fromMidi(61) // => \"Db4\"\r\n * Note.fromMidi(61.7) // => \"D4\"\r\n */\r\nfunction fromMidi(midi) {\r\n return midiToNoteName(midi);\r\n}\r\n/**\r\n * Given a midi number, returns a note name. Uses flats for altered notes.\r\n */\r\nfunction fromFreq(freq) {\r\n return midiToNoteName(freqToMidi(freq));\r\n}\r\n/**\r\n * Given a midi number, returns a note name. Uses flats for altered notes.\r\n */\r\nfunction fromFreqSharps(freq) {\r\n return midiToNoteName(freqToMidi(freq), { sharps: true });\r\n}\r\n/**\r\n * Given a midi number, returns a note name. Uses flats for altered notes.\r\n *\r\n * @function\r\n * @param {number} midi - the midi note number\r\n * @return {string} the note name\r\n * @example\r\n * Note.fromMidiSharps(61) // => \"C#4\"\r\n */\r\nfunction fromMidiSharps(midi) {\r\n return midiToNoteName(midi, { sharps: true });\r\n}\r\n/**\r\n * Transpose a note by an interval\r\n */\r\nconst transpose = transpose$1;\r\nconst tr = transpose$1;\r\n/**\r\n * Transpose by an interval.\r\n * @function\r\n * @param {string} interval\r\n * @return {function} a function that transposes by the given interval\r\n * @example\r\n * [\"C\", \"D\", \"E\"].map(Note.transposeBy(\"5P\"));\r\n * // => [\"G\", \"A\", \"B\"]\r\n */\r\nconst transposeBy = (interval) => (note) => transpose(note, interval);\r\nconst trBy = transposeBy;\r\n/**\r\n * Transpose from a note\r\n * @function\r\n * @param {string} note\r\n * @return {function} a function that transposes the the note by an interval\r\n * [\"1P\", \"3M\", \"5P\"].map(Note.transposeFrom(\"C\"));\r\n * // => [\"C\", \"E\", \"G\"]\r\n */\r\nconst transposeFrom = (note) => (interval) => transpose(note, interval);\r\nconst trFrom = transposeFrom;\r\n/**\r\n * Transpose a note by a number of perfect fifths.\r\n *\r\n * @function\r\n * @param {string} note - the note name\r\n * @param {number} fifhts - the number of fifths\r\n * @return {string} the transposed note name\r\n *\r\n * @example\r\n * import { transposeFifths } from \"@tonaljs/note\"\r\n * transposeFifths(\"G4\", 1) // => \"D\"\r\n * [0, 1, 2, 3, 4].map(fifths => transposeFifths(\"C\", fifths)) // => [\"C\", \"G\", \"D\", \"A\", \"E\"]\r\n */\r\nfunction transposeFifths(noteName, fifths) {\r\n const note = get(noteName);\r\n if (note.empty) {\r\n return \"\";\r\n }\r\n const [nFifths, nOcts] = note.coord;\r\n const transposed = nOcts === undefined\r\n ? coordToNote([nFifths + fifths])\r\n : coordToNote([nFifths + fifths, nOcts]);\r\n return transposed.name;\r\n}\r\nconst trFifths = transposeFifths;\r\nconst ascending = (a, b) => a.height - b.height;\r\nconst descending = (a, b) => b.height - a.height;\r\nfunction sortedNames(notes, comparator) {\r\n comparator = comparator || ascending;\r\n return onlyNotes(notes).sort(comparator).map(toName);\r\n}\r\nfunction sortedUniqNames(notes) {\r\n return sortedNames(notes, ascending).filter((n, i, a) => i === 0 || n !== a[i - 1]);\r\n}\r\n/**\r\n * Simplify a note\r\n *\r\n * @function\r\n * @param {string} note - the note to be simplified\r\n * - sameAccType: default true. Use same kind of accidentals that source\r\n * @return {string} the simplified note or '' if not valid note\r\n * @example\r\n * simplify(\"C##\") // => \"D\"\r\n * simplify(\"C###\") // => \"D#\"\r\n * simplify(\"C###\")\r\n * simplify(\"B#4\") // => \"C5\"\r\n */\r\nconst simplify = nameBuilder(true);\r\n/**\r\n * Get enharmonic of a note\r\n *\r\n * @function\r\n * @param {string} note\r\n * @return {string} the enharmonic note or '' if not valid note\r\n * @example\r\n * Note.enharmonic(\"Db\") // => \"C#\"\r\n * Note.enharmonic(\"C\") // => \"C\"\r\n */\r\nconst enharmonic = nameBuilder(false);\r\nfunction nameBuilder(sameAccidentals) {\r\n return (noteName) => {\r\n const note = get(noteName);\r\n if (note.empty) {\r\n return \"\";\r\n }\r\n const sharps = sameAccidentals ? note.alt > 0 : note.alt < 0;\r\n const pitchClass = note.midi === null;\r\n return midiToNoteName(note.midi || note.chroma, { sharps, pitchClass });\r\n };\r\n}\r\nvar index = {\r\n names,\r\n get,\r\n name,\r\n pitchClass,\r\n accidentals,\r\n octave,\r\n midi,\r\n ascending,\r\n descending,\r\n sortedNames,\r\n sortedUniqNames,\r\n fromMidi,\r\n fromMidiSharps,\r\n freq,\r\n fromFreq,\r\n fromFreqSharps,\r\n chroma,\r\n transpose,\r\n tr,\r\n transposeBy,\r\n trBy,\r\n transposeFrom,\r\n trFrom,\r\n transposeFifths,\r\n trFifths,\r\n simplify,\r\n enharmonic,\r\n};\n\nexport default index;\nexport { accidentals, ascending, chroma, descending, enharmonic, freq, fromFreq, fromFreqSharps, fromMidi, fromMidiSharps, get, midi, name, names, octave, pitchClass, simplify, sortedNames, sortedUniqNames, tr, trBy, trFifths, trFrom, transpose, transposeBy, transposeFifths, transposeFrom };\n//# sourceMappingURL=index.es.js.map\n","import { isPitch, altToAcc, isNamed, deprecate, accToAlt, interval } from '@tonaljs/core';\n\nconst NoRomanNumeral = { empty: true, name: \"\", chordType: \"\" };\r\nconst cache = {};\r\n/**\r\n * Get properties of a roman numeral string\r\n *\r\n * @function\r\n * @param {string} - the roman numeral string (can have type, like: Imaj7)\r\n * @return {Object} - the roman numeral properties\r\n * @param {string} name - the roman numeral (tonic)\r\n * @param {string} type - the chord type\r\n * @param {string} num - the number (1 = I, 2 = II...)\r\n * @param {boolean} major - major or not\r\n *\r\n * @example\r\n * romanNumeral(\"VIIb5\") // => { name: \"VII\", type: \"b5\", num: 7, major: true }\r\n */\r\nfunction get(src) {\r\n return typeof src === \"string\"\r\n ? cache[src] || (cache[src] = parse(src))\r\n : typeof src === \"number\"\r\n ? get(NAMES[src] || \"\")\r\n : isPitch(src)\r\n ? fromPitch(src)\r\n : isNamed(src)\r\n ? get(src.name)\r\n : NoRomanNumeral;\r\n}\r\nconst romanNumeral = deprecate(\"RomanNumeral.romanNumeral\", \"RomanNumeral.get\", get);\r\n/**\r\n * Get roman numeral names\r\n *\r\n * @function\r\n * @param {boolean} [isMajor=true]\r\n * @return {Array}\r\n *\r\n * @example\r\n * names() // => [\"I\", \"II\", \"III\", \"IV\", \"V\", \"VI\", \"VII\"]\r\n */\r\nfunction names(major = true) {\r\n return (major ? NAMES : NAMES_MINOR).slice();\r\n}\r\nfunction fromPitch(pitch) {\r\n return get(altToAcc(pitch.alt) + NAMES[pitch.step]);\r\n}\r\nconst REGEX = /^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;\r\nfunction tokenize(str) {\r\n return (REGEX.exec(str) || [\"\", \"\", \"\", \"\"]);\r\n}\r\nconst ROMANS = \"I II III IV V VI VII\";\r\nconst NAMES = ROMANS.split(\" \");\r\nconst NAMES_MINOR = ROMANS.toLowerCase().split(\" \");\r\nfunction parse(src) {\r\n const [name, acc, roman, chordType] = tokenize(src);\r\n if (!roman) {\r\n return NoRomanNumeral;\r\n }\r\n const upperRoman = roman.toUpperCase();\r\n const step = NAMES.indexOf(upperRoman);\r\n const alt = accToAlt(acc);\r\n const dir = 1;\r\n return {\r\n empty: false,\r\n name,\r\n roman,\r\n interval: interval({ step, alt, dir }).name,\r\n acc,\r\n chordType,\r\n alt,\r\n step,\r\n major: roman === upperRoman,\r\n oct: 0,\r\n dir,\r\n };\r\n}\r\nvar index = {\r\n names,\r\n get,\r\n // deprecated\r\n romanNumeral,\r\n};\n\nexport default index;\nexport { get, names, tokenize };\n//# sourceMappingURL=index.es.js.map\n","import { note, transpose, altToAcc, accToAlt } from '@tonaljs/core';\nimport { transposeFifths } from '@tonaljs/note';\nimport { get } from '@tonaljs/roman-numeral';\n\nconst Empty = Object.freeze([]);\r\nconst NoKey = {\r\n type: \"major\",\r\n tonic: \"\",\r\n alteration: 0,\r\n keySignature: \"\",\r\n};\r\nconst NoKeyScale = {\r\n tonic: \"\",\r\n grades: Empty,\r\n intervals: Empty,\r\n scale: Empty,\r\n chords: Empty,\r\n chordsHarmonicFunction: Empty,\r\n chordScales: Empty,\r\n};\r\nconst NoMajorKey = {\r\n ...NoKey,\r\n ...NoKeyScale,\r\n type: \"major\",\r\n minorRelative: \"\",\r\n scale: Empty,\r\n secondaryDominants: Empty,\r\n secondaryDominantsMinorRelative: Empty,\r\n substituteDominants: Empty,\r\n substituteDominantsMinorRelative: Empty,\r\n};\r\nconst NoMinorKey = {\r\n ...NoKey,\r\n type: \"minor\",\r\n relativeMajor: \"\",\r\n natural: NoKeyScale,\r\n harmonic: NoKeyScale,\r\n melodic: NoKeyScale,\r\n};\r\nconst mapScaleToType = (scale, list, sep = \"\") => list.map((type, i) => `${scale[i]}${sep}${type}`);\r\nfunction keyScale(grades, chords, harmonicFunctions, chordScales) {\r\n return (tonic) => {\r\n const intervals = grades.map((gr) => get(gr).interval || \"\");\r\n const scale = intervals.map((interval) => transpose(tonic, interval));\r\n return {\r\n tonic,\r\n grades,\r\n intervals,\r\n scale,\r\n chords: mapScaleToType(scale, chords),\r\n chordsHarmonicFunction: harmonicFunctions.slice(),\r\n chordScales: mapScaleToType(scale, chordScales, \" \"),\r\n };\r\n };\r\n}\r\nconst distInFifths = (from, to) => {\r\n const f = note(from);\r\n const t = note(to);\r\n return f.empty || t.empty ? 0 : t.coord[0] - f.coord[0];\r\n};\r\nconst MajorScale = keyScale(\"I II III IV V VI VII\".split(\" \"), \"maj7 m7 m7 maj7 7 m7 m7b5\".split(\" \"), \"T SD T SD D T D\".split(\" \"), \"major,dorian,phrygian,lydian,mixolydian,minor,locrian\".split(\",\"));\r\nconst NaturalScale = keyScale(\"I II bIII IV V bVI bVII\".split(\" \"), \"m7 m7b5 maj7 m7 m7 maj7 7\".split(\" \"), \"T SD T SD D SD SD\".split(\" \"), \"minor,locrian,major,dorian,phrygian,lydian,mixolydian\".split(\",\"));\r\nconst HarmonicScale = keyScale(\"I II bIII IV V bVI VII\".split(\" \"), \"mMaj7 m7b5 +maj7 m7 7 maj7 o7\".split(\" \"), \"T SD T SD D SD D\".split(\" \"), \"harmonic minor,locrian 6,major augmented,lydian diminished,phrygian dominant,lydian #9,ultralocrian\".split(\",\"));\r\nconst MelodicScale = keyScale(\"I II bIII IV V VI VII\".split(\" \"), \"m6 m7 +maj7 7 7 m7b5 m7b5\".split(\" \"), \"T SD T SD D \".split(\" \"), \"melodic minor,dorian b2,lydian augmented,lydian dominant,mixolydian b6,locrian #2,altered\".split(\",\"));\r\n/**\r\n * Get a major key properties in a given tonic\r\n * @param tonic\r\n */\r\nfunction majorKey(tonic) {\r\n const pc = note(tonic).pc;\r\n if (!pc)\r\n return NoMajorKey;\r\n const keyScale = MajorScale(pc);\r\n const alteration = distInFifths(\"C\", pc);\r\n const romanInTonic = (src) => {\r\n const r = get(src);\r\n if (r.empty)\r\n return \"\";\r\n return transpose(tonic, r.interval) + r.chordType;\r\n };\r\n return {\r\n ...keyScale,\r\n type: \"major\",\r\n minorRelative: transpose(pc, \"-3m\"),\r\n alteration,\r\n keySignature: altToAcc(alteration),\r\n secondaryDominants: \"- VI7 VII7 I7 II7 III7 -\".split(\" \").map(romanInTonic),\r\n secondaryDominantsMinorRelative: \"- IIIm7b5 IV#m7 Vm7 VIm7 VIIm7b5 -\"\r\n .split(\" \")\r\n .map(romanInTonic),\r\n substituteDominants: \"- bIII7 IV7 bV7 bVI7 bVII7 -\"\r\n .split(\" \")\r\n .map(romanInTonic),\r\n substituteDominantsMinorRelative: \"- IIIm7 Im7 IIbm7 VIm7 IVm7 -\"\r\n .split(\" \")\r\n .map(romanInTonic),\r\n };\r\n}\r\n/**\r\n * Get minor key properties in a given tonic\r\n * @param tonic\r\n */\r\nfunction minorKey(tnc) {\r\n const pc = note(tnc).pc;\r\n if (!pc)\r\n return NoMinorKey;\r\n const alteration = distInFifths(\"C\", pc) - 3;\r\n return {\r\n type: \"minor\",\r\n tonic: pc,\r\n relativeMajor: transpose(pc, \"3m\"),\r\n alteration,\r\n keySignature: altToAcc(alteration),\r\n natural: NaturalScale(pc),\r\n harmonic: HarmonicScale(pc),\r\n melodic: MelodicScale(pc),\r\n };\r\n}\r\n/**\r\n * Given a key signature, returns the tonic of the major key\r\n * @param sigature\r\n * @example\r\n * majorTonicFromKeySignature('###') // => 'A'\r\n */\r\nfunction majorTonicFromKeySignature(sig) {\r\n if (typeof sig === \"number\") {\r\n return transposeFifths(\"C\", sig);\r\n }\r\n else if (typeof sig === \"string\" && /^b+|#+$/.test(sig)) {\r\n return transposeFifths(\"C\", accToAlt(sig));\r\n }\r\n return null;\r\n}\r\nvar index = { majorKey, majorTonicFromKeySignature, minorKey };\n\nexport default index;\nexport { majorKey, majorTonicFromKeySignature, minorKey };\n//# sourceMappingURL=index.es.js.map\n","import { deprecate } from '@tonaljs/core';\nimport { chromaToIntervals, EmptyPcset } from '@tonaljs/pcset';\n\nconst DATA = [\r\n [0, 2773, 0, \"ionian\", \"\", \"Maj7\", \"major\"],\r\n [1, 2902, 2, \"dorian\", \"m\", \"m7\"],\r\n [2, 3418, 4, \"phrygian\", \"m\", \"m7\"],\r\n [3, 2741, -1, \"lydian\", \"\", \"Maj7\"],\r\n [4, 2774, 1, \"mixolydian\", \"\", \"7\"],\r\n [5, 2906, 3, \"aeolian\", \"m\", \"m7\", \"minor\"],\r\n [6, 3434, 5, \"locrian\", \"dim\", \"m7b5\"],\r\n];\n\nconst NoMode = {\r\n ...EmptyPcset,\r\n name: \"\",\r\n alt: 0,\r\n modeNum: NaN,\r\n triad: \"\",\r\n seventh: \"\",\r\n aliases: [],\r\n};\r\nconst modes = DATA.map(toMode);\r\nconst index = {};\r\nmodes.forEach((mode) => {\r\n index[mode.name] = mode;\r\n mode.aliases.forEach((alias) => {\r\n index[alias] = mode;\r\n });\r\n});\r\n/**\r\n * Get a Mode by it's name\r\n *\r\n * @example\r\n * get('dorian')\r\n * // =>\r\n * // {\r\n * // intervals: [ '1P', '2M', '3m', '4P', '5P', '6M', '7m' ],\r\n * // modeNum: 1,\r\n * // chroma: '101101010110',\r\n * // normalized: '101101010110',\r\n * // name: 'dorian',\r\n * // setNum: 2902,\r\n * // alt: 2,\r\n * // triad: 'm',\r\n * // seventh: 'm7',\r\n * // aliases: []\r\n * // }\r\n */\r\nfunction get(name) {\r\n return typeof name === \"string\"\r\n ? index[name.toLowerCase()] || NoMode\r\n : name && name.name\r\n ? get(name.name)\r\n : NoMode;\r\n}\r\nconst mode = deprecate(\"Mode.mode\", \"Mode.get\", get);\r\n/**\r\n * Get a list of all modes\r\n */\r\nfunction all() {\r\n return modes.slice();\r\n}\r\nconst entries = deprecate(\"Mode.mode\", \"Mode.all\", all);\r\n/**\r\n * Get a list of all mode names\r\n */\r\nfunction names() {\r\n return modes.map((mode) => mode.name);\r\n}\r\nfunction toMode(mode) {\r\n const [modeNum, setNum, alt, name, triad, seventh, alias] = mode;\r\n const aliases = alias ? [alias] : [];\r\n const chroma = Number(setNum).toString(2);\r\n const intervals = chromaToIntervals(chroma);\r\n return {\r\n empty: false,\r\n intervals,\r\n modeNum,\r\n chroma,\r\n normalized: chroma,\r\n name,\r\n setNum,\r\n alt,\r\n triad,\r\n seventh,\r\n aliases,\r\n };\r\n}\r\nvar index$1 = {\r\n get,\r\n names,\r\n all,\r\n // deprecated\r\n entries,\r\n mode,\r\n};\n\nexport default index$1;\nexport { all, entries, get, mode, names };\n//# sourceMappingURL=index.es.js.map\n","import { tokenize } from '@tonaljs/chord';\nimport { transpose, interval, distance } from '@tonaljs/core';\nimport { get } from '@tonaljs/roman-numeral';\n\n/**\r\n * Given a tonic and a chord list expressed with roman numeral notation\r\n * returns the progression expressed with leadsheet chords symbols notation\r\n * @example\r\n * fromRomanNumerals(\"C\", [\"I\", \"IIm7\", \"V7\"]);\r\n * // => [\"C\", \"Dm7\", \"G7\"]\r\n */\r\nfunction fromRomanNumerals(tonic, chords) {\r\n const romanNumerals = chords.map(get);\r\n return romanNumerals.map((rn) => transpose(tonic, interval(rn)) + rn.chordType);\r\n}\r\n/**\r\n * Given a tonic and a chord list with leadsheet symbols notation,\r\n * return the chord list with roman numeral notation\r\n * @example\r\n * toRomanNumerals(\"C\", [\"CMaj7\", \"Dm7\", \"G7\"]);\r\n * // => [\"IMaj7\", \"IIm7\", \"V7\"]\r\n */\r\nfunction toRomanNumerals(tonic, chords) {\r\n return chords.map((chord) => {\r\n const [note, chordType] = tokenize(chord);\r\n const intervalName = distance(tonic, note);\r\n const roman = get(interval(intervalName));\r\n return roman.name + chordType;\r\n });\r\n}\r\nvar index = { fromRomanNumerals, toRomanNumerals };\n\nexport default index;\nexport { fromRomanNumerals, toRomanNumerals };\n//# sourceMappingURL=index.es.js.map\n","import { compact, range } from '@tonaljs/collection';\nimport { toMidi, midiToNoteName } from '@tonaljs/midi';\n\n/**\r\n * Create a numeric range. You supply a list of notes or numbers and it will\r\n * be connected to create complex ranges.\r\n *\r\n * @param {Array} array - the list of notes or numbers used\r\n * @return {Array} an array of numbers or empty array if not valid parameters\r\n *\r\n * @example\r\n * numeric([\"C5\", \"C4\"]) // => [ 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60 ]\r\n * // it works midi notes\r\n * numeric([10, 5]) // => [ 10, 9, 8, 7, 6, 5 ]\r\n * // complex range\r\n * numeric([\"C4\", \"E4\", \"Bb3\"]) // => [60, 61, 62, 63, 64, 63, 62, 61, 60, 59, 58]\r\n */\r\nfunction numeric(notes) {\r\n const midi = compact(notes.map(toMidi));\r\n if (!notes.length || midi.length !== notes.length) {\r\n // there is no valid notes\r\n return [];\r\n }\r\n return midi.reduce((result, note) => {\r\n const last = result[result.length - 1];\r\n return result.concat(range(last, note).slice(1));\r\n }, [midi[0]]);\r\n}\r\n/**\r\n * Create a range of chromatic notes. The altered notes will use flats.\r\n *\r\n * @function\r\n * @param {String|Array} list - the list of notes or midi note numbers\r\n * @return {Array} an array of note names\r\n *\r\n * @example\r\n * Range.chromatic(\"C2 E2 D2\") // => [\"C2\", \"Db2\", \"D2\", \"Eb2\", \"E2\", \"Eb2\", \"D2\"]\r\n * // with sharps\r\n * Range.chromatic(\"C2 C3\", true) // => [ \"C2\", \"C#2\", \"D2\", \"D#2\", \"E2\", \"F2\", \"F#2\", \"G2\", \"G#2\", \"A2\", \"A#2\", \"B2\", \"C3\" ]\r\n */\r\nfunction chromatic(notes, options) {\r\n return numeric(notes).map((midi) => midiToNoteName(midi, options));\r\n}\r\nvar index = { numeric, chromatic };\n\nexport default index;\nexport { chromatic, numeric };\n//# sourceMappingURL=index.es.js.map\n","import { all } from '@tonaljs/chord-type';\nimport { rotate } from '@tonaljs/collection';\nimport { note, transpose, deprecate } from '@tonaljs/core';\nimport { sortedUniqNames } from '@tonaljs/note';\nimport { isSubsetOf, isSupersetOf, modes } from '@tonaljs/pcset';\nimport { names as names$1, get as get$1, all as all$1 } from '@tonaljs/scale-type';\n\n/**\r\n * References:\r\n * - https://www.researchgate.net/publication/327567188_An_Algorithm_for_Spelling_the_Pitches_of_Any_Musical_Scale\r\n * @module scale\r\n */\r\nconst NoScale = {\r\n empty: true,\r\n name: \"\",\r\n type: \"\",\r\n tonic: null,\r\n setNum: NaN,\r\n chroma: \"\",\r\n normalized: \"\",\r\n aliases: [],\r\n notes: [],\r\n intervals: [],\r\n};\r\n/**\r\n * Given a string with a scale name and (optionally) a tonic, split\r\n * that components.\r\n *\r\n * It retuns an array with the form [ name, tonic ] where tonic can be a\r\n * note name or null and name can be any arbitrary string\r\n * (this function doesn\"t check if that scale name exists)\r\n *\r\n * @function\r\n * @param {string} name - the scale name\r\n * @return {Array} an array [tonic, name]\r\n * @example\r\n * tokenize(\"C mixolydean\") // => [\"C\", \"mixolydean\"]\r\n * tokenize(\"anything is valid\") // => [\"\", \"anything is valid\"]\r\n * tokenize() // => [\"\", \"\"]\r\n */\r\nfunction tokenize(name) {\r\n if (typeof name !== \"string\") {\r\n return [\"\", \"\"];\r\n }\r\n const i = name.indexOf(\" \");\r\n const tonic = note(name.substring(0, i));\r\n if (tonic.empty) {\r\n const n = note(name);\r\n return n.empty ? [\"\", name] : [n.name, \"\"];\r\n }\r\n const type = name.substring(tonic.name.length + 1);\r\n return [tonic.name, type.length ? type : \"\"];\r\n}\r\n/**\r\n * Get all scale names\r\n * @function\r\n */\r\nconst names = names$1;\r\n/**\r\n * Get a Scale from a scale name.\r\n */\r\nfunction get(src) {\r\n const tokens = Array.isArray(src) ? src : tokenize(src);\r\n const tonic = note(tokens[0]).name;\r\n const st = get$1(tokens[1]);\r\n if (st.empty) {\r\n return NoScale;\r\n }\r\n const type = st.name;\r\n const notes = tonic\r\n ? st.intervals.map((i) => transpose(tonic, i))\r\n : [];\r\n const name = tonic ? tonic + \" \" + type : type;\r\n return { ...st, name, type, tonic, notes };\r\n}\r\nconst scale = deprecate(\"Scale.scale\", \"Scale.get\", get);\r\n/**\r\n * Get all chords that fits a given scale\r\n *\r\n * @function\r\n * @param {string} name - the scale name\r\n * @return {Array} - the chord names\r\n *\r\n * @example\r\n * scaleChords(\"pentatonic\") // => [\"5\", \"64\", \"M\", \"M6\", \"Madd9\", \"Msus2\"]\r\n */\r\nfunction scaleChords(name) {\r\n const s = get(name);\r\n const inScale = isSubsetOf(s.chroma);\r\n return all()\r\n .filter((chord) => inScale(chord.chroma))\r\n .map((chord) => chord.aliases[0]);\r\n}\r\n/**\r\n * Get all scales names that are a superset of the given one\r\n * (has the same notes and at least one more)\r\n *\r\n * @function\r\n * @param {string} name\r\n * @return {Array} a list of scale names\r\n * @example\r\n * extended(\"major\") // => [\"bebop\", \"bebop dominant\", \"bebop major\", \"chromatic\", \"ichikosucho\"]\r\n */\r\nfunction extended(name) {\r\n const s = get(name);\r\n const isSuperset = isSupersetOf(s.chroma);\r\n return all$1()\r\n .filter((scale) => isSuperset(scale.chroma))\r\n .map((scale) => scale.name);\r\n}\r\n/**\r\n * Find all scales names that are a subset of the given one\r\n * (has less notes but all from the given scale)\r\n *\r\n * @function\r\n * @param {string} name\r\n * @return {Array} a list of scale names\r\n *\r\n * @example\r\n * reduced(\"major\") // => [\"ionian pentatonic\", \"major pentatonic\", \"ritusen\"]\r\n */\r\nfunction reduced(name) {\r\n const isSubset = isSubsetOf(get(name).chroma);\r\n return all$1()\r\n .filter((scale) => isSubset(scale.chroma))\r\n .map((scale) => scale.name);\r\n}\r\n/**\r\n * Given an array of notes, return the scale: a pitch class set starting from\r\n * the first note of the array\r\n *\r\n * @function\r\n * @param {string[]} notes\r\n * @return {string[]} pitch classes with same tonic\r\n * @example\r\n * scaleNotes(['C4', 'c3', 'C5', 'C4', 'c4']) // => [\"C\"]\r\n * scaleNotes(['D4', 'c#5', 'A5', 'F#6']) // => [\"D\", \"F#\", \"A\", \"C#\"]\r\n */\r\nfunction scaleNotes(notes) {\r\n const pcset = notes.map((n) => note(n).pc).filter((x) => x);\r\n const tonic = pcset[0];\r\n const scale = sortedUniqNames(pcset);\r\n return rotate(scale.indexOf(tonic), scale);\r\n}\r\n/**\r\n * Find mode names of a scale\r\n *\r\n * @function\r\n * @param {string} name - scale name\r\n * @example\r\n * modeNames(\"C pentatonic\") // => [\r\n * [\"C\", \"major pentatonic\"],\r\n * [\"D\", \"egyptian\"],\r\n * [\"E\", \"malkos raga\"],\r\n * [\"G\", \"ritusen\"],\r\n * [\"A\", \"minor pentatonic\"]\r\n * ]\r\n */\r\nfunction modeNames(name) {\r\n const s = get(name);\r\n if (s.empty) {\r\n return [];\r\n }\r\n const tonics = s.tonic ? s.notes : s.intervals;\r\n return modes(s.chroma)\r\n .map((chroma, i) => {\r\n const modeName = get(chroma).name;\r\n return modeName ? [tonics[i], modeName] : [\"\", \"\"];\r\n })\r\n .filter((x) => x[0]);\r\n}\r\nvar index = {\r\n get,\r\n names,\r\n extended,\r\n modeNames,\r\n reduced,\r\n scaleChords,\r\n scaleNotes,\r\n tokenize,\r\n // deprecated\r\n scale,\r\n};\n\nexport default index;\nexport { extended, get, modeNames, names, reduced, scale, scaleChords, scaleNotes, tokenize };\n//# sourceMappingURL=index.es.js.map\n","// CONSTANTS\r\nconst NONE = {\r\n empty: true,\r\n name: \"\",\r\n upper: undefined,\r\n lower: undefined,\r\n type: undefined,\r\n additive: [],\r\n};\r\nconst NAMES = [\"4/4\", \"3/4\", \"2/4\", \"2/2\", \"12/8\", \"9/8\", \"6/8\", \"3/8\"];\r\n// PUBLIC API\r\nfunction names() {\r\n return NAMES.slice();\r\n}\r\nconst REGEX = /^(\\d?\\d(?:\\+\\d)*)\\/(\\d)$/;\r\nconst CACHE = new Map();\r\nfunction get(literal) {\r\n const cached = CACHE.get(literal);\r\n if (cached) {\r\n return cached;\r\n }\r\n const ts = build(parse(literal));\r\n CACHE.set(literal, ts);\r\n return ts;\r\n}\r\nfunction parse(literal) {\r\n if (typeof literal === \"string\") {\r\n const [_, up, low] = REGEX.exec(literal) || [];\r\n return parse([up, low]);\r\n }\r\n const [up, down] = literal;\r\n const denominator = +down;\r\n if (typeof up === \"number\") {\r\n return [up, denominator];\r\n }\r\n const list = up.split(\"+\").map((n) => +n);\r\n return list.length === 1 ? [list[0], denominator] : [list, denominator];\r\n}\r\nvar index = { names, parse, get };\r\n// PRIVATE\r\nfunction build([up, down]) {\r\n const upper = Array.isArray(up) ? up.reduce((a, b) => a + b, 0) : up;\r\n const lower = down;\r\n if (upper === 0 || lower === 0) {\r\n return NONE;\r\n }\r\n const name = Array.isArray(up) ? `${up.join(\"+\")}/${down}` : `${up}/${down}`;\r\n const additive = Array.isArray(up) ? up : [];\r\n const type = lower === 4 || lower === 2\r\n ? \"simple\"\r\n : lower === 8 && upper % 3 === 0\r\n ? \"compound\"\r\n : \"irregular\";\r\n return {\r\n empty: false,\r\n name,\r\n type,\r\n upper,\r\n lower,\r\n additive,\r\n };\r\n}\n\nexport default index;\nexport { get, names, parse };\n//# sourceMappingURL=index.es.js.map\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tonaljs/abc-notation'), require('@tonaljs/array'), require('@tonaljs/chord'), require('@tonaljs/chord-type'), require('@tonaljs/collection'), require('@tonaljs/core'), require('@tonaljs/duration-value'), require('@tonaljs/interval'), require('@tonaljs/key'), require('@tonaljs/midi'), require('@tonaljs/mode'), require('@tonaljs/note'), require('@tonaljs/pcset'), require('@tonaljs/progression'), require('@tonaljs/range'), require('@tonaljs/roman-numeral'), require('@tonaljs/scale'), require('@tonaljs/scale-type'), require('@tonaljs/time-signature')) :\n typeof define === 'function' && define.amd ? define(['exports', '@tonaljs/abc-notation', '@tonaljs/array', '@tonaljs/chord', '@tonaljs/chord-type', '@tonaljs/collection', '@tonaljs/core', '@tonaljs/duration-value', '@tonaljs/interval', '@tonaljs/key', '@tonaljs/midi', '@tonaljs/mode', '@tonaljs/note', '@tonaljs/pcset', '@tonaljs/progression', '@tonaljs/range', '@tonaljs/roman-numeral', '@tonaljs/scale', '@tonaljs/scale-type', '@tonaljs/time-signature'], factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Tonal = {}, global.abcNotation, global.array, global.chord, global.ChordType, global.collection, global.Core, global.durationValue, global.interval, global.key, global.midi, global.mode, global.note, global.Pcset, global.progression, global.range, global.romanNumeral, global.scale, global.ScaleType, global.timeSignature));\n}(this, (function (exports, abcNotation, array, chord, ChordType, collection, Core, durationValue, interval, key, midi, mode, note, Pcset, progression, range, romanNumeral, scale, ScaleType, timeSignature) { 'use strict';\n\n function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\n\n function _interopNamespace(e) {\n if (e && e.__esModule) { return e; } else {\n var n = Object.create(null);\n if (e) {\n Object.keys(e).forEach(function (k) {\n if (k !== 'default') {\n var d = Object.getOwnPropertyDescriptor(e, k);\n Object.defineProperty(n, k, d.get ? d : {\n enumerable: true,\n get: function () {\n return e[k];\n }\n });\n }\n });\n }\n n['default'] = e;\n return Object.freeze(n);\n }\n }\n\n var abcNotation__default = /*#__PURE__*/_interopDefaultLegacy(abcNotation);\n var array__namespace = /*#__PURE__*/_interopNamespace(array);\n var chord__default = /*#__PURE__*/_interopDefaultLegacy(chord);\n var ChordType__default = /*#__PURE__*/_interopDefaultLegacy(ChordType);\n var collection__default = /*#__PURE__*/_interopDefaultLegacy(collection);\n var Core__namespace = /*#__PURE__*/_interopNamespace(Core);\n var durationValue__default = /*#__PURE__*/_interopDefaultLegacy(durationValue);\n var interval__default = /*#__PURE__*/_interopDefaultLegacy(interval);\n var key__default = /*#__PURE__*/_interopDefaultLegacy(key);\n var midi__default = /*#__PURE__*/_interopDefaultLegacy(midi);\n var mode__default = /*#__PURE__*/_interopDefaultLegacy(mode);\n var note__default = /*#__PURE__*/_interopDefaultLegacy(note);\n var Pcset__default = /*#__PURE__*/_interopDefaultLegacy(Pcset);\n var progression__default = /*#__PURE__*/_interopDefaultLegacy(progression);\n var range__default = /*#__PURE__*/_interopDefaultLegacy(range);\n var romanNumeral__default = /*#__PURE__*/_interopDefaultLegacy(romanNumeral);\n var scale__default = /*#__PURE__*/_interopDefaultLegacy(scale);\n var ScaleType__default = /*#__PURE__*/_interopDefaultLegacy(ScaleType);\n var timeSignature__default = /*#__PURE__*/_interopDefaultLegacy(timeSignature);\n\n // deprecated (backwards compatibility)\r\n var Tonal = Core__namespace;\r\n var PcSet = Pcset__default['default'];\r\n var ChordDictionary = ChordType__default['default'];\r\n var ScaleDictionary = ScaleType__default['default'];\n\n Object.keys(Core).forEach(function (k) {\n if (k !== 'default') Object.defineProperty(exports, k, {\n enumerable: true,\n get: function () {\n return Core[k];\n }\n });\n });\n Object.defineProperty(exports, 'AbcNotation', {\n enumerable: true,\n get: function () {\n return abcNotation__default['default'];\n }\n });\n exports.Array = array__namespace;\n Object.defineProperty(exports, 'Chord', {\n enumerable: true,\n get: function () {\n return chord__default['default'];\n }\n });\n Object.defineProperty(exports, 'ChordType', {\n enumerable: true,\n get: function () {\n return ChordType__default['default'];\n }\n });\n Object.defineProperty(exports, 'Collection', {\n enumerable: true,\n get: function () {\n return collection__default['default'];\n }\n });\n exports.Core = Core__namespace;\n Object.defineProperty(exports, 'DurationValue', {\n enumerable: true,\n get: function () {\n return durationValue__default['default'];\n }\n });\n Object.defineProperty(exports, 'Interval', {\n enumerable: true,\n get: function () {\n return interval__default['default'];\n }\n });\n Object.defineProperty(exports, 'Key', {\n enumerable: true,\n get: function () {\n return key__default['default'];\n }\n });\n Object.defineProperty(exports, 'Midi', {\n enumerable: true,\n get: function () {\n return midi__default['default'];\n }\n });\n Object.defineProperty(exports, 'Mode', {\n enumerable: true,\n get: function () {\n return mode__default['default'];\n }\n });\n Object.defineProperty(exports, 'Note', {\n enumerable: true,\n get: function () {\n return note__default['default'];\n }\n });\n Object.defineProperty(exports, 'Pcset', {\n enumerable: true,\n get: function () {\n return Pcset__default['default'];\n }\n });\n Object.defineProperty(exports, 'Progression', {\n enumerable: true,\n get: function () {\n return progression__default['default'];\n }\n });\n Object.defineProperty(exports, 'Range', {\n enumerable: true,\n get: function () {\n return range__default['default'];\n }\n });\n Object.defineProperty(exports, 'RomanNumeral', {\n enumerable: true,\n get: function () {\n return romanNumeral__default['default'];\n }\n });\n Object.defineProperty(exports, 'Scale', {\n enumerable: true,\n get: function () {\n return scale__default['default'];\n }\n });\n Object.defineProperty(exports, 'ScaleType', {\n enumerable: true,\n get: function () {\n return ScaleType__default['default'];\n }\n });\n Object.defineProperty(exports, 'TimeSignature', {\n enumerable: true,\n get: function () {\n return timeSignature__default['default'];\n }\n });\n exports.ChordDictionary = ChordDictionary;\n exports.PcSet = PcSet;\n exports.ScaleDictionary = ScaleDictionary;\n exports.Tonal = Tonal;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n//# sourceMappingURL=index.js.map\n"],"names":["fillStr","s","n","Array","Math","abs","join","deprecate","original","alternative","fn","args","console","warn","apply","this","isNamed","src","name","isPitch","pitch","step","alt","FIFTHS","STEPS_TO_OCTS","map","fifths","floor","encode","oct","dir","f","undefined","FIFTHS_TO_STEPS","decode","coord","o","i","unaltered","NoNote","empty","pc","acc","cache","Map","stepToLetter","charAt","altToAcc","accToAlt","length","note","cached","get","value","noteName","tokens","tokenizeNote","letter","octStr","charCodeAt","chroma","SEMI","height","m","midi","freq","pow","parse","props","pitchName","set","REGEX","str","exec","toUpperCase","replace","coordToNote","noteCoord","NoInterval","REGEX$1","RegExp","tokenizeInterval","cache$1","interval","num","q","t","TYPES","type","simple","test","qToAlt","semitones","SIZES","parse$1","altToQ","pitchName$1","coordToInterval","transpose","intervalName","note$1","interval$1","intervalCoord","distance","fromNote","toNote","from","to","fcoord","tcoord","character","times","tokenize","abcToScientificNotation","a","scientificToAbcNotation","toLowerCase","index","transpose$1","distance$1","sortedNoteNames","notes","filter","sort","b","arr","permutations","slice","reduce","perm","concat","e","pos","newPerm","splice","ascR","descR","len","rnd","random","range","rotate","compact","EmptyPcset","setNum","normalized","intervals","setNumToChroma","Number","toString","chromaToNumber","parseInt","isChroma","[object Object]","isArray","binary","listToChroma","isPcset","normalizedNum","split","_","chromaRotations","chromaToIntervals","chromaToPcset","pcset","IVLS","push","modes","normalize","r","isSubsetOf","isSupersetOf","isNoteIncludedIn","chromas","isEqual","s1","s2","isIncluded","NoChordType","quality","aliases","dictionary","chordType","all","entries","add","fullName","has","indexOf","getQuality","chord","get$1","forEach","alias","addAlias","ivls","names","index$1","x","symbols","removeAll","keys","Object","NoScaleType","scale","scaleType","NoChord","symbol","root","rootDegree","tonic","NaN","NUM_TYPES","getChord","typeName","optionalTonic","optionalRoot","rootInterval","newNum","shift","detect","source","weight","tonicChroma","pcToName","record","namedSet","allModes","found","mode","chordName","baseNote","findExactMatches","chordScales","isChordIncluded","extended","isSuperset","all$1","reduced","isSubset","VALUES","denominator","shorthand","dots","fraction","NoDuration","base","find","dur","includes","numerator","calcDots","duration","shorthands","IN","IQ","combinator","substract","fromSemitones","d","c","invert","simplify","addTo","other","coordA","coordB","isMidi","arg","toMidi","L2","log","L440","freqToMidi","v","round","SHARPS","FLATS","midiToNoteName","options","isNaN","Infinity","sharps","pitchClass","midiToFreq","tuning","NAMES","toName","onlyNotes","array","tr","transposeBy","trBy","transposeFrom","trFrom","transposeFifths","nFifths","nOcts","trFifths","ascending","sortedNames","comparator","sortedUniqNames","nameBuilder","enharmonic","sameAccidentals","accidentals","octave","descending","fromMidi","fromMidiSharps","fromFreq","fromFreqSharps","NoRomanNumeral","roman","upperRoman","major","romanNumeral","ROMANS","NAMES_MINOR","Empty","freeze","NoKey","alteration","keySignature","NoKeyScale","grades","chords","chordsHarmonicFunction","NoMajorKey","minorRelative","secondaryDominants","secondaryDominantsMinorRelative","substituteDominants","substituteDominantsMinorRelative","NoMinorKey","relativeMajor","natural","harmonic","melodic","mapScaleToType","list","sep","keyScale","harmonicFunctions","gr","distInFifths","MajorScale","NaturalScale","HarmonicScale","MelodicScale","majorKey","romanInTonic","majorTonicFromKeySignature","sig","minorKey","tnc","NoMode","modeNum","triad","seventh","fromRomanNumerals","rn","toRomanNumerals","numeric","result","last","chromatic","NoScale","substring","st","names$1","modeNames","tonics","modeName","scaleChords","inScale","scaleNotes","NONE","upper","lower","additive","CACHE","literal","up","low","down","ts","build","exports","abcNotation","ChordType","collection","Core","durationValue","key","Pcset","progression","ScaleType","timeSignature","_interopDefaultLegacy","default","_interopNamespace","__esModule","create","k","getOwnPropertyDescriptor","defineProperty","enumerable","abcNotation__default","array__namespace","chord__default","ChordType__default","collection__default","Core__namespace","durationValue__default","interval__default","key__default","midi__default","mode__default","note__default","Pcset__default","progression__default","range__default","romanNumeral__default","scale__default","ScaleType__default","timeSignature__default","Tonal","PcSet","ChordDictionary","ScaleDictionary","factory","require$$0","require$$1","require$$2","require$$3","require$$4","require$$5","require$$6","require$$7","require$$8","require$$9","require$$10","require$$11","require$$12","require$$13","require$$14","require$$15","require$$16","require$$17","require$$18"],"mappings":"+KAMA,MAAMA,EAAU,CAACC,EAAGC,IAAMC,MAAMC,KAAKC,IAAIH,GAAK,GAAGI,KAAKL,GACtD,SAASM,EAAUC,EAAUC,EAAaC,GACtC,OAAO,YAAaC,GAGhB,OADAC,QAAQC,KAAK,GAAGL,wBAA+BC,MACxCC,EAAGI,MAAMC,KAAMJ,IAI9B,SAASK,EAAQC,GACb,OAAe,OAARA,GAA+B,iBAARA,GAAwC,iBAAbA,EAAIC,KAKjE,SAASC,EAAQC,GACb,OAAiB,OAAVA,GACc,iBAAVA,GACe,iBAAfA,EAAMC,MACQ,iBAAdD,EAAME,IAKrB,MAAMC,EAAS,CAAC,EAAG,EAAG,GAAI,EAAG,EAAG,EAAG,GAE7BC,EAAgBD,EAAOE,IAAKC,GAAWtB,KAAKuB,MAAgB,EAATD,EAAc,KACvE,SAASE,EAAOR,GACZ,MAAMC,KAAEA,EAAIC,IAAEA,EAAGO,IAAEA,EAAGC,IAAEA,EAAM,GAAMV,EAC9BW,EAAIR,EAAOF,GAAQ,EAAIC,EAC7B,QAAYU,IAARH,EACA,MAAO,CAACC,EAAMC,GAGlB,MAAO,CAACD,EAAMC,EAAGD,GADPD,EAAML,EAAcH,GAAQ,EAAIC,IAO9C,MAAMW,EAAk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A4B,WAGvChO,OAAO6M,eAAelB,EAAS,gBAAiB,CAC9CmB,YAAY,EACZpW,IAAK,WACH,OAAOuX,EAAgC,WAG3CtC,EAAQyC,gBAAkBA,EAC1BzC,EAAQwC,MAAQA,EAChBxC,EAAQ0C,gBAAkBA,EAC1B1C,EAAQuC,MAAQA,EAEhBlO,OAAO6M,eAAelB,EAAS,aAAc,CAAEhV,OAAO,IA3KS2X,CAAQ3C,EAAS4C,EAAkCC,EAA2BC,GAA2BC,GAAgCC,EAAgCC,EAA0BC,GAAoCC,GAA8BC,GAAyBC,GAA0BC,GAA0BC,GAA0BC,GAA2BC,GAAiCC,GAA2BC,GAAmCC,GAA2BC,GAAgCC"} \ No newline at end of file +{"version":3,"file":"tonal.min.js","sources":["../../core/dist/index.es.js","../../abc-notation/dist/index.es.js","../../array/dist/index.es.js","../../collection/dist/index.es.js","../../pcset/dist/index.es.js","../../chord-type/dist/index.es.js","../../midi/dist/index.es.js","../../note/dist/index.es.js","../../interval/dist/index.es.js","../../scale-type/dist/index.es.js","../../chord/dist/index.es.js","../../chord-detect/dist/index.es.js","../../duration-value/dist/index.es.js","../../roman-numeral/dist/index.es.js","../../key/dist/index.es.js","../../mode/dist/index.es.js","../../progression/dist/index.es.js","../../range/dist/index.es.js","../../scale/dist/index.es.js","../../time-signature/dist/index.es.js","../dist/index.js"],"sourcesContent":["/**\r\n * Fill a string with a repeated character\r\n *\r\n * @param character\r\n * @param repetition\r\n */\r\nconst fillStr = (s, n) => Array(Math.abs(n) + 1).join(s);\r\nfunction deprecate(original, alternative, fn) {\r\n return function (...args) {\r\n // tslint:disable-next-line\r\n console.warn(`${original} is deprecated. Use ${alternative}.`);\r\n return fn.apply(this, args);\r\n };\r\n}\n\nfunction isNamed(src) {\r\n return src !== null && typeof src === \"object\" && typeof src.name === \"string\"\r\n ? true\r\n : false;\r\n}\n\nfunction isPitch(pitch) {\r\n return pitch !== null &&\r\n typeof pitch === \"object\" &&\r\n typeof pitch.step === \"number\" &&\r\n typeof pitch.alt === \"number\"\r\n ? true\r\n : false;\r\n}\r\n// The number of fifths of [C, D, E, F, G, A, B]\r\nconst FIFTHS = [0, 2, 4, -1, 1, 3, 5];\r\n// The number of octaves it span each step\r\nconst STEPS_TO_OCTS = FIFTHS.map((fifths) => Math.floor((fifths * 7) / 12));\r\nfunction encode(pitch) {\r\n const { step, alt, oct, dir = 1 } = pitch;\r\n const f = FIFTHS[step] + 7 * alt;\r\n if (oct === undefined) {\r\n return [dir * f];\r\n }\r\n const o = oct - STEPS_TO_OCTS[step] - 4 * alt;\r\n return [dir * f, dir * o];\r\n}\r\n// We need to get the steps from fifths\r\n// Fifths for CDEFGAB are [ 0, 2, 4, -1, 1, 3, 5 ]\r\n// We add 1 to fifths to avoid negative numbers, so:\r\n// for [\"F\", \"C\", \"G\", \"D\", \"A\", \"E\", \"B\"] we have:\r\nconst FIFTHS_TO_STEPS = [3, 0, 4, 1, 5, 2, 6];\r\nfunction decode(coord) {\r\n const [f, o, dir] = coord;\r\n const step = FIFTHS_TO_STEPS[unaltered(f)];\r\n const alt = Math.floor((f + 1) / 7);\r\n if (o === undefined) {\r\n return { step, alt, dir };\r\n }\r\n const oct = o + 4 * alt + STEPS_TO_OCTS[step];\r\n return { step, alt, oct, dir };\r\n}\r\n// Return the number of fifths as if it were unaltered\r\nfunction unaltered(f) {\r\n const i = (f + 1) % 7;\r\n return i < 0 ? 7 + i : i;\r\n}\n\nconst NoNote = { empty: true, name: \"\", pc: \"\", acc: \"\" };\r\nconst cache = new Map();\r\nconst stepToLetter = (step) => \"CDEFGAB\".charAt(step);\r\nconst altToAcc = (alt) => alt < 0 ? fillStr(\"b\", -alt) : fillStr(\"#\", alt);\r\nconst accToAlt = (acc) => acc[0] === \"b\" ? -acc.length : acc.length;\r\n/**\r\n * Given a note literal (a note name or a note object), returns the Note object\r\n * @example\r\n * note('Bb4') // => { name: \"Bb4\", midi: 70, chroma: 10, ... }\r\n */\r\nfunction note(src) {\r\n const cached = cache.get(src);\r\n if (cached) {\r\n return cached;\r\n }\r\n const value = typeof src === \"string\"\r\n ? parse(src)\r\n : isPitch(src)\r\n ? note(pitchName(src))\r\n : isNamed(src)\r\n ? note(src.name)\r\n : NoNote;\r\n cache.set(src, value);\r\n return value;\r\n}\r\nconst REGEX = /^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\\d*)\\s*(.*)$/;\r\n/**\r\n * @private\r\n */\r\nfunction tokenizeNote(str) {\r\n const m = REGEX.exec(str);\r\n return [m[1].toUpperCase(), m[2].replace(/x/g, \"##\"), m[3], m[4]];\r\n}\r\n/**\r\n * @private\r\n */\r\nfunction coordToNote(noteCoord) {\r\n return note(decode(noteCoord));\r\n}\r\nconst mod = (n, m) => ((n % m) + m) % m;\r\nconst SEMI = [0, 2, 4, 5, 7, 9, 11];\r\nfunction parse(noteName) {\r\n const tokens = tokenizeNote(noteName);\r\n if (tokens[0] === \"\" || tokens[3] !== \"\") {\r\n return NoNote;\r\n }\r\n const letter = tokens[0];\r\n const acc = tokens[1];\r\n const octStr = tokens[2];\r\n const step = (letter.charCodeAt(0) + 3) % 7;\r\n const alt = accToAlt(acc);\r\n const oct = octStr.length ? +octStr : undefined;\r\n const coord = encode({ step, alt, oct });\r\n const name = letter + acc + octStr;\r\n const pc = letter + acc;\r\n const chroma = (SEMI[step] + alt + 120) % 12;\r\n const height = oct === undefined\r\n ? mod(SEMI[step] + alt, 12) - 12 * 99\r\n : SEMI[step] + alt + 12 * (oct + 1);\r\n const midi = height >= 0 && height <= 127 ? height : null;\r\n const freq = oct === undefined ? null : Math.pow(2, (height - 69) / 12) * 440;\r\n return {\r\n empty: false,\r\n acc,\r\n alt,\r\n chroma,\r\n coord,\r\n freq,\r\n height,\r\n letter,\r\n midi,\r\n name,\r\n oct,\r\n pc,\r\n step,\r\n };\r\n}\r\nfunction pitchName(props) {\r\n const { step, alt, oct } = props;\r\n const letter = stepToLetter(step);\r\n if (!letter) {\r\n return \"\";\r\n }\r\n const pc = letter + altToAcc(alt);\r\n return oct || oct === 0 ? pc + oct : pc;\r\n}\n\nconst NoInterval = { empty: true, name: \"\", acc: \"\" };\r\n// shorthand tonal notation (with quality after number)\r\nconst INTERVAL_TONAL_REGEX = \"([-+]?\\\\d+)(d{1,4}|m|M|P|A{1,4})\";\r\n// standard shorthand notation (with quality before number)\r\nconst INTERVAL_SHORTHAND_REGEX = \"(AA|A|P|M|m|d|dd)([-+]?\\\\d+)\";\r\nconst REGEX$1 = new RegExp(\"^\" + INTERVAL_TONAL_REGEX + \"|\" + INTERVAL_SHORTHAND_REGEX + \"$\");\r\n/**\r\n * @private\r\n */\r\nfunction tokenizeInterval(str) {\r\n const m = REGEX$1.exec(`${str}`);\r\n if (m === null) {\r\n return [\"\", \"\"];\r\n }\r\n return m[1] ? [m[1], m[2]] : [m[4], m[3]];\r\n}\r\nconst cache$1 = {};\r\n/**\r\n * Get interval properties. It returns an object with:\r\n *\r\n * - name: the interval name\r\n * - num: the interval number\r\n * - type: 'perfectable' or 'majorable'\r\n * - q: the interval quality (d, m, M, A)\r\n * - dir: interval direction (1 ascending, -1 descending)\r\n * - simple: the simplified number\r\n * - semitones: the size in semitones\r\n * - chroma: the interval chroma\r\n *\r\n * @param {string} interval - the interval name\r\n * @return {Object} the interval properties\r\n *\r\n * @example\r\n * import { interval } from '@tonaljs/core'\r\n * interval('P5').semitones // => 7\r\n * interval('m3').type // => 'majorable'\r\n */\r\nfunction interval(src) {\r\n return typeof src === \"string\"\r\n ? cache$1[src] || (cache$1[src] = parse$1(src))\r\n : isPitch(src)\r\n ? interval(pitchName$1(src))\r\n : isNamed(src)\r\n ? interval(src.name)\r\n : NoInterval;\r\n}\r\nconst SIZES = [0, 2, 4, 5, 7, 9, 11];\r\nconst TYPES = \"PMMPPMM\";\r\nfunction parse$1(str) {\r\n const tokens = tokenizeInterval(str);\r\n if (tokens[0] === \"\") {\r\n return NoInterval;\r\n }\r\n const num = +tokens[0];\r\n const q = tokens[1];\r\n const step = (Math.abs(num) - 1) % 7;\r\n const t = TYPES[step];\r\n if (t === \"M\" && q === \"P\") {\r\n return NoInterval;\r\n }\r\n const type = t === \"M\" ? \"majorable\" : \"perfectable\";\r\n const name = \"\" + num + q;\r\n const dir = num < 0 ? -1 : 1;\r\n const simple = num === 8 || num === -8 ? num : dir * (step + 1);\r\n const alt = qToAlt(type, q);\r\n const oct = Math.floor((Math.abs(num) - 1) / 7);\r\n const semitones = dir * (SIZES[step] + alt + 12 * oct);\r\n const chroma = (((dir * (SIZES[step] + alt)) % 12) + 12) % 12;\r\n const coord = encode({ step, alt, oct, dir });\r\n return {\r\n empty: false,\r\n name,\r\n num,\r\n q,\r\n step,\r\n alt,\r\n dir,\r\n type,\r\n simple,\r\n semitones,\r\n chroma,\r\n coord,\r\n oct,\r\n };\r\n}\r\n/**\r\n * @private\r\n */\r\nfunction coordToInterval(coord) {\r\n const [f, o = 0] = coord;\r\n const isDescending = f * 7 + o * 12 < 0;\r\n const ivl = isDescending ? [-f, -o, -1] : [f, o, 1];\r\n return interval(decode(ivl));\r\n}\r\nfunction qToAlt(type, q) {\r\n return (q === \"M\" && type === \"majorable\") ||\r\n (q === \"P\" && type === \"perfectable\")\r\n ? 0\r\n : q === \"m\" && type === \"majorable\"\r\n ? -1\r\n : /^A+$/.test(q)\r\n ? q.length\r\n : /^d+$/.test(q)\r\n ? -1 * (type === \"perfectable\" ? q.length : q.length + 1)\r\n : 0;\r\n}\r\n// return the interval name of a pitch\r\nfunction pitchName$1(props) {\r\n const { step, alt, oct = 0, dir } = props;\r\n if (!dir) {\r\n return \"\";\r\n }\r\n const num = step + 1 + 7 * oct;\r\n const d = dir < 0 ? \"-\" : \"\";\r\n const type = TYPES[step] === \"M\" ? \"majorable\" : \"perfectable\";\r\n const name = d + num + altToQ(type, alt);\r\n return name;\r\n}\r\nfunction altToQ(type, alt) {\r\n if (alt === 0) {\r\n return type === \"majorable\" ? \"M\" : \"P\";\r\n }\r\n else if (alt === -1 && type === \"majorable\") {\r\n return \"m\";\r\n }\r\n else if (alt > 0) {\r\n return fillStr(\"A\", alt);\r\n }\r\n else {\r\n return fillStr(\"d\", type === \"perfectable\" ? alt : alt + 1);\r\n }\r\n}\n\n/**\r\n * Transpose a note by an interval.\r\n *\r\n * @param {string} note - the note or note name\r\n * @param {string} interval - the interval or interval name\r\n * @return {string} the transposed note name or empty string if not valid notes\r\n * @example\r\n * import { tranpose } from \"@tonaljs/core\"\r\n * transpose(\"d3\", \"3M\") // => \"F#3\"\r\n * transpose(\"D\", \"3M\") // => \"F#\"\r\n * [\"C\", \"D\", \"E\", \"F\", \"G\"].map(pc => transpose(pc, \"M3)) // => [\"E\", \"F#\", \"G#\", \"A\", \"B\"]\r\n */\r\nfunction transpose(noteName, intervalName) {\r\n const note$1 = note(noteName);\r\n const interval$1 = interval(intervalName);\r\n if (note$1.empty || interval$1.empty) {\r\n return \"\";\r\n }\r\n const noteCoord = note$1.coord;\r\n const intervalCoord = interval$1.coord;\r\n const tr = noteCoord.length === 1\r\n ? [noteCoord[0] + intervalCoord[0]]\r\n : [noteCoord[0] + intervalCoord[0], noteCoord[1] + intervalCoord[1]];\r\n return coordToNote(tr).name;\r\n}\r\n/**\r\n * Find the interval distance between two notes or coord classes.\r\n *\r\n * To find distance between coord classes, both notes must be coord classes and\r\n * the interval is always ascending\r\n *\r\n * @param {Note|string} from - the note or note name to calculate distance from\r\n * @param {Note|string} to - the note or note name to calculate distance to\r\n * @return {string} the interval name or empty string if not valid notes\r\n *\r\n */\r\nfunction distance(fromNote, toNote) {\r\n const from = note(fromNote);\r\n const to = note(toNote);\r\n if (from.empty || to.empty) {\r\n return \"\";\r\n }\r\n const fcoord = from.coord;\r\n const tcoord = to.coord;\r\n const fifths = tcoord[0] - fcoord[0];\r\n const octs = fcoord.length === 2 && tcoord.length === 2\r\n ? tcoord[1] - fcoord[1]\r\n : -Math.floor((fifths * 7) / 12);\r\n return coordToInterval([fifths, octs]).name;\r\n}\n\nexport { accToAlt, altToAcc, coordToInterval, coordToNote, decode, deprecate, distance, encode, fillStr, interval, isNamed, isPitch, note, stepToLetter, tokenizeInterval, tokenizeNote, transpose };\n//# sourceMappingURL=index.es.js.map\n","import { note, transpose as transpose$1, distance as distance$1 } from '@tonaljs/core';\n\nconst fillStr = (character, times) => Array(times + 1).join(character);\r\nconst REGEX = /^(_{1,}|=|\\^{1,}|)([abcdefgABCDEFG])([,']*)$/;\r\nfunction tokenize(str) {\r\n const m = REGEX.exec(str);\r\n if (!m) {\r\n return [\"\", \"\", \"\"];\r\n }\r\n return [m[1], m[2], m[3]];\r\n}\r\n/**\r\n * Convert a (string) note in ABC notation into a (string) note in scientific notation\r\n *\r\n * @example\r\n * abcToScientificNotation(\"c\") // => \"C5\"\r\n */\r\nfunction abcToScientificNotation(str) {\r\n const [acc, letter, oct] = tokenize(str);\r\n if (letter === \"\") {\r\n return \"\";\r\n }\r\n let o = 4;\r\n for (let i = 0; i < oct.length; i++) {\r\n o += oct.charAt(i) === \",\" ? -1 : 1;\r\n }\r\n const a = acc[0] === \"_\"\r\n ? acc.replace(/_/g, \"b\")\r\n : acc[0] === \"^\"\r\n ? acc.replace(/\\^/g, \"#\")\r\n : \"\";\r\n return letter.charCodeAt(0) > 96\r\n ? letter.toUpperCase() + a + (o + 1)\r\n : letter + a + o;\r\n}\r\n/**\r\n * Convert a (string) note in scientific notation into a (string) note in ABC notation\r\n *\r\n * @example\r\n * scientificToAbcNotation(\"C#4\") // => \"^C\"\r\n */\r\nfunction scientificToAbcNotation(str) {\r\n const n = note(str);\r\n if (n.empty || !n.oct) {\r\n return \"\";\r\n }\r\n const { letter, acc, oct } = n;\r\n const a = acc[0] === \"b\" ? acc.replace(/b/g, \"_\") : acc.replace(/#/g, \"^\");\r\n const l = oct > 4 ? letter.toLowerCase() : letter;\r\n const o = oct === 5 ? \"\" : oct > 4 ? fillStr(\"'\", oct - 5) : fillStr(\",\", 4 - oct);\r\n return a + l + o;\r\n}\r\nfunction transpose(note, interval) {\r\n return scientificToAbcNotation(transpose$1(abcToScientificNotation(note), interval));\r\n}\r\nfunction distance(from, to) {\r\n return distance$1(abcToScientificNotation(from), abcToScientificNotation(to));\r\n}\r\nvar index = {\r\n abcToScientificNotation,\r\n scientificToAbcNotation,\r\n tokenize,\r\n transpose,\r\n distance,\r\n};\n\nexport default index;\nexport { abcToScientificNotation, distance, scientificToAbcNotation, tokenize, transpose };\n//# sourceMappingURL=index.es.js.map\n","import { note } from '@tonaljs/core';\n\n// ascending range\r\nfunction ascR(b, n) {\r\n const a = [];\r\n // tslint:disable-next-line:curly\r\n for (; n--; a[n] = n + b)\r\n ;\r\n return a;\r\n}\r\n// descending range\r\nfunction descR(b, n) {\r\n const a = [];\r\n // tslint:disable-next-line:curly\r\n for (; n--; a[n] = b - n)\r\n ;\r\n return a;\r\n}\r\n/**\r\n * Creates a numeric range\r\n *\r\n * @param {number} from\r\n * @param {number} to\r\n * @return {Array}\r\n *\r\n * @example\r\n * range(-2, 2) // => [-2, -1, 0, 1, 2]\r\n * range(2, -2) // => [2, 1, 0, -1, -2]\r\n */\r\nfunction range(from, to) {\r\n return from < to ? ascR(from, to - from + 1) : descR(from, from - to + 1);\r\n}\r\n/**\r\n * Rotates a list a number of times. It\"s completly agnostic about the\r\n * contents of the list.\r\n *\r\n * @param {Integer} times - the number of rotations\r\n * @param {Array} array\r\n * @return {Array} the rotated array\r\n *\r\n * @example\r\n * rotate(1, [1, 2, 3]) // => [2, 3, 1]\r\n */\r\nfunction rotate(times, arr) {\r\n const len = arr.length;\r\n const n = ((times % len) + len) % len;\r\n return arr.slice(n, len).concat(arr.slice(0, n));\r\n}\r\n/**\r\n * Return a copy of the array with the null values removed\r\n * @function\r\n * @param {Array} array\r\n * @return {Array}\r\n *\r\n * @example\r\n * compact([\"a\", \"b\", null, \"c\"]) // => [\"a\", \"b\", \"c\"]\r\n */\r\nfunction compact(arr) {\r\n return arr.filter((n) => n === 0 || n);\r\n}\r\n/**\r\n * Sort an array of notes in ascending order. Pitch classes are listed\r\n * before notes. Any string that is not a note is removed.\r\n *\r\n * @param {string[]} notes\r\n * @return {string[]} sorted array of notes\r\n *\r\n * @example\r\n * sortedNoteNames(['c2', 'c5', 'c1', 'c0', 'c6', 'c'])\r\n * // => ['C', 'C0', 'C1', 'C2', 'C5', 'C6']\r\n * sortedNoteNames(['c', 'F', 'G', 'a', 'b', 'h', 'J'])\r\n * // => ['C', 'F', 'G', 'A', 'B']\r\n */\r\nfunction sortedNoteNames(notes) {\r\n const valid = notes.map((n) => note(n)).filter((n) => !n.empty);\r\n return valid.sort((a, b) => a.height - b.height).map((n) => n.name);\r\n}\r\n/**\r\n * Get sorted notes with duplicates removed. Pitch classes are listed\r\n * before notes.\r\n *\r\n * @function\r\n * @param {string[]} array\r\n * @return {string[]} unique sorted notes\r\n *\r\n * @example\r\n * Array.sortedUniqNoteNames(['a', 'b', 'c2', '1p', 'p2', 'c2', 'b', 'c', 'c3' ])\r\n * // => [ 'C', 'A', 'B', 'C2', 'C3' ]\r\n */\r\nfunction sortedUniqNoteNames(arr) {\r\n return sortedNoteNames(arr).filter((n, i, a) => i === 0 || n !== a[i - 1]);\r\n}\r\n/**\r\n * Randomizes the order of the specified array in-place, using the Fisher–Yates shuffle.\r\n *\r\n * @function\r\n * @param {Array} array\r\n * @return {Array} the array shuffled\r\n *\r\n * @example\r\n * shuffle([\"C\", \"D\", \"E\", \"F\"]) // => [...]\r\n */\r\nfunction shuffle(arr, rnd = Math.random) {\r\n let i;\r\n let t;\r\n let m = arr.length;\r\n while (m) {\r\n i = Math.floor(rnd() * m--);\r\n t = arr[m];\r\n arr[m] = arr[i];\r\n arr[i] = t;\r\n }\r\n return arr;\r\n}\r\n/**\r\n * Get all permutations of an array\r\n *\r\n * @param {Array} array - the array\r\n * @return {Array} an array with all the permutations\r\n * @example\r\n * permutations([\"a\", \"b\", \"c\"])) // =>\r\n * [\r\n * [\"a\", \"b\", \"c\"],\r\n * [\"b\", \"a\", \"c\"],\r\n * [\"b\", \"c\", \"a\"],\r\n * [\"a\", \"c\", \"b\"],\r\n * [\"c\", \"a\", \"b\"],\r\n * [\"c\", \"b\", \"a\"]\r\n * ]\r\n */\r\nfunction permutations(arr) {\r\n if (arr.length === 0) {\r\n return [[]];\r\n }\r\n return permutations(arr.slice(1)).reduce((acc, perm) => {\r\n return acc.concat(arr.map((e, pos) => {\r\n const newPerm = perm.slice();\r\n newPerm.splice(pos, 0, arr[0]);\r\n return newPerm;\r\n }));\r\n }, []);\r\n}\n\nexport { compact, permutations, range, rotate, shuffle, sortedNoteNames, sortedUniqNoteNames };\n//# sourceMappingURL=index.es.js.map\n","// ascending range\r\nfunction ascR(b, n) {\r\n const a = [];\r\n // tslint:disable-next-line:curly\r\n for (; n--; a[n] = n + b)\r\n ;\r\n return a;\r\n}\r\n// descending range\r\nfunction descR(b, n) {\r\n const a = [];\r\n // tslint:disable-next-line:curly\r\n for (; n--; a[n] = b - n)\r\n ;\r\n return a;\r\n}\r\n/**\r\n * Creates a numeric range\r\n *\r\n * @param {number} from\r\n * @param {number} to\r\n * @return {Array}\r\n *\r\n * @example\r\n * range(-2, 2) // => [-2, -1, 0, 1, 2]\r\n * range(2, -2) // => [2, 1, 0, -1, -2]\r\n */\r\nfunction range(from, to) {\r\n return from < to ? ascR(from, to - from + 1) : descR(from, from - to + 1);\r\n}\r\n/**\r\n * Rotates a list a number of times. It\"s completly agnostic about the\r\n * contents of the list.\r\n *\r\n * @param {Integer} times - the number of rotations\r\n * @param {Array} collection\r\n * @return {Array} the rotated collection\r\n *\r\n * @example\r\n * rotate(1, [1, 2, 3]) // => [2, 3, 1]\r\n */\r\nfunction rotate(times, arr) {\r\n const len = arr.length;\r\n const n = ((times % len) + len) % len;\r\n return arr.slice(n, len).concat(arr.slice(0, n));\r\n}\r\n/**\r\n * Return a copy of the collection with the null values removed\r\n * @function\r\n * @param {Array} collection\r\n * @return {Array}\r\n *\r\n * @example\r\n * compact([\"a\", \"b\", null, \"c\"]) // => [\"a\", \"b\", \"c\"]\r\n */\r\nfunction compact(arr) {\r\n return arr.filter((n) => n === 0 || n);\r\n}\r\n/**\r\n * Randomizes the order of the specified collection in-place, using the Fisher–Yates shuffle.\r\n *\r\n * @function\r\n * @param {Array} collection\r\n * @return {Array} the collection shuffled\r\n *\r\n * @example\r\n * shuffle([\"C\", \"D\", \"E\", \"F\"]) // => [...]\r\n */\r\nfunction shuffle(arr, rnd = Math.random) {\r\n let i;\r\n let t;\r\n let m = arr.length;\r\n while (m) {\r\n i = Math.floor(rnd() * m--);\r\n t = arr[m];\r\n arr[m] = arr[i];\r\n arr[i] = t;\r\n }\r\n return arr;\r\n}\r\n/**\r\n * Get all permutations of an collection\r\n *\r\n * @param {Array} collection - the collection\r\n * @return {Array} an collection with all the permutations\r\n * @example\r\n * permutations([\"a\", \"b\", \"c\"])) // =>\r\n * [\r\n * [\"a\", \"b\", \"c\"],\r\n * [\"b\", \"a\", \"c\"],\r\n * [\"b\", \"c\", \"a\"],\r\n * [\"a\", \"c\", \"b\"],\r\n * [\"c\", \"a\", \"b\"],\r\n * [\"c\", \"b\", \"a\"]\r\n * ]\r\n */\r\nfunction permutations(arr) {\r\n if (arr.length === 0) {\r\n return [[]];\r\n }\r\n return permutations(arr.slice(1)).reduce((acc, perm) => {\r\n return acc.concat(arr.map((e, pos) => {\r\n const newPerm = perm.slice();\r\n newPerm.splice(pos, 0, arr[0]);\r\n return newPerm;\r\n }));\r\n }, []);\r\n}\r\nvar index = {\r\n compact,\r\n permutations,\r\n range,\r\n rotate,\r\n shuffle,\r\n};\n\nexport default index;\nexport { compact, permutations, range, rotate, shuffle };\n//# sourceMappingURL=index.es.js.map\n","import { range, compact, rotate } from '@tonaljs/collection';\nimport { deprecate, note, interval } from '@tonaljs/core';\n\nconst EmptyPcset = {\r\n empty: true,\r\n name: \"\",\r\n setNum: 0,\r\n chroma: \"000000000000\",\r\n normalized: \"000000000000\",\r\n intervals: [],\r\n};\r\n// UTILITIES\r\nconst setNumToChroma = (num) => Number(num).toString(2);\r\nconst chromaToNumber = (chroma) => parseInt(chroma, 2);\r\nconst REGEX = /^[01]{12}$/;\r\nfunction isChroma(set) {\r\n return REGEX.test(set);\r\n}\r\nconst isPcsetNum = (set) => typeof set === \"number\" && set >= 0 && set <= 4095;\r\nconst isPcset = (set) => set && isChroma(set.chroma);\r\nconst cache = { [EmptyPcset.chroma]: EmptyPcset };\r\n/**\r\n * Get the pitch class set of a collection of notes or set number or chroma\r\n */\r\nfunction get(src) {\r\n const chroma = isChroma(src)\r\n ? src\r\n : isPcsetNum(src)\r\n ? setNumToChroma(src)\r\n : Array.isArray(src)\r\n ? listToChroma(src)\r\n : isPcset(src)\r\n ? src.chroma\r\n : EmptyPcset.chroma;\r\n return (cache[chroma] = cache[chroma] || chromaToPcset(chroma));\r\n}\r\n/**\r\n * Use Pcset.properties\r\n * @function\r\n * @deprecated\r\n */\r\nconst pcset = deprecate(\"Pcset.pcset\", \"Pcset.get\", get);\r\n/**\r\n * Get pitch class set chroma\r\n * @function\r\n * @example\r\n * Pcset.chroma([\"c\", \"d\", \"e\"]); //=> \"101010000000\"\r\n */\r\nconst chroma = (set) => get(set).chroma;\r\n/**\r\n * Get intervals (from C) of a set\r\n * @function\r\n * @example\r\n * Pcset.intervals([\"c\", \"d\", \"e\"]); //=>\r\n */\r\nconst intervals = (set) => get(set).intervals;\r\n/**\r\n * Get pitch class set number\r\n * @function\r\n * @example\r\n * Pcset.num([\"c\", \"d\", \"e\"]); //=> 2192\r\n */\r\nconst num = (set) => get(set).setNum;\r\nconst IVLS = [\r\n \"1P\",\r\n \"2m\",\r\n \"2M\",\r\n \"3m\",\r\n \"3M\",\r\n \"4P\",\r\n \"5d\",\r\n \"5P\",\r\n \"6m\",\r\n \"6M\",\r\n \"7m\",\r\n \"7M\",\r\n];\r\n/**\r\n * @private\r\n * Get the intervals of a pcset *starting from C*\r\n * @param {Set} set - the pitch class set\r\n * @return {IntervalName[]} an array of interval names or an empty array\r\n * if not a valid pitch class set\r\n */\r\nfunction chromaToIntervals(chroma) {\r\n const intervals = [];\r\n for (let i = 0; i < 12; i++) {\r\n // tslint:disable-next-line:curly\r\n if (chroma.charAt(i) === \"1\")\r\n intervals.push(IVLS[i]);\r\n }\r\n return intervals;\r\n}\r\n/**\r\n * Get a list of all possible pitch class sets (all possible chromas) *having\r\n * C as root*. There are 2048 different chromas. If you want them with another\r\n * note you have to transpose it\r\n *\r\n * @see http://allthescales.org/\r\n * @return {Array} an array of possible chromas from '10000000000' to '11111111111'\r\n */\r\nfunction chromas() {\r\n return range(2048, 4095).map(setNumToChroma);\r\n}\r\n/**\r\n * Given a a list of notes or a pcset chroma, produce the rotations\r\n * of the chroma discarding the ones that starts with \"0\"\r\n *\r\n * This is used, for example, to get all the modes of a scale.\r\n *\r\n * @param {Array|string} set - the list of notes or pitchChr of the set\r\n * @param {boolean} normalize - (Optional, true by default) remove all\r\n * the rotations that starts with \"0\"\r\n * @return {Array} an array with all the modes of the chroma\r\n *\r\n * @example\r\n * Pcset.modes([\"C\", \"D\", \"E\"]).map(Pcset.intervals)\r\n */\r\nfunction modes(set, normalize = true) {\r\n const pcs = get(set);\r\n const binary = pcs.chroma.split(\"\");\r\n return compact(binary.map((_, i) => {\r\n const r = rotate(i, binary);\r\n return normalize && r[0] === \"0\" ? null : r.join(\"\");\r\n }));\r\n}\r\n/**\r\n * Test if two pitch class sets are numentical\r\n *\r\n * @param {Array|string} set1 - one of the pitch class sets\r\n * @param {Array|string} set2 - the other pitch class set\r\n * @return {boolean} true if they are equal\r\n * @example\r\n * Pcset.isEqual([\"c2\", \"d3\"], [\"c5\", \"d2\"]) // => true\r\n */\r\nfunction isEqual(s1, s2) {\r\n return get(s1).setNum === get(s2).setNum;\r\n}\r\n/**\r\n * Create a function that test if a collection of notes is a\r\n * subset of a given set\r\n *\r\n * The function is curryfied.\r\n *\r\n * @param {PcsetChroma|NoteName[]} set - the superset to test against (chroma or\r\n * list of notes)\r\n * @return{function(PcsetChroma|NoteNames[]): boolean} a function accepting a set\r\n * to test against (chroma or list of notes)\r\n * @example\r\n * const inCMajor = Pcset.isSubsetOf([\"C\", \"E\", \"G\"])\r\n * inCMajor([\"e6\", \"c4\"]) // => true\r\n * inCMajor([\"e6\", \"c4\", \"d3\"]) // => false\r\n */\r\nfunction isSubsetOf(set) {\r\n const s = get(set).setNum;\r\n return (notes) => {\r\n const o = get(notes).setNum;\r\n // tslint:disable-next-line: no-bitwise\r\n return s && s !== o && (o & s) === o;\r\n };\r\n}\r\n/**\r\n * Create a function that test if a collection of notes is a\r\n * superset of a given set (it contains all notes and at least one more)\r\n *\r\n * @param {Set} set - an array of notes or a chroma set string to test against\r\n * @return {(subset: Set): boolean} a function that given a set\r\n * returns true if is a subset of the first one\r\n * @example\r\n * const extendsCMajor = Pcset.isSupersetOf([\"C\", \"E\", \"G\"])\r\n * extendsCMajor([\"e6\", \"a\", \"c4\", \"g2\"]) // => true\r\n * extendsCMajor([\"c6\", \"e4\", \"g3\"]) // => false\r\n */\r\nfunction isSupersetOf(set) {\r\n const s = get(set).setNum;\r\n return (notes) => {\r\n const o = get(notes).setNum;\r\n // tslint:disable-next-line: no-bitwise\r\n return s && s !== o && (o | s) === o;\r\n };\r\n}\r\n/**\r\n * Test if a given pitch class set includes a note\r\n *\r\n * @param {Array} set - the base set to test against\r\n * @param {string} note - the note to test\r\n * @return {boolean} true if the note is included in the pcset\r\n *\r\n * Can be partially applied\r\n *\r\n * @example\r\n * const isNoteInCMajor = isNoteIncludedIn(['C', 'E', 'G'])\r\n * isNoteInCMajor('C4') // => true\r\n * isNoteInCMajor('C#4') // => false\r\n */\r\nfunction isNoteIncludedIn(set) {\r\n const s = get(set);\r\n return (noteName) => {\r\n const n = note(noteName);\r\n return s && !n.empty && s.chroma.charAt(n.chroma) === \"1\";\r\n };\r\n}\r\n/** @deprecated use: isNoteIncludedIn */\r\nconst includes = isNoteIncludedIn;\r\n/**\r\n * Filter a list with a pitch class set\r\n *\r\n * @param {Array|string} set - the pitch class set notes\r\n * @param {Array|string} notes - the note list to be filtered\r\n * @return {Array} the filtered notes\r\n *\r\n * @example\r\n * Pcset.filter([\"C\", \"D\", \"E\"], [\"c2\", \"c#2\", \"d2\", \"c3\", \"c#3\", \"d3\"]) // => [ \"c2\", \"d2\", \"c3\", \"d3\" ])\r\n * Pcset.filter([\"C2\"], [\"c2\", \"c#2\", \"d2\", \"c3\", \"c#3\", \"d3\"]) // => [ \"c2\", \"c3\" ])\r\n */\r\nfunction filter(set) {\r\n const isIncluded = isNoteIncludedIn(set);\r\n return (notes) => {\r\n return notes.filter(isIncluded);\r\n };\r\n}\r\nvar index = {\r\n get,\r\n chroma,\r\n num,\r\n intervals,\r\n chromas,\r\n isSupersetOf,\r\n isSubsetOf,\r\n isNoteIncludedIn,\r\n isEqual,\r\n filter,\r\n modes,\r\n // deprecated\r\n pcset,\r\n};\r\n//// PRIVATE ////\r\nfunction chromaRotations(chroma) {\r\n const binary = chroma.split(\"\");\r\n return binary.map((_, i) => rotate(i, binary).join(\"\"));\r\n}\r\nfunction chromaToPcset(chroma) {\r\n const setNum = chromaToNumber(chroma);\r\n const normalizedNum = chromaRotations(chroma)\r\n .map(chromaToNumber)\r\n .filter((n) => n >= 2048)\r\n .sort()[0];\r\n const normalized = setNumToChroma(normalizedNum);\r\n const intervals = chromaToIntervals(chroma);\r\n return {\r\n empty: false,\r\n name: \"\",\r\n setNum,\r\n chroma,\r\n normalized,\r\n intervals,\r\n };\r\n}\r\nfunction listToChroma(set) {\r\n if (set.length === 0) {\r\n return EmptyPcset.chroma;\r\n }\r\n let pitch;\r\n const binary = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\r\n // tslint:disable-next-line:prefer-for-of\r\n for (let i = 0; i < set.length; i++) {\r\n pitch = note(set[i]);\r\n // tslint:disable-next-line: curly\r\n if (pitch.empty)\r\n pitch = interval(set[i]);\r\n // tslint:disable-next-line: curly\r\n if (!pitch.empty)\r\n binary[pitch.chroma] = 1;\r\n }\r\n return binary.join(\"\");\r\n}\n\nexport default index;\nexport { EmptyPcset, chromaToIntervals, chromas, filter, get, includes, isEqual, isNoteIncludedIn, isSubsetOf, isSupersetOf, modes, pcset };\n//# sourceMappingURL=index.es.js.map\n","import { deprecate } from '@tonaljs/core';\nimport { get as get$1, EmptyPcset } from '@tonaljs/pcset';\n\n/**\r\n * @private\r\n * Chord List\r\n * Source: https://en.wikibooks.org/wiki/Music_Theory/Complete_List_of_Chord_Patterns\r\n * Format: [\"intervals\", \"full name\", \"abrv1 abrv2\"]\r\n */\r\nconst CHORDS = [\r\n // ==Major==\r\n [\"1P 3M 5P\", \"major\", \"M ^ \"],\r\n [\"1P 3M 5P 7M\", \"major seventh\", \"maj7 Δ ma7 M7 Maj7 ^7\"],\r\n [\"1P 3M 5P 7M 9M\", \"major ninth\", \"maj9 Δ9 ^9\"],\r\n [\"1P 3M 5P 7M 9M 13M\", \"major thirteenth\", \"maj13 Maj13 ^13\"],\r\n [\"1P 3M 5P 6M\", \"sixth\", \"6 add6 add13 M6\"],\r\n [\"1P 3M 5P 6M 9M\", \"sixth/ninth\", \"6/9 69 M69\"],\r\n [\"1P 3M 6m 7M\", \"major seventh flat sixth\", \"M7b6 ^7b6\"],\r\n [\r\n \"1P 3M 5P 7M 11A\",\r\n \"major seventh sharp eleventh\",\r\n \"maj#4 Δ#4 Δ#11 M7#11 ^7#11 maj7#11\",\r\n ],\r\n // ==Minor==\r\n // '''Normal'''\r\n [\"1P 3m 5P\", \"minor\", \"m min -\"],\r\n [\"1P 3m 5P 7m\", \"minor seventh\", \"m7 min7 mi7 -7\"],\r\n [\r\n \"1P 3m 5P 7M\",\r\n \"minor/major seventh\",\r\n \"m/ma7 m/maj7 mM7 mMaj7 m/M7 -Δ7 mΔ -^7\",\r\n ],\r\n [\"1P 3m 5P 6M\", \"minor sixth\", \"m6 -6\"],\r\n [\"1P 3m 5P 7m 9M\", \"minor ninth\", \"m9 -9\"],\r\n [\"1P 3m 5P 7M 9M\", \"minor/major ninth\", \"mM9 mMaj9 -^9\"],\r\n [\"1P 3m 5P 7m 9M 11P\", \"minor eleventh\", \"m11 -11\"],\r\n [\"1P 3m 5P 7m 9M 13M\", \"minor thirteenth\", \"m13 -13\"],\r\n // '''Diminished'''\r\n [\"1P 3m 5d\", \"diminished\", \"dim ° o\"],\r\n [\"1P 3m 5d 7d\", \"diminished seventh\", \"dim7 °7 o7\"],\r\n [\"1P 3m 5d 7m\", \"half-diminished\", \"m7b5 ø -7b5 h7 h\"],\r\n // ==Dominant/Seventh==\r\n // '''Normal'''\r\n [\"1P 3M 5P 7m\", \"dominant seventh\", \"7 dom\"],\r\n [\"1P 3M 5P 7m 9M\", \"dominant ninth\", \"9\"],\r\n [\"1P 3M 5P 7m 9M 13M\", \"dominant thirteenth\", \"13\"],\r\n [\"1P 3M 5P 7m 11A\", \"lydian dominant seventh\", \"7#11 7#4\"],\r\n // '''Altered'''\r\n [\"1P 3M 5P 7m 9m\", \"dominant flat ninth\", \"7b9\"],\r\n [\"1P 3M 5P 7m 9A\", \"dominant sharp ninth\", \"7#9\"],\r\n [\"1P 3M 7m 9m\", \"altered\", \"alt7\"],\r\n // '''Suspended'''\r\n [\"1P 4P 5P\", \"suspended fourth\", \"sus4 sus\"],\r\n [\"1P 2M 5P\", \"suspended second\", \"sus2\"],\r\n [\"1P 4P 5P 7m\", \"suspended fourth seventh\", \"7sus4 7sus\"],\r\n [\"1P 5P 7m 9M 11P\", \"eleventh\", \"11\"],\r\n [\r\n \"1P 4P 5P 7m 9m\",\r\n \"suspended fourth flat ninth\",\r\n \"b9sus phryg 7b9sus 7b9sus4\",\r\n ],\r\n // ==Other==\r\n [\"1P 5P\", \"fifth\", \"5\"],\r\n [\"1P 3M 5A\", \"augmented\", \"aug + +5 ^#5\"],\r\n [\"1P 3m 5A\", \"minor augmented\", \"m#5 -#5 m+\"],\r\n [\"1P 3M 5A 7M\", \"augmented seventh\", \"maj7#5 maj7+5 +maj7 ^7#5\"],\r\n [\r\n \"1P 3M 5P 7M 9M 11A\",\r\n \"major sharp eleventh (lydian)\",\r\n \"maj9#11 Δ9#11 ^9#11\",\r\n ],\r\n // ==Legacy==\r\n [\"1P 2M 4P 5P\", \"\", \"sus24 sus4add9\"],\r\n [\"1P 3M 5A 7M 9M\", \"\", \"maj9#5 Maj9#5\"],\r\n [\"1P 3M 5A 7m\", \"\", \"7#5 +7 7+ 7aug aug7\"],\r\n [\"1P 3M 5A 7m 9A\", \"\", \"7#5#9 7#9#5 7alt\"],\r\n [\"1P 3M 5A 7m 9M\", \"\", \"9#5 9+\"],\r\n [\"1P 3M 5A 7m 9M 11A\", \"\", \"9#5#11\"],\r\n [\"1P 3M 5A 7m 9m\", \"\", \"7#5b9 7b9#5\"],\r\n [\"1P 3M 5A 7m 9m 11A\", \"\", \"7#5b9#11\"],\r\n [\"1P 3M 5A 9A\", \"\", \"+add#9\"],\r\n [\"1P 3M 5A 9M\", \"\", \"M#5add9 +add9\"],\r\n [\"1P 3M 5P 6M 11A\", \"\", \"M6#11 M6b5 6#11 6b5\"],\r\n [\"1P 3M 5P 6M 7M 9M\", \"\", \"M7add13\"],\r\n [\"1P 3M 5P 6M 9M 11A\", \"\", \"69#11\"],\r\n [\"1P 3m 5P 6M 9M\", \"\", \"m69 -69\"],\r\n [\"1P 3M 5P 6m 7m\", \"\", \"7b6\"],\r\n [\"1P 3M 5P 7M 9A 11A\", \"\", \"maj7#9#11\"],\r\n [\"1P 3M 5P 7M 9M 11A 13M\", \"\", \"M13#11 maj13#11 M13+4 M13#4\"],\r\n [\"1P 3M 5P 7M 9m\", \"\", \"M7b9\"],\r\n [\"1P 3M 5P 7m 11A 13m\", \"\", \"7#11b13 7b5b13\"],\r\n [\"1P 3M 5P 7m 13M\", \"\", \"7add6 67 7add13\"],\r\n [\"1P 3M 5P 7m 9A 11A\", \"\", \"7#9#11 7b5#9 7#9b5\"],\r\n [\"1P 3M 5P 7m 9A 11A 13M\", \"\", \"13#9#11\"],\r\n [\"1P 3M 5P 7m 9A 11A 13m\", \"\", \"7#9#11b13\"],\r\n [\"1P 3M 5P 7m 9A 13M\", \"\", \"13#9\"],\r\n [\"1P 3M 5P 7m 9A 13m\", \"\", \"7#9b13\"],\r\n [\"1P 3M 5P 7m 9M 11A\", \"\", \"9#11 9+4 9#4\"],\r\n [\"1P 3M 5P 7m 9M 11A 13M\", \"\", \"13#11 13+4 13#4\"],\r\n [\"1P 3M 5P 7m 9M 11A 13m\", \"\", \"9#11b13 9b5b13\"],\r\n [\"1P 3M 5P 7m 9m 11A\", \"\", \"7b9#11 7b5b9 7b9b5\"],\r\n [\"1P 3M 5P 7m 9m 11A 13M\", \"\", \"13b9#11\"],\r\n [\"1P 3M 5P 7m 9m 11A 13m\", \"\", \"7b9b13#11 7b9#11b13 7b5b9b13\"],\r\n [\"1P 3M 5P 7m 9m 13M\", \"\", \"13b9\"],\r\n [\"1P 3M 5P 7m 9m 13m\", \"\", \"7b9b13\"],\r\n [\"1P 3M 5P 7m 9m 9A\", \"\", \"7b9#9\"],\r\n [\"1P 3M 5P 9M\", \"\", \"Madd9 2 add9 add2\"],\r\n [\"1P 3M 5P 9m\", \"\", \"Maddb9\"],\r\n [\"1P 3M 5d\", \"\", \"Mb5\"],\r\n [\"1P 3M 5d 6M 7m 9M\", \"\", \"13b5\"],\r\n [\"1P 3M 5d 7M\", \"\", \"M7b5\"],\r\n [\"1P 3M 5d 7M 9M\", \"\", \"M9b5\"],\r\n [\"1P 3M 5d 7m\", \"\", \"7b5\"],\r\n [\"1P 3M 5d 7m 9M\", \"\", \"9b5\"],\r\n [\"1P 3M 7m\", \"\", \"7no5\"],\r\n [\"1P 3M 7m 13m\", \"\", \"7b13\"],\r\n [\"1P 3M 7m 9M\", \"\", \"9no5\"],\r\n [\"1P 3M 7m 9M 13M\", \"\", \"13no5\"],\r\n [\"1P 3M 7m 9M 13m\", \"\", \"9b13\"],\r\n [\"1P 3m 4P 5P\", \"\", \"madd4\"],\r\n [\"1P 3m 5P 6m 7M\", \"\", \"mMaj7b6\"],\r\n [\"1P 3m 5P 6m 7M 9M\", \"\", \"mMaj9b6\"],\r\n [\"1P 3m 5P 7m 11P\", \"\", \"m7add11 m7add4\"],\r\n [\"1P 3m 5P 9M\", \"\", \"madd9\"],\r\n [\"1P 3m 5d 6M 7M\", \"\", \"o7M7\"],\r\n [\"1P 3m 5d 7M\", \"\", \"oM7\"],\r\n [\"1P 3m 6m 7M\", \"\", \"mb6M7\"],\r\n [\"1P 3m 6m 7m\", \"\", \"m7#5\"],\r\n [\"1P 3m 6m 7m 9M\", \"\", \"m9#5\"],\r\n [\"1P 3m 6m 7m 9M 11P\", \"\", \"m11A\"],\r\n [\"1P 3m 6m 9m\", \"\", \"mb6b9\"],\r\n [\"1P 2M 3m 5d 7m\", \"\", \"m9b5\"],\r\n [\"1P 4P 5A 7M\", \"\", \"M7#5sus4\"],\r\n [\"1P 4P 5A 7M 9M\", \"\", \"M9#5sus4\"],\r\n [\"1P 4P 5A 7m\", \"\", \"7#5sus4\"],\r\n [\"1P 4P 5P 7M\", \"\", \"M7sus4\"],\r\n [\"1P 4P 5P 7M 9M\", \"\", \"M9sus4\"],\r\n [\"1P 4P 5P 7m 9M\", \"\", \"9sus4 9sus\"],\r\n [\"1P 4P 5P 7m 9M 13M\", \"\", \"13sus4 13sus\"],\r\n [\"1P 4P 5P 7m 9m 13m\", \"\", \"7sus4b9b13 7b9b13sus4\"],\r\n [\"1P 4P 7m 10m\", \"\", \"4 quartal\"],\r\n [\"1P 5P 7m 9m 11P\", \"\", \"11b9\"],\r\n];\n\nconst NoChordType = {\r\n ...EmptyPcset,\r\n name: \"\",\r\n quality: \"Unknown\",\r\n intervals: [],\r\n aliases: [],\r\n};\r\nlet dictionary = [];\r\nlet index = {};\r\n/**\r\n * Given a chord name or chroma, return the chord properties\r\n * @param {string} source - chord name or pitch class set chroma\r\n * @example\r\n * import { get } from 'tonaljs/chord-type'\r\n * get('major') // => { name: 'major', ... }\r\n */\r\nfunction get(type) {\r\n return index[type] || NoChordType;\r\n}\r\nconst chordType = deprecate(\"ChordType.chordType\", \"ChordType.get\", get);\r\n/**\r\n * Get all chord (long) names\r\n */\r\nfunction names() {\r\n return dictionary.map((chord) => chord.name).filter((x) => x);\r\n}\r\n/**\r\n * Get all chord symbols\r\n */\r\nfunction symbols() {\r\n return dictionary.map((chord) => chord.aliases[0]).filter((x) => x);\r\n}\r\n/**\r\n * Keys used to reference chord types\r\n */\r\nfunction keys() {\r\n return Object.keys(index);\r\n}\r\n/**\r\n * Return a list of all chord types\r\n */\r\nfunction all() {\r\n return dictionary.slice();\r\n}\r\nconst entries = deprecate(\"ChordType.entries\", \"ChordType.all\", all);\r\n/**\r\n * Clear the dictionary\r\n */\r\nfunction removeAll() {\r\n dictionary = [];\r\n index = {};\r\n}\r\n/**\r\n * Add a chord to the dictionary.\r\n * @param intervals\r\n * @param aliases\r\n * @param [fullName]\r\n */\r\nfunction add(intervals, aliases, fullName) {\r\n const quality = getQuality(intervals);\r\n const chord = {\r\n ...get$1(intervals),\r\n name: fullName || \"\",\r\n quality,\r\n intervals,\r\n aliases,\r\n };\r\n dictionary.push(chord);\r\n if (chord.name) {\r\n index[chord.name] = chord;\r\n }\r\n index[chord.setNum] = chord;\r\n index[chord.chroma] = chord;\r\n chord.aliases.forEach((alias) => addAlias(chord, alias));\r\n}\r\nfunction addAlias(chord, alias) {\r\n index[alias] = chord;\r\n}\r\nfunction getQuality(intervals) {\r\n const has = (interval) => intervals.indexOf(interval) !== -1;\r\n return has(\"5A\")\r\n ? \"Augmented\"\r\n : has(\"3M\")\r\n ? \"Major\"\r\n : has(\"5d\")\r\n ? \"Diminished\"\r\n : has(\"3m\")\r\n ? \"Minor\"\r\n : \"Unknown\";\r\n}\r\nCHORDS.forEach(([ivls, fullName, names]) => add(ivls.split(\" \"), names.split(\" \"), fullName));\r\ndictionary.sort((a, b) => a.setNum - b.setNum);\r\nvar index$1 = {\r\n names,\r\n symbols,\r\n get,\r\n all,\r\n add,\r\n removeAll,\r\n keys,\r\n // deprecated\r\n entries,\r\n chordType,\r\n};\n\nexport default index$1;\nexport { add, addAlias, all, chordType, entries, get, keys, names, removeAll, symbols };\n//# sourceMappingURL=index.es.js.map\n","import { note } from '@tonaljs/core';\n\nfunction isMidi(arg) {\r\n return +arg >= 0 && +arg <= 127;\r\n}\r\n/**\r\n * Get the note midi number (a number between 0 and 127)\r\n *\r\n * It returns undefined if not valid note name\r\n *\r\n * @function\r\n * @param {string|number} note - the note name or midi number\r\n * @return {Integer} the midi number or undefined if not valid note\r\n * @example\r\n * import { toMidi } from '@tonaljs/midi'\r\n * toMidi(\"C4\") // => 60\r\n * toMidi(60) // => 60\r\n * toMidi('60') // => 60\r\n */\r\nfunction toMidi(note$1) {\r\n if (isMidi(note$1)) {\r\n return +note$1;\r\n }\r\n const n = note(note$1);\r\n return n.empty ? null : n.midi;\r\n}\r\n/**\r\n * Get the frequency in hertzs from midi number\r\n *\r\n * @param {number} midi - the note midi number\r\n * @param {number} [tuning = 440] - A4 tuning frequency in Hz (440 by default)\r\n * @return {number} the frequency or null if not valid note midi\r\n * @example\r\n * import { midiToFreq} from '@tonaljs/midi'\r\n * midiToFreq(69) // => 440\r\n */\r\nfunction midiToFreq(midi, tuning = 440) {\r\n return Math.pow(2, (midi - 69) / 12) * tuning;\r\n}\r\nconst L2 = Math.log(2);\r\nconst L440 = Math.log(440);\r\n/**\r\n * Get the midi number from a frequency in hertz. The midi number can\r\n * contain decimals (with two digits precission)\r\n *\r\n * @param {number} frequency\r\n * @return {number}\r\n * @example\r\n * import { freqToMidi} from '@tonaljs/midi'\r\n * freqToMidi(220)); //=> 57\r\n * freqToMidi(261.62)); //=> 60\r\n * freqToMidi(261)); //=> 59.96\r\n */\r\nfunction freqToMidi(freq) {\r\n const v = (12 * (Math.log(freq) - L440)) / L2 + 69;\r\n return Math.round(v * 100) / 100;\r\n}\r\nconst SHARPS = \"C C# D D# E F F# G G# A A# B\".split(\" \");\r\nconst FLATS = \"C Db D Eb E F Gb G Ab A Bb B\".split(\" \");\r\n/**\r\n * Given a midi number, returns a note name. The altered notes will have\r\n * flats unless explicitly set with the optional `useSharps` parameter.\r\n *\r\n * @function\r\n * @param {number} midi - the midi note number\r\n * @param {Object} options = default: `{ sharps: false, pitchClass: false }`\r\n * @param {boolean} useSharps - (Optional) set to true to use sharps instead of flats\r\n * @return {string} the note name\r\n * @example\r\n * import { midiToNoteName } from '@tonaljs/midi'\r\n * midiToNoteName(61) // => \"Db4\"\r\n * midiToNoteName(61, { pitchClass: true }) // => \"Db\"\r\n * midiToNoteName(61, { sharps: true }) // => \"C#4\"\r\n * midiToNoteName(61, { pitchClass: true, sharps: true }) // => \"C#\"\r\n * // it rounds to nearest note\r\n * midiToNoteName(61.7) // => \"D4\"\r\n */\r\nfunction midiToNoteName(midi, options = {}) {\r\n if (isNaN(midi) || midi === -Infinity || midi === Infinity)\r\n return \"\";\r\n midi = Math.round(midi);\r\n const pcs = options.sharps === true ? SHARPS : FLATS;\r\n const pc = pcs[midi % 12];\r\n if (options.pitchClass) {\r\n return pc;\r\n }\r\n const o = Math.floor(midi / 12) - 1;\r\n return pc + o;\r\n}\r\nvar index = { isMidi, toMidi, midiToFreq, midiToNoteName, freqToMidi };\n\nexport default index;\nexport { freqToMidi, isMidi, midiToFreq, midiToNoteName, toMidi };\n//# sourceMappingURL=index.es.js.map\n","import { note, transpose as transpose$1, coordToNote } from '@tonaljs/core';\nimport { midiToNoteName, freqToMidi } from '@tonaljs/midi';\n\nconst NAMES = [\"C\", \"D\", \"E\", \"F\", \"G\", \"A\", \"B\"];\r\nconst toName = (n) => n.name;\r\nconst onlyNotes = (array) => array.map(note).filter((n) => !n.empty);\r\n/**\r\n * Return the natural note names without octave\r\n * @function\r\n * @example\r\n * Note.names(); // => [\"C\", \"D\", \"E\", \"F\", \"G\", \"A\", \"B\"]\r\n */\r\nfunction names(array) {\r\n if (array === undefined) {\r\n return NAMES.slice();\r\n }\r\n else if (!Array.isArray(array)) {\r\n return [];\r\n }\r\n else {\r\n return onlyNotes(array).map(toName);\r\n }\r\n}\r\n/**\r\n * Get a note from a note name\r\n *\r\n * @function\r\n * @example\r\n * Note.get('Bb4') // => { name: \"Bb4\", midi: 70, chroma: 10, ... }\r\n */\r\nconst get = note;\r\n/**\r\n * Get the note name\r\n * @function\r\n */\r\nconst name = (note) => get(note).name;\r\n/**\r\n * Get the note pitch class name\r\n * @function\r\n */\r\nconst pitchClass = (note) => get(note).pc;\r\n/**\r\n * Get the note accidentals\r\n * @function\r\n */\r\nconst accidentals = (note) => get(note).acc;\r\n/**\r\n * Get the note octave\r\n * @function\r\n */\r\nconst octave = (note) => get(note).oct;\r\n/**\r\n * Get the note midi\r\n * @function\r\n */\r\nconst midi = (note) => get(note).midi;\r\n/**\r\n * Get the note midi\r\n * @function\r\n */\r\nconst freq = (note) => get(note).freq;\r\n/**\r\n * Get the note chroma\r\n * @function\r\n */\r\nconst chroma = (note) => get(note).chroma;\r\n/**\r\n * Given a midi number, returns a note name. Uses flats for altered notes.\r\n *\r\n * @function\r\n * @param {number} midi - the midi note number\r\n * @return {string} the note name\r\n * @example\r\n * Note.fromMidi(61) // => \"Db4\"\r\n * Note.fromMidi(61.7) // => \"D4\"\r\n */\r\nfunction fromMidi(midi) {\r\n return midiToNoteName(midi);\r\n}\r\n/**\r\n * Given a midi number, returns a note name. Uses flats for altered notes.\r\n */\r\nfunction fromFreq(freq) {\r\n return midiToNoteName(freqToMidi(freq));\r\n}\r\n/**\r\n * Given a midi number, returns a note name. Uses flats for altered notes.\r\n */\r\nfunction fromFreqSharps(freq) {\r\n return midiToNoteName(freqToMidi(freq), { sharps: true });\r\n}\r\n/**\r\n * Given a midi number, returns a note name. Uses flats for altered notes.\r\n *\r\n * @function\r\n * @param {number} midi - the midi note number\r\n * @return {string} the note name\r\n * @example\r\n * Note.fromMidiSharps(61) // => \"C#4\"\r\n */\r\nfunction fromMidiSharps(midi) {\r\n return midiToNoteName(midi, { sharps: true });\r\n}\r\n/**\r\n * Transpose a note by an interval\r\n */\r\nconst transpose = transpose$1;\r\nconst tr = transpose$1;\r\n/**\r\n * Transpose by an interval.\r\n * @function\r\n * @param {string} interval\r\n * @return {function} a function that transposes by the given interval\r\n * @example\r\n * [\"C\", \"D\", \"E\"].map(Note.transposeBy(\"5P\"));\r\n * // => [\"G\", \"A\", \"B\"]\r\n */\r\nconst transposeBy = (interval) => (note) => transpose(note, interval);\r\nconst trBy = transposeBy;\r\n/**\r\n * Transpose from a note\r\n * @function\r\n * @param {string} note\r\n * @return {function} a function that transposes the the note by an interval\r\n * [\"1P\", \"3M\", \"5P\"].map(Note.transposeFrom(\"C\"));\r\n * // => [\"C\", \"E\", \"G\"]\r\n */\r\nconst transposeFrom = (note) => (interval) => transpose(note, interval);\r\nconst trFrom = transposeFrom;\r\n/**\r\n * Transpose a note by a number of perfect fifths.\r\n *\r\n * @function\r\n * @param {string} note - the note name\r\n * @param {number} fifhts - the number of fifths\r\n * @return {string} the transposed note name\r\n *\r\n * @example\r\n * import { transposeFifths } from \"@tonaljs/note\"\r\n * transposeFifths(\"G4\", 1) // => \"D\"\r\n * [0, 1, 2, 3, 4].map(fifths => transposeFifths(\"C\", fifths)) // => [\"C\", \"G\", \"D\", \"A\", \"E\"]\r\n */\r\nfunction transposeFifths(noteName, fifths) {\r\n const note = get(noteName);\r\n if (note.empty) {\r\n return \"\";\r\n }\r\n const [nFifths, nOcts] = note.coord;\r\n const transposed = nOcts === undefined\r\n ? coordToNote([nFifths + fifths])\r\n : coordToNote([nFifths + fifths, nOcts]);\r\n return transposed.name;\r\n}\r\nconst trFifths = transposeFifths;\r\nconst ascending = (a, b) => a.height - b.height;\r\nconst descending = (a, b) => b.height - a.height;\r\nfunction sortedNames(notes, comparator) {\r\n comparator = comparator || ascending;\r\n return onlyNotes(notes).sort(comparator).map(toName);\r\n}\r\nfunction sortedUniqNames(notes) {\r\n return sortedNames(notes, ascending).filter((n, i, a) => i === 0 || n !== a[i - 1]);\r\n}\r\n/**\r\n * Simplify a note\r\n *\r\n * @function\r\n * @param {string} note - the note to be simplified\r\n * - sameAccType: default true. Use same kind of accidentals that source\r\n * @return {string} the simplified note or '' if not valid note\r\n * @example\r\n * simplify(\"C##\") // => \"D\"\r\n * simplify(\"C###\") // => \"D#\"\r\n * simplify(\"C###\")\r\n * simplify(\"B#4\") // => \"C5\"\r\n */\r\nconst simplify = nameBuilder(true);\r\n/**\r\n * Get enharmonic of a note\r\n *\r\n * @function\r\n * @param {string} note\r\n * @return {string} the enharmonic note or '' if not valid note\r\n * @example\r\n * Note.enharmonic(\"Db\") // => \"C#\"\r\n * Note.enharmonic(\"C\") // => \"C\"\r\n */\r\nconst enharmonic = nameBuilder(false);\r\nfunction nameBuilder(sameAccidentals) {\r\n return (noteName) => {\r\n const note = get(noteName);\r\n if (note.empty) {\r\n return \"\";\r\n }\r\n const sharps = sameAccidentals ? note.alt > 0 : note.alt < 0;\r\n const pitchClass = note.midi === null;\r\n return midiToNoteName(note.midi || note.chroma, { sharps, pitchClass });\r\n };\r\n}\r\nvar index = {\r\n names,\r\n get,\r\n name,\r\n pitchClass,\r\n accidentals,\r\n octave,\r\n midi,\r\n ascending,\r\n descending,\r\n sortedNames,\r\n sortedUniqNames,\r\n fromMidi,\r\n fromMidiSharps,\r\n freq,\r\n fromFreq,\r\n fromFreqSharps,\r\n chroma,\r\n transpose,\r\n tr,\r\n transposeBy,\r\n trBy,\r\n transposeFrom,\r\n trFrom,\r\n transposeFifths,\r\n trFifths,\r\n simplify,\r\n enharmonic,\r\n};\n\nexport default index;\nexport { accidentals, ascending, chroma, descending, enharmonic, freq, fromFreq, fromFreqSharps, fromMidi, fromMidiSharps, get, midi, name, names, octave, pitchClass, simplify, sortedNames, sortedUniqNames, tr, trBy, trFifths, trFrom, transpose, transposeBy, transposeFifths, transposeFrom };\n//# sourceMappingURL=index.es.js.map\n","import { interval, distance as distance$1, coordToInterval } from '@tonaljs/core';\n\n/**\r\n * Get the natural list of names\r\n */\r\nfunction names() {\r\n return \"1P 2M 3M 4P 5P 6m 7m\".split(\" \");\r\n}\r\n/**\r\n * Get properties of an interval\r\n *\r\n * @function\r\n * @example\r\n * Interval.get('P4') // => {\"alt\": 0, \"dir\": 1, \"name\": \"4P\", \"num\": 4, \"oct\": 0, \"q\": \"P\", \"semitones\": 5, \"simple\": 4, \"step\": 3, \"type\": \"perfectable\"}\r\n */\r\nconst get = interval;\r\n/**\r\n * Get name of an interval\r\n *\r\n * @function\r\n * @example\r\n * Interval.name('4P') // => \"4P\"\r\n * Interval.name('P4') // => \"4P\"\r\n * Interval.name('C4') // => \"\"\r\n */\r\nconst name = (name) => interval(name).name;\r\n/**\r\n * Get semitones of an interval\r\n * @function\r\n * @example\r\n * Interval.semitones('P4') // => 5\r\n */\r\nconst semitones = (name) => interval(name).semitones;\r\n/**\r\n * Get quality of an interval\r\n * @function\r\n * @example\r\n * Interval.quality('P4') // => \"P\"\r\n */\r\nconst quality = (name) => interval(name).q;\r\n/**\r\n * Get number of an interval\r\n * @function\r\n * @example\r\n * Interval.num('P4') // => 4\r\n */\r\nconst num = (name) => interval(name).num;\r\n/**\r\n * Get the simplified version of an interval.\r\n *\r\n * @function\r\n * @param {string} interval - the interval to simplify\r\n * @return {string} the simplified interval\r\n *\r\n * @example\r\n * Interval.simplify(\"9M\") // => \"2M\"\r\n * Interval.simplify(\"2M\") // => \"2M\"\r\n * Interval.simplify(\"-2M\") // => \"7m\"\r\n * [\"8P\", \"9M\", \"10M\", \"11P\", \"12P\", \"13M\", \"14M\", \"15P\"].map(Interval.simplify)\r\n * // => [ \"8P\", \"2M\", \"3M\", \"4P\", \"5P\", \"6M\", \"7M\", \"8P\" ]\r\n */\r\nfunction simplify(name) {\r\n const i = interval(name);\r\n return i.empty ? \"\" : i.simple + i.q;\r\n}\r\n/**\r\n * Get the inversion (https://en.wikipedia.org/wiki/Inversion_(music)#Intervals)\r\n * of an interval.\r\n *\r\n * @function\r\n * @param {string} interval - the interval to invert in interval shorthand\r\n * notation or interval array notation\r\n * @return {string} the inverted interval\r\n *\r\n * @example\r\n * Interval.invert(\"3m\") // => \"6M\"\r\n * Interval.invert(\"2M\") // => \"7m\"\r\n */\r\nfunction invert(name) {\r\n const i = interval(name);\r\n if (i.empty) {\r\n return \"\";\r\n }\r\n const step = (7 - i.step) % 7;\r\n const alt = i.type === \"perfectable\" ? -i.alt : -(i.alt + 1);\r\n return interval({ step, alt, oct: i.oct, dir: i.dir }).name;\r\n}\r\n// interval numbers\r\nconst IN = [1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7];\r\n// interval qualities\r\nconst IQ = \"P m M m M P d P m M m M\".split(\" \");\r\n/**\r\n * Get interval name from semitones number. Since there are several interval\r\n * names for the same number, the name it's arbitrary, but deterministic.\r\n *\r\n * @param {Integer} num - the number of semitones (can be negative)\r\n * @return {string} the interval name\r\n * @example\r\n * Interval.fromSemitones(7) // => \"5P\"\r\n * Interval.fromSemitones(-7) // => \"-5P\"\r\n */\r\nfunction fromSemitones(semitones) {\r\n const d = semitones < 0 ? -1 : 1;\r\n const n = Math.abs(semitones);\r\n const c = n % 12;\r\n const o = Math.floor(n / 12);\r\n return d * (IN[c] + 7 * o) + IQ[c];\r\n}\r\n/**\r\n * Find interval between two notes\r\n *\r\n * @example\r\n * Interval.distance(\"C4\", \"G4\"); // => \"5P\"\r\n */\r\nconst distance = distance$1;\r\n/**\r\n * Adds two intervals\r\n *\r\n * @function\r\n * @param {string} interval1\r\n * @param {string} interval2\r\n * @return {string} the added interval name\r\n * @example\r\n * Interval.add(\"3m\", \"5P\") // => \"7m\"\r\n */\r\nconst add = combinator((a, b) => [a[0] + b[0], a[1] + b[1]]);\r\n/**\r\n * Returns a function that adds an interval\r\n *\r\n * @function\r\n * @example\r\n * ['1P', '2M', '3M'].map(Interval.addTo('5P')) // => [\"5P\", \"6M\", \"7M\"]\r\n */\r\nconst addTo = (interval) => (other) => add(interval, other);\r\n/**\r\n * Subtracts two intervals\r\n *\r\n * @function\r\n * @param {string} minuendInterval\r\n * @param {string} subtrahendInterval\r\n * @return {string} the substracted interval name\r\n * @example\r\n * Interval.substract('5P', '3M') // => '3m'\r\n * Interval.substract('3M', '5P') // => '-3m'\r\n */\r\nconst substract = combinator((a, b) => [a[0] - b[0], a[1] - b[1]]);\r\nvar index = {\r\n names,\r\n get,\r\n name,\r\n num,\r\n semitones,\r\n quality,\r\n fromSemitones,\r\n distance,\r\n invert,\r\n simplify,\r\n add,\r\n addTo,\r\n substract,\r\n};\r\nfunction combinator(fn) {\r\n return (a, b) => {\r\n const coordA = interval(a).coord;\r\n const coordB = interval(b).coord;\r\n if (coordA && coordB) {\r\n const coord = fn(coordA, coordB);\r\n return coordToInterval(coord).name;\r\n }\r\n };\r\n}\n\nexport default index;\nexport { add, addTo, distance, fromSemitones, get, invert, name, names, num, quality, semitones, simplify, substract };\n//# sourceMappingURL=index.es.js.map\n","import { deprecate } from '@tonaljs/core';\nimport { EmptyPcset, get as get$1 } from '@tonaljs/pcset';\n\n// SCALES\r\n// Format: [\"intervals\", \"name\", \"alias1\", \"alias2\", ...]\r\nconst SCALES = [\r\n // 5-note scales\r\n [\"1P 2M 3M 5P 6M\", \"major pentatonic\", \"pentatonic\"],\r\n [\"1P 3M 4P 5P 7M\", \"ionian pentatonic\"],\r\n [\"1P 3M 4P 5P 7m\", \"mixolydian pentatonic\", \"indian\"],\r\n [\"1P 2M 4P 5P 6M\", \"ritusen\"],\r\n [\"1P 2M 4P 5P 7m\", \"egyptian\"],\r\n [\"1P 3M 4P 5d 7m\", \"neopolitan major pentatonic\"],\r\n [\"1P 3m 4P 5P 6m\", \"vietnamese 1\"],\r\n [\"1P 2m 3m 5P 6m\", \"pelog\"],\r\n [\"1P 2m 4P 5P 6m\", \"kumoijoshi\"],\r\n [\"1P 2M 3m 5P 6m\", \"hirajoshi\"],\r\n [\"1P 2m 4P 5d 7m\", \"iwato\"],\r\n [\"1P 2m 4P 5P 7m\", \"in-sen\"],\r\n [\"1P 3M 4A 5P 7M\", \"lydian pentatonic\", \"chinese\"],\r\n [\"1P 3m 4P 6m 7m\", \"malkos raga\"],\r\n [\"1P 3m 4P 5d 7m\", \"locrian pentatonic\", \"minor seven flat five pentatonic\"],\r\n [\"1P 3m 4P 5P 7m\", \"minor pentatonic\", \"vietnamese 2\"],\r\n [\"1P 3m 4P 5P 6M\", \"minor six pentatonic\"],\r\n [\"1P 2M 3m 5P 6M\", \"flat three pentatonic\", \"kumoi\"],\r\n [\"1P 2M 3M 5P 6m\", \"flat six pentatonic\"],\r\n [\"1P 2m 3M 5P 6M\", \"scriabin\"],\r\n [\"1P 3M 5d 6m 7m\", \"whole tone pentatonic\"],\r\n [\"1P 3M 4A 5A 7M\", \"lydian #5P pentatonic\"],\r\n [\"1P 3M 4A 5P 7m\", \"lydian dominant pentatonic\"],\r\n [\"1P 3m 4P 5P 7M\", \"minor #7M pentatonic\"],\r\n [\"1P 3m 4d 5d 7m\", \"super locrian pentatonic\"],\r\n // 6-note scales\r\n [\"1P 2M 3m 4P 5P 7M\", \"minor hexatonic\"],\r\n [\"1P 2A 3M 5P 5A 7M\", \"augmented\"],\r\n [\"1P 2M 3m 3M 5P 6M\", \"major blues\"],\r\n [\"1P 2M 4P 5P 6M 7m\", \"piongio\"],\r\n [\"1P 2m 3M 4A 6M 7m\", \"prometheus neopolitan\"],\r\n [\"1P 2M 3M 4A 6M 7m\", \"prometheus\"],\r\n [\"1P 2m 3M 5d 6m 7m\", \"mystery #1\"],\r\n [\"1P 2m 3M 4P 5A 6M\", \"six tone symmetric\"],\r\n [\"1P 2M 3M 4A 5A 7m\", \"whole tone\", \"messiaen's mode #1\"],\r\n [\"1P 2m 4P 4A 5P 7M\", \"messiaen's mode #5\"],\r\n [\"1P 3m 4P 5d 5P 7m\", \"minor blues\", \"blues\"],\r\n // 7-note scales\r\n [\"1P 2M 3M 4P 5d 6m 7m\", \"locrian major\", \"arabian\"],\r\n [\"1P 2m 3M 4A 5P 6m 7M\", \"double harmonic lydian\"],\r\n [\"1P 2M 3m 4P 5P 6m 7M\", \"harmonic minor\"],\r\n [\r\n \"1P 2m 3m 4d 5d 6m 7m\",\r\n \"altered\",\r\n \"super locrian\",\r\n \"diminished whole tone\",\r\n \"pomeroy\",\r\n ],\r\n [\"1P 2M 3m 4P 5d 6m 7m\", \"locrian #2\", \"half-diminished\", \"aeolian b5\"],\r\n [\r\n \"1P 2M 3M 4P 5P 6m 7m\",\r\n \"mixolydian b6\",\r\n \"melodic minor fifth mode\",\r\n \"hindu\",\r\n ],\r\n [\"1P 2M 3M 4A 5P 6M 7m\", \"lydian dominant\", \"lydian b7\", \"overtone\"],\r\n [\"1P 2M 3M 4A 5P 6M 7M\", \"lydian\"],\r\n [\"1P 2M 3M 4A 5A 6M 7M\", \"lydian augmented\"],\r\n [\r\n \"1P 2m 3m 4P 5P 6M 7m\",\r\n \"dorian b2\",\r\n \"phrygian #6\",\r\n \"melodic minor second mode\",\r\n ],\r\n [\"1P 2M 3m 4P 5P 6M 7M\", \"melodic minor\"],\r\n [\"1P 2m 3m 4P 5d 6m 7m\", \"locrian\"],\r\n [\r\n \"1P 2m 3m 4d 5d 6m 7d\",\r\n \"ultralocrian\",\r\n \"superlocrian bb7\",\r\n \"·superlocrian diminished\",\r\n ],\r\n [\"1P 2m 3m 4P 5d 6M 7m\", \"locrian 6\", \"locrian natural 6\", \"locrian sharp 6\"],\r\n [\"1P 2A 3M 4P 5P 5A 7M\", \"augmented heptatonic\"],\r\n [\"1P 2M 3m 5d 5P 6M 7m\", \"romanian minor\"],\r\n [\"1P 2M 3m 4A 5P 6M 7m\", \"dorian #4\"],\r\n [\"1P 2M 3m 4A 5P 6M 7M\", \"lydian diminished\"],\r\n [\"1P 2m 3m 4P 5P 6m 7m\", \"phrygian\"],\r\n [\"1P 2M 3M 4A 5A 7m 7M\", \"leading whole tone\"],\r\n [\"1P 2M 3M 4A 5P 6m 7m\", \"lydian minor\"],\r\n [\"1P 2m 3M 4P 5P 6m 7m\", \"phrygian dominant\", \"spanish\", \"phrygian major\"],\r\n [\"1P 2m 3m 4P 5P 6m 7M\", \"balinese\"],\r\n [\"1P 2m 3m 4P 5P 6M 7M\", \"neopolitan major\"],\r\n [\"1P 2M 3m 4P 5P 6m 7m\", \"aeolian\", \"minor\"],\r\n [\"1P 2M 3M 4P 5P 6m 7M\", \"harmonic major\"],\r\n [\"1P 2m 3M 4P 5P 6m 7M\", \"double harmonic major\", \"gypsy\"],\r\n [\"1P 2M 3m 4P 5P 6M 7m\", \"dorian\"],\r\n [\"1P 2M 3m 4A 5P 6m 7M\", \"hungarian minor\"],\r\n [\"1P 2A 3M 4A 5P 6M 7m\", \"hungarian major\"],\r\n [\"1P 2m 3M 4P 5d 6M 7m\", \"oriental\"],\r\n [\"1P 2m 3m 3M 4A 5P 7m\", \"flamenco\"],\r\n [\"1P 2m 3m 4A 5P 6m 7M\", \"todi raga\"],\r\n [\"1P 2M 3M 4P 5P 6M 7m\", \"mixolydian\", \"dominant\"],\r\n [\"1P 2m 3M 4P 5d 6m 7M\", \"persian\"],\r\n [\"1P 2M 3M 4P 5P 6M 7M\", \"major\", \"ionian\"],\r\n [\"1P 2m 3M 5d 6m 7m 7M\", \"enigmatic\"],\r\n [\r\n \"1P 2M 3M 4P 5A 6M 7M\",\r\n \"major augmented\",\r\n \"major #5\",\r\n \"ionian augmented\",\r\n \"ionian #5\",\r\n ],\r\n [\"1P 2A 3M 4A 5P 6M 7M\", \"lydian #9\"],\r\n // 8-note scales\r\n [\"1P 2m 2M 4P 4A 5P 6m 7M\", \"messiaen's mode #4\"],\r\n [\"1P 2m 3M 4P 4A 5P 6m 7M\", \"purvi raga\"],\r\n [\"1P 2m 3m 3M 4P 5P 6m 7m\", \"spanish heptatonic\"],\r\n [\"1P 2M 3M 4P 5P 6M 7m 7M\", \"bebop\"],\r\n [\"1P 2M 3m 3M 4P 5P 6M 7m\", \"bebop minor\"],\r\n [\"1P 2M 3M 4P 5P 5A 6M 7M\", \"bebop major\"],\r\n [\"1P 2m 3m 4P 5d 5P 6m 7m\", \"bebop locrian\"],\r\n [\"1P 2M 3m 4P 5P 6m 7m 7M\", \"minor bebop\"],\r\n [\"1P 2M 3m 4P 5d 6m 6M 7M\", \"diminished\", \"whole-half diminished\"],\r\n [\"1P 2M 3M 4P 5d 5P 6M 7M\", \"ichikosucho\"],\r\n [\"1P 2M 3m 4P 5P 6m 6M 7M\", \"minor six diminished\"],\r\n [\r\n \"1P 2m 3m 3M 4A 5P 6M 7m\",\r\n \"half-whole diminished\",\r\n \"dominant diminished\",\r\n \"messiaen's mode #2\",\r\n ],\r\n [\"1P 3m 3M 4P 5P 6M 7m 7M\", \"kafi raga\"],\r\n [\"1P 2M 3M 4P 4A 5A 6A 7M\", \"messiaen's mode #6\"],\r\n // 9-note scales\r\n [\"1P 2M 3m 3M 4P 5d 5P 6M 7m\", \"composite blues\"],\r\n [\"1P 2M 3m 3M 4A 5P 6m 7m 7M\", \"messiaen's mode #3\"],\r\n // 10-note scales\r\n [\"1P 2m 2M 3m 4P 4A 5P 6m 6M 7M\", \"messiaen's mode #7\"],\r\n // 12-note scales\r\n [\"1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M\", \"chromatic\"],\r\n];\n\nconst NoScaleType = {\r\n ...EmptyPcset,\r\n intervals: [],\r\n aliases: [],\r\n};\r\nlet dictionary = [];\r\nlet index = {};\r\nfunction names() {\r\n return dictionary.map((scale) => scale.name);\r\n}\r\n/**\r\n * Given a scale name or chroma, return the scale properties\r\n *\r\n * @param {string} type - scale name or pitch class set chroma\r\n * @example\r\n * import { get } from 'tonaljs/scale-type'\r\n * get('major') // => { name: 'major', ... }\r\n */\r\nfunction get(type) {\r\n return index[type] || NoScaleType;\r\n}\r\nconst scaleType = deprecate(\"ScaleDictionary.scaleType\", \"ScaleType.get\", get);\r\n/**\r\n * Return a list of all scale types\r\n */\r\nfunction all() {\r\n return dictionary.slice();\r\n}\r\nconst entries = deprecate(\"ScaleDictionary.entries\", \"ScaleType.all\", all);\r\n/**\r\n * Keys used to reference scale types\r\n */\r\nfunction keys() {\r\n return Object.keys(index);\r\n}\r\n/**\r\n * Clear the dictionary\r\n */\r\nfunction removeAll() {\r\n dictionary = [];\r\n index = {};\r\n}\r\n/**\r\n * Add a scale into dictionary\r\n * @param intervals\r\n * @param name\r\n * @param aliases\r\n */\r\nfunction add(intervals, name, aliases = []) {\r\n const scale = { ...get$1(intervals), name, intervals, aliases };\r\n dictionary.push(scale);\r\n index[scale.name] = scale;\r\n index[scale.setNum] = scale;\r\n index[scale.chroma] = scale;\r\n scale.aliases.forEach((alias) => addAlias(scale, alias));\r\n return scale;\r\n}\r\nfunction addAlias(scale, alias) {\r\n index[alias] = scale;\r\n}\r\nSCALES.forEach(([ivls, name, ...aliases]) => add(ivls.split(\" \"), name, aliases));\r\nvar index$1 = {\r\n names,\r\n get,\r\n all,\r\n add,\r\n removeAll,\r\n keys,\r\n // deprecated\r\n entries,\r\n scaleType,\r\n};\n\nexport default index$1;\nexport { NoScaleType, add, addAlias, all, entries, get, keys, names, removeAll, scaleType };\n//# sourceMappingURL=index.es.js.map\n","import { detect } from '@tonaljs/chord-detect';\nexport { detect } from '@tonaljs/chord-detect';\nimport { get as get$1, all as all$1 } from '@tonaljs/chord-type';\nimport { tokenizeNote, note, distance, transpose as transpose$1, deprecate } from '@tonaljs/core';\nimport { isSupersetOf, isSubsetOf } from '@tonaljs/pcset';\nimport { all } from '@tonaljs/scale-type';\n\nconst NoChord = {\r\n empty: true,\r\n name: \"\",\r\n symbol: \"\",\r\n root: \"\",\r\n rootDegree: 0,\r\n type: \"\",\r\n tonic: null,\r\n setNum: NaN,\r\n quality: \"Unknown\",\r\n chroma: \"\",\r\n normalized: \"\",\r\n aliases: [],\r\n notes: [],\r\n intervals: [],\r\n};\r\n// 6, 64, 7, 9, 11 and 13 are consider part of the chord\r\n// (see https://github.com/danigb/tonal/issues/55)\r\nconst NUM_TYPES = /^(6|64|7|9|11|13)$/;\r\n/**\r\n * Tokenize a chord name. It returns an array with the tonic and chord type\r\n * If not tonic is found, all the name is considered the chord name.\r\n *\r\n * This function does NOT check if the chord type exists or not. It only tries\r\n * to split the tonic and chord type.\r\n *\r\n * @function\r\n * @param {string} name - the chord name\r\n * @return {Array} an array with [tonic, type]\r\n * @example\r\n * tokenize(\"Cmaj7\") // => [ \"C\", \"maj7\" ]\r\n * tokenize(\"C7\") // => [ \"C\", \"7\" ]\r\n * tokenize(\"mMaj7\") // => [ null, \"mMaj7\" ]\r\n * tokenize(\"Cnonsense\") // => [ null, \"nonsense\" ]\r\n */\r\nfunction tokenize(name) {\r\n const [letter, acc, oct, type] = tokenizeNote(name);\r\n if (letter === \"\") {\r\n return [\"\", name];\r\n }\r\n // aug is augmented (see https://github.com/danigb/tonal/issues/55)\r\n if (letter === \"A\" && type === \"ug\") {\r\n return [\"\", \"aug\"];\r\n }\r\n // see: https://github.com/tonaljs/tonal/issues/70\r\n if (!type && (oct === \"4\" || oct === \"5\")) {\r\n return [letter + acc, oct];\r\n }\r\n if (NUM_TYPES.test(oct)) {\r\n return [letter + acc, oct + type];\r\n }\r\n else {\r\n return [letter + acc + oct, type];\r\n }\r\n}\r\n/**\r\n * Get a Chord from a chord name.\r\n */\r\nfunction get(src) {\r\n if (src === \"\") {\r\n return NoChord;\r\n }\r\n if (Array.isArray(src) && src.length === 2) {\r\n return getChord(src[1], src[0]);\r\n }\r\n else {\r\n const [tonic, type] = tokenize(src);\r\n const chord = getChord(type, tonic);\r\n return chord.empty ? getChord(src) : chord;\r\n }\r\n}\r\n/**\r\n * Get chord properties\r\n *\r\n * @param typeName - the chord type name\r\n * @param [tonic] - Optional tonic\r\n * @param [root] - Optional root (requires a tonic)\r\n */\r\nfunction getChord(typeName, optionalTonic, optionalRoot) {\r\n const type = get$1(typeName);\r\n const tonic = note(optionalTonic || \"\");\r\n const root = note(optionalRoot || \"\");\r\n if (type.empty ||\r\n (optionalTonic && tonic.empty) ||\r\n (optionalRoot && root.empty)) {\r\n return NoChord;\r\n }\r\n const rootInterval = distance(tonic.pc, root.pc);\r\n const rootDegree = type.intervals.indexOf(rootInterval) + 1;\r\n if (!root.empty && !rootDegree) {\r\n return NoChord;\r\n }\r\n const intervals = Array.from(type.intervals);\r\n for (let i = 1; i < rootDegree; i++) {\r\n const num = intervals[0][0];\r\n const quality = intervals[0][1];\r\n const newNum = parseInt(num, 10) + 7;\r\n intervals.push(`${newNum}${quality}`);\r\n intervals.shift();\r\n }\r\n const notes = tonic.empty\r\n ? []\r\n : intervals.map((i) => transpose$1(tonic, i));\r\n typeName = type.aliases.indexOf(typeName) !== -1 ? typeName : type.aliases[0];\r\n const symbol = `${tonic.empty ? \"\" : tonic.pc}${typeName}${root.empty || rootDegree <= 1 ? \"\" : \"/\" + root.pc}`;\r\n const name = `${optionalTonic ? tonic.pc + \" \" : \"\"}${type.name}${rootDegree > 1 && optionalRoot ? \" over \" + root.pc : \"\"}`;\r\n return {\r\n ...type,\r\n name,\r\n symbol,\r\n type: type.name,\r\n root: root.name,\r\n intervals,\r\n rootDegree,\r\n tonic: tonic.name,\r\n notes,\r\n };\r\n}\r\nconst chord = deprecate(\"Chord.chord\", \"Chord.get\", get);\r\n/**\r\n * Transpose a chord name\r\n *\r\n * @param {string} chordName - the chord name\r\n * @return {string} the transposed chord\r\n *\r\n * @example\r\n * transpose('Dm7', 'P4') // => 'Gm7\r\n */\r\nfunction transpose(chordName, interval) {\r\n const [tonic, type] = tokenize(chordName);\r\n if (!tonic) {\r\n return chordName;\r\n }\r\n return transpose$1(tonic, interval) + type;\r\n}\r\n/**\r\n * Get all scales where the given chord fits\r\n *\r\n * @example\r\n * chordScales('C7b9')\r\n * // => [\"phrygian dominant\", \"flamenco\", \"spanish heptatonic\", \"half-whole diminished\", \"chromatic\"]\r\n */\r\nfunction chordScales(name) {\r\n const s = get(name);\r\n const isChordIncluded = isSupersetOf(s.chroma);\r\n return all()\r\n .filter((scale) => isChordIncluded(scale.chroma))\r\n .map((scale) => scale.name);\r\n}\r\n/**\r\n * Get all chords names that are a superset of the given one\r\n * (has the same notes and at least one more)\r\n *\r\n * @function\r\n * @example\r\n * extended(\"CMaj7\")\r\n * // => [ 'Cmaj#4', 'Cmaj7#9#11', 'Cmaj9', 'CM7add13', 'Cmaj13', 'Cmaj9#11', 'CM13#11', 'CM7b9' ]\r\n */\r\nfunction extended(chordName) {\r\n const s = get(chordName);\r\n const isSuperset = isSupersetOf(s.chroma);\r\n return all$1()\r\n .filter((chord) => isSuperset(chord.chroma))\r\n .map((chord) => s.tonic + chord.aliases[0]);\r\n}\r\n/**\r\n * Find all chords names that are a subset of the given one\r\n * (has less notes but all from the given chord)\r\n *\r\n * @example\r\n */\r\nfunction reduced(chordName) {\r\n const s = get(chordName);\r\n const isSubset = isSubsetOf(s.chroma);\r\n return all$1()\r\n .filter((chord) => isSubset(chord.chroma))\r\n .map((chord) => s.tonic + chord.aliases[0]);\r\n}\r\nvar index = {\r\n getChord,\r\n get,\r\n detect,\r\n chordScales,\r\n extended,\r\n reduced,\r\n tokenize,\r\n transpose,\r\n // deprecate\r\n chord,\r\n};\n\nexport default index;\nexport { chord, chordScales, extended, get, getChord, reduced, tokenize, transpose };\n//# sourceMappingURL=index.es.js.map\n","import { all } from '@tonaljs/chord-type';\nimport { note, distance } from '@tonaljs/core';\nimport { sortedNames } from '@tonaljs/note';\nimport { simplify } from '@tonaljs/interval';\nimport { modes } from '@tonaljs/pcset';\n\nconst namedSet = (notes) => {\r\n const pcToName = notes.reduce((record, n) => {\r\n const chroma = note(n).chroma;\r\n if (chroma !== undefined) {\r\n record[chroma] = record[chroma] || note(n).name;\r\n }\r\n return record;\r\n }, {});\r\n return (chroma) => pcToName[chroma];\r\n};\r\nfunction detect(source) {\r\n const notes = sortedNames(source)\r\n .map((n) => note(n).pc)\r\n .filter((x) => x);\r\n if (note.length === 0) {\r\n return [];\r\n }\r\n const found = findExactMatches(notes, 1);\r\n return found\r\n .filter((chord) => chord.weight)\r\n .sort((a, b) => b.weight - a.weight)\r\n .map((chord) => chord.name);\r\n}\r\n// Assumes that chord is presorted\r\nfunction findRoot(chord) {\r\n let foundRoot = null;\r\n chord.every((note) => {\r\n const workComplete = chord.some((otherNote) => {\r\n const interval = simplify(distance(note, otherNote));\r\n const orderedNotes = sortedNames([note, otherNote]);\r\n if (interval === \"5P\") {\r\n foundRoot = orderedNotes[0];\r\n return foundRoot; // Loop is complete\r\n }\r\n else if (interval === \"4P\") {\r\n foundRoot = orderedNotes[1];\r\n return foundRoot; // Loop is complete\r\n }\r\n return false; // continue looping\r\n });\r\n // Continue looping if the root note was not found\r\n return !workComplete;\r\n });\r\n if (foundRoot) {\r\n return foundRoot;\r\n }\r\n else {\r\n // Defaults to the old behavior if the chord is complex and the root note cannot be easily found\r\n return chord[0];\r\n }\r\n}\r\n// assumes that notes is presorted\r\nfunction findExactMatches(notes, weight) {\r\n const root = findRoot(notes);\r\n const noteName = namedSet(notes);\r\n // we need to test all chromas to get the correct baseNote\r\n const allModes = modes(notes, false);\r\n const baseNote = notes[0];\r\n const baseChroma = note(baseNote).chroma;\r\n const found = [];\r\n allModes.forEach((mode, index) => {\r\n // some chords could have the same chroma but different interval spelling\r\n const chordTypes = all().filter((chordType) => chordType.chroma === mode);\r\n chordTypes.forEach((chordType) => {\r\n const chordName = chordType.aliases[0];\r\n const rootNote = noteName(index);\r\n const isInversion = note(rootNote).chroma !== baseChroma;\r\n if (isInversion) {\r\n found.push({\r\n weight: 0.5 * weight,\r\n name: `${rootNote}${chordName}/${baseNote}`,\r\n });\r\n }\r\n else {\r\n found.push({ weight: 1 * weight, name: `${root}${chordName}` });\r\n }\r\n });\r\n });\r\n return found;\r\n}\r\nvar index = { detect };\n\nexport default index;\nexport { detect };\n//# sourceMappingURL=index.es.js.map\n","// source: https://en.wikipedia.org/wiki/Note_value\r\nconst DATA = [\r\n [\r\n 0.125,\r\n \"dl\",\r\n [\"large\", \"duplex longa\", \"maxima\", \"octuple\", \"octuple whole\"],\r\n ],\r\n [0.25, \"l\", [\"long\", \"longa\"]],\r\n [0.5, \"d\", [\"double whole\", \"double\", \"breve\"]],\r\n [1, \"w\", [\"whole\", \"semibreve\"]],\r\n [2, \"h\", [\"half\", \"minim\"]],\r\n [4, \"q\", [\"quarter\", \"crotchet\"]],\r\n [8, \"e\", [\"eighth\", \"quaver\"]],\r\n [16, \"s\", [\"sixteenth\", \"semiquaver\"]],\r\n [32, \"t\", [\"thirty-second\", \"demisemiquaver\"]],\r\n [64, \"sf\", [\"sixty-fourth\", \"hemidemisemiquaver\"]],\r\n [128, \"h\", [\"hundred twenty-eighth\"]],\r\n [256, \"th\", [\"two hundred fifty-sixth\"]],\r\n];\n\nconst VALUES = [];\r\nDATA.forEach(([denominator, shorthand, names]) => add(denominator, shorthand, names));\r\nconst NoDuration = {\r\n empty: true,\r\n name: \"\",\r\n value: 0,\r\n fraction: [0, 0],\r\n shorthand: \"\",\r\n dots: \"\",\r\n names: [],\r\n};\r\nfunction names() {\r\n return VALUES.reduce((names, duration) => {\r\n duration.names.forEach((name) => names.push(name));\r\n return names;\r\n }, []);\r\n}\r\nfunction shorthands() {\r\n return VALUES.map((dur) => dur.shorthand);\r\n}\r\nconst REGEX = /^([^.]+)(\\.*)$/;\r\nfunction get(name) {\r\n const [_, simple, dots] = REGEX.exec(name) || [];\r\n const base = VALUES.find((dur) => dur.shorthand === simple || dur.names.includes(simple));\r\n if (!base) {\r\n return NoDuration;\r\n }\r\n const fraction = calcDots(base.fraction, dots.length);\r\n const value = fraction[0] / fraction[1];\r\n return { ...base, name, dots, value, fraction };\r\n}\r\nconst value = (name) => get(name).value;\r\nconst fraction = (name) => get(name).fraction;\r\nvar index = { names, shorthands, get, value, fraction };\r\n//// PRIVATE ////\r\nfunction add(denominator, shorthand, names) {\r\n VALUES.push({\r\n empty: false,\r\n dots: \"\",\r\n name: \"\",\r\n value: 1 / denominator,\r\n fraction: denominator < 1 ? [1 / denominator, 1] : [1, denominator],\r\n shorthand,\r\n names,\r\n });\r\n}\r\nfunction calcDots(fraction, dots) {\r\n const pow = Math.pow(2, dots);\r\n let numerator = fraction[0] * pow;\r\n let denominator = fraction[1] * pow;\r\n const base = numerator;\r\n // add fractions\r\n for (let i = 0; i < dots; i++) {\r\n numerator += base / Math.pow(2, i + 1);\r\n }\r\n // simplify\r\n while (numerator % 2 === 0 && denominator % 2 === 0) {\r\n numerator /= 2;\r\n denominator /= 2;\r\n }\r\n return [numerator, denominator];\r\n}\n\nexport default index;\nexport { fraction, get, names, shorthands, value };\n//# sourceMappingURL=index.es.js.map\n","import { isPitch, altToAcc, isNamed, deprecate, accToAlt, interval } from '@tonaljs/core';\n\nconst NoRomanNumeral = { empty: true, name: \"\", chordType: \"\" };\r\nconst cache = {};\r\n/**\r\n * Get properties of a roman numeral string\r\n *\r\n * @function\r\n * @param {string} - the roman numeral string (can have type, like: Imaj7)\r\n * @return {Object} - the roman numeral properties\r\n * @param {string} name - the roman numeral (tonic)\r\n * @param {string} type - the chord type\r\n * @param {string} num - the number (1 = I, 2 = II...)\r\n * @param {boolean} major - major or not\r\n *\r\n * @example\r\n * romanNumeral(\"VIIb5\") // => { name: \"VII\", type: \"b5\", num: 7, major: true }\r\n */\r\nfunction get(src) {\r\n return typeof src === \"string\"\r\n ? cache[src] || (cache[src] = parse(src))\r\n : typeof src === \"number\"\r\n ? get(NAMES[src] || \"\")\r\n : isPitch(src)\r\n ? fromPitch(src)\r\n : isNamed(src)\r\n ? get(src.name)\r\n : NoRomanNumeral;\r\n}\r\nconst romanNumeral = deprecate(\"RomanNumeral.romanNumeral\", \"RomanNumeral.get\", get);\r\n/**\r\n * Get roman numeral names\r\n *\r\n * @function\r\n * @param {boolean} [isMajor=true]\r\n * @return {Array}\r\n *\r\n * @example\r\n * names() // => [\"I\", \"II\", \"III\", \"IV\", \"V\", \"VI\", \"VII\"]\r\n */\r\nfunction names(major = true) {\r\n return (major ? NAMES : NAMES_MINOR).slice();\r\n}\r\nfunction fromPitch(pitch) {\r\n return get(altToAcc(pitch.alt) + NAMES[pitch.step]);\r\n}\r\nconst REGEX = /^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;\r\nfunction tokenize(str) {\r\n return (REGEX.exec(str) || [\"\", \"\", \"\", \"\"]);\r\n}\r\nconst ROMANS = \"I II III IV V VI VII\";\r\nconst NAMES = ROMANS.split(\" \");\r\nconst NAMES_MINOR = ROMANS.toLowerCase().split(\" \");\r\nfunction parse(src) {\r\n const [name, acc, roman, chordType] = tokenize(src);\r\n if (!roman) {\r\n return NoRomanNumeral;\r\n }\r\n const upperRoman = roman.toUpperCase();\r\n const step = NAMES.indexOf(upperRoman);\r\n const alt = accToAlt(acc);\r\n const dir = 1;\r\n return {\r\n empty: false,\r\n name,\r\n roman,\r\n interval: interval({ step, alt, dir }).name,\r\n acc,\r\n chordType,\r\n alt,\r\n step,\r\n major: roman === upperRoman,\r\n oct: 0,\r\n dir,\r\n };\r\n}\r\nvar index = {\r\n names,\r\n get,\r\n // deprecated\r\n romanNumeral,\r\n};\n\nexport default index;\nexport { get, names, tokenize };\n//# sourceMappingURL=index.es.js.map\n","import { note, transpose, altToAcc, accToAlt } from '@tonaljs/core';\nimport { transposeFifths } from '@tonaljs/note';\nimport { get } from '@tonaljs/roman-numeral';\n\nconst Empty = Object.freeze([]);\r\nconst NoKey = {\r\n type: \"major\",\r\n tonic: \"\",\r\n alteration: 0,\r\n keySignature: \"\",\r\n};\r\nconst NoKeyScale = {\r\n tonic: \"\",\r\n grades: Empty,\r\n intervals: Empty,\r\n scale: Empty,\r\n chords: Empty,\r\n chordsHarmonicFunction: Empty,\r\n chordScales: Empty,\r\n};\r\nconst NoMajorKey = {\r\n ...NoKey,\r\n ...NoKeyScale,\r\n type: \"major\",\r\n minorRelative: \"\",\r\n scale: Empty,\r\n secondaryDominants: Empty,\r\n secondaryDominantsMinorRelative: Empty,\r\n substituteDominants: Empty,\r\n substituteDominantsMinorRelative: Empty,\r\n};\r\nconst NoMinorKey = {\r\n ...NoKey,\r\n type: \"minor\",\r\n relativeMajor: \"\",\r\n natural: NoKeyScale,\r\n harmonic: NoKeyScale,\r\n melodic: NoKeyScale,\r\n};\r\nconst mapScaleToType = (scale, list, sep = \"\") => list.map((type, i) => `${scale[i]}${sep}${type}`);\r\nfunction keyScale(grades, chords, harmonicFunctions, chordScales) {\r\n return (tonic) => {\r\n const intervals = grades.map((gr) => get(gr).interval || \"\");\r\n const scale = intervals.map((interval) => transpose(tonic, interval));\r\n return {\r\n tonic,\r\n grades,\r\n intervals,\r\n scale,\r\n chords: mapScaleToType(scale, chords),\r\n chordsHarmonicFunction: harmonicFunctions.slice(),\r\n chordScales: mapScaleToType(scale, chordScales, \" \"),\r\n };\r\n };\r\n}\r\nconst distInFifths = (from, to) => {\r\n const f = note(from);\r\n const t = note(to);\r\n return f.empty || t.empty ? 0 : t.coord[0] - f.coord[0];\r\n};\r\nconst MajorScale = keyScale(\"I II III IV V VI VII\".split(\" \"), \"maj7 m7 m7 maj7 7 m7 m7b5\".split(\" \"), \"T SD T SD D T D\".split(\" \"), \"major,dorian,phrygian,lydian,mixolydian,minor,locrian\".split(\",\"));\r\nconst NaturalScale = keyScale(\"I II bIII IV V bVI bVII\".split(\" \"), \"m7 m7b5 maj7 m7 m7 maj7 7\".split(\" \"), \"T SD T SD D SD SD\".split(\" \"), \"minor,locrian,major,dorian,phrygian,lydian,mixolydian\".split(\",\"));\r\nconst HarmonicScale = keyScale(\"I II bIII IV V bVI VII\".split(\" \"), \"mMaj7 m7b5 +maj7 m7 7 maj7 o7\".split(\" \"), \"T SD T SD D SD D\".split(\" \"), \"harmonic minor,locrian 6,major augmented,lydian diminished,phrygian dominant,lydian #9,ultralocrian\".split(\",\"));\r\nconst MelodicScale = keyScale(\"I II bIII IV V VI VII\".split(\" \"), \"m6 m7 +maj7 7 7 m7b5 m7b5\".split(\" \"), \"T SD T SD D \".split(\" \"), \"melodic minor,dorian b2,lydian augmented,lydian dominant,mixolydian b6,locrian #2,altered\".split(\",\"));\r\n/**\r\n * Get a major key properties in a given tonic\r\n * @param tonic\r\n */\r\nfunction majorKey(tonic) {\r\n const pc = note(tonic).pc;\r\n if (!pc)\r\n return NoMajorKey;\r\n const keyScale = MajorScale(pc);\r\n const alteration = distInFifths(\"C\", pc);\r\n const romanInTonic = (src) => {\r\n const r = get(src);\r\n if (r.empty)\r\n return \"\";\r\n return transpose(tonic, r.interval) + r.chordType;\r\n };\r\n return {\r\n ...keyScale,\r\n type: \"major\",\r\n minorRelative: transpose(pc, \"-3m\"),\r\n alteration,\r\n keySignature: altToAcc(alteration),\r\n secondaryDominants: \"- VI7 VII7 I7 II7 III7 -\".split(\" \").map(romanInTonic),\r\n secondaryDominantsMinorRelative: \"- IIIm7b5 IV#m7 Vm7 VIm7 VIIm7b5 -\"\r\n .split(\" \")\r\n .map(romanInTonic),\r\n substituteDominants: \"- bIII7 IV7 bV7 bVI7 bVII7 -\"\r\n .split(\" \")\r\n .map(romanInTonic),\r\n substituteDominantsMinorRelative: \"- IIIm7 Im7 IIbm7 VIm7 IVm7 -\"\r\n .split(\" \")\r\n .map(romanInTonic),\r\n };\r\n}\r\n/**\r\n * Get minor key properties in a given tonic\r\n * @param tonic\r\n */\r\nfunction minorKey(tnc) {\r\n const pc = note(tnc).pc;\r\n if (!pc)\r\n return NoMinorKey;\r\n const alteration = distInFifths(\"C\", pc) - 3;\r\n return {\r\n type: \"minor\",\r\n tonic: pc,\r\n relativeMajor: transpose(pc, \"3m\"),\r\n alteration,\r\n keySignature: altToAcc(alteration),\r\n natural: NaturalScale(pc),\r\n harmonic: HarmonicScale(pc),\r\n melodic: MelodicScale(pc),\r\n };\r\n}\r\n/**\r\n * Given a key signature, returns the tonic of the major key\r\n * @param sigature\r\n * @example\r\n * majorTonicFromKeySignature('###') // => 'A'\r\n */\r\nfunction majorTonicFromKeySignature(sig) {\r\n if (typeof sig === \"number\") {\r\n return transposeFifths(\"C\", sig);\r\n }\r\n else if (typeof sig === \"string\" && /^b+|#+$/.test(sig)) {\r\n return transposeFifths(\"C\", accToAlt(sig));\r\n }\r\n return null;\r\n}\r\nvar index = { majorKey, majorTonicFromKeySignature, minorKey };\n\nexport default index;\nexport { majorKey, majorTonicFromKeySignature, minorKey };\n//# sourceMappingURL=index.es.js.map\n","import { deprecate } from '@tonaljs/core';\nimport { chromaToIntervals, EmptyPcset } from '@tonaljs/pcset';\n\nconst DATA = [\r\n [0, 2773, 0, \"ionian\", \"\", \"Maj7\", \"major\"],\r\n [1, 2902, 2, \"dorian\", \"m\", \"m7\"],\r\n [2, 3418, 4, \"phrygian\", \"m\", \"m7\"],\r\n [3, 2741, -1, \"lydian\", \"\", \"Maj7\"],\r\n [4, 2774, 1, \"mixolydian\", \"\", \"7\"],\r\n [5, 2906, 3, \"aeolian\", \"m\", \"m7\", \"minor\"],\r\n [6, 3434, 5, \"locrian\", \"dim\", \"m7b5\"],\r\n];\n\nconst NoMode = {\r\n ...EmptyPcset,\r\n name: \"\",\r\n alt: 0,\r\n modeNum: NaN,\r\n triad: \"\",\r\n seventh: \"\",\r\n aliases: [],\r\n};\r\nconst modes = DATA.map(toMode);\r\nconst index = {};\r\nmodes.forEach((mode) => {\r\n index[mode.name] = mode;\r\n mode.aliases.forEach((alias) => {\r\n index[alias] = mode;\r\n });\r\n});\r\n/**\r\n * Get a Mode by it's name\r\n *\r\n * @example\r\n * get('dorian')\r\n * // =>\r\n * // {\r\n * // intervals: [ '1P', '2M', '3m', '4P', '5P', '6M', '7m' ],\r\n * // modeNum: 1,\r\n * // chroma: '101101010110',\r\n * // normalized: '101101010110',\r\n * // name: 'dorian',\r\n * // setNum: 2902,\r\n * // alt: 2,\r\n * // triad: 'm',\r\n * // seventh: 'm7',\r\n * // aliases: []\r\n * // }\r\n */\r\nfunction get(name) {\r\n return typeof name === \"string\"\r\n ? index[name.toLowerCase()] || NoMode\r\n : name && name.name\r\n ? get(name.name)\r\n : NoMode;\r\n}\r\nconst mode = deprecate(\"Mode.mode\", \"Mode.get\", get);\r\n/**\r\n * Get a list of all modes\r\n */\r\nfunction all() {\r\n return modes.slice();\r\n}\r\nconst entries = deprecate(\"Mode.mode\", \"Mode.all\", all);\r\n/**\r\n * Get a list of all mode names\r\n */\r\nfunction names() {\r\n return modes.map((mode) => mode.name);\r\n}\r\nfunction toMode(mode) {\r\n const [modeNum, setNum, alt, name, triad, seventh, alias] = mode;\r\n const aliases = alias ? [alias] : [];\r\n const chroma = Number(setNum).toString(2);\r\n const intervals = chromaToIntervals(chroma);\r\n return {\r\n empty: false,\r\n intervals,\r\n modeNum,\r\n chroma,\r\n normalized: chroma,\r\n name,\r\n setNum,\r\n alt,\r\n triad,\r\n seventh,\r\n aliases,\r\n };\r\n}\r\nvar index$1 = {\r\n get,\r\n names,\r\n all,\r\n // deprecated\r\n entries,\r\n mode,\r\n};\n\nexport default index$1;\nexport { all, entries, get, mode, names };\n//# sourceMappingURL=index.es.js.map\n","import { tokenize } from '@tonaljs/chord';\nimport { transpose, interval, distance } from '@tonaljs/core';\nimport { get } from '@tonaljs/roman-numeral';\n\n/**\r\n * Given a tonic and a chord list expressed with roman numeral notation\r\n * returns the progression expressed with leadsheet chords symbols notation\r\n * @example\r\n * fromRomanNumerals(\"C\", [\"I\", \"IIm7\", \"V7\"]);\r\n * // => [\"C\", \"Dm7\", \"G7\"]\r\n */\r\nfunction fromRomanNumerals(tonic, chords) {\r\n const romanNumerals = chords.map(get);\r\n return romanNumerals.map((rn) => transpose(tonic, interval(rn)) + rn.chordType);\r\n}\r\n/**\r\n * Given a tonic and a chord list with leadsheet symbols notation,\r\n * return the chord list with roman numeral notation\r\n * @example\r\n * toRomanNumerals(\"C\", [\"CMaj7\", \"Dm7\", \"G7\"]);\r\n * // => [\"IMaj7\", \"IIm7\", \"V7\"]\r\n */\r\nfunction toRomanNumerals(tonic, chords) {\r\n return chords.map((chord) => {\r\n const [note, chordType] = tokenize(chord);\r\n const intervalName = distance(tonic, note);\r\n const roman = get(interval(intervalName));\r\n return roman.name + chordType;\r\n });\r\n}\r\nvar index = { fromRomanNumerals, toRomanNumerals };\n\nexport default index;\nexport { fromRomanNumerals, toRomanNumerals };\n//# sourceMappingURL=index.es.js.map\n","import { compact, range } from '@tonaljs/collection';\nimport { toMidi, midiToNoteName } from '@tonaljs/midi';\n\n/**\r\n * Create a numeric range. You supply a list of notes or numbers and it will\r\n * be connected to create complex ranges.\r\n *\r\n * @param {Array} array - the list of notes or numbers used\r\n * @return {Array} an array of numbers or empty array if not valid parameters\r\n *\r\n * @example\r\n * numeric([\"C5\", \"C4\"]) // => [ 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60 ]\r\n * // it works midi notes\r\n * numeric([10, 5]) // => [ 10, 9, 8, 7, 6, 5 ]\r\n * // complex range\r\n * numeric([\"C4\", \"E4\", \"Bb3\"]) // => [60, 61, 62, 63, 64, 63, 62, 61, 60, 59, 58]\r\n */\r\nfunction numeric(notes) {\r\n const midi = compact(notes.map(toMidi));\r\n if (!notes.length || midi.length !== notes.length) {\r\n // there is no valid notes\r\n return [];\r\n }\r\n return midi.reduce((result, note) => {\r\n const last = result[result.length - 1];\r\n return result.concat(range(last, note).slice(1));\r\n }, [midi[0]]);\r\n}\r\n/**\r\n * Create a range of chromatic notes. The altered notes will use flats.\r\n *\r\n * @function\r\n * @param {String|Array} list - the list of notes or midi note numbers\r\n * @return {Array} an array of note names\r\n *\r\n * @example\r\n * Range.chromatic(\"C2 E2 D2\") // => [\"C2\", \"Db2\", \"D2\", \"Eb2\", \"E2\", \"Eb2\", \"D2\"]\r\n * // with sharps\r\n * Range.chromatic(\"C2 C3\", true) // => [ \"C2\", \"C#2\", \"D2\", \"D#2\", \"E2\", \"F2\", \"F#2\", \"G2\", \"G#2\", \"A2\", \"A#2\", \"B2\", \"C3\" ]\r\n */\r\nfunction chromatic(notes, options) {\r\n return numeric(notes).map((midi) => midiToNoteName(midi, options));\r\n}\r\nvar index = { numeric, chromatic };\n\nexport default index;\nexport { chromatic, numeric };\n//# sourceMappingURL=index.es.js.map\n","import { all } from '@tonaljs/chord-type';\nimport { rotate } from '@tonaljs/collection';\nimport { note, transpose, deprecate } from '@tonaljs/core';\nimport { sortedUniqNames } from '@tonaljs/note';\nimport { isSubsetOf, isSupersetOf, modes } from '@tonaljs/pcset';\nimport { names as names$1, get as get$1, all as all$1 } from '@tonaljs/scale-type';\n\n/**\r\n * References:\r\n * - https://www.researchgate.net/publication/327567188_An_Algorithm_for_Spelling_the_Pitches_of_Any_Musical_Scale\r\n * @module scale\r\n */\r\nconst NoScale = {\r\n empty: true,\r\n name: \"\",\r\n type: \"\",\r\n tonic: null,\r\n setNum: NaN,\r\n chroma: \"\",\r\n normalized: \"\",\r\n aliases: [],\r\n notes: [],\r\n intervals: [],\r\n};\r\n/**\r\n * Given a string with a scale name and (optionally) a tonic, split\r\n * that components.\r\n *\r\n * It retuns an array with the form [ name, tonic ] where tonic can be a\r\n * note name or null and name can be any arbitrary string\r\n * (this function doesn\"t check if that scale name exists)\r\n *\r\n * @function\r\n * @param {string} name - the scale name\r\n * @return {Array} an array [tonic, name]\r\n * @example\r\n * tokenize(\"C mixolydean\") // => [\"C\", \"mixolydean\"]\r\n * tokenize(\"anything is valid\") // => [\"\", \"anything is valid\"]\r\n * tokenize() // => [\"\", \"\"]\r\n */\r\nfunction tokenize(name) {\r\n if (typeof name !== \"string\") {\r\n return [\"\", \"\"];\r\n }\r\n const i = name.indexOf(\" \");\r\n const tonic = note(name.substring(0, i));\r\n if (tonic.empty) {\r\n const n = note(name);\r\n return n.empty ? [\"\", name] : [n.name, \"\"];\r\n }\r\n const type = name.substring(tonic.name.length + 1);\r\n return [tonic.name, type.length ? type : \"\"];\r\n}\r\n/**\r\n * Get all scale names\r\n * @function\r\n */\r\nconst names = names$1;\r\n/**\r\n * Get a Scale from a scale name.\r\n */\r\nfunction get(src) {\r\n const tokens = Array.isArray(src) ? src : tokenize(src);\r\n const tonic = note(tokens[0]).name;\r\n const st = get$1(tokens[1]);\r\n if (st.empty) {\r\n return NoScale;\r\n }\r\n const type = st.name;\r\n const notes = tonic\r\n ? st.intervals.map((i) => transpose(tonic, i))\r\n : [];\r\n const name = tonic ? tonic + \" \" + type : type;\r\n return { ...st, name, type, tonic, notes };\r\n}\r\nconst scale = deprecate(\"Scale.scale\", \"Scale.get\", get);\r\n/**\r\n * Get all chords that fits a given scale\r\n *\r\n * @function\r\n * @param {string} name - the scale name\r\n * @return {Array} - the chord names\r\n *\r\n * @example\r\n * scaleChords(\"pentatonic\") // => [\"5\", \"64\", \"M\", \"M6\", \"Madd9\", \"Msus2\"]\r\n */\r\nfunction scaleChords(name) {\r\n const s = get(name);\r\n const inScale = isSubsetOf(s.chroma);\r\n return all()\r\n .filter((chord) => inScale(chord.chroma))\r\n .map((chord) => chord.aliases[0]);\r\n}\r\n/**\r\n * Get all scales names that are a superset of the given one\r\n * (has the same notes and at least one more)\r\n *\r\n * @function\r\n * @param {string} name\r\n * @return {Array} a list of scale names\r\n * @example\r\n * extended(\"major\") // => [\"bebop\", \"bebop dominant\", \"bebop major\", \"chromatic\", \"ichikosucho\"]\r\n */\r\nfunction extended(name) {\r\n const s = get(name);\r\n const isSuperset = isSupersetOf(s.chroma);\r\n return all$1()\r\n .filter((scale) => isSuperset(scale.chroma))\r\n .map((scale) => scale.name);\r\n}\r\n/**\r\n * Find all scales names that are a subset of the given one\r\n * (has less notes but all from the given scale)\r\n *\r\n * @function\r\n * @param {string} name\r\n * @return {Array} a list of scale names\r\n *\r\n * @example\r\n * reduced(\"major\") // => [\"ionian pentatonic\", \"major pentatonic\", \"ritusen\"]\r\n */\r\nfunction reduced(name) {\r\n const isSubset = isSubsetOf(get(name).chroma);\r\n return all$1()\r\n .filter((scale) => isSubset(scale.chroma))\r\n .map((scale) => scale.name);\r\n}\r\n/**\r\n * Given an array of notes, return the scale: a pitch class set starting from\r\n * the first note of the array\r\n *\r\n * @function\r\n * @param {string[]} notes\r\n * @return {string[]} pitch classes with same tonic\r\n * @example\r\n * scaleNotes(['C4', 'c3', 'C5', 'C4', 'c4']) // => [\"C\"]\r\n * scaleNotes(['D4', 'c#5', 'A5', 'F#6']) // => [\"D\", \"F#\", \"A\", \"C#\"]\r\n */\r\nfunction scaleNotes(notes) {\r\n const pcset = notes.map((n) => note(n).pc).filter((x) => x);\r\n const tonic = pcset[0];\r\n const scale = sortedUniqNames(pcset);\r\n return rotate(scale.indexOf(tonic), scale);\r\n}\r\n/**\r\n * Find mode names of a scale\r\n *\r\n * @function\r\n * @param {string} name - scale name\r\n * @example\r\n * modeNames(\"C pentatonic\") // => [\r\n * [\"C\", \"major pentatonic\"],\r\n * [\"D\", \"egyptian\"],\r\n * [\"E\", \"malkos raga\"],\r\n * [\"G\", \"ritusen\"],\r\n * [\"A\", \"minor pentatonic\"]\r\n * ]\r\n */\r\nfunction modeNames(name) {\r\n const s = get(name);\r\n if (s.empty) {\r\n return [];\r\n }\r\n const tonics = s.tonic ? s.notes : s.intervals;\r\n return modes(s.chroma)\r\n .map((chroma, i) => {\r\n const modeName = get(chroma).name;\r\n return modeName ? [tonics[i], modeName] : [\"\", \"\"];\r\n })\r\n .filter((x) => x[0]);\r\n}\r\nvar index = {\r\n get,\r\n names,\r\n extended,\r\n modeNames,\r\n reduced,\r\n scaleChords,\r\n scaleNotes,\r\n tokenize,\r\n // deprecated\r\n scale,\r\n};\n\nexport default index;\nexport { extended, get, modeNames, names, reduced, scale, scaleChords, scaleNotes, tokenize };\n//# sourceMappingURL=index.es.js.map\n","// CONSTANTS\r\nconst NONE = {\r\n empty: true,\r\n name: \"\",\r\n upper: undefined,\r\n lower: undefined,\r\n type: undefined,\r\n additive: [],\r\n};\r\nconst NAMES = [\"4/4\", \"3/4\", \"2/4\", \"2/2\", \"12/8\", \"9/8\", \"6/8\", \"3/8\"];\r\n// PUBLIC API\r\nfunction names() {\r\n return NAMES.slice();\r\n}\r\nconst REGEX = /^(\\d?\\d(?:\\+\\d)*)\\/(\\d)$/;\r\nconst CACHE = new Map();\r\nfunction get(literal) {\r\n const cached = CACHE.get(literal);\r\n if (cached) {\r\n return cached;\r\n }\r\n const ts = build(parse(literal));\r\n CACHE.set(literal, ts);\r\n return ts;\r\n}\r\nfunction parse(literal) {\r\n if (typeof literal === \"string\") {\r\n const [_, up, low] = REGEX.exec(literal) || [];\r\n return parse([up, low]);\r\n }\r\n const [up, down] = literal;\r\n const denominator = +down;\r\n if (typeof up === \"number\") {\r\n return [up, denominator];\r\n }\r\n const list = up.split(\"+\").map((n) => +n);\r\n return list.length === 1 ? [list[0], denominator] : [list, denominator];\r\n}\r\nvar index = { names, parse, get };\r\n// PRIVATE\r\nfunction build([up, down]) {\r\n const upper = Array.isArray(up) ? up.reduce((a, b) => a + b, 0) : up;\r\n const lower = down;\r\n if (upper === 0 || lower === 0) {\r\n return NONE;\r\n }\r\n const name = Array.isArray(up) ? `${up.join(\"+\")}/${down}` : `${up}/${down}`;\r\n const additive = Array.isArray(up) ? up : [];\r\n const type = lower === 4 || lower === 2\r\n ? \"simple\"\r\n : lower === 8 && upper % 3 === 0\r\n ? \"compound\"\r\n : \"irregular\";\r\n return {\r\n empty: false,\r\n name,\r\n type,\r\n upper,\r\n lower,\r\n additive,\r\n };\r\n}\n\nexport default index;\nexport { get, names, parse };\n//# sourceMappingURL=index.es.js.map\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tonaljs/abc-notation'), require('@tonaljs/array'), require('@tonaljs/chord'), require('@tonaljs/chord-type'), require('@tonaljs/collection'), require('@tonaljs/core'), require('@tonaljs/duration-value'), require('@tonaljs/interval'), require('@tonaljs/key'), require('@tonaljs/midi'), require('@tonaljs/mode'), require('@tonaljs/note'), require('@tonaljs/pcset'), require('@tonaljs/progression'), require('@tonaljs/range'), require('@tonaljs/roman-numeral'), require('@tonaljs/scale'), require('@tonaljs/scale-type'), require('@tonaljs/time-signature')) :\n typeof define === 'function' && define.amd ? define(['exports', '@tonaljs/abc-notation', '@tonaljs/array', '@tonaljs/chord', '@tonaljs/chord-type', '@tonaljs/collection', '@tonaljs/core', '@tonaljs/duration-value', '@tonaljs/interval', '@tonaljs/key', '@tonaljs/midi', '@tonaljs/mode', '@tonaljs/note', '@tonaljs/pcset', '@tonaljs/progression', '@tonaljs/range', '@tonaljs/roman-numeral', '@tonaljs/scale', '@tonaljs/scale-type', '@tonaljs/time-signature'], factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Tonal = {}, global.abcNotation, global.array, global.chord, global.ChordType, global.collection, global.Core, global.durationValue, global.interval, global.key, global.midi, global.mode, global.note, global.Pcset, global.progression, global.range, global.romanNumeral, global.scale, global.ScaleType, global.timeSignature));\n}(this, (function (exports, abcNotation, array, chord, ChordType, collection, Core, durationValue, interval, key, midi, mode, note, Pcset, progression, range, romanNumeral, scale, ScaleType, timeSignature) { 'use strict';\n\n function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\n\n function _interopNamespace(e) {\n if (e && e.__esModule) { return e; } else {\n var n = Object.create(null);\n if (e) {\n Object.keys(e).forEach(function (k) {\n if (k !== 'default') {\n var d = Object.getOwnPropertyDescriptor(e, k);\n Object.defineProperty(n, k, d.get ? d : {\n enumerable: true,\n get: function () {\n return e[k];\n }\n });\n }\n });\n }\n n['default'] = e;\n return Object.freeze(n);\n }\n }\n\n var abcNotation__default = /*#__PURE__*/_interopDefaultLegacy(abcNotation);\n var array__namespace = /*#__PURE__*/_interopNamespace(array);\n var chord__default = /*#__PURE__*/_interopDefaultLegacy(chord);\n var ChordType__default = /*#__PURE__*/_interopDefaultLegacy(ChordType);\n var collection__default = /*#__PURE__*/_interopDefaultLegacy(collection);\n var Core__namespace = /*#__PURE__*/_interopNamespace(Core);\n var durationValue__default = /*#__PURE__*/_interopDefaultLegacy(durationValue);\n var interval__default = /*#__PURE__*/_interopDefaultLegacy(interval);\n var key__default = /*#__PURE__*/_interopDefaultLegacy(key);\n var midi__default = /*#__PURE__*/_interopDefaultLegacy(midi);\n var mode__default = /*#__PURE__*/_interopDefaultLegacy(mode);\n var note__default = /*#__PURE__*/_interopDefaultLegacy(note);\n var Pcset__default = /*#__PURE__*/_interopDefaultLegacy(Pcset);\n var progression__default = /*#__PURE__*/_interopDefaultLegacy(progression);\n var range__default = /*#__PURE__*/_interopDefaultLegacy(range);\n var romanNumeral__default = /*#__PURE__*/_interopDefaultLegacy(romanNumeral);\n var scale__default = /*#__PURE__*/_interopDefaultLegacy(scale);\n var ScaleType__default = /*#__PURE__*/_interopDefaultLegacy(ScaleType);\n var timeSignature__default = /*#__PURE__*/_interopDefaultLegacy(timeSignature);\n\n // deprecated (backwards compatibility)\r\n var Tonal = Core__namespace;\r\n var PcSet = Pcset__default['default'];\r\n var ChordDictionary = ChordType__default['default'];\r\n var ScaleDictionary = ScaleType__default['default'];\n\n Object.keys(Core).forEach(function (k) {\n if (k !== 'default') Object.defineProperty(exports, k, {\n enumerable: true,\n get: function () {\n return Core[k];\n }\n });\n });\n Object.defineProperty(exports, 'AbcNotation', {\n enumerable: true,\n get: function () {\n return abcNotation__default['default'];\n }\n });\n exports.Array = array__namespace;\n Object.defineProperty(exports, 'Chord', {\n enumerable: true,\n get: function () {\n return chord__default['default'];\n }\n });\n Object.defineProperty(exports, 'ChordType', {\n enumerable: true,\n get: function () {\n return ChordType__default['default'];\n }\n });\n Object.defineProperty(exports, 'Collection', {\n enumerable: true,\n get: function () {\n return collection__default['default'];\n }\n });\n exports.Core = Core__namespace;\n Object.defineProperty(exports, 'DurationValue', {\n enumerable: true,\n get: function () {\n return durationValue__default['default'];\n }\n });\n Object.defineProperty(exports, 'Interval', {\n enumerable: true,\n get: function () {\n return interval__default['default'];\n }\n });\n Object.defineProperty(exports, 'Key', {\n enumerable: true,\n get: function () {\n return key__default['default'];\n }\n });\n Object.defineProperty(exports, 'Midi', {\n enumerable: true,\n get: function () {\n return midi__default['default'];\n }\n });\n Object.defineProperty(exports, 'Mode', {\n enumerable: true,\n get: function () {\n return mode__default['default'];\n }\n });\n Object.defineProperty(exports, 'Note', {\n enumerable: true,\n get: function () {\n return note__default['default'];\n }\n });\n Object.defineProperty(exports, 'Pcset', {\n enumerable: true,\n get: function () {\n return Pcset__default['default'];\n }\n });\n Object.defineProperty(exports, 'Progression', {\n enumerable: true,\n get: function () {\n return progression__default['default'];\n }\n });\n Object.defineProperty(exports, 'Range', {\n enumerable: true,\n get: function () {\n return range__default['default'];\n }\n });\n Object.defineProperty(exports, 'RomanNumeral', {\n enumerable: true,\n get: function () {\n return romanNumeral__default['default'];\n }\n });\n Object.defineProperty(exports, 'Scale', {\n enumerable: true,\n get: function () {\n return scale__default['default'];\n }\n });\n Object.defineProperty(exports, 'ScaleType', {\n enumerable: true,\n get: function () {\n return ScaleType__default['default'];\n }\n });\n Object.defineProperty(exports, 'TimeSignature', {\n enumerable: true,\n get: function () {\n return timeSignature__default['default'];\n }\n });\n exports.ChordDictionary = ChordDictionary;\n exports.PcSet = PcSet;\n exports.ScaleDictionary = ScaleDictionary;\n exports.Tonal = Tonal;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n//# sourceMappingURL=index.js.map\n"],"names":["fillStr","s","n","Array","Math","abs","join","deprecate","original","alternative","fn","args","console","warn","apply","this","isNamed","src","name","isPitch","pitch","step","alt","FIFTHS","STEPS_TO_OCTS","map","fifths","floor","encode","oct","dir","f","undefined","FIFTHS_TO_STEPS","decode","coord","o","i","unaltered","NoNote","empty","pc","acc","cache","Map","stepToLetter","charAt","altToAcc","accToAlt","length","note","cached","get","value","noteName","tokens","tokenizeNote","letter","octStr","charCodeAt","chroma","SEMI","height","m","midi","freq","pow","parse","props","pitchName","set","REGEX","str","exec","toUpperCase","replace","coordToNote","noteCoord","NoInterval","REGEX$1","RegExp","tokenizeInterval","cache$1","interval","num","q","t","TYPES","type","simple","test","qToAlt","semitones","SIZES","parse$1","altToQ","pitchName$1","coordToInterval","transpose","intervalName","note$1","interval$1","intervalCoord","distance","fromNote","toNote","from","to","fcoord","tcoord","character","times","tokenize","abcToScientificNotation","a","scientificToAbcNotation","toLowerCase","index","transpose$1","distance$1","sortedNoteNames","notes","filter","sort","b","arr","permutations","slice","reduce","perm","concat","e","pos","newPerm","splice","ascR","descR","len","rnd","random","range","rotate","compact","EmptyPcset","setNum","normalized","intervals","setNumToChroma","Number","toString","chromaToNumber","parseInt","isChroma","[object Object]","isArray","binary","listToChroma","isPcset","normalizedNum","split","_","chromaRotations","chromaToIntervals","chromaToPcset","pcset","IVLS","push","modes","normalize","r","isSubsetOf","isSupersetOf","isNoteIncludedIn","chromas","isEqual","s1","s2","isIncluded","NoChordType","quality","aliases","dictionary","chordType","all","entries","add","fullName","has","indexOf","getQuality","chord","get$1","forEach","alias","addAlias","ivls","names","index$1","x","symbols","removeAll","keys","Object","isMidi","arg","toMidi","L2","log","L440","freqToMidi","v","round","SHARPS","FLATS","midiToNoteName","options","isNaN","Infinity","sharps","pitchClass","midiToFreq","tuning","NAMES","toName","onlyNotes","array","tr","transposeBy","trBy","transposeFrom","trFrom","transposeFifths","nFifths","nOcts","trFifths","ascending","sortedNames","comparator","sortedUniqNames","simplify","nameBuilder","enharmonic","sameAccidentals","accidentals","octave","descending","fromMidi","fromMidiSharps","fromFreq","fromFreqSharps","IN","IQ","combinator","substract","fromSemitones","d","c","invert","addTo","other","coordA","coordB","NoScaleType","scale","scaleType","NoChord","symbol","root","rootDegree","tonic","NaN","NUM_TYPES","getChord","typeName","optionalTonic","optionalRoot","rootInterval","newNum","shift","detect","source","weight","foundRoot","every","some","otherNote","orderedNotes","findRoot","pcToName","record","namedSet","allModes","baseNote","baseChroma","found","mode","chordName","rootNote","findExactMatches","chordScales","isChordIncluded","extended","isSuperset","all$1","reduced","isSubset","VALUES","denominator","shorthand","dots","fraction","NoDuration","base","find","dur","includes","numerator","calcDots","duration","shorthands","NoRomanNumeral","roman","upperRoman","major","romanNumeral","ROMANS","NAMES_MINOR","Empty","freeze","NoKey","alteration","keySignature","NoKeyScale","grades","chords","chordsHarmonicFunction","NoMajorKey","minorRelative","secondaryDominants","secondaryDominantsMinorRelative","substituteDominants","substituteDominantsMinorRelative","NoMinorKey","relativeMajor","natural","harmonic","melodic","mapScaleToType","list","sep","keyScale","harmonicFunctions","gr","distInFifths","MajorScale","NaturalScale","HarmonicScale","MelodicScale","majorKey","romanInTonic","majorTonicFromKeySignature","sig","minorKey","tnc","NoMode","modeNum","triad","seventh","fromRomanNumerals","rn","toRomanNumerals","numeric","result","last","chromatic","NoScale","substring","st","names$1","modeNames","tonics","modeName","scaleChords","inScale","scaleNotes","NONE","upper","lower","additive","CACHE","literal","up","low","down","ts","build","exports","abcNotation","ChordType","collection","Core","durationValue","key","Pcset","progression","ScaleType","timeSignature","_interopDefaultLegacy","default","_interopNamespace","__esModule","create","k","getOwnPropertyDescriptor","defineProperty","enumerable","abcNotation__default","array__namespace","chord__default","ChordType__default","collection__default","Core__namespace","durationValue__default","interval__default","key__default","midi__default","mode__default","note__default","Pcset__default","progression__default","range__default","romanNumeral__default","scale__default","ScaleType__default","timeSignature__default","Tonal","PcSet","ChordDictionary","ScaleDictionary","factory","require$$0","require$$1","require$$2","require$$3","require$$4","require$$5","require$$6","require$$7","require$$8","require$$9","require$$10","require$$11","require$$12","require$$13","require$$14","require$$15","require$$16","require$$17","require$$18"],"mappings":"+KAMA,MAAMA,EAAU,CAACC,EAAGC,IAAMC,MAAMC,KAAKC,IAAIH,GAAK,GAAGI,KAAKL,GACtD,SAASM,EAAUC,EAAUC,EAAaC,GACtC,OAAO,YAAaC,GAGhB,OADAC,QAAQC,KAAK,GAAGL,wBAA+BC,MACxCC,EAAGI,MAAMC,KAAMJ,IAI9B,SAASK,EAAQC,GACb,OAAe,OAARA,GAA+B,iBAARA,GAAwC,iBAAbA,EAAIC,KAKjE,SAASC,EAAQC,GACb,OAAiB,OAAVA,GACc,iBAAVA,GACe,iBAAfA,EAAMC,MACQ,iBAAdD,EAAME,IAKrB,MAAMC,EAAS,CAAC,EAAG,EAAG,GAAI,EAAG,EAAG,EAAG,GAE7BC,EAAgBD,EAAOE,IAAKC,GAAWtB,KAAKuB,MAAgB,EAATD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