tonal 4.7.2 → 4.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";(()=>{var Ne=Object.defineProperty;var xt=(t,e)=>{for(var n in e)Ne(t,n,{get:e[n],enumerable:!0})};var ut={};xt(ut,{accToAlt:()=>V,altToAcc:()=>T,coordToInterval:()=>U,coordToNote:()=>L,decode:()=>ct,deprecate:()=>d,distance:()=>I,encode:()=>st,fillStr:()=>q,interval:()=>u,isNamed:()=>G,isPitch:()=>z,note:()=>s,stepToLetter:()=>Rt,tokenizeInterval:()=>$t,tokenizeNote:()=>J,transpose:()=>l});var q=(t,e)=>Array(Math.abs(e)+1).join(t);function d(t,e,n){return function(...r){return console.warn(`${t} is deprecated. Use ${e}.`),n.apply(this,r)}}function G(t){return t!==null&&typeof t=="object"&&typeof t.name=="string"}function z(t){return t!==null&&typeof t=="object"&&typeof t.step=="number"&&typeof t.alt=="number"}var _t=[0,2,4,-1,1,3,5],wt=_t.map(t=>Math.floor(t*7/12));function st(t){let{step:e,alt:n,oct:r,dir:o=1}=t,a=_t[e]+7*n;if(r===void 0)return[o*a];let m=r-wt[e]-4*n;return[o*a,o*m]}var Se=[3,0,4,1,5,2,6];function ct(t){let[e,n,r]=t,o=Se[je(e)],a=Math.floor((e+1)/7);if(n===void 0)return{step:o,alt:a,dir:r};let m=n+4*a+wt[o];return{step:o,alt:a,oct:m,dir:r}}function je(t){let e=(t+1)%7;return e<0?7+e:e}var Vt={empty:!0,name:"",pc:"",acc:""},Et=new Map,Rt=t=>"CDEFGAB".charAt(t),T=t=>t<0?q("b",-t):q("#",t),V=t=>t[0]==="b"?-t.length:t.length;function s(t){let e=JSON.stringify(t),n=Et.get(e);if(n)return n;let r=typeof t=="string"?Ee(t):z(t)?s(Ce(t)):G(t)?s(t.name):Vt;return Et.set(e,r),r}var Te=/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;function J(t){let e=Te.exec(t);return[e[1].toUpperCase(),e[2].replace(/x/g,"##"),e[3],e[4]]}function L(t){return s(ct(t))}var xe=(t,e)=>(t%e+e)%e,mt=[0,2,4,5,7,9,11];function Ee(t){let e=J(t);if(e[0]===""||e[3]!=="")return Vt;let n=e[0],r=e[1],o=e[2],a=(n.charCodeAt(0)+3)%7,m=V(r),i=o.length?+o:void 0,c=st({step:a,alt:m,oct:i}),y=n+r+o,P=n+r,b=(mt[a]+m+120)%12,f=i===void 0?xe(mt[a]+m,12)-12*99:mt[a]+m+12*(i+1),w=f>=0&&f<=127?f:null,F=i===void 0?null:Math.pow(2,(f-69)/12)*440;return{empty:!1,acc:r,alt:m,chroma:b,coord:c,freq:F,height:f,letter:n,midi:w,name:y,oct:i,pc:P,step:a}}function Ce(t){let{step:e,alt:n,oct:r}=t,o=Rt(e);if(!o)return"";let a=o+T(n);return r||r===0?a+r:a}var it={empty:!0,name:"",acc:""},De="([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})",_e="(AA|A|P|M|m|d|dd)([-+]?\\d+)",we=new RegExp("^"+De+"|"+_e+"$");function $t(t){let e=we.exec(`${t}`);return e===null?["",""]:e[1]?[e[1],e[2]]:[e[4],e[3]]}var Ct={};function u(t){return typeof t=="string"?Ct[t]||(Ct[t]=Ve(t)):z(t)?u($e(t)):G(t)?u(t.name):it}var Dt=[0,2,4,5,7,9,11],Ot="PMMPPMM";function Ve(t){let e=$t(t);if(e[0]==="")return it;let n=+e[0],r=e[1],o=(Math.abs(n)-1)%7,a=Ot[o];if(a==="M"&&r==="P")return it;let m=a==="M"?"majorable":"perfectable",i=""+n+r,c=n<0?-1:1,y=n===8||n===-8?n:c*(o+1),P=Re(m,r),b=Math.floor((Math.abs(n)-1)/7),f=c*(Dt[o]+P+12*b),w=(c*(Dt[o]+P)%12+12)%12,F=st({step:o,alt:P,oct:b,dir:c});return{empty:!1,name:i,num:n,q:r,step:o,alt:P,dir:c,type:m,simple:y,semitones:f,chroma:w,coord:F,oct:b}}function U(t,e){let[n,r=0]=t,o=n*7+r*12<0,a=e||o?[-n,-r,-1]:[n,r,1];return u(ct(a))}function Re(t,e){return e==="M"&&t==="majorable"||e==="P"&&t==="perfectable"?0:e==="m"&&t==="majorable"?-1:/^A+$/.test(e)?e.length:/^d+$/.test(e)?-1*(t==="perfectable"?e.length:e.length+1):0}function $e(t){let{step:e,alt:n,oct:r=0,dir:o}=t;if(!o)return"";let a=e+1+7*r,m=a===0?e+1:a,i=o<0?"-":"",c=Ot[e]==="M"?"majorable":"perfectable";return i+m+Oe(c,n)}function Oe(t,e){return e===0?t==="majorable"?"M":"P":e===-1&&t==="majorable"?"m":e>0?q("A",e):q("d",t==="perfectable"?e:e+1)}function l(t,e){let n=s(t),r=u(e);if(n.empty||r.empty)return"";let o=n.coord,a=r.coord,m=o.length===1?[o[0]+a[0]]:[o[0]+a[0],o[1]+a[1]];return L(m).name}function I(t,e){let n=s(t),r=s(e);if(n.empty||r.empty)return"";let o=n.coord,a=r.coord,m=a[0]-o[0],i=o.length===2&&a.length===2?a[1]-o[1]:-Math.floor(m*7/12),c=r.height===n.height&&r.midi!==null&&n.midi!==null&&n.step>r.step;return U([m,i],c).name}var kt=(t,e)=>Array(e+1).join(t),ke=/^(_{1,}|=|\^{1,}|)([abcdefgABCDEFG])([,']*)$/;function Ft(t){let e=ke.exec(t);return e?[e[1],e[2],e[3]]:["","",""]}function Y(t){let[e,n,r]=Ft(t);if(n==="")return"";let o=4;for(let m=0;m<r.length;m++)o+=r.charAt(m)===","?-1:1;let a=e[0]==="_"?e.replace(/_/g,"b"):e[0]==="^"?e.replace(/\^/g,"#"):"";return n.charCodeAt(0)>96?n.toUpperCase()+a+(o+1):n+a+o}function qt(t){let e=s(t);if(e.empty||!e.oct&&e.oct!==0)return"";let{letter:n,acc:r,oct:o}=e,a=r[0]==="b"?r.replace(/b/g,"_"):r.replace(/#/g,"^"),m=o>4?n.toLowerCase():n,i=o===5?"":o>4?kt("'",o-5):kt(",",4-o);return a+m+i}function Fe(t,e){return qt(l(Y(t),e))}function qe(t,e){return I(Y(t),Y(e))}var Ge={abcToScientificNotation:Y,scientificToAbcNotation:qt,tokenize:Ft,transpose:Fe,distance:qe};var Lt={};xt(Lt,{compact:()=>He,permutations:()=>zt,range:()=>Ue,rotate:()=>Be,shuffle:()=>Ke,sortedNoteNames:()=>Gt,sortedUniqNoteNames:()=>Xe});var ko=Array.isArray;function ze(t,e){let n=[];for(;e--;n[e]=e+t);return n}function Le(t,e){let n=[];for(;e--;n[e]=t-e);return n}function Ue(t,e){return t<e?ze(t,e-t+1):Le(t,t-e+1)}function Be(t,e){let n=e.length,r=(t%n+n)%n;return e.slice(r,n).concat(e.slice(0,r))}function He(t){return t.filter(e=>e===0||e)}function Gt(t){return t.map(n=>s(n)).filter(n=>!n.empty).sort((n,r)=>n.height-r.height).map(n=>n.name)}function Xe(t){return Gt(t).filter((e,n,r)=>n===0||e!==r[n-1])}function Ke(t,e=Math.random){let n,r,o=t.length;for(;o;)n=Math.floor(e()*o--),r=t[o],t[o]=t[n],t[n]=r;return t}function zt(t){return t.length===0?[[]]:zt(t.slice(1)).reduce((e,n)=>e.concat(t.map((r,o)=>{let a=n.slice();return a.splice(o,0,t[0]),a})),[])}function Qe(t,e){let n=[];for(;e--;n[e]=e+t);return n}function Je(t,e){let n=[];for(;e--;n[e]=t-e);return n}function x(t,e){return t<e?Qe(t,e-t+1):Je(t,t-e+1)}function S(t,e){let n=e.length,r=(t%n+n)%n;return e.slice(r,n).concat(e.slice(0,r))}function B(t){return t.filter(e=>e===0||e)}function Ye(t,e=Math.random){let n,r,o=t.length;for(;o;)n=Math.floor(e()*o--),r=t[o],t[o]=t[n],t[n]=r;return t}function Ut(t){return t.length===0?[[]]:Ut(t.slice(1)).reduce((e,n)=>e.concat(t.map((r,o)=>{let a=n.slice();return a.splice(o,0,t[0]),a})),[])}var Ze={compact:B,permutations:Ut,range:x,rotate:S,shuffle:Ye};var g={empty:!0,name:"",setNum:0,chroma:"000000000000",normalized:"000000000000",intervals:[]},lt=t=>Number(t).toString(2),Bt=t=>parseInt(t,2),We=/^[01]{12}$/;function Xt(t){return We.test(t)}var tn=t=>typeof t=="number"&&t>=0&&t<=4095,en=t=>t&&Xt(t.chroma),Ht={[g.chroma]:g};function p(t){let e=Xt(t)?t:tn(t)?lt(t):Array.isArray(t)?fn(t):en(t)?t.chroma:g.chroma;return Ht[e]=Ht[e]||pn(e)}var nn=d("Pcset.pcset","Pcset.get",p),rn=t=>p(t).chroma,on=t=>p(t).intervals,an=t=>p(t).setNum,mn=["1P","2m","2M","3m","3M","4P","5d","5P","6m","6M","7m","7M"];function sn(t){let e=[];for(let n=0;n<12;n++)t.charAt(n)==="1"&&e.push(mn[n]);return e}function cn(){return x(2048,4095).map(lt)}function H(t,e=!0){let r=p(t).chroma.split("");return B(r.map((o,a)=>{let m=S(a,r);return e&&m[0]==="0"?null:m.join("")}))}function un(t,e){return p(t).setNum===p(e).setNum}function R(t){let e=p(t).setNum;return n=>{let r=p(n).setNum;return e&&e!==r&&(r&e)===r}}function $(t){let e=p(t).setNum;return n=>{let r=p(n).setNum;return e&&e!==r&&(r|e)===r}}function Kt(t){let e=p(t);return n=>{let r=s(n);return e&&!r.empty&&e.chroma.charAt(r.chroma)==="1"}}function ln(t){let e=Kt(t);return n=>n.filter(e)}var Qt={get:p,chroma:rn,num:an,intervals:on,chromas:cn,isSupersetOf:$,isSubsetOf:R,isNoteIncludedIn:Kt,isEqual:un,filter:ln,modes:H,pcset:nn};function dn(t){let e=t.split("");return e.map((n,r)=>S(r,e).join(""))}function pn(t){let e=Bt(t),n=dn(t).map(Bt).filter(a=>a>=2048).sort()[0],r=lt(n),o=sn(t);return{empty:!1,name:"",setNum:e,chroma:t,normalized:r,intervals:o}}function fn(t){if(t.length===0)return g.chroma;let e,n=[0,0,0,0,0,0,0,0,0,0,0,0];for(let r=0;r<t.length;r++)e=s(t[r]),e.empty&&(e=u(t[r])),e.empty||(n[e.chroma]=1);return n.join("")}var Pn=[["1P 3M 5P","major","M ^ maj"],["1P 3M 5P 7M","major seventh","maj7 \u0394 ma7 M7 Maj7 ^7"],["1P 3M 5P 7M 9M","major ninth","maj9 \u03949 ^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 \u0394#4 \u0394#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 -\u03947 m\u0394 -^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 \xB0 o"],["1P 3m 5d 7d","diminished seventh","dim7 \xB07 o7"],["1P 3m 5d 7m","half-diminished","m7b5 \xF8 -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 \u03949#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 5A 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"]],Mn=Pn,hn={...g,name:"",quality:"Unknown",intervals:[],aliases:[]},O=[],E={};function Z(t){return E[t]||hn}var vn=d("ChordType.chordType","ChordType.get",Z);function yn(){return O.map(t=>t.name).filter(t=>t)}function bn(){return O.map(t=>t.aliases[0]).filter(t=>t)}function gn(){return Object.keys(E)}function N(){return O.slice()}var An=d("ChordType.entries","ChordType.all",N);function In(){O=[],E={}}function Jt(t,e,n){let r=Sn(t),o={...p(t),name:n||"",quality:r,intervals:t,aliases:e};O.push(o),o.name&&(E[o.name]=o),E[o.setNum]=o,E[o.chroma]=o,o.aliases.forEach(a=>Nn(o,a))}function Nn(t,e){E[e]=t}function Sn(t){let e=n=>t.indexOf(n)!==-1;return e("5A")?"Augmented":e("3M")?"Major":e("5d")?"Diminished":e("3m")?"Minor":"Unknown"}Mn.forEach(([t,e,n])=>Jt(t.split(" "),n.split(" "),e));O.sort((t,e)=>t.setNum-e.setNum);var Yt={names:yn,symbols:bn,get:Z,all:N,add:Jt,removeAll:In,keys:gn,entries:An,chordType:vn};var jn=t=>{let e=t.reduce((n,r)=>{let o=s(r).chroma;return o!==void 0&&(n[o]=n[o]||s(r).name),n},{});return n=>e[n]};function dt(t){let e=t.map(r=>s(r).pc).filter(r=>r);return s.length===0?[]:Tn(e,1).filter(r=>r.weight).sort((r,o)=>o.weight-r.weight).map(r=>r.name)}function Tn(t,e){let n=t[0],r=s(n).chroma,o=jn(t),a=H(t,!1),m=[];return a.forEach((i,c)=>{N().filter(P=>P.chroma===i).forEach(P=>{let b=P.aliases[0],f=o(c);c!==r?m.push({weight:.5*e,name:`${f}${b}/${n}`}):m.push({weight:1*e,name:`${f}${b}`})})}),m}var xn=[["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 6A","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 2A 3M 4A 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 4A 5P 6M 7m","dorian #4","ukrainian dorian","romanian minor","altered dorian"],["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"]],En=xn,Cn={...g,intervals:[],aliases:[]},W=[],C={};function pt(){return W.map(t=>t.name)}function k(t){return C[t]||Cn}var Dn=d("ScaleDictionary.scaleType","ScaleType.get",k);function D(){return W.slice()}var _n=d("ScaleDictionary.entries","ScaleType.all",D);function wn(){return Object.keys(C)}function Vn(){W=[],C={}}function Zt(t,e,n=[]){let r={...p(t),name:e,intervals:t,aliases:n};return W.push(r),C[r.name]=r,C[r.setNum]=r,C[r.chroma]=r,r.aliases.forEach(o=>Rn(r,o)),r}function Rn(t,e){C[e]=t}En.forEach(([t,e,...n])=>Zt(t.split(" "),e,n));var Wt={names:pt,get:k,all:D,add:Zt,removeAll:Vn,keys:wn,entries:_n,scaleType:Dn};var ft={empty:!0,name:"",symbol:"",root:"",rootDegree:0,type:"",tonic:null,setNum:NaN,quality:"Unknown",chroma:"",normalized:"",aliases:[],notes:[],intervals:[]},$n=/^(6|64|7|9|11|13)$/;function X(t){let[e,n,r,o]=J(t);return e===""?["",t]:e==="A"&&o==="ug"?["","aug"]:!o&&(r==="4"||r==="5")?[e+n,r]:$n.test(r)?[e+n,r+o]:[e+n+r,o]}function K(t){if(t==="")return ft;if(Array.isArray(t)&&t.length===2)return tt(t[1],t[0]);{let[e,n]=X(t),r=tt(n,e);return r.empty?tt(t):r}}function tt(t,e,n){let r=Z(t),o=s(e||""),a=s(n||"");if(r.empty||e&&o.empty||n&&a.empty)return ft;let m=I(o.pc,a.pc),i=r.intervals.indexOf(m)+1;if(!a.empty&&!i)return ft;let c=Array.from(r.intervals);for(let f=1;f<i;f++){let w=c[0][0],F=c[0][1],Ie=parseInt(w,10)+7;c.push(`${Ie}${F}`),c.shift()}let y=o.empty?[]:c.map(f=>l(o,f));t=r.aliases.indexOf(t)!==-1?t:r.aliases[0];let P=`${o.empty?"":o.pc}${t}${a.empty||i<=1?"":"/"+a.pc}`,b=`${e?o.pc+" ":""}${r.name}${i>1&&n?" over "+a.pc:""}`;return{...r,name:b,symbol:P,type:r.name,root:a.name,intervals:c,rootDegree:i,tonic:o.name,notes:y}}var On=d("Chord.chord","Chord.get",K);function kn(t,e){let[n,r]=X(t);return n?l(n,e)+r:t}function Fn(t){let e=K(t),n=$(e.chroma);return D().filter(r=>n(r.chroma)).map(r=>r.name)}function qn(t){let e=K(t),n=$(e.chroma);return N().filter(r=>n(r.chroma)).map(r=>e.tonic+r.aliases[0])}function Gn(t){let e=K(t),n=R(e.chroma);return N().filter(r=>n(r.chroma)).map(r=>e.tonic+r.aliases[0])}var zn={getChord:tt,get:K,detect:dt,chordScales:Fn,extended:qn,reduced:Gn,tokenize:X,transpose:kn,chord:On};var Ln=[[.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"]]],Un=Ln,et=[];Un.forEach(([t,e,n])=>Zn(t,e,n));var Bn={empty:!0,name:"",value:0,fraction:[0,0],shorthand:"",dots:"",names:[]};function Hn(){return et.reduce((t,e)=>(e.names.forEach(n=>t.push(n)),t),[])}function Xn(){return et.map(t=>t.shorthand)}var Kn=/^([^.]+)(\.*)$/;function Pt(t){let[e,n,r]=Kn.exec(t)||[],o=et.find(i=>i.shorthand===n||i.names.includes(n));if(!o)return Bn;let a=Wn(o.fraction,r.length),m=a[0]/a[1];return{...o,name:t,dots:r,value:m,fraction:a}}var Qn=t=>Pt(t).value,Jn=t=>Pt(t).fraction,Yn={names:Hn,shorthands:Xn,get:Pt,value:Qn,fraction:Jn};function Zn(t,e,n){et.push({empty:!1,dots:"",name:"",value:1/t,fraction:t<1?[1/t,1]:[1,t],shorthand:e,names:n})}function Wn(t,e){let n=Math.pow(2,e),r=t[0]*n,o=t[1]*n,a=r;for(let m=0;m<e;m++)r+=a/Math.pow(2,m+1);for(;r%2===0&&o%2===0;)r/=2,o/=2;return[r,o]}function tr(){return"1P 2M 3M 4P 5P 6m 7m".split(" ")}var te=u,er=t=>u(t).name,nr=t=>u(t).semitones,rr=t=>u(t).q,or=t=>u(t).num;function Mt(t){let e=u(t);return e.empty?"":e.simple+e.q}function ar(t){let e=u(t);if(e.empty)return"";let n=(7-e.step)%7,r=e.type==="perfectable"?-e.alt:-(e.alt+1);return u({step:n,alt:r,oct:e.oct,dir:e.dir}).name}var mr=[1,2,2,3,3,4,5,5,6,6,7,7],ir="P m M m M P d P m M m M".split(" ");function sr(t){let e=t<0?-1:1,n=Math.abs(t),r=n%12,o=Math.floor(n/12);return e*(mr[r]+7*o)+ir[r]}var cr=I,ee=ne((t,e)=>[t[0]+e[0],t[1]+e[1]]),ur=t=>e=>ee(t,e),lr=ne((t,e)=>[t[0]-e[0],t[1]-e[1]]);function ht(t,e){let n=te(t);if(n.empty)return"";let[r,o,a]=n.coord;return U([r+e,o,a]).name}var dr={names:tr,get:te,name:er,num:or,semitones:nr,quality:rr,fromSemitones:sr,distance:cr,invert:ar,simplify:Mt,add:ee,addTo:ur,substract:lr,transposeFifths:ht};function ne(t){return(e,n)=>{let r=u(e).coord,o=u(n).coord;if(r&&o){let a=t(r,o);return U(a).name}}}function re(t){return+t>=0&&+t<=127}function vt(t){if(re(t))return+t;let e=s(t);return e.empty?null:e.midi}function pr(t,e=440){return Math.pow(2,(t-69)/12)*e}var fr=Math.log(2),Pr=Math.log(440);function nt(t){let e=12*(Math.log(t)-Pr)/fr+69;return Math.round(e*100)/100}var Mr="C C# D D# E F F# G G# A A# B".split(" "),hr="C Db D Eb E F Gb G Ab A Bb B".split(" ");function A(t,e={}){if(isNaN(t)||t===-1/0||t===1/0)return"";t=Math.round(t);let r=(e.sharps===!0?Mr:hr)[t%12];if(e.pitchClass)return r;let o=Math.floor(t/12)-1;return r+o}var vr={isMidi:re,toMidi:vt,midiToFreq:pr,midiToNoteName:A,freqToMidi:nt};var yr=["C","D","E","F","G","A","B"],oe=t=>t.name,ae=t=>t.map(s).filter(e=>!e.empty);function br(t){return t===void 0?yr.slice():Array.isArray(t)?ae(t).map(oe):[]}var M=s,gr=t=>M(t).name,Ar=t=>M(t).pc,Ir=t=>M(t).acc,Nr=t=>M(t).oct,Sr=t=>M(t).midi,jr=t=>M(t).freq,Tr=t=>M(t).chroma;function yt(t){return A(t)}function xr(t){return A(nt(t))}function Er(t){return A(nt(t),{sharps:!0})}function Cr(t){return A(t,{sharps:!0})}var bt=l,Dr=l,me=t=>e=>bt(e,t),_r=me,ie=t=>e=>bt(t,e),wr=ie;function Q(t,e){let n=M(t);if(n.empty)return"";let[r,o]=n.coord;return(o===void 0?L([r+e]):L([r+e,o])).name}var Vr=Q,gt=(t,e)=>t.height-e.height,Rr=(t,e)=>e.height-t.height;function se(t,e){return e=e||gt,ae(t).sort(e).map(oe)}function At(t){return se(t,gt).filter((e,n,r)=>n===0||e!==r[n-1])}var $r=t=>{let e=M(t);return e.empty?"":A(e.midi||e.chroma,{sharps:e.alt>0,pitchClass:e.midi===null})};function It(t,e){let n=M(t);if(n.empty)return"";let r=M(e||A(n.midi||n.chroma,{sharps:n.alt<0,pitchClass:!0}));if(r.empty||r.chroma!==n.chroma)return"";if(n.oct===void 0)return r.pc;let o=n.chroma-n.alt,a=r.chroma-r.alt,m=o>11||a<0?-1:o<0||a>11?1:0,i=n.oct+m;return r.pc+i}var Or={names:br,get:M,name:gr,pitchClass:Ar,accidentals:Ir,octave:Nr,midi:Sr,ascending:gt,descending:Rr,sortedNames:se,sortedUniqNames:At,fromMidi:yt,fromMidiSharps:Cr,freq:jr,fromFreq:xr,fromFreqSharps:Er,chroma:Tr,transpose:bt,tr:Dr,transposeBy:me,trBy:_r,transposeFrom:ie,trFrom:wr,transposeFifths:Q,trFifths:Vr,simplify:$r,enharmonic:It};var ue={empty:!0,name:"",chordType:""},ce={};function h(t){return typeof t=="string"?ce[t]||(ce[t]=Ur(t)):typeof t=="number"?h(rt[t]||""):z(t)?qr(t):G(t)?h(t.name):ue}var kr=d("RomanNumeral.romanNumeral","RomanNumeral.get",h);function Fr(t=!0){return(t?rt:Lr).slice()}function qr(t){return h(T(t.alt)+rt[t.step])}var Gr=/^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;function zr(t){return Gr.exec(t)||["","","",""]}var le="I II III IV V VI VII",rt=le.split(" "),Lr=le.toLowerCase().split(" ");function Ur(t){let[e,n,r,o]=zr(t);if(!r)return ue;let a=r.toUpperCase(),m=rt.indexOf(a),i=V(n),c=1;return{empty:!1,name:e,roman:r,interval:u({step:m,alt:i,dir:c}).name,acc:n,chordType:o,alt:i,step:m,major:r===a,oct:0,dir:c}}var Br={names:Fr,get:h,romanNumeral:kr};var v=Object.freeze([]),pe={type:"major",tonic:"",alteration:0,keySignature:""},ot={tonic:"",grades:v,intervals:v,scale:v,chords:v,chordsHarmonicFunction:v,chordScales:v},Hr={...pe,...ot,type:"major",minorRelative:"",scale:v,secondaryDominants:v,secondaryDominantsMinorRelative:v,substituteDominants:v,substituteDominantsMinorRelative:v},Xr={...pe,type:"minor",relativeMajor:"",natural:ot,harmonic:ot,melodic:ot},de=(t,e,n="")=>e.map((r,o)=>`${t[o]}${n}${r}`);function at(t,e,n,r){return o=>{let a=t.map(i=>h(i).interval||""),m=a.map(i=>l(o,i));return{tonic:o,grades:t,intervals:a,scale:m,chords:de(m,e),chordsHarmonicFunction:n.slice(),chordScales:de(m,r," ")}}}var fe=(t,e)=>{let n=s(t),r=s(e);return n.empty||r.empty?0:r.coord[0]-n.coord[0]},Kr=at("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(",")),Qr=at("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(",")),Jr=at("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(",")),Yr=at("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(","));function Zr(t){let e=s(t).pc;if(!e)return Hr;let n=Kr(e),r=fe("C",e),o=a=>{let m=h(a);return m.empty?"":l(t,m.interval)+m.chordType};return{...n,type:"major",minorRelative:l(e,"-3m"),alteration:r,keySignature:T(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)}}function Wr(t){let e=s(t).pc;if(!e)return Xr;let n=fe("C",e)-3;return{type:"minor",tonic:e,relativeMajor:l(e,"3m"),alteration:n,keySignature:T(n),natural:Qr(e),harmonic:Jr(e),melodic:Yr(e)}}function to(t){return typeof t=="number"?Q("C",t):typeof t=="string"&&/^b+|#+$/.test(t)?Q("C",V(t)):null}var eo={majorKey:Zr,majorTonicFromKeySignature:to,minorKey:Wr};var St=[[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"]],Pe={...g,name:"",alt:0,modeNum:NaN,triad:"",seventh:"",aliases:[]},jt=St.map(ao),Nt={};jt.forEach(t=>{Nt[t.name]=t,t.aliases.forEach(e=>{Nt[e]=t})});function _(t){return typeof t=="string"?Nt[t.toLowerCase()]||Pe:t&&t.name?_(t.name):Pe}var no=d("Mode.mode","Mode.get",_);function Me(){return jt.slice()}var ro=d("Mode.mode","Mode.all",Me);function oo(){return jt.map(t=>t.name)}function ao(t){let[e,n,r,o,a,m,i]=t,c=i?[i]:[],y=Number(n).toString(2);return{empty:!1,intervals:k(o).intervals,modeNum:e,chroma:y,normalized:y,name:o,setNum:n,alt:r,triad:a,seventh:m,aliases:c}}function mo(t,e){return _(t).intervals.map(n=>l(e,n))}function he(t){return(e,n)=>{let r=_(e);if(r.empty)return[];let o=S(r.modeNum,t),a=r.intervals.map(m=>l(n,m));return o.map((m,i)=>a[i]+m)}}var io=he(St.map(t=>t[4])),so=he(St.map(t=>t[5]));function ve(t,e){let n=_(e),r=_(t);return n.empty||r.empty?"":Mt(ht("1P",r.alt-n.alt))}function co(t,e,n){return l(n,ve(t,e))}var uo={get:_,names:oo,all:Me,distance:ve,relativeTonic:co,notes:mo,triads:io,seventhChords:so,entries:ro,mode:no};function lo(t,e){return e.map(h).map(r=>l(t,u(r))+r.chordType)}function po(t,e){return e.map(n=>{let[r,o]=X(n),a=I(t,r);return h(u(a)).name+o})}var fo={fromRomanNumerals:lo,toRomanNumerals:po};function ye(t){let e=B(t.map(vt));return!t.length||e.length!==t.length?[]:e.reduce((n,r)=>{let o=n[n.length-1];return n.concat(x(o,r).slice(1))},[e[0]])}function Po(t,e){return ye(t).map(n=>A(n,e))}var Mo={numeric:ye,chromatic:Po};var ho={empty:!0,name:"",type:"",tonic:null,setNum:NaN,chroma:"",normalized:"",aliases:[],notes:[],intervals:[]};function be(t){if(typeof t!="string")return["",""];let e=t.indexOf(" "),n=s(t.substring(0,e));if(n.empty){let o=s(t);return o.empty?["",t]:[o.name,""]}let r=t.substring(n.name.length+1);return[n.name,r.length?r:""]}var vo=pt;function j(t){let e=Array.isArray(t)?t:be(t),n=s(e[0]).name,r=k(e[1]);if(r.empty)return ho;let o=r.name,a=n?r.intervals.map(i=>l(n,i)):[],m=n?n+" "+o:o;return{...r,name:m,type:o,tonic:n,notes:a}}var yo=d("Scale.scale","Scale.get",j);function bo(t){let e=j(t),n=R(e.chroma);return N().filter(r=>n(r.chroma)).map(r=>r.aliases[0])}function go(t){let e=j(t),n=$(e.chroma);return D().filter(r=>n(r.chroma)).map(r=>r.name)}function Ao(t){let e=R(j(t).chroma);return D().filter(n=>e(n.chroma)).map(n=>n.name)}function ge(t){let e=t.map(o=>s(o).pc).filter(o=>o),n=e[0],r=At(e);return S(r.indexOf(n),r)}function Io(t){let e=j(t);if(e.empty)return[];let n=e.tonic?e.notes:e.intervals;return H(e.chroma).map((r,o)=>{let a=j(r).name;return a?[n[o],a]:["",""]}).filter(r=>r[0])}function No(t){let e=Array.isArray(t)?ge(t):j(t).notes,n=e.map(r=>s(r).chroma);return r=>{let o=typeof r=="number"?s(yt(r)):s(r),a=o.height;if(a===void 0)return;let m=a%12,i=n.indexOf(m);if(i!==-1)return It(o.name,e[i])}}function So(t){let e=No(t);return(n,r)=>{let o=s(n).height,a=s(r).height;return o===void 0||a===void 0?[]:x(o,a).map(e).filter(m=>m)}}var jo={get:j,names:vo,extended:go,modeNames:Io,reduced:Ao,scaleChords:bo,scaleNotes:ge,tokenize:be,rangeOf:So,scale:yo};var To={empty:!0,name:"",upper:void 0,lower:void 0,type:void 0,additive:[]},xo=["4/4","3/4","2/4","2/2","12/8","9/8","6/8","3/8"];function Eo(){return xo.slice()}var Co=/^(\d?\d(?:\+\d)*)\/(\d)$/,Ae=new Map;function Do(t){let e=JSON.stringify(t),n=Ae.get(e);if(n)return n;let r=wo(Tt(t));return Ae.set(e,r),r}function Tt(t){if(typeof t=="string"){let[a,m,i]=Co.exec(t)||[];return Tt([m,i])}let[e,n]=t,r=+n;if(typeof e=="number")return[e,r];let o=e.split("+").map(a=>+a);return o.length===1?[o[0],r]:[o,r]}var _o={names:Eo,parse:Tt,get:Do};function wo([t,e]){let n=Array.isArray(t)?t.reduce((i,c)=>i+c,0):t,r=e;if(n===0||r===0)return To;let o=Array.isArray(t)?`${t.join("+")}/${e}`:`${t}/${e}`,a=Array.isArray(t)?t:[],m=r===4||r===2?"simple":r===8&&n%3===0?"compound":"irregular";return{empty:!1,name:o,type:m,upper:n,lower:r,additive:a}}var om=ut,am=Qt,mm=Yt,im=Wt;})();
1
+ "use strict";(()=>{var Ne=Object.defineProperty;var xt=(t,e)=>{for(var n in e)Ne(t,n,{get:e[n],enumerable:!0})};var ut={};xt(ut,{accToAlt:()=>V,altToAcc:()=>T,coordToInterval:()=>U,coordToNote:()=>L,decode:()=>ct,deprecate:()=>d,distance:()=>I,encode:()=>st,fillStr:()=>q,interval:()=>u,isNamed:()=>G,isPitch:()=>z,note:()=>s,stepToLetter:()=>Ot,tokenizeInterval:()=>Rt,tokenizeNote:()=>J,transpose:()=>l});var q=(t,e)=>Array(Math.abs(e)+1).join(t);function d(t,e,n){return function(...r){return console.warn(`${t} is deprecated. Use ${e}.`),n.apply(this,r)}}function G(t){return t!==null&&typeof t=="object"&&typeof t.name=="string"}function z(t){return t!==null&&typeof t=="object"&&typeof t.step=="number"&&typeof t.alt=="number"}var _t=[0,2,4,-1,1,3,5],wt=_t.map(t=>Math.floor(t*7/12));function st(t){let{step:e,alt:n,oct:r,dir:o=1}=t,a=_t[e]+7*n;if(r===void 0)return[o*a];let m=r-wt[e]-4*n;return[o*a,o*m]}var Se=[3,0,4,1,5,2,6];function ct(t){let[e,n,r]=t,o=Se[je(e)],a=Math.floor((e+1)/7);if(n===void 0)return{step:o,alt:a,dir:r};let m=n+4*a+wt[o];return{step:o,alt:a,oct:m,dir:r}}function je(t){let e=(t+1)%7;return e<0?7+e:e}var Vt={empty:!0,name:"",pc:"",acc:""},Et=new Map,Ot=t=>"CDEFGAB".charAt(t),T=t=>t<0?q("b",-t):q("#",t),V=t=>t[0]==="b"?-t.length:t.length;function s(t){let e=JSON.stringify(t),n=Et.get(e);if(n)return n;let r=typeof t=="string"?Ee(t):z(t)?s(Ce(t)):G(t)?s(t.name):Vt;return Et.set(e,r),r}var Te=/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;function J(t){let e=Te.exec(t);return[e[1].toUpperCase(),e[2].replace(/x/g,"##"),e[3],e[4]]}function L(t){return s(ct(t))}var xe=(t,e)=>(t%e+e)%e,mt=[0,2,4,5,7,9,11];function Ee(t){let e=J(t);if(e[0]===""||e[3]!=="")return Vt;let n=e[0],r=e[1],o=e[2],a=(n.charCodeAt(0)+3)%7,m=V(r),i=o.length?+o:void 0,c=st({step:a,alt:m,oct:i}),y=n+r+o,P=n+r,b=(mt[a]+m+120)%12,f=i===void 0?xe(mt[a]+m,12)-12*99:mt[a]+m+12*(i+1),w=f>=0&&f<=127?f:null,F=i===void 0?null:Math.pow(2,(f-69)/12)*440;return{empty:!1,acc:r,alt:m,chroma:b,coord:c,freq:F,height:f,letter:n,midi:w,name:y,oct:i,pc:P,step:a}}function Ce(t){let{step:e,alt:n,oct:r}=t,o=Ot(e);if(!o)return"";let a=o+T(n);return r||r===0?a+r:a}var it={empty:!0,name:"",acc:""},De="([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})",_e="(AA|A|P|M|m|d|dd)([-+]?\\d+)",we=new RegExp("^"+De+"|"+_e+"$");function Rt(t){let e=we.exec(`${t}`);return e===null?["",""]:e[1]?[e[1],e[2]]:[e[4],e[3]]}var Ct={};function u(t){return typeof t=="string"?Ct[t]||(Ct[t]=Ve(t)):z(t)?u(Re(t)):G(t)?u(t.name):it}var Dt=[0,2,4,5,7,9,11],$t="PMMPPMM";function Ve(t){let e=Rt(t);if(e[0]==="")return it;let n=+e[0],r=e[1],o=(Math.abs(n)-1)%7,a=$t[o];if(a==="M"&&r==="P")return it;let m=a==="M"?"majorable":"perfectable",i=""+n+r,c=n<0?-1:1,y=n===8||n===-8?n:c*(o+1),P=Oe(m,r),b=Math.floor((Math.abs(n)-1)/7),f=c*(Dt[o]+P+12*b),w=(c*(Dt[o]+P)%12+12)%12,F=st({step:o,alt:P,oct:b,dir:c});return{empty:!1,name:i,num:n,q:r,step:o,alt:P,dir:c,type:m,simple:y,semitones:f,chroma:w,coord:F,oct:b}}function U(t,e){let[n,r=0]=t,o=n*7+r*12<0,a=e||o?[-n,-r,-1]:[n,r,1];return u(ct(a))}function Oe(t,e){return e==="M"&&t==="majorable"||e==="P"&&t==="perfectable"?0:e==="m"&&t==="majorable"?-1:/^A+$/.test(e)?e.length:/^d+$/.test(e)?-1*(t==="perfectable"?e.length:e.length+1):0}function Re(t){let{step:e,alt:n,oct:r=0,dir:o}=t;if(!o)return"";let a=e+1+7*r,m=a===0?e+1:a,i=o<0?"-":"",c=$t[e]==="M"?"majorable":"perfectable";return i+m+$e(c,n)}function $e(t,e){return e===0?t==="majorable"?"M":"P":e===-1&&t==="majorable"?"m":e>0?q("A",e):q("d",t==="perfectable"?e:e+1)}function l(t,e){let n=s(t),r=u(e);if(n.empty||r.empty)return"";let o=n.coord,a=r.coord,m=o.length===1?[o[0]+a[0]]:[o[0]+a[0],o[1]+a[1]];return L(m).name}function I(t,e){let n=s(t),r=s(e);if(n.empty||r.empty)return"";let o=n.coord,a=r.coord,m=a[0]-o[0],i=o.length===2&&a.length===2?a[1]-o[1]:-Math.floor(m*7/12),c=r.height===n.height&&r.midi!==null&&n.midi!==null&&n.step>r.step;return U([m,i],c).name}var kt=(t,e)=>Array(e+1).join(t),ke=/^(_{1,}|=|\^{1,}|)([abcdefgABCDEFG])([,']*)$/;function Ft(t){let e=ke.exec(t);return e?[e[1],e[2],e[3]]:["","",""]}function Y(t){let[e,n,r]=Ft(t);if(n==="")return"";let o=4;for(let m=0;m<r.length;m++)o+=r.charAt(m)===","?-1:1;let a=e[0]==="_"?e.replace(/_/g,"b"):e[0]==="^"?e.replace(/\^/g,"#"):"";return n.charCodeAt(0)>96?n.toUpperCase()+a+(o+1):n+a+o}function qt(t){let e=s(t);if(e.empty||!e.oct&&e.oct!==0)return"";let{letter:n,acc:r,oct:o}=e,a=r[0]==="b"?r.replace(/b/g,"_"):r.replace(/#/g,"^"),m=o>4?n.toLowerCase():n,i=o===5?"":o>4?kt("'",o-5):kt(",",4-o);return a+m+i}function Fe(t,e){return qt(l(Y(t),e))}function qe(t,e){return I(Y(t),Y(e))}var Ge={abcToScientificNotation:Y,scientificToAbcNotation:qt,tokenize:Ft,transpose:Fe,distance:qe};var Lt={};xt(Lt,{compact:()=>He,permutations:()=>zt,range:()=>Ue,rotate:()=>Be,shuffle:()=>Ke,sortedNoteNames:()=>Gt,sortedUniqNoteNames:()=>Xe});var Fo=Array.isArray;function ze(t,e){let n=[];for(;e--;n[e]=e+t);return n}function Le(t,e){let n=[];for(;e--;n[e]=t-e);return n}function Ue(t,e){return t<e?ze(t,e-t+1):Le(t,t-e+1)}function Be(t,e){let n=e.length,r=(t%n+n)%n;return e.slice(r,n).concat(e.slice(0,r))}function He(t){return t.filter(e=>e===0||e)}function Gt(t){return t.map(n=>s(n)).filter(n=>!n.empty).sort((n,r)=>n.height-r.height).map(n=>n.name)}function Xe(t){return Gt(t).filter((e,n,r)=>n===0||e!==r[n-1])}function Ke(t,e=Math.random){let n,r,o=t.length;for(;o;)n=Math.floor(e()*o--),r=t[o],t[o]=t[n],t[n]=r;return t}function zt(t){return t.length===0?[[]]:zt(t.slice(1)).reduce((e,n)=>e.concat(t.map((r,o)=>{let a=n.slice();return a.splice(o,0,t[0]),a})),[])}function Qe(t,e){let n=[];for(;e--;n[e]=e+t);return n}function Je(t,e){let n=[];for(;e--;n[e]=t-e);return n}function x(t,e){return t<e?Qe(t,e-t+1):Je(t,t-e+1)}function S(t,e){let n=e.length,r=(t%n+n)%n;return e.slice(r,n).concat(e.slice(0,r))}function B(t){return t.filter(e=>e===0||e)}function Ye(t,e=Math.random){let n,r,o=t.length;for(;o;)n=Math.floor(e()*o--),r=t[o],t[o]=t[n],t[n]=r;return t}function Ut(t){return t.length===0?[[]]:Ut(t.slice(1)).reduce((e,n)=>e.concat(t.map((r,o)=>{let a=n.slice();return a.splice(o,0,t[0]),a})),[])}var Ze={compact:B,permutations:Ut,range:x,rotate:S,shuffle:Ye};var g={empty:!0,name:"",setNum:0,chroma:"000000000000",normalized:"000000000000",intervals:[]},lt=t=>Number(t).toString(2),Bt=t=>parseInt(t,2),We=/^[01]{12}$/;function Xt(t){return We.test(t)}var tn=t=>typeof t=="number"&&t>=0&&t<=4095,en=t=>t&&Xt(t.chroma),Ht={[g.chroma]:g};function p(t){let e=Xt(t)?t:tn(t)?lt(t):Array.isArray(t)?fn(t):en(t)?t.chroma:g.chroma;return Ht[e]=Ht[e]||pn(e)}var nn=d("Pcset.pcset","Pcset.get",p),rn=t=>p(t).chroma,on=t=>p(t).intervals,an=t=>p(t).setNum,mn=["1P","2m","2M","3m","3M","4P","5d","5P","6m","6M","7m","7M"];function sn(t){let e=[];for(let n=0;n<12;n++)t.charAt(n)==="1"&&e.push(mn[n]);return e}function cn(){return x(2048,4095).map(lt)}function H(t,e=!0){let r=p(t).chroma.split("");return B(r.map((o,a)=>{let m=S(a,r);return e&&m[0]==="0"?null:m.join("")}))}function un(t,e){return p(t).setNum===p(e).setNum}function O(t){let e=p(t).setNum;return n=>{let r=p(n).setNum;return e&&e!==r&&(r&e)===r}}function R(t){let e=p(t).setNum;return n=>{let r=p(n).setNum;return e&&e!==r&&(r|e)===r}}function Kt(t){let e=p(t);return n=>{let r=s(n);return e&&!r.empty&&e.chroma.charAt(r.chroma)==="1"}}function ln(t){let e=Kt(t);return n=>n.filter(e)}var Qt={get:p,chroma:rn,num:an,intervals:on,chromas:cn,isSupersetOf:R,isSubsetOf:O,isNoteIncludedIn:Kt,isEqual:un,filter:ln,modes:H,pcset:nn};function dn(t){let e=t.split("");return e.map((n,r)=>S(r,e).join(""))}function pn(t){let e=Bt(t),n=dn(t).map(Bt).filter(a=>a>=2048).sort()[0],r=lt(n),o=sn(t);return{empty:!1,name:"",setNum:e,chroma:t,normalized:r,intervals:o}}function fn(t){if(t.length===0)return g.chroma;let e,n=[0,0,0,0,0,0,0,0,0,0,0,0];for(let r=0;r<t.length;r++)e=s(t[r]),e.empty&&(e=u(t[r])),e.empty||(n[e.chroma]=1);return n.join("")}var Pn=[["1P 3M 5P","major","M ^ maj"],["1P 3M 5P 7M","major seventh","maj7 \u0394 ma7 M7 Maj7 ^7"],["1P 3M 5P 7M 9M","major ninth","maj9 \u03949 ^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 \u0394#4 \u0394#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 -\u03947 m\u0394 -^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 \xB0 o"],["1P 3m 5d 7d","diminished seventh","dim7 \xB07 o7"],["1P 3m 5d 7m","half-diminished","m7b5 \xF8 -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 \u03949#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 5A 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"]],Mn=Pn,hn={...g,name:"",quality:"Unknown",intervals:[],aliases:[]},$=[],E={};function Z(t){return E[t]||hn}var vn=d("ChordType.chordType","ChordType.get",Z);function yn(){return $.map(t=>t.name).filter(t=>t)}function bn(){return $.map(t=>t.aliases[0]).filter(t=>t)}function gn(){return Object.keys(E)}function N(){return $.slice()}var An=d("ChordType.entries","ChordType.all",N);function In(){$=[],E={}}function Jt(t,e,n){let r=Sn(t),o={...p(t),name:n||"",quality:r,intervals:t,aliases:e};$.push(o),o.name&&(E[o.name]=o),E[o.setNum]=o,E[o.chroma]=o,o.aliases.forEach(a=>Nn(o,a))}function Nn(t,e){E[e]=t}function Sn(t){let e=n=>t.indexOf(n)!==-1;return e("5A")?"Augmented":e("3M")?"Major":e("5d")?"Diminished":e("3m")?"Minor":"Unknown"}Mn.forEach(([t,e,n])=>Jt(t.split(" "),n.split(" "),e));$.sort((t,e)=>t.setNum-e.setNum);var Yt={names:yn,symbols:bn,get:Z,all:N,add:Jt,removeAll:In,keys:gn,entries:An,chordType:vn};var jn=t=>{let e=t.reduce((n,r)=>{let o=s(r).chroma;return o!==void 0&&(n[o]=n[o]||s(r).name),n},{});return n=>e[n]};function dt(t){let e=t.map(r=>s(r).pc).filter(r=>r);return s.length===0?[]:Tn(e,1).filter(r=>r.weight).sort((r,o)=>o.weight-r.weight).map(r=>r.name)}function Tn(t,e){let n=t[0],r=s(n).chroma,o=jn(t),a=H(t,!1),m=[];return a.forEach((i,c)=>{N().filter(P=>P.chroma===i).forEach(P=>{let b=P.aliases[0],f=o(c);c!==r?m.push({weight:.5*e,name:`${f}${b}/${n}`}):m.push({weight:1*e,name:`${f}${b}`})})}),m}var xn=[["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 6A","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 2A 3M 4A 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 4A 5P 6M 7m","dorian #4","ukrainian dorian","romanian minor","altered dorian"],["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"]],En=xn,Cn={...g,intervals:[],aliases:[]},W=[],C={};function pt(){return W.map(t=>t.name)}function k(t){return C[t]||Cn}var Dn=d("ScaleDictionary.scaleType","ScaleType.get",k);function D(){return W.slice()}var _n=d("ScaleDictionary.entries","ScaleType.all",D);function wn(){return Object.keys(C)}function Vn(){W=[],C={}}function Zt(t,e,n=[]){let r={...p(t),name:e,intervals:t,aliases:n};return W.push(r),C[r.name]=r,C[r.setNum]=r,C[r.chroma]=r,r.aliases.forEach(o=>On(r,o)),r}function On(t,e){C[e]=t}En.forEach(([t,e,...n])=>Zt(t.split(" "),e,n));var Wt={names:pt,get:k,all:D,add:Zt,removeAll:Vn,keys:wn,entries:_n,scaleType:Dn};var ft={empty:!0,name:"",symbol:"",root:"",rootDegree:0,type:"",tonic:null,setNum:NaN,quality:"Unknown",chroma:"",normalized:"",aliases:[],notes:[],intervals:[]},Rn=/^(6|64|7|9|11|13)$/;function X(t){let[e,n,r,o]=J(t);return e===""?["",t]:e==="A"&&o==="ug"?["","aug"]:!o&&(r==="4"||r==="5")?[e+n,r]:Rn.test(r)?[e+n,r+o]:[e+n+r,o]}function K(t){if(t==="")return ft;if(Array.isArray(t)&&t.length===2)return tt(t[1],t[0]);{let[e,n]=X(t),r=tt(n,e);return r.empty?tt(t):r}}function tt(t,e,n){let r=Z(t),o=s(e||""),a=s(n||"");if(r.empty||e&&o.empty||n&&a.empty)return ft;let m=I(o.pc,a.pc),i=r.intervals.indexOf(m)+1;if(!a.empty&&!i)return ft;let c=Array.from(r.intervals);for(let f=1;f<i;f++){let w=c[0][0],F=c[0][1],Ie=parseInt(w,10)+7;c.push(`${Ie}${F}`),c.shift()}let y=o.empty?[]:c.map(f=>l(o,f));t=r.aliases.indexOf(t)!==-1?t:r.aliases[0];let P=`${o.empty?"":o.pc}${t}${a.empty||i<=1?"":"/"+a.pc}`,b=`${e?o.pc+" ":""}${r.name}${i>1&&n?" over "+a.pc:""}`;return{...r,name:b,symbol:P,type:r.name,root:a.name,intervals:c,rootDegree:i,tonic:o.name,notes:y}}var $n=d("Chord.chord","Chord.get",K);function kn(t,e){let[n,r]=X(t);return n?l(n,e)+r:t}function Fn(t){let e=K(t),n=R(e.chroma);return D().filter(r=>n(r.chroma)).map(r=>r.name)}function qn(t){let e=K(t),n=R(e.chroma);return N().filter(r=>n(r.chroma)).map(r=>e.tonic+r.aliases[0])}function Gn(t){let e=K(t),n=O(e.chroma);return N().filter(r=>n(r.chroma)).map(r=>e.tonic+r.aliases[0])}var zn={getChord:tt,get:K,detect:dt,chordScales:Fn,extended:qn,reduced:Gn,tokenize:X,transpose:kn,chord:$n};var Ln=[[.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"]]],Un=Ln,et=[];Un.forEach(([t,e,n])=>Zn(t,e,n));var Bn={empty:!0,name:"",value:0,fraction:[0,0],shorthand:"",dots:"",names:[]};function Hn(){return et.reduce((t,e)=>(e.names.forEach(n=>t.push(n)),t),[])}function Xn(){return et.map(t=>t.shorthand)}var Kn=/^([^.]+)(\.*)$/;function Pt(t){let[e,n,r]=Kn.exec(t)||[],o=et.find(i=>i.shorthand===n||i.names.includes(n));if(!o)return Bn;let a=Wn(o.fraction,r.length),m=a[0]/a[1];return{...o,name:t,dots:r,value:m,fraction:a}}var Qn=t=>Pt(t).value,Jn=t=>Pt(t).fraction,Yn={names:Hn,shorthands:Xn,get:Pt,value:Qn,fraction:Jn};function Zn(t,e,n){et.push({empty:!1,dots:"",name:"",value:1/t,fraction:t<1?[1/t,1]:[1,t],shorthand:e,names:n})}function Wn(t,e){let n=Math.pow(2,e),r=t[0]*n,o=t[1]*n,a=r;for(let m=0;m<e;m++)r+=a/Math.pow(2,m+1);for(;r%2===0&&o%2===0;)r/=2,o/=2;return[r,o]}function tr(){return"1P 2M 3M 4P 5P 6m 7m".split(" ")}var te=u,er=t=>u(t).name,nr=t=>u(t).semitones,rr=t=>u(t).q,or=t=>u(t).num;function Mt(t){let e=u(t);return e.empty?"":e.simple+e.q}function ar(t){let e=u(t);if(e.empty)return"";let n=(7-e.step)%7,r=e.type==="perfectable"?-e.alt:-(e.alt+1);return u({step:n,alt:r,oct:e.oct,dir:e.dir}).name}var mr=[1,2,2,3,3,4,5,5,6,6,7,7],ir="P m M m M P d P m M m M".split(" ");function sr(t){let e=t<0?-1:1,n=Math.abs(t),r=n%12,o=Math.floor(n/12);return e*(mr[r]+7*o)+ir[r]}var cr=I,ee=ne((t,e)=>[t[0]+e[0],t[1]+e[1]]),ur=t=>e=>ee(t,e),lr=ne((t,e)=>[t[0]-e[0],t[1]-e[1]]);function ht(t,e){let n=te(t);if(n.empty)return"";let[r,o,a]=n.coord;return U([r+e,o,a]).name}var dr={names:tr,get:te,name:er,num:or,semitones:nr,quality:rr,fromSemitones:sr,distance:cr,invert:ar,simplify:Mt,add:ee,addTo:ur,substract:lr,transposeFifths:ht};function ne(t){return(e,n)=>{let r=u(e).coord,o=u(n).coord;if(r&&o){let a=t(r,o);return U(a).name}}}function re(t){return+t>=0&&+t<=127}function vt(t){if(re(t))return+t;let e=s(t);return e.empty?null:e.midi}function pr(t,e=440){return Math.pow(2,(t-69)/12)*e}var fr=Math.log(2),Pr=Math.log(440);function nt(t){let e=12*(Math.log(t)-Pr)/fr+69;return Math.round(e*100)/100}var Mr="C C# D D# E F F# G G# A A# B".split(" "),hr="C Db D Eb E F Gb G Ab A Bb B".split(" ");function A(t,e={}){if(isNaN(t)||t===-1/0||t===1/0)return"";t=Math.round(t);let r=(e.sharps===!0?Mr:hr)[t%12];if(e.pitchClass)return r;let o=Math.floor(t/12)-1;return r+o}var vr={isMidi:re,toMidi:vt,midiToFreq:pr,midiToNoteName:A,freqToMidi:nt};var yr=["C","D","E","F","G","A","B"],oe=t=>t.name,ae=t=>t.map(s).filter(e=>!e.empty);function br(t){return t===void 0?yr.slice():Array.isArray(t)?ae(t).map(oe):[]}var M=s,gr=t=>M(t).name,Ar=t=>M(t).pc,Ir=t=>M(t).acc,Nr=t=>M(t).oct,Sr=t=>M(t).midi,jr=t=>M(t).freq,Tr=t=>M(t).chroma;function yt(t){return A(t)}function xr(t){return A(nt(t))}function Er(t){return A(nt(t),{sharps:!0})}function Cr(t){return A(t,{sharps:!0})}var bt=l,Dr=l,me=t=>e=>bt(e,t),_r=me,ie=t=>e=>bt(t,e),wr=ie;function Q(t,e){let n=M(t);if(n.empty)return"";let[r,o]=n.coord;return(o===void 0?L([r+e]):L([r+e,o])).name}var Vr=Q,gt=(t,e)=>t.height-e.height,Or=(t,e)=>e.height-t.height;function se(t,e){return e=e||gt,ae(t).sort(e).map(oe)}function At(t){return se(t,gt).filter((e,n,r)=>n===0||e!==r[n-1])}var Rr=t=>{let e=M(t);return e.empty?"":A(e.midi||e.chroma,{sharps:e.alt>0,pitchClass:e.midi===null})};function It(t,e){let n=M(t);if(n.empty)return"";let r=M(e||A(n.midi||n.chroma,{sharps:n.alt<0,pitchClass:!0}));if(r.empty||r.chroma!==n.chroma)return"";if(n.oct===void 0)return r.pc;let o=n.chroma-n.alt,a=r.chroma-r.alt,m=o>11||a<0?-1:o<0||a>11?1:0,i=n.oct+m;return r.pc+i}var $r={names:br,get:M,name:gr,pitchClass:Ar,accidentals:Ir,octave:Nr,midi:Sr,ascending:gt,descending:Or,sortedNames:se,sortedUniqNames:At,fromMidi:yt,fromMidiSharps:Cr,freq:jr,fromFreq:xr,fromFreqSharps:Er,chroma:Tr,transpose:bt,tr:Dr,transposeBy:me,trBy:_r,transposeFrom:ie,trFrom:wr,transposeFifths:Q,trFifths:Vr,simplify:Rr,enharmonic:It};var ue={empty:!0,name:"",chordType:""},ce={};function h(t){return typeof t=="string"?ce[t]||(ce[t]=Ur(t)):typeof t=="number"?h(rt[t]||""):z(t)?qr(t):G(t)?h(t.name):ue}var kr=d("RomanNumeral.romanNumeral","RomanNumeral.get",h);function Fr(t=!0){return(t?rt:Lr).slice()}function qr(t){return h(T(t.alt)+rt[t.step])}var Gr=/^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;function zr(t){return Gr.exec(t)||["","","",""]}var le="I II III IV V VI VII",rt=le.split(" "),Lr=le.toLowerCase().split(" ");function Ur(t){let[e,n,r,o]=zr(t);if(!r)return ue;let a=r.toUpperCase(),m=rt.indexOf(a),i=V(n),c=1;return{empty:!1,name:e,roman:r,interval:u({step:m,alt:i,dir:c}).name,acc:n,chordType:o,alt:i,step:m,major:r===a,oct:0,dir:c}}var Br={names:Fr,get:h,romanNumeral:kr};var v=Object.freeze([]),pe={type:"major",tonic:"",alteration:0,keySignature:""},ot={tonic:"",grades:v,intervals:v,scale:v,chords:v,chordsHarmonicFunction:v,chordScales:v},Hr={...pe,...ot,type:"major",minorRelative:"",scale:v,secondaryDominants:v,secondaryDominantsMinorRelative:v,substituteDominants:v,substituteDominantsMinorRelative:v},Xr={...pe,type:"minor",relativeMajor:"",natural:ot,harmonic:ot,melodic:ot},de=(t,e,n="")=>e.map((r,o)=>`${t[o]}${n}${r}`);function at(t,e,n,r){return o=>{let a=t.map(i=>h(i).interval||""),m=a.map(i=>l(o,i));return{tonic:o,grades:t,intervals:a,scale:m,chords:de(m,e),chordsHarmonicFunction:n.slice(),chordScales:de(m,r," ")}}}var fe=(t,e)=>{let n=s(t),r=s(e);return n.empty||r.empty?0:r.coord[0]-n.coord[0]},Kr=at("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(",")),Qr=at("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(",")),Jr=at("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(",")),Yr=at("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(","));function Zr(t){let e=s(t).pc;if(!e)return Hr;let n=Kr(e),r=fe("C",e),o=a=>{let m=h(a);return m.empty?"":l(t,m.interval)+m.chordType};return{...n,type:"major",minorRelative:l(e,"-3m"),alteration:r,keySignature:T(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)}}function Wr(t){let e=s(t).pc;if(!e)return Xr;let n=fe("C",e)-3;return{type:"minor",tonic:e,relativeMajor:l(e,"3m"),alteration:n,keySignature:T(n),natural:Qr(e),harmonic:Jr(e),melodic:Yr(e)}}function to(t){return typeof t=="number"?Q("C",t):typeof t=="string"&&/^b+|#+$/.test(t)?Q("C",V(t)):null}var eo={majorKey:Zr,majorTonicFromKeySignature:to,minorKey:Wr};var St=[[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"]],Pe={...g,name:"",alt:0,modeNum:NaN,triad:"",seventh:"",aliases:[]},jt=St.map(ao),Nt={};jt.forEach(t=>{Nt[t.name]=t,t.aliases.forEach(e=>{Nt[e]=t})});function _(t){return typeof t=="string"?Nt[t.toLowerCase()]||Pe:t&&t.name?_(t.name):Pe}var no=d("Mode.mode","Mode.get",_);function Me(){return jt.slice()}var ro=d("Mode.mode","Mode.all",Me);function oo(){return jt.map(t=>t.name)}function ao(t){let[e,n,r,o,a,m,i]=t,c=i?[i]:[],y=Number(n).toString(2);return{empty:!1,intervals:k(o).intervals,modeNum:e,chroma:y,normalized:y,name:o,setNum:n,alt:r,triad:a,seventh:m,aliases:c}}function mo(t,e){return _(t).intervals.map(n=>l(e,n))}function he(t){return(e,n)=>{let r=_(e);if(r.empty)return[];let o=S(r.modeNum,t),a=r.intervals.map(m=>l(n,m));return o.map((m,i)=>a[i]+m)}}var io=he(St.map(t=>t[4])),so=he(St.map(t=>t[5]));function ve(t,e){let n=_(e),r=_(t);return n.empty||r.empty?"":Mt(ht("1P",r.alt-n.alt))}function co(t,e,n){return l(n,ve(t,e))}var uo={get:_,names:oo,all:Me,distance:ve,relativeTonic:co,notes:mo,triads:io,seventhChords:so,entries:ro,mode:no};function lo(t,e){return e.map(h).map(r=>l(t,u(r))+r.chordType)}function po(t,e){return e.map(n=>{let[r,o]=X(n),a=I(t,r);return h(u(a)).name+o})}var fo={fromRomanNumerals:lo,toRomanNumerals:po};function ye(t){let e=B(t.map(vt));return!t.length||e.length!==t.length?[]:e.reduce((n,r)=>{let o=n[n.length-1];return n.concat(x(o,r).slice(1))},[e[0]])}function Po(t,e){return ye(t).map(n=>A(n,e))}var Mo={numeric:ye,chromatic:Po};var ho={empty:!0,name:"",type:"",tonic:null,setNum:NaN,chroma:"",normalized:"",aliases:[],notes:[],intervals:[]};function be(t){if(typeof t!="string")return["",""];let e=t.indexOf(" "),n=s(t.substring(0,e));if(n.empty){let o=s(t);return o.empty?["",t]:[o.name,""]}let r=t.substring(n.name.length+1);return[n.name,r.length?r:""]}var vo=pt;function j(t){let e=Array.isArray(t)?t:be(t),n=s(e[0]).name,r=k(e[1]);if(r.empty)return ho;let o=r.name,a=n?r.intervals.map(i=>l(n,i)):[],m=n?n+" "+o:o;return{...r,name:m,type:o,tonic:n,notes:a}}var yo=d("Scale.scale","Scale.get",j);function bo(t){let e=j(t),n=O(e.chroma);return N().filter(r=>n(r.chroma)).map(r=>r.aliases[0])}function go(t){let e=j(t),n=R(e.chroma);return D().filter(r=>n(r.chroma)).map(r=>r.name)}function Ao(t){let e=O(j(t).chroma);return D().filter(n=>e(n.chroma)).map(n=>n.name)}function ge(t){let e=t.map(o=>s(o).pc).filter(o=>o),n=e[0],r=At(e);return S(r.indexOf(n),r)}function Io(t){let e=j(t);if(e.empty)return[];let n=e.tonic?e.notes:e.intervals;return H(e.chroma).map((r,o)=>{let a=j(r).name;return a?[n[o],a]:["",""]}).filter(r=>r[0])}function No(t){let e=Array.isArray(t)?ge(t):j(t).notes,n=e.map(r=>s(r).chroma);return r=>{let o=typeof r=="number"?s(yt(r)):s(r),a=o.height;if(a===void 0)return;let m=a%12,i=n.indexOf(m);if(i!==-1)return It(o.name,e[i])}}function So(t){let e=No(t);return(n,r)=>{let o=s(n).height,a=s(r).height;return o===void 0||a===void 0?[]:x(o,a).map(e).filter(m=>m)}}var jo={get:j,names:vo,extended:go,modeNames:Io,reduced:Ao,scaleChords:bo,scaleNotes:ge,tokenize:be,rangeOf:So,scale:yo};var To={empty:!0,name:"",upper:void 0,lower:void 0,type:void 0,additive:[]},xo=["4/4","3/4","2/4","2/2","12/8","9/8","6/8","3/8"];function Eo(){return xo.slice()}var Co=/^(\d*\d(?:\+\d)*)\/(\d+)$/,Ae=new Map;function Do(t){let e=JSON.stringify(t),n=Ae.get(e);if(n)return n;let r=Vo(Tt(t));return Ae.set(e,r),r}function Tt(t){if(typeof t=="string"){let[a,m,i]=Co.exec(t)||[];return Tt([m,i])}let[e,n]=t,r=+n;if(typeof e=="number")return[e,r];let o=e.split("+").map(a=>+a);return o.length===1?[o[0],r]:[o,r]}var _o={names:Eo,parse:Tt,get:Do},wo=t=>Math.log(t)/Math.log(2)%1===0;function Vo([t,e]){let n=Array.isArray(t)?t.reduce((i,c)=>i+c,0):t,r=e;if(n===0||r===0)return To;let o=Array.isArray(t)?`${t.join("+")}/${e}`:`${t}/${e}`,a=Array.isArray(t)?t:[],m=r===4||r===2?"simple":r===8&&n%3===0?"compound":wo(r)?"irregular":"irrational";return{empty:!1,name:o,type:m,upper:n,lower:r,additive:a}}var am=ut,mm=Qt,im=Yt,sm=Wt;})();
2
2
  //# sourceMappingURL=tonal.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../core/src/utils.ts", "../../core/src/named.ts", "../../core/src/pitch.ts", "../../core/src/note.ts", "../../core/src/interval.ts", "../../core/src/distance.ts", "../../abc-notation/index.ts", "../../array/index.ts", "../../collection/index.ts", "../../pcset/index.ts", "../../chord-type/index.ts", "../../chord-type/data.ts", "../../chord-detect/index.ts", "../../scale-type/index.ts", "../../scale-type/data.ts", "../../chord/index.ts", "../../duration-value/data.ts", "../../duration-value/index.ts", "../../interval/index.ts", "../../midi/index.ts", "../../note/index.ts", "../../roman-numeral/index.ts", "../../key/index.ts", "../../mode/index.ts", "../../progression/index.ts", "../../range/index.ts", "../../scale/index.ts", "../../time-signature/index.ts", "../index.ts"],
4
- "sourcesContent": ["/**\n * Fill a string with a repeated character\n *\n * @param character\n * @param repetition\n */\nexport const fillStr = (s: string, n: number) => Array(Math.abs(n) + 1).join(s);\n\nexport function deprecate<\n ResultFn extends (this: any, ...newArgs: any[]) => ReturnType<ResultFn>\n>(original: string, alternative: string, fn: ResultFn) {\n return function (this: unknown, ...args: unknown[]): ReturnType<ResultFn> {\n // tslint:disable-next-line\n console.warn(`${original} is deprecated. Use ${alternative}.`);\n return fn.apply(this, args);\n };\n}\n", "export interface Named {\n readonly name: string;\n}\n\nexport interface NamedFound {\n readonly empty: false;\n}\n\nexport interface NotFound extends Named {\n readonly empty: true;\n readonly name: \"\";\n}\n\nexport function isNamed(src: any): src is Named {\n return src !== null && typeof src === \"object\" && typeof src.name === \"string\"\n ? true\n : false;\n}\n", "import { Named } from \"./named\";\n\ntype Fifths = number;\ntype Octaves = number;\nexport type Direction = 1 | -1;\n\nexport type PitchClassCoordinates = [Fifths];\nexport type NoteCoordinates = [Fifths, Octaves];\nexport type IntervalCoordinates = [Fifths, Octaves, Direction];\nexport type PitchCoordinates =\n | PitchClassCoordinates\n | NoteCoordinates\n | IntervalCoordinates;\n\n/**\n * Pitch properties\n *\n * - {number} step - The step number: 0 = C, 1 = D, ... 6 = B\n * - {number} alt - Number of alterations: -2 = 'bb', -1 = 'b', 0 = '', 1 = '#', ...\n * - {number} [oct] = The octave (undefined when is a coord class)\n * - {number} [dir] = Interval direction (undefined when is not an interval)\n */\nexport interface Pitch {\n readonly step: number;\n readonly alt: number;\n readonly oct?: number; // undefined for pitch classes\n readonly dir?: Direction; // undefined for notes\n}\n\nexport function isPitch(pitch: any): pitch is Pitch {\n return pitch !== null &&\n typeof pitch === \"object\" &&\n typeof pitch.step === \"number\" &&\n typeof pitch.alt === \"number\"\n ? true\n : false;\n}\n\n// The number of fifths of [C, D, E, F, G, A, B]\nconst FIFTHS = [0, 2, 4, -1, 1, 3, 5];\n// The number of octaves it span each step\nconst STEPS_TO_OCTS = FIFTHS.map((fifths: number) =>\n Math.floor((fifths * 7) / 12)\n);\n\nexport function encode(pitch: Pitch): PitchCoordinates {\n const { step, alt, oct, dir = 1 } = pitch;\n const f = FIFTHS[step] + 7 * alt;\n if (oct === undefined) {\n return [dir * f];\n }\n const o = oct - STEPS_TO_OCTS[step] - 4 * alt;\n return [dir * f, dir * o];\n}\n\n// We need to get the steps from fifths\n// Fifths for CDEFGAB are [ 0, 2, 4, -1, 1, 3, 5 ]\n// We add 1 to fifths to avoid negative numbers, so:\n// for [\"F\", \"C\", \"G\", \"D\", \"A\", \"E\", \"B\"] we have:\nconst FIFTHS_TO_STEPS = [3, 0, 4, 1, 5, 2, 6];\n\nexport function decode(coord: PitchCoordinates): Pitch {\n const [f, o, dir] = coord;\n const step = FIFTHS_TO_STEPS[unaltered(f)];\n const alt = Math.floor((f + 1) / 7);\n if (o === undefined) {\n return { step, alt, dir };\n }\n const oct = o + 4 * alt + STEPS_TO_OCTS[step];\n return { step, alt, oct, dir };\n}\n\n// Return the number of fifths as if it were unaltered\nfunction unaltered(f: number): number {\n const i = (f + 1) % 7;\n return i < 0 ? 7 + i : i;\n}\n", "import { isNamed, Named } from \"./named\";\nimport { decode, encode, isPitch, Pitch, PitchCoordinates } from \"./pitch\";\nimport { fillStr } from \"./utils\";\n\nexport type NoteWithOctave = string;\nexport type PcName = string;\nexport type NoteName = NoteWithOctave | PcName;\nexport type NoteLiteral = NoteName | Pitch | Named;\n\nexport interface Note extends Pitch, Named {\n readonly empty: boolean;\n readonly name: NoteName;\n readonly letter: string;\n readonly acc: string;\n readonly pc: PcName;\n readonly chroma: number;\n readonly height: number;\n readonly coord: PitchCoordinates;\n readonly midi: number | null;\n readonly freq: number | null;\n}\n\nexport interface NoNote extends Partial<Note> {\n empty: true;\n name: \"\";\n pc: \"\";\n acc: \"\";\n}\nconst NoNote: NoNote = { empty: true, name: \"\", pc: \"\", acc: \"\" };\n\nconst cache: Map<NoteLiteral | undefined, Note | NoNote> = new Map();\n\nexport const stepToLetter = (step: number) => \"CDEFGAB\".charAt(step);\nexport const altToAcc = (alt: number): string =>\n alt < 0 ? fillStr(\"b\", -alt) : fillStr(\"#\", alt);\nexport const accToAlt = (acc: string): number =>\n acc[0] === \"b\" ? -acc.length : acc.length;\n\n/**\n * Given a note literal (a note name or a note object), returns the Note object\n * @example\n * note('Bb4') // => { name: \"Bb4\", midi: 70, chroma: 10, ... }\n */\nexport function note(src: NoteLiteral): Note | NoNote {\n const stringSrc = JSON.stringify(src);\n\n const cached = cache.get(stringSrc);\n if (cached) {\n return cached;\n }\n\n const value =\n typeof src === \"string\"\n ? parse(src)\n : isPitch(src)\n ? note(pitchName(src))\n : isNamed(src)\n ? note(src.name)\n : NoNote;\n cache.set(stringSrc, value);\n return value;\n}\n\ntype NoteTokens = [string, string, string, string];\n\nconst REGEX = /^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\\d*)\\s*(.*)$/;\n\n/**\n * @private\n */\nexport function tokenizeNote(str: string): NoteTokens {\n const m = REGEX.exec(str) as string[];\n return [m[1].toUpperCase(), m[2].replace(/x/g, \"##\"), m[3], m[4]];\n}\n\n/**\n * @private\n */\nexport function coordToNote(noteCoord: PitchCoordinates): Note {\n return note(decode(noteCoord)) as Note;\n}\n\nconst mod = (n: number, m: number) => ((n % m) + m) % m;\n\nconst SEMI = [0, 2, 4, 5, 7, 9, 11];\nfunction parse(noteName: NoteName): Note | NoNote {\n const tokens = tokenizeNote(noteName);\n if (tokens[0] === \"\" || tokens[3] !== \"\") {\n return NoNote;\n }\n\n const letter = tokens[0];\n const acc = tokens[1];\n const octStr = tokens[2];\n\n const step = (letter.charCodeAt(0) + 3) % 7;\n const alt = accToAlt(acc);\n const oct = octStr.length ? +octStr : undefined;\n const coord = encode({ step, alt, oct });\n\n const name = letter + acc + octStr;\n const pc = letter + acc;\n const chroma = (SEMI[step] + alt + 120) % 12;\n const height =\n oct === undefined\n ? mod(SEMI[step] + alt, 12) - 12 * 99\n : SEMI[step] + alt + 12 * (oct + 1);\n const midi = height >= 0 && height <= 127 ? height : null;\n const freq = oct === undefined ? null : Math.pow(2, (height - 69) / 12) * 440;\n\n return {\n empty: false,\n acc,\n alt,\n chroma,\n coord,\n freq,\n height,\n letter,\n midi,\n name,\n oct,\n pc,\n step,\n };\n}\n\nfunction pitchName(props: Pitch): NoteName {\n const { step, alt, oct } = props;\n const letter = stepToLetter(step);\n if (!letter) {\n return \"\";\n }\n\n const pc = letter + altToAcc(alt);\n return oct || oct === 0 ? pc + oct : pc;\n}\n", "import { isNamed, Named } from \"./named\";\nimport {\n decode,\n Direction,\n encode,\n IntervalCoordinates,\n isPitch,\n Pitch,\n PitchCoordinates,\n} from \"./pitch\";\nimport { fillStr } from \"./utils\";\n\nexport type IntervalName = string;\nexport type IntervalLiteral = IntervalName | Pitch | Named;\n\ntype Quality =\n | \"dddd\"\n | \"ddd\"\n | \"dd\"\n | \"d\"\n | \"m\"\n | \"M\"\n | \"P\"\n | \"A\"\n | \"AA\"\n | \"AAA\"\n | \"AAAA\";\ntype Type = \"perfectable\" | \"majorable\";\n\nexport interface Interval extends Pitch, Named {\n readonly empty: boolean;\n readonly name: IntervalName;\n readonly num: number;\n readonly q: Quality;\n readonly type: Type;\n readonly step: number;\n readonly alt: number;\n readonly dir: Direction;\n readonly simple: number;\n readonly semitones: number;\n readonly chroma: number;\n readonly coord: IntervalCoordinates;\n readonly oct: number;\n}\n\nexport interface NoInterval extends Partial<Interval> {\n readonly empty: true;\n readonly name: \"\";\n readonly acc: \"\";\n}\n\nconst NoInterval: NoInterval = { empty: true, name: \"\", acc: \"\" };\n\n// shorthand tonal notation (with quality after number)\nconst INTERVAL_TONAL_REGEX = \"([-+]?\\\\d+)(d{1,4}|m|M|P|A{1,4})\";\n// standard shorthand notation (with quality before number)\nconst INTERVAL_SHORTHAND_REGEX = \"(AA|A|P|M|m|d|dd)([-+]?\\\\d+)\";\nconst REGEX = new RegExp(\n \"^\" + INTERVAL_TONAL_REGEX + \"|\" + INTERVAL_SHORTHAND_REGEX + \"$\"\n);\n\ntype IntervalTokens = [string, string];\n\n/**\n * @private\n */\nexport function tokenizeInterval(str?: IntervalName): IntervalTokens {\n const m = REGEX.exec(`${str}`);\n if (m === null) {\n return [\"\", \"\"];\n }\n return m[1] ? [m[1], m[2]] : [m[4], m[3]];\n}\n\nconst cache: { [key in string]: Interval | NoInterval } = {};\n\n/**\n * Get interval properties. It returns an object with:\n *\n * - name: the interval name\n * - num: the interval number\n * - type: 'perfectable' or 'majorable'\n * - q: the interval quality (d, m, M, A)\n * - dir: interval direction (1 ascending, -1 descending)\n * - simple: the simplified number\n * - semitones: the size in semitones\n * - chroma: the interval chroma\n *\n * @param {string} interval - the interval name\n * @return {Object} the interval properties\n *\n * @example\n * import { interval } from '@tonaljs/core'\n * interval('P5').semitones // => 7\n * interval('m3').type // => 'majorable'\n */\nexport function interval(src: IntervalLiteral): Interval | NoInterval {\n return typeof src === \"string\"\n ? cache[src] || (cache[src] = parse(src))\n : isPitch(src)\n ? interval(pitchName(src))\n : isNamed(src)\n ? interval(src.name)\n : NoInterval;\n}\n\nconst SIZES = [0, 2, 4, 5, 7, 9, 11];\nconst TYPES = \"PMMPPMM\";\nfunction parse(str?: string): Interval | NoInterval {\n const tokens = tokenizeInterval(str);\n if (tokens[0] === \"\") {\n return NoInterval;\n }\n const num = +tokens[0];\n const q = tokens[1] as Quality;\n const step = (Math.abs(num) - 1) % 7;\n const t = TYPES[step];\n if (t === \"M\" && q === \"P\") {\n return NoInterval;\n }\n const type = t === \"M\" ? \"majorable\" : \"perfectable\";\n\n const name = \"\" + num + q;\n const dir = num < 0 ? -1 : 1;\n const simple = num === 8 || num === -8 ? num : dir * (step + 1);\n const alt = qToAlt(type, q);\n const oct = Math.floor((Math.abs(num) - 1) / 7);\n const semitones = dir * (SIZES[step] + alt + 12 * oct);\n const chroma = (((dir * (SIZES[step] + alt)) % 12) + 12) % 12;\n const coord = encode({ step, alt, oct, dir }) as IntervalCoordinates;\n return {\n empty: false,\n name,\n num,\n q,\n step,\n alt,\n dir,\n type,\n simple,\n semitones,\n chroma,\n coord,\n oct,\n };\n}\n\n/**\n * @private\n *\n * forceDescending is used in the case of unison (#243)\n */\nexport function coordToInterval(\n coord: PitchCoordinates,\n forceDescending?: boolean\n): Interval {\n const [f, o = 0] = coord;\n const isDescending = f * 7 + o * 12 < 0;\n const ivl: IntervalCoordinates =\n forceDescending || isDescending ? [-f, -o, -1] : [f, o, 1];\n return interval(decode(ivl)) as Interval;\n}\n\nfunction qToAlt(type: Type, q: string): number {\n return (q === \"M\" && type === \"majorable\") ||\n (q === \"P\" && type === \"perfectable\")\n ? 0\n : q === \"m\" && type === \"majorable\"\n ? -1\n : /^A+$/.test(q)\n ? q.length\n : /^d+$/.test(q)\n ? -1 * (type === \"perfectable\" ? q.length : q.length + 1)\n : 0;\n}\n\n// return the interval name of a pitch\nfunction pitchName(props: Pitch): string {\n const { step, alt, oct = 0, dir } = props;\n if (!dir) {\n return \"\";\n }\n const calcNum = step + 1 + 7 * oct;\n // this is an edge case: descending pitch class unison (see #243)\n const num = calcNum === 0 ? step + 1 : calcNum;\n const d = dir < 0 ? \"-\" : \"\";\n const type = TYPES[step] === \"M\" ? \"majorable\" : \"perfectable\";\n const name = d + num + altToQ(type, alt);\n return name;\n}\n\nfunction altToQ(type: Type, alt: number): Quality {\n if (alt === 0) {\n return type === \"majorable\" ? \"M\" : \"P\";\n } else if (alt === -1 && type === \"majorable\") {\n return \"m\";\n } else if (alt > 0) {\n return fillStr(\"A\", alt) as Quality;\n } else {\n return fillStr(\"d\", type === \"perfectable\" ? alt : alt + 1) as Quality;\n }\n}\n", "import {\n coordToInterval,\n interval as asInterval,\n IntervalLiteral,\n IntervalName,\n} from \"./interval\";\nimport { coordToNote, note as asNote, NoteLiteral, NoteName } from \"./note\";\nimport { PitchCoordinates } from \"./pitch\";\n\n/**\n * Transpose a note by an interval.\n *\n * @param {string} note - the note or note name\n * @param {string} interval - the interval or interval name\n * @return {string} the transposed note name or empty string if not valid notes\n * @example\n * import { tranpose } from \"@tonaljs/core\"\n * transpose(\"d3\", \"3M\") // => \"F#3\"\n * transpose(\"D\", \"3M\") // => \"F#\"\n * [\"C\", \"D\", \"E\", \"F\", \"G\"].map(pc => transpose(pc, \"M3)) // => [\"E\", \"F#\", \"G#\", \"A\", \"B\"]\n */\nexport function transpose(\n noteName: NoteLiteral,\n intervalName: IntervalLiteral\n): NoteName {\n const note = asNote(noteName);\n const interval = asInterval(intervalName);\n if (note.empty || interval.empty) {\n return \"\";\n }\n const noteCoord = note.coord;\n const intervalCoord = interval.coord;\n const tr: PitchCoordinates =\n noteCoord.length === 1\n ? [noteCoord[0] + intervalCoord[0]]\n : [noteCoord[0] + intervalCoord[0], noteCoord[1] + intervalCoord[1]];\n return coordToNote(tr).name;\n}\n\n/**\n * Find the interval distance between two notes or coord classes.\n *\n * To find distance between coord classes, both notes must be coord classes and\n * the interval is always ascending\n *\n * @param {Note|string} from - the note or note name to calculate distance from\n * @param {Note|string} to - the note or note name to calculate distance to\n * @return {string} the interval name or empty string if not valid notes\n *\n */\nexport function distance(\n fromNote: NoteLiteral,\n toNote: NoteLiteral\n): IntervalName {\n const from = asNote(fromNote);\n const to = asNote(toNote);\n if (from.empty || to.empty) {\n return \"\";\n }\n\n const fcoord = from.coord;\n const tcoord = to.coord;\n const fifths = tcoord[0] - fcoord[0];\n const octs =\n fcoord.length === 2 && tcoord.length === 2\n ? tcoord[1] - fcoord[1]\n : -Math.floor((fifths * 7) / 12);\n\n // If it's unison and not pitch class, it can be descending interval (#243)\n const forceDescending =\n to.height === from.height &&\n to.midi !== null &&\n from.midi !== null &&\n from.step > to.step;\n return coordToInterval([fifths, octs], forceDescending).name;\n}\n", "import { distance as dist, note, transpose as tr } from \"@tonaljs/core\";\n\nconst fillStr = (character: string, times: number) =>\n Array(times + 1).join(character);\n\nconst REGEX = /^(_{1,}|=|\\^{1,}|)([abcdefgABCDEFG])([,']*)$/;\n\ntype AbcTokens = [string, string, string];\n\nexport function tokenize(str: string): AbcTokens {\n const m = REGEX.exec(str);\n if (!m) {\n return [\"\", \"\", \"\"];\n }\n return [m[1], m[2], m[3]];\n}\n\n/**\n * Convert a (string) note in ABC notation into a (string) note in scientific notation\n *\n * @example\n * abcToScientificNotation(\"c\") // => \"C5\"\n */\nexport function abcToScientificNotation(str: string): string {\n const [acc, letter, oct] = tokenize(str);\n if (letter === \"\") {\n return \"\";\n }\n let o = 4;\n for (let i = 0; i < oct.length; i++) {\n o += oct.charAt(i) === \",\" ? -1 : 1;\n }\n const a =\n acc[0] === \"_\"\n ? acc.replace(/_/g, \"b\")\n : acc[0] === \"^\"\n ? acc.replace(/\\^/g, \"#\")\n : \"\";\n return letter.charCodeAt(0) > 96\n ? letter.toUpperCase() + a + (o + 1)\n : letter + a + o;\n}\n\n/**\n * Convert a (string) note in scientific notation into a (string) note in ABC notation\n *\n * @example\n * scientificToAbcNotation(\"C#4\") // => \"^C\"\n */\nexport function scientificToAbcNotation(str: string): string {\n const n = note(str);\n if (n.empty || (!n.oct && n.oct !== 0)) {\n return \"\";\n }\n const { letter, acc, oct } = n;\n const a = acc[0] === \"b\" ? acc.replace(/b/g, \"_\") : acc.replace(/#/g, \"^\");\n const l = oct > 4 ? letter.toLowerCase() : letter;\n const o =\n oct === 5 ? \"\" : oct > 4 ? fillStr(\"'\", oct - 5) : fillStr(\",\", 4 - oct);\n return a + l + o;\n}\n\nexport function transpose(note: string, interval: string): string {\n return scientificToAbcNotation(tr(abcToScientificNotation(note), interval));\n}\n\nexport function distance(from: string, to: string): string {\n return dist(abcToScientificNotation(from), abcToScientificNotation(to));\n}\n\nexport default {\n abcToScientificNotation,\n scientificToAbcNotation,\n tokenize,\n transpose,\n distance,\n};\n", "import { note, Note } from \"@tonaljs/core\";\n\nconst isArray = Array.isArray;\n\n// ascending range\nfunction ascR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = n + b);\n return a;\n}\n// descending range\nfunction descR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = b - n);\n return a;\n}\n\n/**\n * Creates a numeric range\n *\n * @param {number} from\n * @param {number} to\n * @return {Array<number>}\n *\n * @example\n * range(-2, 2) // => [-2, -1, 0, 1, 2]\n * range(2, -2) // => [2, 1, 0, -1, -2]\n */\nexport function range(from: number, to: number): number[] {\n return from < to ? ascR(from, to - from + 1) : descR(from, from - to + 1);\n}\n\n/**\n * Rotates a list a number of times. It\"s completly agnostic about the\n * contents of the list.\n *\n * @param {Integer} times - the number of rotations\n * @param {Array} array\n * @return {Array} the rotated array\n *\n * @example\n * rotate(1, [1, 2, 3]) // => [2, 3, 1]\n */\nexport function rotate<T>(times: number, arr: T[]): T[] {\n const len = arr.length;\n const n = ((times % len) + len) % len;\n return arr.slice(n, len).concat(arr.slice(0, n));\n}\n\n/**\n * Return a copy of the array with the null values removed\n * @function\n * @param {Array} array\n * @return {Array}\n *\n * @example\n * compact([\"a\", \"b\", null, \"c\"]) // => [\"a\", \"b\", \"c\"]\n */\nexport function compact(arr: any[]): any[] {\n return arr.filter((n) => n === 0 || n);\n}\n\n/**\n * Sort an array of notes in ascending order. Pitch classes are listed\n * before notes. Any string that is not a note is removed.\n *\n * @param {string[]} notes\n * @return {string[]} sorted array of notes\n *\n * @example\n * sortedNoteNames(['c2', 'c5', 'c1', 'c0', 'c6', 'c'])\n * // => ['C', 'C0', 'C1', 'C2', 'C5', 'C6']\n * sortedNoteNames(['c', 'F', 'G', 'a', 'b', 'h', 'J'])\n * // => ['C', 'F', 'G', 'A', 'B']\n */\nexport function sortedNoteNames(notes: string[]): string[] {\n const valid = notes.map((n) => note(n)).filter((n) => !n.empty) as Note[];\n return valid.sort((a, b) => a.height - b.height).map((n) => n.name);\n}\n\n/**\n * Get sorted notes with duplicates removed. Pitch classes are listed\n * before notes.\n *\n * @function\n * @param {string[]} array\n * @return {string[]} unique sorted notes\n *\n * @example\n * Array.sortedUniqNoteNames(['a', 'b', 'c2', '1p', 'p2', 'c2', 'b', 'c', 'c3' ])\n * // => [ 'C', 'A', 'B', 'C2', 'C3' ]\n */\nexport function sortedUniqNoteNames(arr: string[]): string[] {\n return sortedNoteNames(arr).filter((n, i, a) => i === 0 || n !== a[i - 1]);\n}\n\n/**\n * Randomizes the order of the specified array in-place, using the Fisher\u2013Yates shuffle.\n *\n * @function\n * @param {Array} array\n * @return {Array} the array shuffled\n *\n * @example\n * shuffle([\"C\", \"D\", \"E\", \"F\"]) // => [...]\n */\nexport function shuffle(arr: any[], rnd = Math.random): any[] {\n let i: number;\n let t: any;\n let m: number = arr.length;\n while (m) {\n i = Math.floor(rnd() * m--);\n t = arr[m];\n arr[m] = arr[i];\n arr[i] = t;\n }\n return arr;\n}\n\n/**\n * Get all permutations of an array\n *\n * @param {Array} array - the array\n * @return {Array<Array>} an array with all the permutations\n * @example\n * permutations([\"a\", \"b\", \"c\"])) // =>\n * [\n * [\"a\", \"b\", \"c\"],\n * [\"b\", \"a\", \"c\"],\n * [\"b\", \"c\", \"a\"],\n * [\"a\", \"c\", \"b\"],\n * [\"c\", \"a\", \"b\"],\n * [\"c\", \"b\", \"a\"]\n * ]\n */\nexport function permutations(arr: any[]): any[] {\n if (arr.length === 0) {\n return [[]];\n }\n return permutations(arr.slice(1)).reduce((acc, perm) => {\n return acc.concat(\n arr.map((e, pos) => {\n const newPerm = perm.slice();\n newPerm.splice(pos, 0, arr[0]);\n return newPerm;\n })\n );\n }, []);\n}\n", "// ascending range\nfunction ascR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = n + b);\n return a;\n}\n// descending range\nfunction descR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = b - n);\n return a;\n}\n\n/**\n * Creates a numeric range\n *\n * @param {number} from\n * @param {number} to\n * @return {Array<number>}\n *\n * @example\n * range(-2, 2) // => [-2, -1, 0, 1, 2]\n * range(2, -2) // => [2, 1, 0, -1, -2]\n */\nexport function range(from: number, to: number): number[] {\n return from < to ? ascR(from, to - from + 1) : descR(from, from - to + 1);\n}\n\n/**\n * Rotates a list a number of times. It\"s completly agnostic about the\n * contents of the list.\n *\n * @param {Integer} times - the number of rotations\n * @param {Array} collection\n * @return {Array} the rotated collection\n *\n * @example\n * rotate(1, [1, 2, 3]) // => [2, 3, 1]\n */\nexport function rotate<T>(times: number, arr: T[]): T[] {\n const len = arr.length;\n const n = ((times % len) + len) % len;\n return arr.slice(n, len).concat(arr.slice(0, n));\n}\n\n/**\n * Return a copy of the collection with the null values removed\n * @function\n * @param {Array} collection\n * @return {Array}\n *\n * @example\n * compact([\"a\", \"b\", null, \"c\"]) // => [\"a\", \"b\", \"c\"]\n */\nexport function compact(arr: any[]): any[] {\n return arr.filter((n) => n === 0 || n);\n}\n\n/**\n * Randomizes the order of the specified collection in-place, using the Fisher\u2013Yates shuffle.\n *\n * @function\n * @param {Array} collection\n * @return {Array} the collection shuffled\n *\n * @example\n * shuffle([\"C\", \"D\", \"E\", \"F\"]) // => [...]\n */\nexport function shuffle(arr: any[], rnd = Math.random): any[] {\n let i: number;\n let t: any;\n let m: number = arr.length;\n while (m) {\n i = Math.floor(rnd() * m--);\n t = arr[m];\n arr[m] = arr[i];\n arr[i] = t;\n }\n return arr;\n}\n\n/**\n * Get all permutations of an collection\n *\n * @param {Array} collection - the collection\n * @return {Array<Array>} an collection with all the permutations\n * @example\n * permutations([\"a\", \"b\", \"c\"])) // =>\n * [\n * [\"a\", \"b\", \"c\"],\n * [\"b\", \"a\", \"c\"],\n * [\"b\", \"c\", \"a\"],\n * [\"a\", \"c\", \"b\"],\n * [\"c\", \"a\", \"b\"],\n * [\"c\", \"b\", \"a\"]\n * ]\n */\nexport function permutations(arr: any[]): any[] {\n if (arr.length === 0) {\n return [[]];\n }\n return permutations(arr.slice(1)).reduce((acc, perm) => {\n return acc.concat(\n arr.map((e, pos) => {\n const newPerm = perm.slice();\n newPerm.splice(pos, 0, arr[0]);\n return newPerm;\n })\n );\n }, []);\n}\n\nexport default {\n compact,\n permutations,\n range,\n rotate,\n shuffle,\n};\n", "import { compact, range, rotate } from \"@tonaljs/collection\";\nimport {\n deprecate,\n Interval,\n interval,\n IntervalName,\n Named,\n note,\n Note,\n NoteName,\n NotFound,\n} from \"@tonaljs/core\";\n\n/**\n * The properties of a pitch class set\n * @param {number} num - a number between 1 and 4095 (both included) that\n * uniquely identifies the set. It's the decimal number of the chrom.\n * @param {string} chroma - a string representation of the set: a 12-char string\n * with either \"1\" or \"0\" as characters, representing a pitch class or not\n * for the given position in the octave. For example, a \"1\" at index 0 means 'C',\n * a \"1\" at index 2 means 'D', and so on...\n * @param {string} normalized - the chroma but shifted to the first 1\n * @param {number} length - the number of notes of the pitch class set\n * @param {IntervalName[]} intervals - the intervals of the pitch class set\n * *starting from C*\n */\nexport interface Pcset extends Named {\n readonly empty: boolean;\n readonly setNum: number;\n readonly chroma: PcsetChroma;\n readonly normalized: PcsetChroma;\n readonly intervals: IntervalName[];\n}\n\nexport const EmptyPcset: Pcset = {\n empty: true,\n name: \"\",\n setNum: 0,\n chroma: \"000000000000\",\n normalized: \"000000000000\",\n intervals: [],\n};\n\nexport type PcsetChroma = string;\nexport type PcsetNum = number;\n\n// UTILITIES\nconst setNumToChroma = (num: number): string => Number(num).toString(2);\nconst chromaToNumber = (chroma: string): number => parseInt(chroma, 2);\nconst REGEX = /^[01]{12}$/;\nfunction isChroma(set: any): set is PcsetChroma {\n return REGEX.test(set);\n}\nconst isPcsetNum = (set: any): set is PcsetNum =>\n typeof set === \"number\" && set >= 0 && set <= 4095;\nconst isPcset = (set: any): set is Pcset => set && isChroma(set.chroma);\n\nconst cache: { [key in string]: Pcset } = { [EmptyPcset.chroma]: EmptyPcset };\n\n/**\n * A definition of a pitch class set. It could be:\n * - The pitch class set chroma (a 12-length string with only 1s or 0s)\n * - The pitch class set number (an integer between 1 and 4095)\n * - An array of note names\n * - An array of interval names\n */\nexport type Set =\n | Partial<Pcset>\n | PcsetChroma\n | PcsetNum\n | NoteName[]\n | IntervalName[];\n\n/**\n * Get the pitch class set of a collection of notes or set number or chroma\n */\nexport function get(src: Set): Pcset {\n const chroma: PcsetChroma = isChroma(src)\n ? src\n : isPcsetNum(src)\n ? setNumToChroma(src)\n : Array.isArray(src)\n ? listToChroma(src)\n : isPcset(src)\n ? src.chroma\n : EmptyPcset.chroma;\n\n return (cache[chroma] = cache[chroma] || chromaToPcset(chroma));\n}\n\n/**\n * Use Pcset.properties\n * @function\n * @deprecated\n */\nexport const pcset = deprecate(\"Pcset.pcset\", \"Pcset.get\", get);\n\n/**\n * Get pitch class set chroma\n * @function\n * @example\n * Pcset.chroma([\"c\", \"d\", \"e\"]); //=> \"101010000000\"\n */\nconst chroma = (set: Set) => get(set).chroma;\n\n/**\n * Get intervals (from C) of a set\n * @function\n * @example\n * Pcset.intervals([\"c\", \"d\", \"e\"]); //=>\n */\nconst intervals = (set: Set) => get(set).intervals;\n\n/**\n * Get pitch class set number\n * @function\n * @example\n * Pcset.num([\"c\", \"d\", \"e\"]); //=> 2192\n */\nconst num = (set: Set) => get(set).setNum;\n\nconst IVLS = [\n \"1P\",\n \"2m\",\n \"2M\",\n \"3m\",\n \"3M\",\n \"4P\",\n \"5d\",\n \"5P\",\n \"6m\",\n \"6M\",\n \"7m\",\n \"7M\",\n];\n\n/**\n * @private\n * Get the intervals of a pcset *starting from C*\n * @param {Set} set - the pitch class set\n * @return {IntervalName[]} an array of interval names or an empty array\n * if not a valid pitch class set\n */\nexport function chromaToIntervals(chroma: PcsetChroma): IntervalName[] {\n const intervals = [];\n for (let i = 0; i < 12; i++) {\n // tslint:disable-next-line:curly\n if (chroma.charAt(i) === \"1\") intervals.push(IVLS[i]);\n }\n return intervals;\n}\n\n/**\n * Get a list of all possible pitch class sets (all possible chromas) *having\n * C as root*. There are 2048 different chromas. If you want them with another\n * note you have to transpose it\n *\n * @see http://allthescales.org/\n * @return {Array<PcsetChroma>} an array of possible chromas from '10000000000' to '11111111111'\n */\nexport function chromas(): PcsetChroma[] {\n return range(2048, 4095).map(setNumToChroma);\n}\n\n/**\n * Given a a list of notes or a pcset chroma, produce the rotations\n * of the chroma discarding the ones that starts with \"0\"\n *\n * This is used, for example, to get all the modes of a scale.\n *\n * @param {Array|string} set - the list of notes or pitchChr of the set\n * @param {boolean} normalize - (Optional, true by default) remove all\n * the rotations that starts with \"0\"\n * @return {Array<string>} an array with all the modes of the chroma\n *\n * @example\n * Pcset.modes([\"C\", \"D\", \"E\"]).map(Pcset.intervals)\n */\nexport function modes(set: Set, normalize = true): PcsetChroma[] {\n const pcs = get(set);\n\n const binary = pcs.chroma.split(\"\");\n return compact(\n binary.map((_, i) => {\n const r = rotate(i, binary);\n return normalize && r[0] === \"0\" ? null : r.join(\"\");\n })\n );\n}\n\n/**\n * Test if two pitch class sets are numentical\n *\n * @param {Array|string} set1 - one of the pitch class sets\n * @param {Array|string} set2 - the other pitch class set\n * @return {boolean} true if they are equal\n * @example\n * Pcset.isEqual([\"c2\", \"d3\"], [\"c5\", \"d2\"]) // => true\n */\nexport function isEqual(s1: Set, s2: Set) {\n return get(s1).setNum === get(s2).setNum;\n}\n\n/**\n * Create a function that test if a collection of notes is a\n * subset of a given set\n *\n * The function is curryfied.\n *\n * @param {PcsetChroma|NoteName[]} set - the superset to test against (chroma or\n * list of notes)\n * @return{function(PcsetChroma|NoteNames[]): boolean} a function accepting a set\n * to test against (chroma or list of notes)\n * @example\n * const inCMajor = Pcset.isSubsetOf([\"C\", \"E\", \"G\"])\n * inCMajor([\"e6\", \"c4\"]) // => true\n * inCMajor([\"e6\", \"c4\", \"d3\"]) // => false\n */\nexport function isSubsetOf(set: Set) {\n const s = get(set).setNum;\n\n return (notes: Set | Pcset) => {\n const o = get(notes).setNum;\n // tslint:disable-next-line: no-bitwise\n return s && s !== o && (o & s) === o;\n };\n}\n\n/**\n * Create a function that test if a collection of notes is a\n * superset of a given set (it contains all notes and at least one more)\n *\n * @param {Set} set - an array of notes or a chroma set string to test against\n * @return {(subset: Set): boolean} a function that given a set\n * returns true if is a subset of the first one\n * @example\n * const extendsCMajor = Pcset.isSupersetOf([\"C\", \"E\", \"G\"])\n * extendsCMajor([\"e6\", \"a\", \"c4\", \"g2\"]) // => true\n * extendsCMajor([\"c6\", \"e4\", \"g3\"]) // => false\n */\nexport function isSupersetOf(set: Set) {\n const s = get(set).setNum;\n return (notes: Set) => {\n const o = get(notes).setNum;\n // tslint:disable-next-line: no-bitwise\n return s && s !== o && (o | s) === o;\n };\n}\n\n/**\n * Test if a given pitch class set includes a note\n *\n * @param {Array<string>} set - the base set to test against\n * @param {string} note - the note to test\n * @return {boolean} true if the note is included in the pcset\n *\n * Can be partially applied\n *\n * @example\n * const isNoteInCMajor = isNoteIncludedIn(['C', 'E', 'G'])\n * isNoteInCMajor('C4') // => true\n * isNoteInCMajor('C#4') // => false\n */\nexport function isNoteIncludedIn(set: Set) {\n const s = get(set);\n\n return (noteName: NoteName): boolean => {\n const n = note(noteName);\n return s && !n.empty && s.chroma.charAt(n.chroma) === \"1\";\n };\n}\n\n/** @deprecated use: isNoteIncludedIn */\nexport const includes = isNoteIncludedIn;\n\n/**\n * Filter a list with a pitch class set\n *\n * @param {Array|string} set - the pitch class set notes\n * @param {Array|string} notes - the note list to be filtered\n * @return {Array} the filtered notes\n *\n * @example\n * Pcset.filter([\"C\", \"D\", \"E\"], [\"c2\", \"c#2\", \"d2\", \"c3\", \"c#3\", \"d3\"]) // => [ \"c2\", \"d2\", \"c3\", \"d3\" ])\n * Pcset.filter([\"C2\"], [\"c2\", \"c#2\", \"d2\", \"c3\", \"c#3\", \"d3\"]) // => [ \"c2\", \"c3\" ])\n */\nexport function filter(set: Set) {\n const isIncluded = isNoteIncludedIn(set);\n return (notes: NoteName[]) => {\n return notes.filter(isIncluded);\n };\n}\n\nexport default {\n get,\n chroma,\n num,\n intervals,\n chromas,\n isSupersetOf,\n isSubsetOf,\n isNoteIncludedIn,\n isEqual,\n filter,\n modes,\n // deprecated\n pcset,\n};\n\n//// PRIVATE ////\n\nfunction chromaRotations(chroma: string): string[] {\n const binary = chroma.split(\"\");\n return binary.map((_, i) => rotate(i, binary).join(\"\"));\n}\n\nfunction chromaToPcset(chroma: PcsetChroma): Pcset {\n const setNum = chromaToNumber(chroma);\n const normalizedNum = chromaRotations(chroma)\n .map(chromaToNumber)\n .filter((n) => n >= 2048)\n .sort()[0];\n const normalized = setNumToChroma(normalizedNum);\n\n const intervals = chromaToIntervals(chroma);\n\n return {\n empty: false,\n name: \"\",\n setNum,\n chroma,\n normalized,\n intervals,\n };\n}\n\nfunction listToChroma(set: any[]): PcsetChroma {\n if (set.length === 0) {\n return EmptyPcset.chroma;\n }\n\n let pitch: Note | Interval | NotFound;\n const binary = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n // tslint:disable-next-line:prefer-for-of\n for (let i = 0; i < set.length; i++) {\n pitch = note(set[i]);\n // tslint:disable-next-line: curly\n if (pitch.empty) pitch = interval(set[i]);\n // tslint:disable-next-line: curly\n if (!pitch.empty) binary[pitch.chroma] = 1;\n }\n return binary.join(\"\");\n}\n", "import { deprecate } from \"@tonaljs/core\";\nimport {\n EmptyPcset,\n get as pcset,\n Pcset,\n PcsetChroma,\n PcsetNum,\n} from \"@tonaljs/pcset\";\nimport data from \"./data\";\n\nexport type ChordQuality =\n | \"Major\"\n | \"Minor\"\n | \"Augmented\"\n | \"Diminished\"\n | \"Unknown\";\n\nexport interface ChordType extends Pcset {\n name: string;\n quality: ChordQuality;\n aliases: string[];\n}\nconst NoChordType: ChordType = {\n ...EmptyPcset,\n name: \"\",\n quality: \"Unknown\",\n intervals: [],\n aliases: [],\n};\n\ntype ChordTypeName = string | PcsetChroma | PcsetNum;\n\nlet dictionary: ChordType[] = [];\nlet index: Record<ChordTypeName, ChordType> = {};\n\n/**\n * Given a chord name or chroma, return the chord properties\n * @param {string} source - chord name or pitch class set chroma\n * @example\n * import { get } from 'tonaljs/chord-type'\n * get('major') // => { name: 'major', ... }\n */\nexport function get(type: ChordTypeName): ChordType {\n return index[type] || NoChordType;\n}\n\nexport const chordType = deprecate(\"ChordType.chordType\", \"ChordType.get\", get);\n\n/**\n * Get all chord (long) names\n */\nexport function names() {\n return dictionary.map((chord) => chord.name).filter((x) => x);\n}\n\n/**\n * Get all chord symbols\n */\nexport function symbols() {\n return dictionary.map((chord) => chord.aliases[0]).filter((x) => x);\n}\n\n/**\n * Keys used to reference chord types\n */\nexport function keys() {\n return Object.keys(index);\n}\n\n/**\n * Return a list of all chord types\n */\nexport function all(): ChordType[] {\n return dictionary.slice();\n}\n\nexport const entries = deprecate(\"ChordType.entries\", \"ChordType.all\", all);\n\n/**\n * Clear the dictionary\n */\nexport function removeAll() {\n dictionary = [];\n index = {};\n}\n\n/**\n * Add a chord to the dictionary.\n * @param intervals\n * @param aliases\n * @param [fullName]\n */\nexport function add(intervals: string[], aliases: string[], fullName?: string) {\n const quality = getQuality(intervals);\n const chord = {\n ...pcset(intervals),\n name: fullName || \"\",\n quality,\n intervals,\n aliases,\n };\n dictionary.push(chord);\n if (chord.name) {\n index[chord.name] = chord;\n }\n index[chord.setNum] = chord;\n index[chord.chroma] = chord;\n chord.aliases.forEach((alias) => addAlias(chord, alias));\n}\n\nexport function addAlias(chord: ChordType, alias: string) {\n index[alias] = chord;\n}\n\nfunction getQuality(intervals: string[]): ChordQuality {\n const has = (interval: string) => intervals.indexOf(interval) !== -1;\n return has(\"5A\")\n ? \"Augmented\"\n : has(\"3M\")\n ? \"Major\"\n : has(\"5d\")\n ? \"Diminished\"\n : has(\"3m\")\n ? \"Minor\"\n : \"Unknown\";\n}\n\ndata.forEach(([ivls, fullName, names]: string[]) =>\n add(ivls.split(\" \"), names.split(\" \"), fullName)\n);\ndictionary.sort((a, b) => a.setNum - b.setNum);\n\nexport default {\n names,\n symbols,\n get,\n all,\n add,\n removeAll,\n keys,\n // deprecated\n entries,\n chordType,\n};\n", "/**\n * @private\n * Chord List\n * Source: https://en.wikibooks.org/wiki/Music_Theory/Complete_List_of_Chord_Patterns\n * Format: [\"intervals\", \"full name\", \"abrv1 abrv2\"]\n */\nconst CHORDS: string[][] = [\n // ==Major==\n [\"1P 3M 5P\", \"major\", \"M ^ maj\"],\n [\"1P 3M 5P 7M\", \"major seventh\", \"maj7 \u0394 ma7 M7 Maj7 ^7\"],\n [\"1P 3M 5P 7M 9M\", \"major ninth\", \"maj9 \u03949 ^9\"],\n [\"1P 3M 5P 7M 9M 13M\", \"major thirteenth\", \"maj13 Maj13 ^13\"],\n [\"1P 3M 5P 6M\", \"sixth\", \"6 add6 add13 M6\"],\n [\"1P 3M 5P 6M 9M\", \"sixth/ninth\", \"6/9 69 M69\"],\n [\"1P 3M 6m 7M\", \"major seventh flat sixth\", \"M7b6 ^7b6\"],\n [\n \"1P 3M 5P 7M 11A\",\n \"major seventh sharp eleventh\",\n \"maj#4 \u0394#4 \u0394#11 M7#11 ^7#11 maj7#11\",\n ],\n // ==Minor==\n // '''Normal'''\n [\"1P 3m 5P\", \"minor\", \"m min -\"],\n [\"1P 3m 5P 7m\", \"minor seventh\", \"m7 min7 mi7 -7\"],\n [\n \"1P 3m 5P 7M\",\n \"minor/major seventh\",\n \"m/ma7 m/maj7 mM7 mMaj7 m/M7 -\u03947 m\u0394 -^7\",\n ],\n [\"1P 3m 5P 6M\", \"minor sixth\", \"m6 -6\"],\n [\"1P 3m 5P 7m 9M\", \"minor ninth\", \"m9 -9\"],\n [\"1P 3m 5P 7M 9M\", \"minor/major ninth\", \"mM9 mMaj9 -^9\"],\n [\"1P 3m 5P 7m 9M 11P\", \"minor eleventh\", \"m11 -11\"],\n [\"1P 3m 5P 7m 9M 13M\", \"minor thirteenth\", \"m13 -13\"],\n // '''Diminished'''\n [\"1P 3m 5d\", \"diminished\", \"dim \u00B0 o\"],\n [\"1P 3m 5d 7d\", \"diminished seventh\", \"dim7 \u00B07 o7\"],\n [\"1P 3m 5d 7m\", \"half-diminished\", \"m7b5 \u00F8 -7b5 h7 h\"],\n // ==Dominant/Seventh==\n // '''Normal'''\n [\"1P 3M 5P 7m\", \"dominant seventh\", \"7 dom\"],\n [\"1P 3M 5P 7m 9M\", \"dominant ninth\", \"9\"],\n [\"1P 3M 5P 7m 9M 13M\", \"dominant thirteenth\", \"13\"],\n [\"1P 3M 5P 7m 11A\", \"lydian dominant seventh\", \"7#11 7#4\"],\n // '''Altered'''\n [\"1P 3M 5P 7m 9m\", \"dominant flat ninth\", \"7b9\"],\n [\"1P 3M 5P 7m 9A\", \"dominant sharp ninth\", \"7#9\"],\n [\"1P 3M 7m 9m\", \"altered\", \"alt7\"],\n // '''Suspended'''\n [\"1P 4P 5P\", \"suspended fourth\", \"sus4 sus\"],\n [\"1P 2M 5P\", \"suspended second\", \"sus2\"],\n [\"1P 4P 5P 7m\", \"suspended fourth seventh\", \"7sus4 7sus\"],\n [\"1P 5P 7m 9M 11P\", \"eleventh\", \"11\"],\n [\n \"1P 4P 5P 7m 9m\",\n \"suspended fourth flat ninth\",\n \"b9sus phryg 7b9sus 7b9sus4\",\n ],\n // ==Other==\n [\"1P 5P\", \"fifth\", \"5\"],\n [\"1P 3M 5A\", \"augmented\", \"aug + +5 ^#5\"],\n [\"1P 3m 5A\", \"minor augmented\", \"m#5 -#5 m+\"],\n [\"1P 3M 5A 7M\", \"augmented seventh\", \"maj7#5 maj7+5 +maj7 ^7#5\"],\n [\n \"1P 3M 5P 7M 9M 11A\",\n \"major sharp eleventh (lydian)\",\n \"maj9#11 \u03949#11 ^9#11\",\n ],\n // ==Legacy==\n [\"1P 2M 4P 5P\", \"\", \"sus24 sus4add9\"],\n [\"1P 3M 5A 7M 9M\", \"\", \"maj9#5 Maj9#5\"],\n [\"1P 3M 5A 7m\", \"\", \"7#5 +7 7+ 7aug aug7\"],\n [\"1P 3M 5A 7m 9A\", \"\", \"7#5#9 7#9#5 7alt\"],\n [\"1P 3M 5A 7m 9M\", \"\", \"9#5 9+\"],\n [\"1P 3M 5A 7m 9M 11A\", \"\", \"9#5#11\"],\n [\"1P 3M 5A 7m 9m\", \"\", \"7#5b9 7b9#5\"],\n [\"1P 3M 5A 7m 9m 11A\", \"\", \"7#5b9#11\"],\n [\"1P 3M 5A 9A\", \"\", \"+add#9\"],\n [\"1P 3M 5A 9M\", \"\", \"M#5add9 +add9\"],\n [\"1P 3M 5P 6M 11A\", \"\", \"M6#11 M6b5 6#11 6b5\"],\n [\"1P 3M 5P 6M 7M 9M\", \"\", \"M7add13\"],\n [\"1P 3M 5P 6M 9M 11A\", \"\", \"69#11\"],\n [\"1P 3m 5P 6M 9M\", \"\", \"m69 -69\"],\n [\"1P 3M 5P 6m 7m\", \"\", \"7b6\"],\n [\"1P 3M 5P 7M 9A 11A\", \"\", \"maj7#9#11\"],\n [\"1P 3M 5P 7M 9M 11A 13M\", \"\", \"M13#11 maj13#11 M13+4 M13#4\"],\n [\"1P 3M 5P 7M 9m\", \"\", \"M7b9\"],\n [\"1P 3M 5P 7m 11A 13m\", \"\", \"7#11b13 7b5b13\"],\n [\"1P 3M 5P 7m 13M\", \"\", \"7add6 67 7add13\"],\n [\"1P 3M 5P 7m 9A 11A\", \"\", \"7#9#11 7b5#9 7#9b5\"],\n [\"1P 3M 5P 7m 9A 11A 13M\", \"\", \"13#9#11\"],\n [\"1P 3M 5P 7m 9A 11A 13m\", \"\", \"7#9#11b13\"],\n [\"1P 3M 5P 7m 9A 13M\", \"\", \"13#9\"],\n [\"1P 3M 5P 7m 9A 13m\", \"\", \"7#9b13\"],\n [\"1P 3M 5P 7m 9M 11A\", \"\", \"9#11 9+4 9#4\"],\n [\"1P 3M 5P 7m 9M 11A 13M\", \"\", \"13#11 13+4 13#4\"],\n [\"1P 3M 5P 7m 9M 11A 13m\", \"\", \"9#11b13 9b5b13\"],\n [\"1P 3M 5P 7m 9m 11A\", \"\", \"7b9#11 7b5b9 7b9b5\"],\n [\"1P 3M 5P 7m 9m 11A 13M\", \"\", \"13b9#11\"],\n [\"1P 3M 5P 7m 9m 11A 13m\", \"\", \"7b9b13#11 7b9#11b13 7b5b9b13\"],\n [\"1P 3M 5P 7m 9m 13M\", \"\", \"13b9\"],\n [\"1P 3M 5P 7m 9m 13m\", \"\", \"7b9b13\"],\n [\"1P 3M 5P 7m 9m 9A\", \"\", \"7b9#9\"],\n [\"1P 3M 5P 9M\", \"\", \"Madd9 2 add9 add2\"],\n [\"1P 3M 5P 9m\", \"\", \"Maddb9\"],\n [\"1P 3M 5d\", \"\", \"Mb5\"],\n [\"1P 3M 5d 6M 7m 9M\", \"\", \"13b5\"],\n [\"1P 3M 5d 7M\", \"\", \"M7b5\"],\n [\"1P 3M 5d 7M 9M\", \"\", \"M9b5\"],\n [\"1P 3M 5d 7m\", \"\", \"7b5\"],\n [\"1P 3M 5d 7m 9M\", \"\", \"9b5\"],\n [\"1P 3M 7m\", \"\", \"7no5\"],\n [\"1P 3M 7m 13m\", \"\", \"7b13\"],\n [\"1P 3M 7m 9M\", \"\", \"9no5\"],\n [\"1P 3M 7m 9M 13M\", \"\", \"13no5\"],\n [\"1P 3M 7m 9M 13m\", \"\", \"9b13\"],\n [\"1P 3m 4P 5P\", \"\", \"madd4\"],\n [\"1P 3m 5P 6m 7M\", \"\", \"mMaj7b6\"],\n [\"1P 3m 5P 6m 7M 9M\", \"\", \"mMaj9b6\"],\n [\"1P 3m 5P 7m 11P\", \"\", \"m7add11 m7add4\"],\n [\"1P 3m 5P 9M\", \"\", \"madd9\"],\n [\"1P 3m 5d 6M 7M\", \"\", \"o7M7\"],\n [\"1P 3m 5d 7M\", \"\", \"oM7\"],\n [\"1P 3m 6m 7M\", \"\", \"mb6M7\"],\n [\"1P 3m 6m 7m\", \"\", \"m7#5\"],\n [\"1P 3m 6m 7m 9M\", \"\", \"m9#5\"],\n [\"1P 3m 5A 7m 9M 11P\", \"\", \"m11A\"],\n [\"1P 3m 6m 9m\", \"\", \"mb6b9\"],\n [\"1P 2M 3m 5d 7m\", \"\", \"m9b5\"],\n [\"1P 4P 5A 7M\", \"\", \"M7#5sus4\"],\n [\"1P 4P 5A 7M 9M\", \"\", \"M9#5sus4\"],\n [\"1P 4P 5A 7m\", \"\", \"7#5sus4\"],\n [\"1P 4P 5P 7M\", \"\", \"M7sus4\"],\n [\"1P 4P 5P 7M 9M\", \"\", \"M9sus4\"],\n [\"1P 4P 5P 7m 9M\", \"\", \"9sus4 9sus\"],\n [\"1P 4P 5P 7m 9M 13M\", \"\", \"13sus4 13sus\"],\n [\"1P 4P 5P 7m 9m 13m\", \"\", \"7sus4b9b13 7b9b13sus4\"],\n [\"1P 4P 7m 10m\", \"\", \"4 quartal\"],\n [\"1P 5P 7m 9m 11P\", \"\", \"11b9\"],\n];\n\nexport default CHORDS;\n", "import { all } from \"@tonaljs/chord-type\";\nimport { note } from \"@tonaljs/core\";\nimport { modes } from \"@tonaljs/pcset\";\n\ninterface FoundChord {\n readonly weight: number;\n readonly name: string;\n}\n\nconst namedSet = (notes: string[]) => {\n const pcToName = notes.reduce<Record<number, string>>((record, n) => {\n const chroma = note(n).chroma;\n if (chroma !== undefined) {\n record[chroma] = record[chroma] || note(n).name;\n }\n return record;\n }, {});\n\n return (chroma: number) => pcToName[chroma];\n};\n\nexport function detect(source: string[]): string[] {\n const notes = source.map((n) => note(n).pc).filter((x) => x);\n if (note.length === 0) {\n return [];\n }\n\n const found: FoundChord[] = findExactMatches(notes, 1);\n\n return found\n .filter((chord) => chord.weight)\n .sort((a, b) => b.weight - a.weight)\n .map((chord) => chord.name);\n}\n\nfunction findExactMatches(notes: string[], weight: number): FoundChord[] {\n const tonic = notes[0];\n const tonicChroma = note(tonic).chroma;\n const noteName = namedSet(notes);\n // we need to test all chormas to get the correct baseNote\n const allModes = modes(notes, false);\n\n const found: FoundChord[] = [];\n allModes.forEach((mode, index) => {\n // some chords could have the same chroma but different interval spelling\n const chordTypes = all().filter((chordType) => chordType.chroma === mode);\n\n chordTypes.forEach((chordType) => {\n const chordName = chordType.aliases[0];\n const baseNote = noteName(index);\n const isInversion = index !== tonicChroma;\n if (isInversion) {\n found.push({\n weight: 0.5 * weight,\n name: `${baseNote}${chordName}/${tonic}`,\n });\n } else {\n found.push({ weight: 1 * weight, name: `${baseNote}${chordName}` });\n }\n });\n });\n\n return found;\n}\n\nexport default { detect };\n", "import { deprecate } from \"@tonaljs/core\";\nimport {\n EmptyPcset,\n get as pcset,\n Pcset,\n PcsetChroma,\n PcsetNum,\n} from \"@tonaljs/pcset\";\nimport data from \"./data\";\n\n/**\n * Properties for a scale in the scale dictionary. It's a pitch class set\n * properties with the following additional information:\n * - name: the scale name\n * - aliases: alternative list of names\n * - intervals: an array of interval names\n */\nexport interface ScaleType extends Pcset {\n readonly name: string;\n readonly aliases: string[];\n}\n\nexport const NoScaleType: ScaleType = {\n ...EmptyPcset,\n intervals: [],\n aliases: [],\n};\n\ntype ScaleTypeName = string | PcsetChroma | PcsetNum;\n\nlet dictionary: ScaleType[] = [];\nlet index: Record<ScaleTypeName, ScaleType> = {};\n\nexport function names() {\n return dictionary.map((scale) => scale.name);\n}\n\n/**\n * Given a scale name or chroma, return the scale properties\n *\n * @param {string} type - scale name or pitch class set chroma\n * @example\n * import { get } from 'tonaljs/scale-type'\n * get('major') // => { name: 'major', ... }\n */\nexport function get(type: ScaleTypeName): ScaleType {\n return index[type] || NoScaleType;\n}\n\nexport const scaleType = deprecate(\n \"ScaleDictionary.scaleType\",\n \"ScaleType.get\",\n get\n);\n\n/**\n * Return a list of all scale types\n */\nexport function all() {\n return dictionary.slice();\n}\n\nexport const entries = deprecate(\n \"ScaleDictionary.entries\",\n \"ScaleType.all\",\n all\n);\n\n/**\n * Keys used to reference scale types\n */\nexport function keys() {\n return Object.keys(index);\n}\n\n/**\n * Clear the dictionary\n */\nexport function removeAll() {\n dictionary = [];\n index = {};\n}\n\n/**\n * Add a scale into dictionary\n * @param intervals\n * @param name\n * @param aliases\n */\nexport function add(\n intervals: string[],\n name: string,\n aliases: string[] = []\n): ScaleType {\n const scale = { ...pcset(intervals), name, intervals, aliases };\n dictionary.push(scale);\n index[scale.name] = scale;\n index[scale.setNum] = scale;\n index[scale.chroma] = scale;\n scale.aliases.forEach((alias) => addAlias(scale, alias));\n return scale;\n}\n\nexport function addAlias(scale: ScaleType, alias: string) {\n index[alias] = scale;\n}\n\ndata.forEach(([ivls, name, ...aliases]: string[]) =>\n add(ivls.split(\" \"), name, aliases)\n);\n\nexport default {\n names,\n get,\n all,\n add,\n removeAll,\n keys,\n\n // deprecated\n entries,\n scaleType,\n};\n", "// SCALES\n// Format: [\"intervals\", \"name\", \"alias1\", \"alias2\", ...]\nconst SCALES: string[][] = [\n // 5-note scales\n [\"1P 2M 3M 5P 6M\", \"major pentatonic\", \"pentatonic\"],\n [\"1P 3M 4P 5P 7M\", \"ionian pentatonic\"],\n [\"1P 3M 4P 5P 7m\", \"mixolydian pentatonic\", \"indian\"],\n [\"1P 2M 4P 5P 6M\", \"ritusen\"],\n [\"1P 2M 4P 5P 7m\", \"egyptian\"],\n [\"1P 3M 4P 5d 7m\", \"neopolitan major pentatonic\"],\n [\"1P 3m 4P 5P 6m\", \"vietnamese 1\"],\n [\"1P 2m 3m 5P 6m\", \"pelog\"],\n [\"1P 2m 4P 5P 6m\", \"kumoijoshi\"],\n [\"1P 2M 3m 5P 6m\", \"hirajoshi\"],\n [\"1P 2m 4P 5d 7m\", \"iwato\"],\n [\"1P 2m 4P 5P 7m\", \"in-sen\"],\n [\"1P 3M 4A 5P 7M\", \"lydian pentatonic\", \"chinese\"],\n [\"1P 3m 4P 6m 7m\", \"malkos raga\"],\n [\"1P 3m 4P 5d 7m\", \"locrian pentatonic\", \"minor seven flat five pentatonic\"],\n [\"1P 3m 4P 5P 7m\", \"minor pentatonic\", \"vietnamese 2\"],\n [\"1P 3m 4P 5P 6M\", \"minor six pentatonic\"],\n [\"1P 2M 3m 5P 6M\", \"flat three pentatonic\", \"kumoi\"],\n [\"1P 2M 3M 5P 6m\", \"flat six pentatonic\"],\n [\"1P 2m 3M 5P 6M\", \"scriabin\"],\n [\"1P 3M 5d 6m 7m\", \"whole tone pentatonic\"],\n [\"1P 3M 4A 5A 7M\", \"lydian #5P pentatonic\"],\n [\"1P 3M 4A 5P 7m\", \"lydian dominant pentatonic\"],\n [\"1P 3m 4P 5P 7M\", \"minor #7M pentatonic\"],\n [\"1P 3m 4d 5d 7m\", \"super locrian pentatonic\"],\n\n // 6-note scales\n [\"1P 2M 3m 4P 5P 7M\", \"minor hexatonic\"],\n [\"1P 2A 3M 5P 5A 7M\", \"augmented\"],\n [\"1P 2M 3m 3M 5P 6M\", \"major blues\"],\n [\"1P 2M 4P 5P 6M 7m\", \"piongio\"],\n [\"1P 2m 3M 4A 6M 7m\", \"prometheus neopolitan\"],\n [\"1P 2M 3M 4A 6M 7m\", \"prometheus\"],\n [\"1P 2m 3M 5d 6m 7m\", \"mystery #1\"],\n [\"1P 2m 3M 4P 5A 6M\", \"six tone symmetric\"],\n [\"1P 2M 3M 4A 5A 6A\", \"whole tone\", \"messiaen's mode #1\"],\n [\"1P 2m 4P 4A 5P 7M\", \"messiaen's mode #5\"],\n [\"1P 3m 4P 5d 5P 7m\", \"minor blues\", \"blues\"],\n\n // 7-note scales\n [\"1P 2M 3M 4P 5d 6m 7m\", \"locrian major\", \"arabian\"],\n [\"1P 2m 3M 4A 5P 6m 7M\", \"double harmonic lydian\"],\n [\"1P 2M 3m 4P 5P 6m 7M\", \"harmonic minor\"],\n [\n \"1P 2m 2A 3M 4A 6m 7m\",\n \"altered\",\n \"super locrian\",\n \"diminished whole tone\",\n \"pomeroy\",\n ],\n [\"1P 2M 3m 4P 5d 6m 7m\", \"locrian #2\", \"half-diminished\", \"aeolian b5\"],\n [\n \"1P 2M 3M 4P 5P 6m 7m\",\n \"mixolydian b6\",\n \"melodic minor fifth mode\",\n \"hindu\",\n ],\n [\"1P 2M 3M 4A 5P 6M 7m\", \"lydian dominant\", \"lydian b7\", \"overtone\"],\n [\"1P 2M 3M 4A 5P 6M 7M\", \"lydian\"],\n [\"1P 2M 3M 4A 5A 6M 7M\", \"lydian augmented\"],\n [\n \"1P 2m 3m 4P 5P 6M 7m\",\n \"dorian b2\",\n \"phrygian #6\",\n \"melodic minor second mode\",\n ],\n [\"1P 2M 3m 4P 5P 6M 7M\", \"melodic minor\"],\n [\"1P 2m 3m 4P 5d 6m 7m\", \"locrian\"],\n [\n \"1P 2m 3m 4d 5d 6m 7d\",\n \"ultralocrian\",\n \"superlocrian bb7\",\n \"superlocrian diminished\",\n ],\n [\"1P 2m 3m 4P 5d 6M 7m\", \"locrian 6\", \"locrian natural 6\", \"locrian sharp 6\"],\n [\"1P 2A 3M 4P 5P 5A 7M\", \"augmented heptatonic\"],\n // Source https://en.wikipedia.org/wiki/Ukrainian_Dorian_scale\n [\n \"1P 2M 3m 4A 5P 6M 7m\",\n \"dorian #4\",\n \"ukrainian dorian\",\n \"romanian minor\",\n \"altered dorian\",\n ],\n [\"1P 2M 3m 4A 5P 6M 7M\", \"lydian diminished\"],\n [\"1P 2m 3m 4P 5P 6m 7m\", \"phrygian\"],\n [\"1P 2M 3M 4A 5A 7m 7M\", \"leading whole tone\"],\n [\"1P 2M 3M 4A 5P 6m 7m\", \"lydian minor\"],\n [\"1P 2m 3M 4P 5P 6m 7m\", \"phrygian dominant\", \"spanish\", \"phrygian major\"],\n [\"1P 2m 3m 4P 5P 6m 7M\", \"balinese\"],\n [\"1P 2m 3m 4P 5P 6M 7M\", \"neopolitan major\"],\n [\"1P 2M 3m 4P 5P 6m 7m\", \"aeolian\", \"minor\"],\n [\"1P 2M 3M 4P 5P 6m 7M\", \"harmonic major\"],\n [\"1P 2m 3M 4P 5P 6m 7M\", \"double harmonic major\", \"gypsy\"],\n [\"1P 2M 3m 4P 5P 6M 7m\", \"dorian\"],\n [\"1P 2M 3m 4A 5P 6m 7M\", \"hungarian minor\"],\n [\"1P 2A 3M 4A 5P 6M 7m\", \"hungarian major\"],\n [\"1P 2m 3M 4P 5d 6M 7m\", \"oriental\"],\n [\"1P 2m 3m 3M 4A 5P 7m\", \"flamenco\"],\n [\"1P 2m 3m 4A 5P 6m 7M\", \"todi raga\"],\n [\"1P 2M 3M 4P 5P 6M 7m\", \"mixolydian\", \"dominant\"],\n [\"1P 2m 3M 4P 5d 6m 7M\", \"persian\"],\n [\"1P 2M 3M 4P 5P 6M 7M\", \"major\", \"ionian\"],\n [\"1P 2m 3M 5d 6m 7m 7M\", \"enigmatic\"],\n [\n \"1P 2M 3M 4P 5A 6M 7M\",\n \"major augmented\",\n \"major #5\",\n \"ionian augmented\",\n \"ionian #5\",\n ],\n [\"1P 2A 3M 4A 5P 6M 7M\", \"lydian #9\"],\n\n // 8-note scales\n [\"1P 2m 2M 4P 4A 5P 6m 7M\", \"messiaen's mode #4\"],\n [\"1P 2m 3M 4P 4A 5P 6m 7M\", \"purvi raga\"],\n [\"1P 2m 3m 3M 4P 5P 6m 7m\", \"spanish heptatonic\"],\n [\"1P 2M 3M 4P 5P 6M 7m 7M\", \"bebop\"],\n [\"1P 2M 3m 3M 4P 5P 6M 7m\", \"bebop minor\"],\n [\"1P 2M 3M 4P 5P 5A 6M 7M\", \"bebop major\"],\n [\"1P 2m 3m 4P 5d 5P 6m 7m\", \"bebop locrian\"],\n [\"1P 2M 3m 4P 5P 6m 7m 7M\", \"minor bebop\"],\n [\"1P 2M 3m 4P 5d 6m 6M 7M\", \"diminished\", \"whole-half diminished\"],\n [\"1P 2M 3M 4P 5d 5P 6M 7M\", \"ichikosucho\"],\n [\"1P 2M 3m 4P 5P 6m 6M 7M\", \"minor six diminished\"],\n [\n \"1P 2m 3m 3M 4A 5P 6M 7m\",\n \"half-whole diminished\",\n \"dominant diminished\",\n \"messiaen's mode #2\",\n ],\n [\"1P 3m 3M 4P 5P 6M 7m 7M\", \"kafi raga\"],\n [\"1P 2M 3M 4P 4A 5A 6A 7M\", \"messiaen's mode #6\"],\n\n // 9-note scales\n [\"1P 2M 3m 3M 4P 5d 5P 6M 7m\", \"composite blues\"],\n [\"1P 2M 3m 3M 4A 5P 6m 7m 7M\", \"messiaen's mode #3\"],\n\n // 10-note scales\n [\"1P 2m 2M 3m 4P 4A 5P 6m 6M 7M\", \"messiaen's mode #7\"],\n\n // 12-note scales\n [\"1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M\", \"chromatic\"],\n];\n\nexport default SCALES;\n", "import { detect } from \"@tonaljs/chord-detect\";\nimport {\n all as chordTypes,\n ChordType,\n get as getChordType,\n} from \"@tonaljs/chord-type\";\n\nimport {\n deprecate,\n distance,\n note,\n NoteName,\n tokenizeNote,\n transpose as transposeNote,\n} from \"@tonaljs/core\";\n\nimport { isSubsetOf, isSupersetOf } from \"@tonaljs/pcset\";\n\nimport { all as scaleTypes } from \"@tonaljs/scale-type\";\nexport { detect } from \"@tonaljs/chord-detect\";\n\ntype ChordName = string;\ntype ChordNameTokens = [string, string]; // [TONIC, SCALE TYPE]\n\nexport interface Chord extends ChordType {\n tonic: string | null;\n type: string;\n root: string;\n rootDegree: number;\n symbol: string;\n notes: NoteName[];\n}\n\nconst NoChord: Chord = {\n empty: true,\n name: \"\",\n symbol: \"\",\n root: \"\",\n rootDegree: 0,\n type: \"\",\n tonic: null,\n setNum: NaN,\n quality: \"Unknown\",\n chroma: \"\",\n normalized: \"\",\n aliases: [],\n notes: [],\n intervals: [],\n};\n\n// 6, 64, 7, 9, 11 and 13 are consider part of the chord\n// (see https://github.com/danigb/tonal/issues/55)\nconst NUM_TYPES = /^(6|64|7|9|11|13)$/;\n/**\n * Tokenize a chord name. It returns an array with the tonic and chord type\n * If not tonic is found, all the name is considered the chord name.\n *\n * This function does NOT check if the chord type exists or not. It only tries\n * to split the tonic and chord type.\n *\n * @function\n * @param {string} name - the chord name\n * @return {Array} an array with [tonic, type]\n * @example\n * tokenize(\"Cmaj7\") // => [ \"C\", \"maj7\" ]\n * tokenize(\"C7\") // => [ \"C\", \"7\" ]\n * tokenize(\"mMaj7\") // => [ null, \"mMaj7\" ]\n * tokenize(\"Cnonsense\") // => [ null, \"nonsense\" ]\n */\nexport function tokenize(name: string): ChordNameTokens {\n const [letter, acc, oct, type] = tokenizeNote(name);\n if (letter === \"\") {\n return [\"\", name];\n }\n // aug is augmented (see https://github.com/danigb/tonal/issues/55)\n if (letter === \"A\" && type === \"ug\") {\n return [\"\", \"aug\"];\n }\n // see: https://github.com/tonaljs/tonal/issues/70\n if (!type && (oct === \"4\" || oct === \"5\")) {\n return [letter + acc, oct];\n }\n\n if (NUM_TYPES.test(oct)) {\n return [letter + acc, oct + type];\n } else {\n return [letter + acc + oct, type];\n }\n}\n\n/**\n * Get a Chord from a chord name.\n */\nexport function get(src: ChordName | ChordNameTokens): Chord {\n if (src === \"\") {\n return NoChord;\n }\n if (Array.isArray(src) && src.length === 2) {\n return getChord(src[1], src[0]);\n } else {\n const [tonic, type] = tokenize(src);\n const chord = getChord(type, tonic);\n return chord.empty ? getChord(src) : chord;\n }\n}\n\n/**\n * Get chord properties\n *\n * @param typeName - the chord type name\n * @param [tonic] - Optional tonic\n * @param [root] - Optional root (requires a tonic)\n */\nexport function getChord(\n typeName: string,\n optionalTonic?: string,\n optionalRoot?: string\n): Chord {\n const type = getChordType(typeName);\n const tonic = note(optionalTonic || \"\");\n const root = note(optionalRoot || \"\");\n\n if (\n type.empty ||\n (optionalTonic && tonic.empty) ||\n (optionalRoot && root.empty)\n ) {\n return NoChord;\n }\n\n const rootInterval = distance(tonic.pc, root.pc);\n const rootDegree = type.intervals.indexOf(rootInterval) + 1;\n if (!root.empty && !rootDegree) {\n return NoChord;\n }\n\n const intervals = Array.from(type.intervals);\n\n for (let i = 1; i < rootDegree; i++) {\n const num = intervals[0][0];\n const quality = intervals[0][1];\n const newNum = parseInt(num, 10) + 7;\n intervals.push(`${newNum}${quality}`);\n intervals.shift();\n }\n\n const notes = tonic.empty\n ? []\n : intervals.map((i) => transposeNote(tonic, i));\n\n typeName = type.aliases.indexOf(typeName) !== -1 ? typeName : type.aliases[0];\n const symbol = `${tonic.empty ? \"\" : tonic.pc}${typeName}${\n root.empty || rootDegree <= 1 ? \"\" : \"/\" + root.pc\n }`;\n const name = `${optionalTonic ? tonic.pc + \" \" : \"\"}${type.name}${\n rootDegree > 1 && optionalRoot ? \" over \" + root.pc : \"\"\n }`;\n return {\n ...type,\n name,\n symbol,\n type: type.name,\n root: root.name,\n intervals,\n rootDegree,\n tonic: tonic.name,\n notes,\n };\n}\n\nexport const chord = deprecate(\"Chord.chord\", \"Chord.get\", get);\n\n/**\n * Transpose a chord name\n *\n * @param {string} chordName - the chord name\n * @return {string} the transposed chord\n *\n * @example\n * transpose('Dm7', 'P4') // => 'Gm7\n */\nexport function transpose(chordName: string, interval: string): string {\n const [tonic, type] = tokenize(chordName);\n if (!tonic) {\n return chordName;\n }\n return transposeNote(tonic, interval) + type;\n}\n\n/**\n * Get all scales where the given chord fits\n *\n * @example\n * chordScales('C7b9')\n * // => [\"phrygian dominant\", \"flamenco\", \"spanish heptatonic\", \"half-whole diminished\", \"chromatic\"]\n */\nexport function chordScales(name: string): string[] {\n const s = get(name);\n const isChordIncluded = isSupersetOf(s.chroma);\n return scaleTypes()\n .filter((scale) => isChordIncluded(scale.chroma))\n .map((scale) => scale.name);\n}\n/**\n * Get all chords names that are a superset of the given one\n * (has the same notes and at least one more)\n *\n * @function\n * @example\n * extended(\"CMaj7\")\n * // => [ 'Cmaj#4', 'Cmaj7#9#11', 'Cmaj9', 'CM7add13', 'Cmaj13', 'Cmaj9#11', 'CM13#11', 'CM7b9' ]\n */\nexport function extended(chordName: string): string[] {\n const s = get(chordName);\n const isSuperset = isSupersetOf(s.chroma);\n return chordTypes()\n .filter((chord) => isSuperset(chord.chroma))\n .map((chord) => s.tonic + chord.aliases[0]);\n}\n\n/**\n * Find all chords names that are a subset of the given one\n * (has less notes but all from the given chord)\n *\n * @example\n */\nexport function reduced(chordName: string): string[] {\n const s = get(chordName);\n const isSubset = isSubsetOf(s.chroma);\n return chordTypes()\n .filter((chord) => isSubset(chord.chroma))\n .map((chord) => s.tonic + chord.aliases[0]);\n}\n\nexport default {\n getChord,\n get,\n detect,\n chordScales,\n extended,\n reduced,\n tokenize,\n transpose,\n // deprecate\n chord,\n};\n", "// source: https://en.wikipedia.org/wiki/Note_value\nconst DATA: [number, string, string[]][] = [\n [\n 0.125,\n \"dl\",\n [\"large\", \"duplex longa\", \"maxima\", \"octuple\", \"octuple whole\"],\n ],\n [0.25, \"l\", [\"long\", \"longa\"]],\n [0.5, \"d\", [\"double whole\", \"double\", \"breve\"]],\n [1, \"w\", [\"whole\", \"semibreve\"]],\n [2, \"h\", [\"half\", \"minim\"]],\n [4, \"q\", [\"quarter\", \"crotchet\"]],\n [8, \"e\", [\"eighth\", \"quaver\"]],\n [16, \"s\", [\"sixteenth\", \"semiquaver\"]],\n [32, \"t\", [\"thirty-second\", \"demisemiquaver\"]],\n [64, \"sf\", [\"sixty-fourth\", \"hemidemisemiquaver\"]],\n [128, \"h\", [\"hundred twenty-eighth\"]],\n [256, \"th\", [\"two hundred fifty-sixth\"]],\n];\n\nexport default DATA;\n", "import DATA from \"./data\";\n\ntype Fraction = [number, number];\n\nconst VALUES: DurationValue[] = [];\n\nDATA.forEach(([denominator, shorthand, names]) =>\n add(denominator, shorthand, names)\n);\n\nexport interface DurationValue {\n empty: boolean;\n value: number;\n name: string;\n fraction: Fraction;\n shorthand: string;\n dots: string;\n names: string[];\n}\n\nconst NoDuration: DurationValue = {\n empty: true,\n name: \"\",\n value: 0,\n fraction: [0, 0],\n shorthand: \"\",\n dots: \"\",\n names: [],\n};\n\nexport function names(): string[] {\n return VALUES.reduce((names, duration) => {\n duration.names.forEach((name) => names.push(name));\n return names;\n }, [] as string[]);\n}\n\nexport function shorthands(): string[] {\n return VALUES.map((dur) => dur.shorthand);\n}\n\nconst REGEX = /^([^.]+)(\\.*)$/;\n\nexport function get(name: string): DurationValue {\n const [_, simple, dots] = REGEX.exec(name) || [];\n const base = VALUES.find(\n (dur) => dur.shorthand === simple || dur.names.includes(simple)\n );\n if (!base) {\n return NoDuration;\n }\n\n const fraction = calcDots(base.fraction, dots.length);\n const value = fraction[0] / fraction[1];\n\n return { ...base, name, dots, value, fraction };\n}\n\nexport const value = (name: string) => get(name).value;\nexport const fraction = (name: string) => get(name).fraction;\n\nexport default { names, shorthands, get, value, fraction };\n\n//// PRIVATE ////\n\nfunction add(denominator: number, shorthand: string, names: string[]) {\n VALUES.push({\n empty: false,\n dots: \"\",\n name: \"\",\n value: 1 / denominator,\n fraction: denominator < 1 ? [1 / denominator, 1] : [1, denominator],\n shorthand,\n names,\n });\n}\n\nfunction calcDots(fraction: Fraction, dots: number): Fraction {\n const pow = Math.pow(2, dots);\n\n let numerator = fraction[0] * pow;\n let denominator = fraction[1] * pow;\n const base = numerator;\n\n // add fractions\n for (let i = 0; i < dots; i++) {\n numerator += base / Math.pow(2, i + 1);\n }\n\n // simplify\n while (numerator % 2 === 0 && denominator % 2 === 0) {\n numerator /= 2;\n denominator /= 2;\n }\n return [numerator, denominator];\n}\n", "import {\n coordToInterval,\n distance as dist,\n interval as props,\n IntervalCoordinates,\n IntervalName,\n NoteCoordinates,\n tokenizeInterval as tokenize,\n} from \"@tonaljs/core\";\n\n/**\n * Get the natural list of names\n */\nexport function names(): IntervalName[] {\n return \"1P 2M 3M 4P 5P 6m 7m\".split(\" \");\n}\n\n/**\n * Get properties of an interval\n *\n * @function\n * @example\n * Interval.get('P4') // => {\"alt\": 0, \"dir\": 1, \"name\": \"4P\", \"num\": 4, \"oct\": 0, \"q\": \"P\", \"semitones\": 5, \"simple\": 4, \"step\": 3, \"type\": \"perfectable\"}\n */\nexport const get = props;\n\n/**\n * Get name of an interval\n *\n * @function\n * @example\n * Interval.name('4P') // => \"4P\"\n * Interval.name('P4') // => \"4P\"\n * Interval.name('C4') // => \"\"\n */\nexport const name = (name: string) => props(name).name;\n\n/**\n * Get semitones of an interval\n * @function\n * @example\n * Interval.semitones('P4') // => 5\n */\nexport const semitones = (name: string) => props(name).semitones;\n\n/**\n * Get quality of an interval\n * @function\n * @example\n * Interval.quality('P4') // => \"P\"\n */\nexport const quality = (name: string) => props(name).q;\n\n/**\n * Get number of an interval\n * @function\n * @example\n * Interval.num('P4') // => 4\n */\nexport const num = (name: string) => props(name).num;\n\n/**\n * Get the simplified version of an interval.\n *\n * @function\n * @param {string} interval - the interval to simplify\n * @return {string} the simplified interval\n *\n * @example\n * Interval.simplify(\"9M\") // => \"2M\"\n * Interval.simplify(\"2M\") // => \"2M\"\n * Interval.simplify(\"-2M\") // => \"7m\"\n * [\"8P\", \"9M\", \"10M\", \"11P\", \"12P\", \"13M\", \"14M\", \"15P\"].map(Interval.simplify)\n * // => [ \"8P\", \"2M\", \"3M\", \"4P\", \"5P\", \"6M\", \"7M\", \"8P\" ]\n */\nexport function simplify(name: IntervalName): IntervalName {\n const i = props(name);\n return i.empty ? \"\" : i.simple + i.q;\n}\n\n/**\n * Get the inversion (https://en.wikipedia.org/wiki/Inversion_(music)#Intervals)\n * of an interval.\n *\n * @function\n * @param {string} interval - the interval to invert in interval shorthand\n * notation or interval array notation\n * @return {string} the inverted interval\n *\n * @example\n * Interval.invert(\"3m\") // => \"6M\"\n * Interval.invert(\"2M\") // => \"7m\"\n */\nexport function invert(name: IntervalName): IntervalName {\n const i = props(name);\n if (i.empty) {\n return \"\";\n }\n const step = (7 - i.step) % 7;\n const alt = i.type === \"perfectable\" ? -i.alt : -(i.alt + 1);\n return props({ step, alt, oct: i.oct, dir: i.dir }).name;\n}\n\n// interval numbers\nconst IN = [1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7];\n// interval qualities\nconst IQ = \"P m M m M P d P m M m M\".split(\" \");\n\n/**\n * Get interval name from semitones number. Since there are several interval\n * names for the same number, the name it's arbitrary, but deterministic.\n *\n * @param {Integer} num - the number of semitones (can be negative)\n * @return {string} the interval name\n * @example\n * Interval.fromSemitones(7) // => \"5P\"\n * Interval.fromSemitones(-7) // => \"-5P\"\n */\nexport function fromSemitones(semitones: number): IntervalName {\n const d = semitones < 0 ? -1 : 1;\n const n = Math.abs(semitones);\n const c = n % 12;\n const o = Math.floor(n / 12);\n return d * (IN[c] + 7 * o) + IQ[c];\n}\n\n/**\n * Find interval between two notes\n *\n * @example\n * Interval.distance(\"C4\", \"G4\"); // => \"5P\"\n */\nexport const distance = dist;\n\n/**\n * Adds two intervals\n *\n * @function\n * @param {string} interval1\n * @param {string} interval2\n * @return {string} the added interval name\n * @example\n * Interval.add(\"3m\", \"5P\") // => \"7m\"\n */\nexport const add = combinator((a, b) => [a[0] + b[0], a[1] + b[1]]);\n\n/**\n * Returns a function that adds an interval\n *\n * @function\n * @example\n * ['1P', '2M', '3M'].map(Interval.addTo('5P')) // => [\"5P\", \"6M\", \"7M\"]\n */\nexport const addTo = (interval: string) => (other: string) =>\n add(interval, other);\n\n/**\n * Subtracts two intervals\n *\n * @function\n * @param {string} minuendInterval\n * @param {string} subtrahendInterval\n * @return {string} the substracted interval name\n * @example\n * Interval.substract('5P', '3M') // => '3m'\n * Interval.substract('3M', '5P') // => '-3m'\n */\nexport const substract = combinator((a, b) => [a[0] - b[0], a[1] - b[1]]);\n\nexport function transposeFifths(\n interval: IntervalName,\n fifths: number\n): IntervalName {\n const ivl = get(interval);\n if (ivl.empty) return \"\";\n\n const [nFifths, nOcts, dir] = ivl.coord;\n return coordToInterval([nFifths + fifths, nOcts, dir]).name;\n}\n\nexport default {\n names,\n get,\n name,\n num,\n semitones,\n quality,\n fromSemitones,\n distance,\n invert,\n simplify,\n add,\n addTo,\n substract,\n transposeFifths,\n};\n\n//// PRIVATE ////\n\ntype Operation = (\n a: IntervalCoordinates,\n b: IntervalCoordinates\n) => NoteCoordinates;\n\nfunction combinator(fn: Operation) {\n return (a: IntervalName, b: IntervalName): IntervalName | undefined => {\n const coordA = props(a).coord;\n const coordB = props(b).coord;\n if (coordA && coordB) {\n const coord = fn(coordA, coordB);\n return coordToInterval(coord).name;\n }\n };\n}\n", "import { note as props, NoteName } from \"@tonaljs/core\";\n\ntype Midi = number;\n\nexport function isMidi(arg: any): arg is Midi {\n return +arg >= 0 && +arg <= 127;\n}\n\n/**\n * Get the note midi number (a number between 0 and 127)\n *\n * It returns undefined if not valid note name\n *\n * @function\n * @param {string|number} note - the note name or midi number\n * @return {Integer} the midi number or undefined if not valid note\n * @example\n * import { toMidi } from '@tonaljs/midi'\n * toMidi(\"C4\") // => 60\n * toMidi(60) // => 60\n * toMidi('60') // => 60\n */\nexport function toMidi(note: NoteName | number): number | null {\n if (isMidi(note)) {\n return +note;\n }\n const n = props(note);\n return n.empty ? null : n.midi;\n}\n\n/**\n * Get the frequency in hertzs from midi number\n *\n * @param {number} midi - the note midi number\n * @param {number} [tuning = 440] - A4 tuning frequency in Hz (440 by default)\n * @return {number} the frequency or null if not valid note midi\n * @example\n * import { midiToFreq} from '@tonaljs/midi'\n * midiToFreq(69) // => 440\n */\nexport function midiToFreq(midi: number, tuning = 440): number {\n return Math.pow(2, (midi - 69) / 12) * tuning;\n}\n\nconst L2 = Math.log(2);\nconst L440 = Math.log(440);\n\n/**\n * Get the midi number from a frequency in hertz. The midi number can\n * contain decimals (with two digits precision)\n *\n * @param {number} frequency\n * @return {number}\n * @example\n * import { freqToMidi} from '@tonaljs/midi'\n * freqToMidi(220)); //=> 57\n * freqToMidi(261.62)); //=> 60\n * freqToMidi(261)); //=> 59.96\n */\nexport function freqToMidi(freq: number): number {\n const v = (12 * (Math.log(freq) - L440)) / L2 + 69;\n return Math.round(v * 100) / 100;\n}\n\nexport interface ToNoteNameOptions {\n pitchClass?: boolean;\n sharps?: boolean;\n}\n\nconst SHARPS = \"C C# D D# E F F# G G# A A# B\".split(\" \");\nconst FLATS = \"C Db D Eb E F Gb G Ab A Bb B\".split(\" \");\n/**\n * Given a midi number, returns a note name. The altered notes will have\n * flats unless explicitly set with the optional `useSharps` parameter.\n *\n * @function\n * @param {number} midi - the midi note number\n * @param {Object} options = default: `{ sharps: false, pitchClass: false }`\n * @param {boolean} useSharps - (Optional) set to true to use sharps instead of flats\n * @return {string} the note name\n * @example\n * import { midiToNoteName } from '@tonaljs/midi'\n * midiToNoteName(61) // => \"Db4\"\n * midiToNoteName(61, { pitchClass: true }) // => \"Db\"\n * midiToNoteName(61, { sharps: true }) // => \"C#4\"\n * midiToNoteName(61, { pitchClass: true, sharps: true }) // => \"C#\"\n * // it rounds to nearest note\n * midiToNoteName(61.7) // => \"D4\"\n */\nexport function midiToNoteName(midi: number, options: ToNoteNameOptions = {}) {\n if (isNaN(midi) || midi === -Infinity || midi === Infinity) return \"\";\n midi = Math.round(midi);\n const pcs = options.sharps === true ? SHARPS : FLATS;\n const pc = pcs[midi % 12];\n if (options.pitchClass) {\n return pc;\n }\n const o = Math.floor(midi / 12) - 1;\n return pc + o;\n}\n\nexport default { isMidi, toMidi, midiToFreq, midiToNoteName, freqToMidi };\n", "import {\n coordToNote,\n IntervalName,\n Named,\n Note,\n note as props,\n NoteLiteral,\n NoteName,\n Pitch,\n transpose as _tr,\n} from \"@tonaljs/core\";\nimport { midiToNoteName, freqToMidi } from \"@tonaljs/midi\";\n\nconst NAMES = [\"C\", \"D\", \"E\", \"F\", \"G\", \"A\", \"B\"];\n\nconst toName = (n: Named) => n.name;\nconst onlyNotes = (array: any[]) =>\n array.map(props).filter((n) => !n.empty) as Note[];\n\n/**\n * Return the natural note names without octave\n * @function\n * @example\n * Note.names(); // => [\"C\", \"D\", \"E\", \"F\", \"G\", \"A\", \"B\"]\n */\nexport function names(array?: any[]): string[] {\n if (array === undefined) {\n return NAMES.slice();\n } else if (!Array.isArray(array)) {\n return [];\n } else {\n return onlyNotes(array).map(toName);\n }\n}\n\n/**\n * Get a note from a note name\n *\n * @function\n * @example\n * Note.get('Bb4') // => { name: \"Bb4\", midi: 70, chroma: 10, ... }\n */\nexport const get = props;\n\n/**\n * Get the note name\n * @function\n */\nexport const name = (note: NoteLiteral) => get(note).name;\n\n/**\n * Get the note pitch class name\n * @function\n */\nexport const pitchClass = (note: NoteLiteral) => get(note).pc;\n\n/**\n * Get the note accidentals\n * @function\n */\nexport const accidentals = (note: NoteLiteral) => get(note).acc;\n\n/**\n * Get the note octave\n * @function\n */\nexport const octave = (note: NoteLiteral) => get(note).oct;\n\n/**\n * Get the note midi\n * @function\n */\nexport const midi = (note: NoteLiteral) => get(note).midi;\n\n/**\n * Get the note midi\n * @function\n */\nexport const freq = (note: NoteLiteral) => get(note).freq;\n\n/**\n * Get the note chroma\n * @function\n */\nexport const chroma = (note: NoteLiteral) => get(note).chroma;\n\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n *\n * @function\n * @param {number} midi - the midi note number\n * @return {string} the note name\n * @example\n * Note.fromMidi(61) // => \"Db4\"\n * Note.fromMidi(61.7) // => \"D4\"\n */\nexport function fromMidi(midi: number) {\n return midiToNoteName(midi);\n}\n\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n */\nexport function fromFreq(freq: number) {\n return midiToNoteName(freqToMidi(freq));\n}\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n */\nexport function fromFreqSharps(freq: number) {\n return midiToNoteName(freqToMidi(freq), { sharps: true });\n}\n\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n *\n * @function\n * @param {number} midi - the midi note number\n * @return {string} the note name\n * @example\n * Note.fromMidiSharps(61) // => \"C#4\"\n */\n\nexport function fromMidiSharps(midi: number) {\n return midiToNoteName(midi, { sharps: true });\n}\n\n/**\n * Transpose a note by an interval\n */\nexport const transpose = _tr;\nexport const tr = _tr;\n\n/**\n * Transpose by an interval.\n * @function\n * @param {string} interval\n * @return {function} a function that transposes by the given interval\n * @example\n * [\"C\", \"D\", \"E\"].map(Note.transposeBy(\"5P\"));\n * // => [\"G\", \"A\", \"B\"]\n */\nexport const transposeBy = (interval: IntervalName) => (note: NoteName) =>\n transpose(note, interval);\nexport const trBy = transposeBy;\n\n/**\n * Transpose from a note\n * @function\n * @param {string} note\n * @return {function} a function that transposes the the note by an interval\n * [\"1P\", \"3M\", \"5P\"].map(Note.transposeFrom(\"C\"));\n * // => [\"C\", \"E\", \"G\"]\n */\nexport const transposeFrom = (note: NoteName) => (interval: IntervalName) =>\n transpose(note, interval);\nexport const trFrom = transposeFrom;\n\n/**\n * Transpose a note by a number of perfect fifths.\n *\n * @function\n * @param {string} note - the note name\n * @param {number} fifhts - the number of fifths\n * @return {string} the transposed note name\n *\n * @example\n * import { transposeFifths } from \"@tonaljs/note\"\n * transposeFifths(\"G4\", 1) // => \"D\"\n * [0, 1, 2, 3, 4].map(fifths => transposeFifths(\"C\", fifths)) // => [\"C\", \"G\", \"D\", \"A\", \"E\"]\n */\nexport function transposeFifths(noteName: NoteName, fifths: number): NoteName {\n const note = get(noteName);\n if (note.empty) {\n return \"\";\n }\n const [nFifths, nOcts] = note.coord;\n const transposed =\n nOcts === undefined\n ? coordToNote([nFifths + fifths])\n : coordToNote([nFifths + fifths, nOcts]);\n\n return transposed.name;\n}\nexport const trFifths = transposeFifths;\n\nexport type NoteComparator = (a: Note, b: Note) => number;\n\nexport const ascending: NoteComparator = (a, b) => a.height - b.height;\nexport const descending: NoteComparator = (a, b) => b.height - a.height;\n\nexport function sortedNames(\n notes: any[],\n comparator?: NoteComparator\n): string[] {\n comparator = comparator || ascending;\n return onlyNotes(notes).sort(comparator).map(toName);\n}\n\nexport function sortedUniqNames(notes: any[]): string[] {\n return sortedNames(notes, ascending).filter(\n (n, i, a) => i === 0 || n !== a[i - 1]\n );\n}\n\n/**\n * Simplify a note\n *\n * @function\n * @param {string} note - the note to be simplified\n * - sameAccType: default true. Use same kind of accidentals that source\n * @return {string} the simplified note or '' if not valid note\n * @example\n * simplify(\"C##\") // => \"D\"\n * simplify(\"C###\") // => \"D#\"\n * simplify(\"C###\")\n * simplify(\"B#4\") // => \"C5\"\n */\nexport const simplify = (noteName: NoteName | Pitch): string => {\n const note = get(noteName);\n if (note.empty) {\n return \"\";\n }\n return midiToNoteName(note.midi || note.chroma, {\n sharps: note.alt > 0,\n pitchClass: note.midi === null,\n });\n};\n/**\n * Get enharmonic of a note\n *\n * @function\n * @param {string} note\n * @param [string] - [optional] Destination pitch class\n * @return {string} the enharmonic note name or '' if not valid note\n * @example\n * Note.enharmonic(\"Db\") // => \"C#\"\n * Note.enharmonic(\"C\") // => \"C\"\n * Note.enharmonic(\"F2\",\"E#\") // => \"E#2\"\n */\nexport function enharmonic(noteName: string, destName?: string) {\n const src = get(noteName);\n if (src.empty) {\n return \"\";\n }\n\n // destination: use given or generate one\n const dest = get(\n destName ||\n midiToNoteName(src.midi || src.chroma, {\n sharps: src.alt < 0,\n pitchClass: true,\n })\n );\n\n // ensure destination is valid\n if (dest.empty || dest.chroma !== src.chroma) {\n return \"\";\n }\n\n // if src has no octave, no need to calculate anything else\n if (src.oct === undefined) {\n return dest.pc;\n }\n\n // detect any octave overflow\n const srcChroma = src.chroma - src.alt;\n const destChroma = dest.chroma - dest.alt;\n const destOctOffset =\n srcChroma > 11 || destChroma < 0\n ? -1\n : srcChroma < 0 || destChroma > 11\n ? +1\n : 0;\n // calculate the new octave\n const destOct = src.oct + destOctOffset;\n return dest.pc + destOct;\n}\n\nexport default {\n names,\n get,\n name,\n pitchClass,\n accidentals,\n octave,\n midi,\n ascending,\n descending,\n sortedNames,\n sortedUniqNames,\n fromMidi,\n fromMidiSharps,\n freq,\n fromFreq,\n fromFreqSharps,\n chroma,\n transpose,\n tr,\n transposeBy,\n trBy,\n transposeFrom,\n trFrom,\n transposeFifths,\n trFifths,\n simplify,\n enharmonic,\n};\n", "import {\n accToAlt,\n altToAcc,\n deprecate,\n interval,\n isNamed,\n isPitch,\n Named,\n Pitch,\n} from \"@tonaljs/core\";\n\nexport interface RomanNumeral extends Pitch, Named {\n readonly empty: boolean;\n readonly roman: string;\n readonly interval: string;\n readonly acc: string;\n readonly chordType: string;\n readonly major: boolean;\n readonly dir: 1;\n}\n\nexport interface NoRomanNumeral extends Partial<RomanNumeral> {\n readonly empty: true;\n readonly name: \"\";\n readonly chordType: \"\";\n}\nconst NoRomanNumeral: NoRomanNumeral = { empty: true, name: \"\", chordType: \"\" };\n\nconst cache: Record<string, RomanNumeral | NoRomanNumeral> = {};\n\n/**\n * Get properties of a roman numeral string\n *\n * @function\n * @param {string} - the roman numeral string (can have type, like: Imaj7)\n * @return {Object} - the roman numeral properties\n * @param {string} name - the roman numeral (tonic)\n * @param {string} type - the chord type\n * @param {string} num - the number (1 = I, 2 = II...)\n * @param {boolean} major - major or not\n *\n * @example\n * romanNumeral(\"VIIb5\") // => { name: \"VII\", type: \"b5\", num: 7, major: true }\n */\nexport function get(src: any): RomanNumeral | NoRomanNumeral {\n return typeof src === \"string\"\n ? cache[src] || (cache[src] = parse(src))\n : typeof src === \"number\"\n ? get(NAMES[src] || \"\")\n : isPitch(src)\n ? fromPitch(src)\n : isNamed(src)\n ? get(src.name)\n : NoRomanNumeral;\n}\n\nconst romanNumeral = deprecate(\n \"RomanNumeral.romanNumeral\",\n \"RomanNumeral.get\",\n get\n);\n\n/**\n * Get roman numeral names\n *\n * @function\n * @param {boolean} [isMajor=true]\n * @return {Array<String>}\n *\n * @example\n * names() // => [\"I\", \"II\", \"III\", \"IV\", \"V\", \"VI\", \"VII\"]\n */\nexport function names(major = true) {\n return (major ? NAMES : NAMES_MINOR).slice();\n}\n\nfunction fromPitch(pitch: Pitch): RomanNumeral | NoRomanNumeral {\n return get(altToAcc(pitch.alt) + NAMES[pitch.step]);\n}\n\nconst REGEX =\n /^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;\n\n// [name, accidentals, romanNumeral, chordType]\ntype RomanNumeralTokens = [string, string, string, string];\nexport function tokenize(str: string): RomanNumeralTokens {\n return (REGEX.exec(str) || [\"\", \"\", \"\", \"\"]) as RomanNumeralTokens;\n}\n\nconst ROMANS = \"I II III IV V VI VII\";\nconst NAMES = ROMANS.split(\" \");\nconst NAMES_MINOR = ROMANS.toLowerCase().split(\" \");\n\nfunction parse(src: string): RomanNumeral | NoRomanNumeral {\n const [name, acc, roman, chordType] = tokenize(src);\n if (!roman) {\n return NoRomanNumeral;\n }\n\n const upperRoman = roman.toUpperCase();\n const step = NAMES.indexOf(upperRoman);\n const alt = accToAlt(acc);\n const dir = 1;\n return {\n empty: false,\n name,\n roman,\n interval: interval({ step, alt, dir }).name,\n acc,\n chordType,\n alt,\n step,\n major: roman === upperRoman,\n oct: 0,\n dir,\n };\n}\n\nexport default {\n names,\n get,\n // deprecated\n romanNumeral,\n};\n", "import { accToAlt, altToAcc, note, transpose } from \"@tonaljs/core\";\nimport { transposeFifths } from \"@tonaljs/note\";\nimport { get as roman } from \"@tonaljs/roman-numeral\";\n\nconst Empty: readonly string[] = Object.freeze([] as string[]);\n\nexport interface Key {\n readonly type: \"major\" | \"minor\";\n readonly tonic: string;\n readonly alteration: number;\n readonly keySignature: string;\n}\n\nconst NoKey: Key = {\n type: \"major\",\n tonic: \"\",\n alteration: 0,\n keySignature: \"\",\n};\n\nexport interface KeyScale {\n readonly tonic: string;\n readonly grades: readonly string[];\n readonly intervals: readonly string[];\n readonly scale: readonly string[];\n readonly chords: readonly string[];\n readonly chordsHarmonicFunction: readonly string[];\n readonly chordScales: readonly string[];\n}\n\nconst NoKeyScale: KeyScale = {\n tonic: \"\",\n grades: Empty,\n intervals: Empty,\n scale: Empty,\n chords: Empty,\n chordsHarmonicFunction: Empty,\n chordScales: Empty,\n};\n\nexport interface MajorKey extends Key, KeyScale {\n readonly type: \"major\";\n readonly minorRelative: string;\n readonly scale: readonly string[];\n readonly secondaryDominants: readonly string[];\n readonly secondaryDominantsMinorRelative: readonly string[];\n readonly substituteDominants: readonly string[];\n readonly substituteDominantsMinorRelative: readonly string[];\n}\n\nconst NoMajorKey: MajorKey = {\n ...NoKey,\n ...NoKeyScale,\n type: \"major\",\n minorRelative: \"\",\n scale: Empty,\n secondaryDominants: Empty,\n secondaryDominantsMinorRelative: Empty,\n substituteDominants: Empty,\n substituteDominantsMinorRelative: Empty,\n};\n\nexport interface MinorKey extends Key {\n readonly type: \"minor\";\n readonly relativeMajor: string;\n readonly natural: KeyScale;\n readonly harmonic: KeyScale;\n readonly melodic: KeyScale;\n}\n\nconst NoMinorKey: MinorKey = {\n ...NoKey,\n type: \"minor\",\n relativeMajor: \"\",\n natural: NoKeyScale,\n harmonic: NoKeyScale,\n melodic: NoKeyScale,\n};\n\nconst mapScaleToType = (scale: string[], list: string[], sep = \"\") =>\n list.map((type, i) => `${scale[i]}${sep}${type}`);\n\nfunction keyScale(\n grades: string[],\n chords: string[],\n harmonicFunctions: string[],\n chordScales: string[]\n) {\n return (tonic: string): KeyScale => {\n const intervals = grades.map((gr) => roman(gr).interval || \"\");\n const scale = intervals.map((interval) => transpose(tonic, interval));\n\n return {\n tonic,\n grades,\n intervals,\n scale,\n chords: mapScaleToType(scale, chords),\n chordsHarmonicFunction: harmonicFunctions.slice(),\n chordScales: mapScaleToType(scale, chordScales, \" \"),\n };\n };\n}\n\nconst distInFifths = (from: string, to: string) => {\n const f = note(from);\n const t = note(to);\n return f.empty || t.empty ? 0 : t.coord[0] - f.coord[0];\n};\n\nconst MajorScale = keyScale(\n \"I II III IV V VI VII\".split(\" \"),\n \"maj7 m7 m7 maj7 7 m7 m7b5\".split(\" \"),\n \"T SD T SD D T D\".split(\" \"),\n \"major,dorian,phrygian,lydian,mixolydian,minor,locrian\".split(\",\")\n);\nconst NaturalScale = keyScale(\n \"I II bIII IV V bVI bVII\".split(\" \"),\n \"m7 m7b5 maj7 m7 m7 maj7 7\".split(\" \"),\n \"T SD T SD D SD SD\".split(\" \"),\n \"minor,locrian,major,dorian,phrygian,lydian,mixolydian\".split(\",\")\n);\nconst HarmonicScale = keyScale(\n \"I II bIII IV V bVI VII\".split(\" \"),\n \"mMaj7 m7b5 +maj7 m7 7 maj7 o7\".split(\" \"),\n \"T SD T SD D SD D\".split(\" \"),\n \"harmonic minor,locrian 6,major augmented,lydian diminished,phrygian dominant,lydian #9,ultralocrian\".split(\n \",\"\n )\n);\nconst MelodicScale = keyScale(\n \"I II bIII IV V VI VII\".split(\" \"),\n \"m6 m7 +maj7 7 7 m7b5 m7b5\".split(\" \"),\n \"T SD T SD D \".split(\" \"),\n \"melodic minor,dorian b2,lydian augmented,lydian dominant,mixolydian b6,locrian #2,altered\".split(\n \",\"\n )\n);\n\n/**\n * Get a major key properties in a given tonic\n * @param tonic\n */\nexport function majorKey(tonic: string): MajorKey {\n const pc = note(tonic).pc;\n if (!pc) return NoMajorKey;\n\n const keyScale = MajorScale(pc);\n const alteration = distInFifths(\"C\", pc);\n const romanInTonic = (src: string) => {\n const r = roman(src);\n if (r.empty) return \"\";\n\n return transpose(tonic, r.interval) + r.chordType;\n };\n\n return {\n ...keyScale,\n type: \"major\",\n minorRelative: transpose(pc, \"-3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n secondaryDominants: \"- VI7 VII7 I7 II7 III7 -\".split(\" \").map(romanInTonic),\n secondaryDominantsMinorRelative: \"- IIIm7b5 IV#m7 Vm7 VIm7 VIIm7b5 -\"\n .split(\" \")\n .map(romanInTonic),\n substituteDominants: \"- bIII7 IV7 bV7 bVI7 bVII7 -\"\n .split(\" \")\n .map(romanInTonic),\n substituteDominantsMinorRelative: \"- IIIm7 Im7 IIbm7 VIm7 IVm7 -\"\n .split(\" \")\n .map(romanInTonic),\n };\n}\n\n/**\n * Get minor key properties in a given tonic\n * @param tonic\n */\nexport function minorKey(tnc: string): MinorKey {\n const pc = note(tnc).pc;\n if (!pc) return NoMinorKey;\n\n const alteration = distInFifths(\"C\", pc) - 3;\n return {\n type: \"minor\",\n tonic: pc,\n relativeMajor: transpose(pc, \"3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n natural: NaturalScale(pc),\n harmonic: HarmonicScale(pc),\n melodic: MelodicScale(pc),\n };\n}\n\n/**\n * Given a key signature, returns the tonic of the major key\n * @param sigature\n * @example\n * majorTonicFromKeySignature('###') // => 'A'\n */\nexport function majorTonicFromKeySignature(\n sig: string | number\n): string | null {\n if (typeof sig === \"number\") {\n return transposeFifths(\"C\", sig);\n } else if (typeof sig === \"string\" && /^b+|#+$/.test(sig)) {\n return transposeFifths(\"C\", accToAlt(sig));\n }\n return null;\n}\n\nexport default { majorKey, majorTonicFromKeySignature, minorKey };\n", "import { rotate } from \"@tonaljs/collection\";\nimport { deprecate, Named, NoteName, transpose } from \"@tonaljs/core\";\nimport { simplify, transposeFifths } from \"@tonaljs/interval\";\nimport { EmptyPcset, Pcset } from \"@tonaljs/pcset\";\nimport { get as getType } from \"@tonaljs/scale-type\";\n\nconst MODES = [\n [0, 2773, 0, \"ionian\", \"\", \"Maj7\", \"major\"],\n [1, 2902, 2, \"dorian\", \"m\", \"m7\"],\n [2, 3418, 4, \"phrygian\", \"m\", \"m7\"],\n [3, 2741, -1, \"lydian\", \"\", \"Maj7\"],\n [4, 2774, 1, \"mixolydian\", \"\", \"7\"],\n [5, 2906, 3, \"aeolian\", \"m\", \"m7\", \"minor\"],\n [6, 3434, 5, \"locrian\", \"dim\", \"m7b5\"],\n] as const;\n\ntype ModeDatum = typeof MODES[number];\n\nexport interface Mode extends Pcset {\n readonly name: string;\n readonly modeNum: number;\n readonly alt: number; // number of alterations === number of fiths\n readonly triad: string;\n readonly seventh: string;\n readonly aliases: string[];\n}\n\nconst NoMode: Mode = {\n ...EmptyPcset,\n name: \"\",\n alt: 0,\n modeNum: NaN,\n triad: \"\",\n seventh: \"\",\n aliases: [],\n};\n\nconst modes: Mode[] = MODES.map(toMode);\nconst index: Record<string, Mode> = {};\nmodes.forEach((mode) => {\n index[mode.name] = mode;\n mode.aliases.forEach((alias) => {\n index[alias] = mode;\n });\n});\n\ntype ModeLiteral = string | Named;\n\n/**\n * Get a Mode by it's name\n *\n * @example\n * get('dorian')\n * // =>\n * // {\n * // intervals: [ '1P', '2M', '3m', '4P', '5P', '6M', '7m' ],\n * // modeNum: 1,\n * // chroma: '101101010110',\n * // normalized: '101101010110',\n * // name: 'dorian',\n * // setNum: 2902,\n * // alt: 2,\n * // triad: 'm',\n * // seventh: 'm7',\n * // aliases: []\n * // }\n */\nexport function get(name: ModeLiteral): Mode {\n return typeof name === \"string\"\n ? index[name.toLowerCase()] || NoMode\n : name && name.name\n ? get(name.name)\n : NoMode;\n}\n\nexport const mode = deprecate(\"Mode.mode\", \"Mode.get\", get);\n\n/**\n * Get a list of all modes\n */\nexport function all() {\n return modes.slice();\n}\nexport const entries = deprecate(\"Mode.mode\", \"Mode.all\", all);\n\n/**\n * Get a list of all mode names\n */\nexport function names() {\n return modes.map((mode) => mode.name);\n}\n\nfunction toMode(mode: ModeDatum): Mode {\n const [modeNum, setNum, alt, name, triad, seventh, alias] = mode;\n const aliases = alias ? [alias] : [];\n const chroma = Number(setNum).toString(2);\n const intervals = getType(name).intervals;\n return {\n empty: false,\n intervals,\n modeNum,\n chroma,\n normalized: chroma,\n name,\n setNum,\n alt,\n triad,\n seventh,\n aliases,\n };\n}\n\nexport function notes(modeName: ModeLiteral, tonic: NoteName) {\n return get(modeName).intervals.map((ivl) => transpose(tonic, ivl));\n}\n\nfunction chords(chords: string[]) {\n return (modeName: ModeLiteral, tonic: NoteName) => {\n const mode = get(modeName);\n if (mode.empty) return [];\n const triads = rotate(mode.modeNum, chords);\n const tonics = mode.intervals.map((i) => transpose(tonic, i));\n return triads.map((triad, i) => tonics[i] + triad);\n };\n}\n\nexport const triads = chords(MODES.map((x) => x[4]));\nexport const seventhChords = chords(MODES.map((x) => x[5]));\n\nexport function distance(destination: ModeLiteral, source: ModeLiteral) {\n const from = get(source);\n const to = get(destination);\n if (from.empty || to.empty) return \"\";\n return simplify(transposeFifths(\"1P\", to.alt - from.alt));\n}\n\nexport function relativeTonic(\n destination: ModeLiteral,\n source: ModeLiteral,\n tonic: NoteName\n) {\n return transpose(tonic, distance(destination, source));\n}\n\nexport default {\n get,\n names,\n all,\n distance,\n relativeTonic,\n notes,\n triads,\n seventhChords,\n // deprecated\n entries,\n mode,\n};\n", "import { tokenize } from \"@tonaljs/chord\";\nimport { distance, interval, NoteLiteral, transpose } from \"@tonaljs/core\";\nimport { get as romanNumeral } from \"@tonaljs/roman-numeral\";\n\n/**\n * Given a tonic and a chord list expressed with roman numeral notation\n * returns the progression expressed with leadsheet chords symbols notation\n * @example\n * fromRomanNumerals(\"C\", [\"I\", \"IIm7\", \"V7\"]);\n * // => [\"C\", \"Dm7\", \"G7\"]\n */\nexport function fromRomanNumerals(\n tonic: NoteLiteral,\n chords: string[]\n): string[] {\n const romanNumerals = chords.map(romanNumeral);\n return romanNumerals.map(\n (rn) => transpose(tonic, interval(rn)) + rn.chordType\n );\n}\n\n/**\n * Given a tonic and a chord list with leadsheet symbols notation,\n * return the chord list with roman numeral notation\n * @example\n * toRomanNumerals(\"C\", [\"CMaj7\", \"Dm7\", \"G7\"]);\n * // => [\"IMaj7\", \"IIm7\", \"V7\"]\n */\nexport function toRomanNumerals(\n tonic: NoteLiteral,\n chords: string[]\n): string[] {\n return chords.map((chord) => {\n const [note, chordType] = tokenize(chord);\n const intervalName = distance(tonic, note);\n const roman = romanNumeral(interval(intervalName));\n return roman.name + chordType;\n });\n}\n\nexport default { fromRomanNumerals, toRomanNumerals };\n", "import { compact, range } from \"@tonaljs/collection\";\nimport { midiToNoteName, toMidi, ToNoteNameOptions } from \"@tonaljs/midi\";\n\n/**\n * Create a numeric range. You supply a list of notes or numbers and it will\n * be connected to create complex ranges.\n *\n * @param {Array} notes - the list of notes or midi numbers used\n * @return {Array} an array of numbers or empty array if not valid parameters\n *\n * @example\n * numeric([\"C5\", \"C4\"]) // => [ 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60 ]\n * // it works midi notes\n * numeric([10, 5]) // => [ 10, 9, 8, 7, 6, 5 ]\n * // complex range\n * numeric([\"C4\", \"E4\", \"Bb3\"]) // => [60, 61, 62, 63, 64, 63, 62, 61, 60, 59, 58]\n */\nexport function numeric(notes: (string | number)[]): number[] {\n const midi: number[] = compact(notes.map(toMidi));\n if (!notes.length || midi.length !== notes.length) {\n // there is no valid notes\n return [];\n }\n\n return midi.reduce(\n (result, note) => {\n const last: number = result[result.length - 1];\n return result.concat(range(last, note).slice(1));\n },\n [midi[0]]\n );\n}\n\n/**\n * Create a range of chromatic notes. The altered notes will use flats.\n *\n * @function\n * @param {Array} notes - the list of notes or midi note numbers to create a range from\n * @param {Object} options - The same as `midiToNoteName` (`{ sharps: boolean, pitchClass: boolean }`)\n * @return {Array} an array of note names\n *\n * @example\n * Range.chromatic([\"C2, \"E2\", \"D2\"]) // => [\"C2\", \"Db2\", \"D2\", \"Eb2\", \"E2\", \"Eb2\", \"D2\"]\n * // with sharps\n * Range.chromatic([\"C2\", \"C3\"], { sharps: true }) // => [ \"C2\", \"C#2\", \"D2\", \"D#2\", \"E2\", \"F2\", \"F#2\", \"G2\", \"G#2\", \"A2\", \"A#2\", \"B2\", \"C3\" ]\n */\nexport function chromatic(\n notes: (string | number)[],\n options?: ToNoteNameOptions\n): string[] {\n return numeric(notes).map((midi) => midiToNoteName(midi, options));\n}\n\nexport default { numeric, chromatic };\n", "/**\n * References:\n * - https://www.researchgate.net/publication/327567188_An_Algorithm_for_Spelling_the_Pitches_of_Any_Musical_Scale\n * @module scale\n */\nimport { all as chordTypes } from \"@tonaljs/chord-type\";\nimport { rotate, range as nums } from \"@tonaljs/collection\";\nimport { deprecate, note, NoteName, transpose } from \"@tonaljs/core\";\nimport { sortedUniqNames, fromMidi, enharmonic } from \"@tonaljs/note\";\nimport { isSubsetOf, isSupersetOf, modes } from \"@tonaljs/pcset\";\nimport {\n all as scaleTypes,\n get as getScaleType,\n names as scaleTypeNames,\n ScaleType,\n} from \"@tonaljs/scale-type\";\n\ntype ScaleName = string;\ntype ScaleNameTokens = [string, string]; // [TONIC, SCALE TYPE]\n\nexport interface Scale extends ScaleType {\n tonic: string | null;\n type: string;\n notes: NoteName[];\n}\n\nconst NoScale: Scale = {\n empty: true,\n name: \"\",\n type: \"\",\n tonic: null,\n setNum: NaN,\n chroma: \"\",\n normalized: \"\",\n aliases: [],\n notes: [],\n intervals: [],\n};\n\n/**\n * Given a string with a scale name and (optionally) a tonic, split\n * that components.\n *\n * It retuns an array with the form [ name, tonic ] where tonic can be a\n * note name or null and name can be any arbitrary string\n * (this function doesn\"t check if that scale name exists)\n *\n * @function\n * @param {string} name - the scale name\n * @return {Array} an array [tonic, name]\n * @example\n * tokenize(\"C mixolydean\") // => [\"C\", \"mixolydean\"]\n * tokenize(\"anything is valid\") // => [\"\", \"anything is valid\"]\n * tokenize() // => [\"\", \"\"]\n */\nexport function tokenize(name: ScaleName): ScaleNameTokens {\n if (typeof name !== \"string\") {\n return [\"\", \"\"];\n }\n const i = name.indexOf(\" \");\n const tonic = note(name.substring(0, i));\n if (tonic.empty) {\n const n = note(name);\n return n.empty ? [\"\", name] : [n.name, \"\"];\n }\n\n const type = name.substring(tonic.name.length + 1);\n return [tonic.name, type.length ? type : \"\"];\n}\n\n/**\n * Get all scale names\n * @function\n */\nexport const names = scaleTypeNames;\n\n/**\n * Get a Scale from a scale name.\n */\nexport function get(src: ScaleName | ScaleNameTokens): Scale {\n const tokens = Array.isArray(src) ? src : tokenize(src);\n const tonic = note(tokens[0]).name;\n const st = getScaleType(tokens[1]);\n if (st.empty) {\n return NoScale;\n }\n\n const type = st.name;\n const notes: string[] = tonic\n ? st.intervals.map((i) => transpose(tonic, i))\n : [];\n\n const name = tonic ? tonic + \" \" + type : type;\n\n return { ...st, name, type, tonic, notes };\n}\n\nexport const scale = deprecate(\"Scale.scale\", \"Scale.get\", get);\n\n/**\n * Get all chords that fits a given scale\n *\n * @function\n * @param {string} name - the scale name\n * @return {Array<string>} - the chord names\n *\n * @example\n * scaleChords(\"pentatonic\") // => [\"5\", \"64\", \"M\", \"M6\", \"Madd9\", \"Msus2\"]\n */\nexport function scaleChords(name: string): string[] {\n const s = get(name);\n const inScale = isSubsetOf(s.chroma);\n return chordTypes()\n .filter((chord) => inScale(chord.chroma))\n .map((chord) => chord.aliases[0]);\n}\n/**\n * Get all scales names that are a superset of the given one\n * (has the same notes and at least one more)\n *\n * @function\n * @param {string} name\n * @return {Array} a list of scale names\n * @example\n * extended(\"major\") // => [\"bebop\", \"bebop dominant\", \"bebop major\", \"chromatic\", \"ichikosucho\"]\n */\nexport function extended(name: string): string[] {\n const s = get(name);\n const isSuperset = isSupersetOf(s.chroma);\n return scaleTypes()\n .filter((scale) => isSuperset(scale.chroma))\n .map((scale) => scale.name);\n}\n\n/**\n * Find all scales names that are a subset of the given one\n * (has less notes but all from the given scale)\n *\n * @function\n * @param {string} name\n * @return {Array} a list of scale names\n *\n * @example\n * reduced(\"major\") // => [\"ionian pentatonic\", \"major pentatonic\", \"ritusen\"]\n */\nexport function reduced(name: string): string[] {\n const isSubset = isSubsetOf(get(name).chroma);\n return scaleTypes()\n .filter((scale) => isSubset(scale.chroma))\n .map((scale) => scale.name);\n}\n\n/**\n * Given an array of notes, return the scale: a pitch class set starting from\n * the first note of the array\n *\n * @function\n * @param {string[]} notes\n * @return {string[]} pitch classes with same tonic\n * @example\n * scaleNotes(['C4', 'c3', 'C5', 'C4', 'c4']) // => [\"C\"]\n * scaleNotes(['D4', 'c#5', 'A5', 'F#6']) // => [\"D\", \"F#\", \"A\", \"C#\"]\n */\nexport function scaleNotes(notes: NoteName[]) {\n const pcset: string[] = notes.map((n) => note(n).pc).filter((x) => x);\n const tonic = pcset[0];\n const scale = sortedUniqNames(pcset);\n return rotate(scale.indexOf(tonic), scale);\n}\n\ntype ScaleMode = [string, string];\n/**\n * Find mode names of a scale\n *\n * @function\n * @param {string} name - scale name\n * @example\n * modeNames(\"C pentatonic\") // => [\n * [\"C\", \"major pentatonic\"],\n * [\"D\", \"egyptian\"],\n * [\"E\", \"malkos raga\"],\n * [\"G\", \"ritusen\"],\n * [\"A\", \"minor pentatonic\"]\n * ]\n */\nexport function modeNames(name: string): ScaleMode[] {\n const s = get(name);\n if (s.empty) {\n return [];\n }\n\n const tonics = s.tonic ? s.notes : s.intervals;\n return modes(s.chroma)\n .map((chroma: string, i: number): ScaleMode => {\n const modeName = get(chroma).name;\n return modeName ? [tonics[i], modeName] : [\"\", \"\"];\n })\n .filter((x) => x[0]);\n}\n\nfunction getNoteNameOf(scale: string | string[]) {\n const names = Array.isArray(scale) ? scaleNotes(scale) : get(scale).notes;\n const chromas = names.map((name) => note(name).chroma);\n\n return (noteOrMidi: string | number): string | undefined => {\n const currNote =\n typeof noteOrMidi === \"number\"\n ? note(fromMidi(noteOrMidi))\n : note(noteOrMidi);\n const height = currNote.height;\n\n if (height === undefined) return undefined;\n const chroma = height % 12;\n const position = chromas.indexOf(chroma);\n if (position === -1) return undefined;\n return enharmonic(currNote.name, names[position]);\n };\n}\n\nexport function rangeOf(scale: string | string[]) {\n const getName = getNoteNameOf(scale);\n return (fromNote: string, toNote: string) => {\n const from = note(fromNote).height;\n const to = note(toNote).height;\n if (from === undefined || to === undefined) return [];\n\n return nums(from, to)\n .map(getName)\n .filter((x) => x);\n };\n}\n\nexport default {\n get,\n names,\n extended,\n modeNames,\n reduced,\n scaleChords,\n scaleNotes,\n tokenize,\n rangeOf,\n // deprecated\n scale,\n};\n", "// TYPES: PARSING\nexport type TimeSignatureLiteral = string | [number, number] | [string, string];\ntype ParsedTimeSignature = [number | number[], number];\n\n// TYPES: PROPERTIES\nexport type ValidTimeSignature = {\n readonly empty: false;\n readonly name: string;\n readonly upper: number | number[];\n readonly lower: number;\n readonly type: \"simple\" | \"compound\" | \"irregular\";\n readonly additive: number[];\n};\n\nexport type InvalidTimeSignature = {\n readonly empty: true;\n readonly name: \"\";\n readonly upper: undefined;\n readonly lower: undefined;\n readonly type: undefined;\n readonly additive: [];\n};\n\nexport type TimeSignature = ValidTimeSignature | InvalidTimeSignature;\n\n// CONSTANTS\nconst NONE: InvalidTimeSignature = {\n empty: true,\n name: \"\",\n upper: undefined,\n lower: undefined,\n type: undefined,\n additive: [],\n};\n\nconst NAMES = [\"4/4\", \"3/4\", \"2/4\", \"2/2\", \"12/8\", \"9/8\", \"6/8\", \"3/8\"];\n\n// PUBLIC API\n\nexport function names() {\n return NAMES.slice();\n}\n\nconst REGEX = /^(\\d?\\d(?:\\+\\d)*)\\/(\\d)$/;\nconst CACHE = new Map<TimeSignatureLiteral, TimeSignature>();\n\nexport function get(literal: TimeSignatureLiteral): TimeSignature {\n const stringifiedLiteral = JSON.stringify(literal);\n const cached = CACHE.get(stringifiedLiteral);\n if (cached) {\n return cached;\n }\n\n const ts = build(parse(literal));\n CACHE.set(stringifiedLiteral, ts);\n return ts;\n}\n\nexport function parse(literal: TimeSignatureLiteral): ParsedTimeSignature {\n if (typeof literal === \"string\") {\n const [_, up, low] = REGEX.exec(literal) || [];\n return parse([up, low]);\n }\n\n const [up, down] = literal;\n const denominator = +down;\n if (typeof up === \"number\") {\n return [up, denominator];\n }\n\n const list = up.split(\"+\").map((n) => +n);\n return list.length === 1 ? [list[0], denominator] : [list, denominator];\n}\n\nexport default { names, parse, get };\n\n// PRIVATE\n\nfunction build([up, down]: ParsedTimeSignature): TimeSignature {\n const upper = Array.isArray(up) ? up.reduce((a, b) => a + b, 0) : up;\n const lower = down;\n if (upper === 0 || lower === 0) {\n return NONE;\n }\n\n const name = Array.isArray(up) ? `${up.join(\"+\")}/${down}` : `${up}/${down}`;\n const additive = Array.isArray(up) ? up : [];\n const type =\n lower === 4 || lower === 2\n ? \"simple\"\n : lower === 8 && upper % 3 === 0\n ? \"compound\"\n : \"irregular\";\n\n return {\n empty: false,\n name,\n type,\n upper,\n lower,\n additive,\n };\n}\n", "import AbcNotation from \"@tonaljs/abc-notation\";\nimport * as Array from \"@tonaljs/array\";\nimport Chord from \"@tonaljs/chord\";\nimport ChordType from \"@tonaljs/chord-type\";\nimport Collection from \"@tonaljs/collection\";\nimport * as Core from \"@tonaljs/core\";\nimport DurationValue from \"@tonaljs/duration-value\";\nimport Interval from \"@tonaljs/interval\";\nimport Key from \"@tonaljs/key\";\nimport Midi from \"@tonaljs/midi\";\nimport Mode from \"@tonaljs/mode\";\nimport Note from \"@tonaljs/note\";\nimport Pcset from \"@tonaljs/pcset\";\nimport Progression from \"@tonaljs/progression\";\nimport Range from \"@tonaljs/range\";\nimport RomanNumeral from \"@tonaljs/roman-numeral\";\nimport Scale from \"@tonaljs/scale\";\nimport ScaleType from \"@tonaljs/scale-type\";\nimport TimeSignature from \"@tonaljs/time-signature\";\n\nexport * from \"@tonaljs/core\";\n\n// deprecated (backwards compatibility)\nconst Tonal = Core;\nconst PcSet = Pcset;\nconst ChordDictionary = ChordType;\nconst ScaleDictionary = ScaleType;\n\nexport {\n AbcNotation,\n Array,\n Chord,\n ChordType,\n Collection,\n Core,\n DurationValue,\n Note,\n Interval,\n Key,\n Midi,\n Mode,\n Pcset,\n Progression,\n Range,\n RomanNumeral,\n Scale,\n ScaleType,\n TimeSignature,\n // backwards API compatibility (3.0)\n Tonal,\n PcSet,\n ChordDictionary,\n ScaleDictionary,\n};\n"],
5
- "mappings": "uZAMO,IAAMA,EAAU,CAACC,EAAWC,IAAc,MAAM,KAAK,IAAIA,CAAC,EAAI,CAAC,EAAE,KAAKD,CAAC,EAEvE,SAASE,EAEdC,EAAkBC,EAAqBC,EAAc,CACrD,OAAO,YAA4BC,EAAuC,CAExE,eAAQ,KAAK,GAAGH,wBAA+BC,IAAc,EACtDC,EAAG,MAAM,KAAMC,CAAI,CAC5B,CACF,CCHO,SAASC,EAAQC,EAAwB,CAC9C,OAAOA,IAAQ,MAAQ,OAAOA,GAAQ,UAAY,OAAOA,EAAI,MAAS,QAGxE,CCYO,SAASC,EAAQC,EAA4B,CAClD,OAAOA,IAAU,MACf,OAAOA,GAAU,UACjB,OAAOA,EAAM,MAAS,UACtB,OAAOA,EAAM,KAAQ,QAGzB,CAGA,IAAMC,GAAS,CAAC,EAAG,EAAG,EAAG,GAAI,EAAG,EAAG,CAAC,EAE9BC,GAAgBD,GAAO,IAAKE,GACh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B,EAAO,MAAM,QAAQX,CAAE,EAAI,GAAGA,EAAG,KAAK,GAAG,KAAKE,IAAS,GAAGF,KAAME,IAChEU,EAAW,MAAM,QAAQZ,CAAE,EAAIA,EAAK,CAAC,EACrCa,EACJH,IAAU,GAAKA,IAAU,EACrB,SACAA,IAAU,GAAKH,EAAQ,IAAM,EAC7B,WACA,YAEN,MAAO,CACL,MAAO,GACP,KAAAI,EACA,KAAAE,EACA,MAAAN,EACA,MAAAG,EACA,SAAAE,CACF,CACF,CC/EA,IAAME,GAAQC,GACRC,GAAQC,GACRC,GAAkBC,GAClBC,GAAkBC",
6
- "names": ["fillStr", "s", "n", "deprecate", "original", "alternative", "fn", "args", "isNamed", "src", "isPitch", "pitch", "FIFTHS", "STEPS_TO_OCTS", "fifths", "encode", "step", "alt", "oct", "dir", "f", "o", "FIFTHS_TO_STEPS", "decode", "coord", "unaltered", "i", "NoNote", "cache", "stepToLetter", "altToAcc", "accToAlt", "acc", "note", "stringSrc", "cached", "value", "parse", "pitchName", "REGEX", "tokenizeNote", "str", "m", "coordToNote", "noteCoord", "mod", "SEMI", "noteName", "tokens", "letter", "octStr", "name", "pc", "chroma", "height", "midi", "freq", "props", "NoInterval", "INTERVAL_TONAL_REGEX", "INTERVAL_SHORTHAND_REGEX", "tokenizeInterval", "interval", "SIZES", "TYPES", "num", "q", "t", "type", "simple", "qToAlt", "semitones", "coordToInterval", "forceDescending", "isDescending", "ivl", "calcNum", "d", "altToQ", "transpose", "intervalName", "intervalCoord", "tr", "distance", "fromNote", "toNote", "from", "to", "fcoord", "tcoord", "octs", "fillStr", "character", "times", "REGEX", "tokenize", "str", "m", "abcToScientificNotation", "acc", "letter", "oct", "i", "scientificToAbcNotation", "n", "note", "l", "o", "transpose", "interval", "distance", "from", "to", "abc_notation_default", "isArray", "ascR", "b", "n", "a", "descR", "range", "from", "to", "rotate", "times", "arr", "len", "compact", "sortedNoteNames", "notes", "note", "sortedUniqNoteNames", "i", "shuffle", "rnd", "t", "m", "permutations", "acc", "perm", "e", "pos", "newPerm", "ascR", "b", "n", "a", "descR", "range", "from", "to", "rotate", "times", "arr", "len", "compact", "shuffle", "rnd", "i", "t", "m", "permutations", "acc", "perm", "e", "pos", "newPerm", "collection_default", "EmptyPcset", "setNumToChroma", "num", "chromaToNumber", "chroma", "REGEX", "isChroma", "set", "isPcsetNum", "isPcset", "cache", "get", "src", "listToChroma", "chromaToPcset", "pcset", "deprecate", "intervals", "IVLS", "chromaToIntervals", "i", "chromas", "range", "modes", "normalize", "binary", "compact", "_", "r", "rotate", "isEqual", "s1", "s2", "isSubsetOf", "s", "notes", "o", "isSupersetOf", "isNoteIncludedIn", "noteName", "n", "note", "filter", "set", "isIncluded", "isNoteIncludedIn", "notes", "pcset_default", "get", "chroma", "num", "intervals", "chromas", "isSupersetOf", "isSubsetOf", "isEqual", "modes", "pcset", "chromaRotations", "binary", "_", "i", "rotate", "chromaToPcset", "setNum", "chromaToNumber", "normalizedNum", "n", "normalized", "setNumToChroma", "chromaToIntervals", "listToChroma", "EmptyPcset", "pitch", "note", "interval", "CHORDS", "data_default", "NoChordType", "EmptyPcset", "dictionary", "index", "get", "type", "chordType", "deprecate", "names", "chord", "x", "symbols", "keys", "all", "entries", "removeAll", "add", "intervals", "aliases", "fullName", "quality", "getQuality", "alias", "addAlias", "has", "interval", "ivls", "a", "b", "chord_type_default", "namedSet", "notes", "pcToName", "record", "n", "chroma", "note", "detect", "source", "x", "findExactMatches", "chord", "a", "b", "weight", "tonic", "tonicChroma", "noteName", "allModes", "modes", "found", "mode", "index", "all", "chordType", "chordName", "baseNote", "SCALES", "data_default", "NoScaleType", "EmptyPcset", "dictionary", "index", "names", "scale", "get", "type", "scaleType", "deprecate", "all", "entries", "keys", "removeAll", "add", "intervals", "name", "aliases", "alias", "addAlias", "ivls", "scale_type_default", "NoChord", "NUM_TYPES", "tokenize", "name", "letter", "acc", "oct", "type", "tokenizeNote", "get", "src", "getChord", "tonic", "chord", "typeName", "optionalTonic", "optionalRoot", "note", "root", "rootInterval", "distance", "rootDegree", "intervals", "i", "num", "quality", "newNum", "notes", "transpose", "symbol", "deprecate", "chordName", "interval", "chordScales", "s", "isChordIncluded", "isSupersetOf", "all", "scale", "extended", "isSuperset", "reduced", "isSubset", "isSubsetOf", "chord_default", "detect", "DATA", "data_default", "VALUES", "denominator", "shorthand", "names", "add", "NoDuration", "duration", "name", "shorthands", "dur", "REGEX", "get", "_", "simple", "dots", "base", "fraction", "calcDots", "value", "duration_value_default", "pow", "numerator", "i", "names", "get", "interval", "name", "semitones", "quality", "num", "simplify", "i", "invert", "step", "alt", "IN", "IQ", "fromSemitones", "d", "c", "distance", "add", "combinator", "a", "b", "addTo", "other", "substract", "transposeFifths", "fifths", "ivl", "nFifths", "nOcts", "dir", "coordToInterval", "interval_default", "fn", "coordA", "coordB", "coord", "isMidi", "arg", "toMidi", "note", "n", "midiToFreq", "midi", "tuning", "L2", "L440", "freqToMidi", "freq", "v", "SHARPS", "FLATS", "midiToNoteName", "options", "pc", "midi_default", "NAMES", "toName", "n", "onlyNotes", "array", "note", "names", "get", "name", "pitchClass", "accidentals", "octave", "midi", "freq", "chroma", "fromMidi", "midiToNoteName", "fromFreq", "freqToMidi", "fromFreqSharps", "fromMidiSharps", "transpose", "tr", "transposeBy", "interval", "trBy", "transposeFrom", "trFrom", "transposeFifths", "noteName", "fifths", "nFifths", "nOcts", "coordToNote", "trFifths", "ascending", "a", "b", "descending", "sortedNames", "notes", "comparator", "sortedUniqNames", "i", "simplify", "enharmonic", "destName", "src", "dest", "srcChroma", "destChroma", "destOctOffset", "destOct", "note_default", "NoRomanNumeral", "cache", "get", "src", "parse", "NAMES", "isPitch", "fromPitch", "isNamed", "romanNumeral", "deprecate", "names", "major", "NAMES_MINOR", "pitch", "altToAcc", "REGEX", "tokenize", "str", "ROMANS", "name", "acc", "roman", "chordType", "upperRoman", "step", "alt", "accToAlt", "dir", "interval", "roman_numeral_default", "Empty", "NoKey", "NoKeyScale", "NoMajorKey", "NoMinorKey", "mapScaleToType", "scale", "list", "sep", "type", "i", "keyScale", "grades", "chords", "harmonicFunctions", "chordScales", "tonic", "intervals", "gr", "get", "interval", "transpose", "distInFifths", "from", "to", "f", "note", "t", "MajorScale", "NaturalScale", "HarmonicScale", "MelodicScale", "majorKey", "pc", "alteration", "romanInTonic", "src", "r", "altToAcc", "minorKey", "tnc", "majorTonicFromKeySignature", "sig", "transposeFifths", "accToAlt", "key_default", "MODES", "NoMode", "EmptyPcset", "modes", "toMode", "index", "mode", "alias", "get", "name", "deprecate", "all", "entries", "names", "modeNum", "setNum", "alt", "triad", "seventh", "aliases", "chroma", "notes", "modeName", "tonic", "ivl", "transpose", "chords", "triads", "rotate", "tonics", "i", "x", "seventhChords", "distance", "destination", "source", "from", "to", "simplify", "transposeFifths", "relativeTonic", "mode_default", "fromRomanNumerals", "tonic", "chords", "get", "rn", "transpose", "interval", "toRomanNumerals", "chord", "note", "chordType", "tokenize", "intervalName", "distance", "progression_default", "numeric", "notes", "midi", "compact", "toMidi", "result", "note", "last", "range", "chromatic", "options", "midiToNoteName", "range_default", "NoScale", "tokenize", "name", "i", "tonic", "note", "n", "type", "names", "get", "src", "tokens", "st", "notes", "transpose", "scale", "deprecate", "scaleChords", "s", "inScale", "isSubsetOf", "all", "chord", "extended", "isSuperset", "isSupersetOf", "reduced", "isSubset", "scaleNotes", "pcset", "x", "sortedUniqNames", "rotate", "modeNames", "tonics", "modes", "chroma", "modeName", "getNoteNameOf", "chromas", "noteOrMidi", "currNote", "fromMidi", "height", "position", "enharmonic", "rangeOf", "getName", "fromNote", "toNote", "from", "to", "range", "scale_default", "NONE", "NAMES", "names", "REGEX", "CACHE", "get", "literal", "stringifiedLiteral", "cached", "ts", "build", "parse", "_", "up", "low", "down", "denominator", "list", "n", "time_signature_default", "upper", "a", "b", "lower", "name", "additive", "type", "Tonal", "dist_exports", "PcSet", "pcset_default", "ChordDictionary", "chord_type_default", "ScaleDictionary", "scale_type_default"]
4
+ "sourcesContent": ["/**\n * Fill a string with a repeated character\n *\n * @param character\n * @param repetition\n */\nexport const fillStr = (s: string, n: number) => Array(Math.abs(n) + 1).join(s);\n\nexport function deprecate<\n ResultFn extends (this: any, ...newArgs: any[]) => ReturnType<ResultFn>\n>(original: string, alternative: string, fn: ResultFn) {\n return function (this: unknown, ...args: unknown[]): ReturnType<ResultFn> {\n // tslint:disable-next-line\n console.warn(`${original} is deprecated. Use ${alternative}.`);\n return fn.apply(this, args);\n };\n}\n", "export interface Named {\n readonly name: string;\n}\n\nexport interface NamedFound {\n readonly empty: false;\n}\n\nexport interface NotFound extends Named {\n readonly empty: true;\n readonly name: \"\";\n}\n\nexport function isNamed(src: any): src is Named {\n return src !== null && typeof src === \"object\" && typeof src.name === \"string\"\n ? true\n : false;\n}\n", "import { Named } from \"./named\";\n\ntype Fifths = number;\ntype Octaves = number;\nexport type Direction = 1 | -1;\n\nexport type PitchClassCoordinates = [Fifths];\nexport type NoteCoordinates = [Fifths, Octaves];\nexport type IntervalCoordinates = [Fifths, Octaves, Direction];\nexport type PitchCoordinates =\n | PitchClassCoordinates\n | NoteCoordinates\n | IntervalCoordinates;\n\n/**\n * Pitch properties\n *\n * - {number} step - The step number: 0 = C, 1 = D, ... 6 = B\n * - {number} alt - Number of alterations: -2 = 'bb', -1 = 'b', 0 = '', 1 = '#', ...\n * - {number} [oct] = The octave (undefined when is a coord class)\n * - {number} [dir] = Interval direction (undefined when is not an interval)\n */\nexport interface Pitch {\n readonly step: number;\n readonly alt: number;\n readonly oct?: number; // undefined for pitch classes\n readonly dir?: Direction; // undefined for notes\n}\n\nexport function isPitch(pitch: any): pitch is Pitch {\n return pitch !== null &&\n typeof pitch === \"object\" &&\n typeof pitch.step === \"number\" &&\n typeof pitch.alt === \"number\"\n ? true\n : false;\n}\n\n// The number of fifths of [C, D, E, F, G, A, B]\nconst FIFTHS = [0, 2, 4, -1, 1, 3, 5];\n// The number of octaves it span each step\nconst STEPS_TO_OCTS = FIFTHS.map((fifths: number) =>\n Math.floor((fifths * 7) / 12)\n);\n\nexport function encode(pitch: Pitch): PitchCoordinates {\n const { step, alt, oct, dir = 1 } = pitch;\n const f = FIFTHS[step] + 7 * alt;\n if (oct === undefined) {\n return [dir * f];\n }\n const o = oct - STEPS_TO_OCTS[step] - 4 * alt;\n return [dir * f, dir * o];\n}\n\n// We need to get the steps from fifths\n// Fifths for CDEFGAB are [ 0, 2, 4, -1, 1, 3, 5 ]\n// We add 1 to fifths to avoid negative numbers, so:\n// for [\"F\", \"C\", \"G\", \"D\", \"A\", \"E\", \"B\"] we have:\nconst FIFTHS_TO_STEPS = [3, 0, 4, 1, 5, 2, 6];\n\nexport function decode(coord: PitchCoordinates): Pitch {\n const [f, o, dir] = coord;\n const step = FIFTHS_TO_STEPS[unaltered(f)];\n const alt = Math.floor((f + 1) / 7);\n if (o === undefined) {\n return { step, alt, dir };\n }\n const oct = o + 4 * alt + STEPS_TO_OCTS[step];\n return { step, alt, oct, dir };\n}\n\n// Return the number of fifths as if it were unaltered\nfunction unaltered(f: number): number {\n const i = (f + 1) % 7;\n return i < 0 ? 7 + i : i;\n}\n", "import { isNamed, Named } from \"./named\";\nimport { decode, encode, isPitch, Pitch, PitchCoordinates } from \"./pitch\";\nimport { fillStr } from \"./utils\";\n\nexport type NoteWithOctave = string;\nexport type PcName = string;\nexport type NoteName = NoteWithOctave | PcName;\nexport type NoteLiteral = NoteName | Pitch | Named;\n\nexport interface Note extends Pitch, Named {\n readonly empty: boolean;\n readonly name: NoteName;\n readonly letter: string;\n readonly acc: string;\n readonly pc: PcName;\n readonly chroma: number;\n readonly height: number;\n readonly coord: PitchCoordinates;\n readonly midi: number | null;\n readonly freq: number | null;\n}\n\nexport interface NoNote extends Partial<Note> {\n empty: true;\n name: \"\";\n pc: \"\";\n acc: \"\";\n}\nconst NoNote: NoNote = { empty: true, name: \"\", pc: \"\", acc: \"\" };\n\nconst cache: Map<NoteLiteral | undefined, Note | NoNote> = new Map();\n\nexport const stepToLetter = (step: number) => \"CDEFGAB\".charAt(step);\nexport const altToAcc = (alt: number): string =>\n alt < 0 ? fillStr(\"b\", -alt) : fillStr(\"#\", alt);\nexport const accToAlt = (acc: string): number =>\n acc[0] === \"b\" ? -acc.length : acc.length;\n\n/**\n * Given a note literal (a note name or a note object), returns the Note object\n * @example\n * note('Bb4') // => { name: \"Bb4\", midi: 70, chroma: 10, ... }\n */\nexport function note(src: NoteLiteral): Note | NoNote {\n const stringSrc = JSON.stringify(src);\n\n const cached = cache.get(stringSrc);\n if (cached) {\n return cached;\n }\n\n const value =\n typeof src === \"string\"\n ? parse(src)\n : isPitch(src)\n ? note(pitchName(src))\n : isNamed(src)\n ? note(src.name)\n : NoNote;\n cache.set(stringSrc, value);\n return value;\n}\n\ntype NoteTokens = [string, string, string, string];\n\nconst REGEX = /^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\\d*)\\s*(.*)$/;\n\n/**\n * @private\n */\nexport function tokenizeNote(str: string): NoteTokens {\n const m = REGEX.exec(str) as string[];\n return [m[1].toUpperCase(), m[2].replace(/x/g, \"##\"), m[3], m[4]];\n}\n\n/**\n * @private\n */\nexport function coordToNote(noteCoord: PitchCoordinates): Note {\n return note(decode(noteCoord)) as Note;\n}\n\nconst mod = (n: number, m: number) => ((n % m) + m) % m;\n\nconst SEMI = [0, 2, 4, 5, 7, 9, 11];\nfunction parse(noteName: NoteName): Note | NoNote {\n const tokens = tokenizeNote(noteName);\n if (tokens[0] === \"\" || tokens[3] !== \"\") {\n return NoNote;\n }\n\n const letter = tokens[0];\n const acc = tokens[1];\n const octStr = tokens[2];\n\n const step = (letter.charCodeAt(0) + 3) % 7;\n const alt = accToAlt(acc);\n const oct = octStr.length ? +octStr : undefined;\n const coord = encode({ step, alt, oct });\n\n const name = letter + acc + octStr;\n const pc = letter + acc;\n const chroma = (SEMI[step] + alt + 120) % 12;\n const height =\n oct === undefined\n ? mod(SEMI[step] + alt, 12) - 12 * 99\n : SEMI[step] + alt + 12 * (oct + 1);\n const midi = height >= 0 && height <= 127 ? height : null;\n const freq = oct === undefined ? null : Math.pow(2, (height - 69) / 12) * 440;\n\n return {\n empty: false,\n acc,\n alt,\n chroma,\n coord,\n freq,\n height,\n letter,\n midi,\n name,\n oct,\n pc,\n step,\n };\n}\n\nfunction pitchName(props: Pitch): NoteName {\n const { step, alt, oct } = props;\n const letter = stepToLetter(step);\n if (!letter) {\n return \"\";\n }\n\n const pc = letter + altToAcc(alt);\n return oct || oct === 0 ? pc + oct : pc;\n}\n", "import { isNamed, Named } from \"./named\";\nimport {\n decode,\n Direction,\n encode,\n IntervalCoordinates,\n isPitch,\n Pitch,\n PitchCoordinates,\n} from \"./pitch\";\nimport { fillStr } from \"./utils\";\n\nexport type IntervalName = string;\nexport type IntervalLiteral = IntervalName | Pitch | Named;\n\ntype Quality =\n | \"dddd\"\n | \"ddd\"\n | \"dd\"\n | \"d\"\n | \"m\"\n | \"M\"\n | \"P\"\n | \"A\"\n | \"AA\"\n | \"AAA\"\n | \"AAAA\";\ntype Type = \"perfectable\" | \"majorable\";\n\nexport interface Interval extends Pitch, Named {\n readonly empty: boolean;\n readonly name: IntervalName;\n readonly num: number;\n readonly q: Quality;\n readonly type: Type;\n readonly step: number;\n readonly alt: number;\n readonly dir: Direction;\n readonly simple: number;\n readonly semitones: number;\n readonly chroma: number;\n readonly coord: IntervalCoordinates;\n readonly oct: number;\n}\n\nexport interface NoInterval extends Partial<Interval> {\n readonly empty: true;\n readonly name: \"\";\n readonly acc: \"\";\n}\n\nconst NoInterval: NoInterval = { empty: true, name: \"\", acc: \"\" };\n\n// shorthand tonal notation (with quality after number)\nconst INTERVAL_TONAL_REGEX = \"([-+]?\\\\d+)(d{1,4}|m|M|P|A{1,4})\";\n// standard shorthand notation (with quality before number)\nconst INTERVAL_SHORTHAND_REGEX = \"(AA|A|P|M|m|d|dd)([-+]?\\\\d+)\";\nconst REGEX = new RegExp(\n \"^\" + INTERVAL_TONAL_REGEX + \"|\" + INTERVAL_SHORTHAND_REGEX + \"$\"\n);\n\ntype IntervalTokens = [string, string];\n\n/**\n * @private\n */\nexport function tokenizeInterval(str?: IntervalName): IntervalTokens {\n const m = REGEX.exec(`${str}`);\n if (m === null) {\n return [\"\", \"\"];\n }\n return m[1] ? [m[1], m[2]] : [m[4], m[3]];\n}\n\nconst cache: { [key in string]: Interval | NoInterval } = {};\n\n/**\n * Get interval properties. It returns an object with:\n *\n * - name: the interval name\n * - num: the interval number\n * - type: 'perfectable' or 'majorable'\n * - q: the interval quality (d, m, M, A)\n * - dir: interval direction (1 ascending, -1 descending)\n * - simple: the simplified number\n * - semitones: the size in semitones\n * - chroma: the interval chroma\n *\n * @param {string} interval - the interval name\n * @return {Object} the interval properties\n *\n * @example\n * import { interval } from '@tonaljs/core'\n * interval('P5').semitones // => 7\n * interval('m3').type // => 'majorable'\n */\nexport function interval(src: IntervalLiteral): Interval | NoInterval {\n return typeof src === \"string\"\n ? cache[src] || (cache[src] = parse(src))\n : isPitch(src)\n ? interval(pitchName(src))\n : isNamed(src)\n ? interval(src.name)\n : NoInterval;\n}\n\nconst SIZES = [0, 2, 4, 5, 7, 9, 11];\nconst TYPES = \"PMMPPMM\";\nfunction parse(str?: string): Interval | NoInterval {\n const tokens = tokenizeInterval(str);\n if (tokens[0] === \"\") {\n return NoInterval;\n }\n const num = +tokens[0];\n const q = tokens[1] as Quality;\n const step = (Math.abs(num) - 1) % 7;\n const t = TYPES[step];\n if (t === \"M\" && q === \"P\") {\n return NoInterval;\n }\n const type = t === \"M\" ? \"majorable\" : \"perfectable\";\n\n const name = \"\" + num + q;\n const dir = num < 0 ? -1 : 1;\n const simple = num === 8 || num === -8 ? num : dir * (step + 1);\n const alt = qToAlt(type, q);\n const oct = Math.floor((Math.abs(num) - 1) / 7);\n const semitones = dir * (SIZES[step] + alt + 12 * oct);\n const chroma = (((dir * (SIZES[step] + alt)) % 12) + 12) % 12;\n const coord = encode({ step, alt, oct, dir }) as IntervalCoordinates;\n return {\n empty: false,\n name,\n num,\n q,\n step,\n alt,\n dir,\n type,\n simple,\n semitones,\n chroma,\n coord,\n oct,\n };\n}\n\n/**\n * @private\n *\n * forceDescending is used in the case of unison (#243)\n */\nexport function coordToInterval(\n coord: PitchCoordinates,\n forceDescending?: boolean\n): Interval {\n const [f, o = 0] = coord;\n const isDescending = f * 7 + o * 12 < 0;\n const ivl: IntervalCoordinates =\n forceDescending || isDescending ? [-f, -o, -1] : [f, o, 1];\n return interval(decode(ivl)) as Interval;\n}\n\nfunction qToAlt(type: Type, q: string): number {\n return (q === \"M\" && type === \"majorable\") ||\n (q === \"P\" && type === \"perfectable\")\n ? 0\n : q === \"m\" && type === \"majorable\"\n ? -1\n : /^A+$/.test(q)\n ? q.length\n : /^d+$/.test(q)\n ? -1 * (type === \"perfectable\" ? q.length : q.length + 1)\n : 0;\n}\n\n// return the interval name of a pitch\nfunction pitchName(props: Pitch): string {\n const { step, alt, oct = 0, dir } = props;\n if (!dir) {\n return \"\";\n }\n const calcNum = step + 1 + 7 * oct;\n // this is an edge case: descending pitch class unison (see #243)\n const num = calcNum === 0 ? step + 1 : calcNum;\n const d = dir < 0 ? \"-\" : \"\";\n const type = TYPES[step] === \"M\" ? \"majorable\" : \"perfectable\";\n const name = d + num + altToQ(type, alt);\n return name;\n}\n\nfunction altToQ(type: Type, alt: number): Quality {\n if (alt === 0) {\n return type === \"majorable\" ? \"M\" : \"P\";\n } else if (alt === -1 && type === \"majorable\") {\n return \"m\";\n } else if (alt > 0) {\n return fillStr(\"A\", alt) as Quality;\n } else {\n return fillStr(\"d\", type === \"perfectable\" ? alt : alt + 1) as Quality;\n }\n}\n", "import {\n coordToInterval,\n interval as asInterval,\n IntervalLiteral,\n IntervalName,\n} from \"./interval\";\nimport { coordToNote, note as asNote, NoteLiteral, NoteName } from \"./note\";\nimport { PitchCoordinates } from \"./pitch\";\n\n/**\n * Transpose a note by an interval.\n *\n * @param {string} note - the note or note name\n * @param {string} interval - the interval or interval name\n * @return {string} the transposed note name or empty string if not valid notes\n * @example\n * import { tranpose } from \"@tonaljs/core\"\n * transpose(\"d3\", \"3M\") // => \"F#3\"\n * transpose(\"D\", \"3M\") // => \"F#\"\n * [\"C\", \"D\", \"E\", \"F\", \"G\"].map(pc => transpose(pc, \"M3)) // => [\"E\", \"F#\", \"G#\", \"A\", \"B\"]\n */\nexport function transpose(\n noteName: NoteLiteral,\n intervalName: IntervalLiteral\n): NoteName {\n const note = asNote(noteName);\n const interval = asInterval(intervalName);\n if (note.empty || interval.empty) {\n return \"\";\n }\n const noteCoord = note.coord;\n const intervalCoord = interval.coord;\n const tr: PitchCoordinates =\n noteCoord.length === 1\n ? [noteCoord[0] + intervalCoord[0]]\n : [noteCoord[0] + intervalCoord[0], noteCoord[1] + intervalCoord[1]];\n return coordToNote(tr).name;\n}\n\n/**\n * Find the interval distance between two notes or coord classes.\n *\n * To find distance between coord classes, both notes must be coord classes and\n * the interval is always ascending\n *\n * @param {Note|string} from - the note or note name to calculate distance from\n * @param {Note|string} to - the note or note name to calculate distance to\n * @return {string} the interval name or empty string if not valid notes\n *\n */\nexport function distance(\n fromNote: NoteLiteral,\n toNote: NoteLiteral\n): IntervalName {\n const from = asNote(fromNote);\n const to = asNote(toNote);\n if (from.empty || to.empty) {\n return \"\";\n }\n\n const fcoord = from.coord;\n const tcoord = to.coord;\n const fifths = tcoord[0] - fcoord[0];\n const octs =\n fcoord.length === 2 && tcoord.length === 2\n ? tcoord[1] - fcoord[1]\n : -Math.floor((fifths * 7) / 12);\n\n // If it's unison and not pitch class, it can be descending interval (#243)\n const forceDescending =\n to.height === from.height &&\n to.midi !== null &&\n from.midi !== null &&\n from.step > to.step;\n return coordToInterval([fifths, octs], forceDescending).name;\n}\n", "import { distance as dist, note, transpose as tr } from \"@tonaljs/core\";\n\nconst fillStr = (character: string, times: number) =>\n Array(times + 1).join(character);\n\nconst REGEX = /^(_{1,}|=|\\^{1,}|)([abcdefgABCDEFG])([,']*)$/;\n\ntype AbcTokens = [string, string, string];\n\nexport function tokenize(str: string): AbcTokens {\n const m = REGEX.exec(str);\n if (!m) {\n return [\"\", \"\", \"\"];\n }\n return [m[1], m[2], m[3]];\n}\n\n/**\n * Convert a (string) note in ABC notation into a (string) note in scientific notation\n *\n * @example\n * abcToScientificNotation(\"c\") // => \"C5\"\n */\nexport function abcToScientificNotation(str: string): string {\n const [acc, letter, oct] = tokenize(str);\n if (letter === \"\") {\n return \"\";\n }\n let o = 4;\n for (let i = 0; i < oct.length; i++) {\n o += oct.charAt(i) === \",\" ? -1 : 1;\n }\n const a =\n acc[0] === \"_\"\n ? acc.replace(/_/g, \"b\")\n : acc[0] === \"^\"\n ? acc.replace(/\\^/g, \"#\")\n : \"\";\n return letter.charCodeAt(0) > 96\n ? letter.toUpperCase() + a + (o + 1)\n : letter + a + o;\n}\n\n/**\n * Convert a (string) note in scientific notation into a (string) note in ABC notation\n *\n * @example\n * scientificToAbcNotation(\"C#4\") // => \"^C\"\n */\nexport function scientificToAbcNotation(str: string): string {\n const n = note(str);\n if (n.empty || (!n.oct && n.oct !== 0)) {\n return \"\";\n }\n const { letter, acc, oct } = n;\n const a = acc[0] === \"b\" ? acc.replace(/b/g, \"_\") : acc.replace(/#/g, \"^\");\n const l = oct > 4 ? letter.toLowerCase() : letter;\n const o =\n oct === 5 ? \"\" : oct > 4 ? fillStr(\"'\", oct - 5) : fillStr(\",\", 4 - oct);\n return a + l + o;\n}\n\nexport function transpose(note: string, interval: string): string {\n return scientificToAbcNotation(tr(abcToScientificNotation(note), interval));\n}\n\nexport function distance(from: string, to: string): string {\n return dist(abcToScientificNotation(from), abcToScientificNotation(to));\n}\n\nexport default {\n abcToScientificNotation,\n scientificToAbcNotation,\n tokenize,\n transpose,\n distance,\n};\n", "import { note, Note } from \"@tonaljs/core\";\n\nconst isArray = Array.isArray;\n\n// ascending range\nfunction ascR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = n + b);\n return a;\n}\n// descending range\nfunction descR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = b - n);\n return a;\n}\n\n/**\n * Creates a numeric range\n *\n * @param {number} from\n * @param {number} to\n * @return {Array<number>}\n *\n * @example\n * range(-2, 2) // => [-2, -1, 0, 1, 2]\n * range(2, -2) // => [2, 1, 0, -1, -2]\n */\nexport function range(from: number, to: number): number[] {\n return from < to ? ascR(from, to - from + 1) : descR(from, from - to + 1);\n}\n\n/**\n * Rotates a list a number of times. It\"s completly agnostic about the\n * contents of the list.\n *\n * @param {Integer} times - the number of rotations\n * @param {Array} array\n * @return {Array} the rotated array\n *\n * @example\n * rotate(1, [1, 2, 3]) // => [2, 3, 1]\n */\nexport function rotate<T>(times: number, arr: T[]): T[] {\n const len = arr.length;\n const n = ((times % len) + len) % len;\n return arr.slice(n, len).concat(arr.slice(0, n));\n}\n\n/**\n * Return a copy of the array with the null values removed\n * @function\n * @param {Array} array\n * @return {Array}\n *\n * @example\n * compact([\"a\", \"b\", null, \"c\"]) // => [\"a\", \"b\", \"c\"]\n */\nexport function compact(arr: any[]): any[] {\n return arr.filter((n) => n === 0 || n);\n}\n\n/**\n * Sort an array of notes in ascending order. Pitch classes are listed\n * before notes. Any string that is not a note is removed.\n *\n * @param {string[]} notes\n * @return {string[]} sorted array of notes\n *\n * @example\n * sortedNoteNames(['c2', 'c5', 'c1', 'c0', 'c6', 'c'])\n * // => ['C', 'C0', 'C1', 'C2', 'C5', 'C6']\n * sortedNoteNames(['c', 'F', 'G', 'a', 'b', 'h', 'J'])\n * // => ['C', 'F', 'G', 'A', 'B']\n */\nexport function sortedNoteNames(notes: string[]): string[] {\n const valid = notes.map((n) => note(n)).filter((n) => !n.empty) as Note[];\n return valid.sort((a, b) => a.height - b.height).map((n) => n.name);\n}\n\n/**\n * Get sorted notes with duplicates removed. Pitch classes are listed\n * before notes.\n *\n * @function\n * @param {string[]} array\n * @return {string[]} unique sorted notes\n *\n * @example\n * Array.sortedUniqNoteNames(['a', 'b', 'c2', '1p', 'p2', 'c2', 'b', 'c', 'c3' ])\n * // => [ 'C', 'A', 'B', 'C2', 'C3' ]\n */\nexport function sortedUniqNoteNames(arr: string[]): string[] {\n return sortedNoteNames(arr).filter((n, i, a) => i === 0 || n !== a[i - 1]);\n}\n\n/**\n * Randomizes the order of the specified array in-place, using the Fisher\u2013Yates shuffle.\n *\n * @function\n * @param {Array} array\n * @return {Array} the array shuffled\n *\n * @example\n * shuffle([\"C\", \"D\", \"E\", \"F\"]) // => [...]\n */\nexport function shuffle(arr: any[], rnd = Math.random): any[] {\n let i: number;\n let t: any;\n let m: number = arr.length;\n while (m) {\n i = Math.floor(rnd() * m--);\n t = arr[m];\n arr[m] = arr[i];\n arr[i] = t;\n }\n return arr;\n}\n\n/**\n * Get all permutations of an array\n *\n * @param {Array} array - the array\n * @return {Array<Array>} an array with all the permutations\n * @example\n * permutations([\"a\", \"b\", \"c\"])) // =>\n * [\n * [\"a\", \"b\", \"c\"],\n * [\"b\", \"a\", \"c\"],\n * [\"b\", \"c\", \"a\"],\n * [\"a\", \"c\", \"b\"],\n * [\"c\", \"a\", \"b\"],\n * [\"c\", \"b\", \"a\"]\n * ]\n */\nexport function permutations(arr: any[]): any[] {\n if (arr.length === 0) {\n return [[]];\n }\n return permutations(arr.slice(1)).reduce((acc, perm) => {\n return acc.concat(\n arr.map((e, pos) => {\n const newPerm = perm.slice();\n newPerm.splice(pos, 0, arr[0]);\n return newPerm;\n })\n );\n }, []);\n}\n", "// ascending range\nfunction ascR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = n + b);\n return a;\n}\n// descending range\nfunction descR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = b - n);\n return a;\n}\n\n/**\n * Creates a numeric range\n *\n * @param {number} from\n * @param {number} to\n * @return {Array<number>}\n *\n * @example\n * range(-2, 2) // => [-2, -1, 0, 1, 2]\n * range(2, -2) // => [2, 1, 0, -1, -2]\n */\nexport function range(from: number, to: number): number[] {\n return from < to ? ascR(from, to - from + 1) : descR(from, from - to + 1);\n}\n\n/**\n * Rotates a list a number of times. It\"s completly agnostic about the\n * contents of the list.\n *\n * @param {Integer} times - the number of rotations\n * @param {Array} collection\n * @return {Array} the rotated collection\n *\n * @example\n * rotate(1, [1, 2, 3]) // => [2, 3, 1]\n */\nexport function rotate<T>(times: number, arr: T[]): T[] {\n const len = arr.length;\n const n = ((times % len) + len) % len;\n return arr.slice(n, len).concat(arr.slice(0, n));\n}\n\n/**\n * Return a copy of the collection with the null values removed\n * @function\n * @param {Array} collection\n * @return {Array}\n *\n * @example\n * compact([\"a\", \"b\", null, \"c\"]) // => [\"a\", \"b\", \"c\"]\n */\nexport function compact(arr: any[]): any[] {\n return arr.filter((n) => n === 0 || n);\n}\n\n/**\n * Randomizes the order of the specified collection in-place, using the Fisher\u2013Yates shuffle.\n *\n * @function\n * @param {Array} collection\n * @return {Array} the collection shuffled\n *\n * @example\n * shuffle([\"C\", \"D\", \"E\", \"F\"]) // => [...]\n */\nexport function shuffle(arr: any[], rnd = Math.random): any[] {\n let i: number;\n let t: any;\n let m: number = arr.length;\n while (m) {\n i = Math.floor(rnd() * m--);\n t = arr[m];\n arr[m] = arr[i];\n arr[i] = t;\n }\n return arr;\n}\n\n/**\n * Get all permutations of an collection\n *\n * @param {Array} collection - the collection\n * @return {Array<Array>} an collection with all the permutations\n * @example\n * permutations([\"a\", \"b\", \"c\"])) // =>\n * [\n * [\"a\", \"b\", \"c\"],\n * [\"b\", \"a\", \"c\"],\n * [\"b\", \"c\", \"a\"],\n * [\"a\", \"c\", \"b\"],\n * [\"c\", \"a\", \"b\"],\n * [\"c\", \"b\", \"a\"]\n * ]\n */\nexport function permutations(arr: any[]): any[] {\n if (arr.length === 0) {\n return [[]];\n }\n return permutations(arr.slice(1)).reduce((acc, perm) => {\n return acc.concat(\n arr.map((e, pos) => {\n const newPerm = perm.slice();\n newPerm.splice(pos, 0, arr[0]);\n return newPerm;\n })\n );\n }, []);\n}\n\nexport default {\n compact,\n permutations,\n range,\n rotate,\n shuffle,\n};\n", "import { compact, range, rotate } from \"@tonaljs/collection\";\nimport {\n deprecate,\n Interval,\n interval,\n IntervalName,\n Named,\n note,\n Note,\n NoteName,\n NotFound,\n} from \"@tonaljs/core\";\n\n/**\n * The properties of a pitch class set\n * @param {number} num - a number between 1 and 4095 (both included) that\n * uniquely identifies the set. It's the decimal number of the chrom.\n * @param {string} chroma - a string representation of the set: a 12-char string\n * with either \"1\" or \"0\" as characters, representing a pitch class or not\n * for the given position in the octave. For example, a \"1\" at index 0 means 'C',\n * a \"1\" at index 2 means 'D', and so on...\n * @param {string} normalized - the chroma but shifted to the first 1\n * @param {number} length - the number of notes of the pitch class set\n * @param {IntervalName[]} intervals - the intervals of the pitch class set\n * *starting from C*\n */\nexport interface Pcset extends Named {\n readonly empty: boolean;\n readonly setNum: number;\n readonly chroma: PcsetChroma;\n readonly normalized: PcsetChroma;\n readonly intervals: IntervalName[];\n}\n\nexport const EmptyPcset: Pcset = {\n empty: true,\n name: \"\",\n setNum: 0,\n chroma: \"000000000000\",\n normalized: \"000000000000\",\n intervals: [],\n};\n\nexport type PcsetChroma = string;\nexport type PcsetNum = number;\n\n// UTILITIES\nconst setNumToChroma = (num: number): string => Number(num).toString(2);\nconst chromaToNumber = (chroma: string): number => parseInt(chroma, 2);\nconst REGEX = /^[01]{12}$/;\nfunction isChroma(set: any): set is PcsetChroma {\n return REGEX.test(set);\n}\nconst isPcsetNum = (set: any): set is PcsetNum =>\n typeof set === \"number\" && set >= 0 && set <= 4095;\nconst isPcset = (set: any): set is Pcset => set && isChroma(set.chroma);\n\nconst cache: { [key in string]: Pcset } = { [EmptyPcset.chroma]: EmptyPcset };\n\n/**\n * A definition of a pitch class set. It could be:\n * - The pitch class set chroma (a 12-length string with only 1s or 0s)\n * - The pitch class set number (an integer between 1 and 4095)\n * - An array of note names\n * - An array of interval names\n */\nexport type Set =\n | Partial<Pcset>\n | PcsetChroma\n | PcsetNum\n | NoteName[]\n | IntervalName[];\n\n/**\n * Get the pitch class set of a collection of notes or set number or chroma\n */\nexport function get(src: Set): Pcset {\n const chroma: PcsetChroma = isChroma(src)\n ? src\n : isPcsetNum(src)\n ? setNumToChroma(src)\n : Array.isArray(src)\n ? listToChroma(src)\n : isPcset(src)\n ? src.chroma\n : EmptyPcset.chroma;\n\n return (cache[chroma] = cache[chroma] || chromaToPcset(chroma));\n}\n\n/**\n * Use Pcset.properties\n * @function\n * @deprecated\n */\nexport const pcset = deprecate(\"Pcset.pcset\", \"Pcset.get\", get);\n\n/**\n * Get pitch class set chroma\n * @function\n * @example\n * Pcset.chroma([\"c\", \"d\", \"e\"]); //=> \"101010000000\"\n */\nconst chroma = (set: Set) => get(set).chroma;\n\n/**\n * Get intervals (from C) of a set\n * @function\n * @example\n * Pcset.intervals([\"c\", \"d\", \"e\"]); //=>\n */\nconst intervals = (set: Set) => get(set).intervals;\n\n/**\n * Get pitch class set number\n * @function\n * @example\n * Pcset.num([\"c\", \"d\", \"e\"]); //=> 2192\n */\nconst num = (set: Set) => get(set).setNum;\n\nconst IVLS = [\n \"1P\",\n \"2m\",\n \"2M\",\n \"3m\",\n \"3M\",\n \"4P\",\n \"5d\",\n \"5P\",\n \"6m\",\n \"6M\",\n \"7m\",\n \"7M\",\n];\n\n/**\n * @private\n * Get the intervals of a pcset *starting from C*\n * @param {Set} set - the pitch class set\n * @return {IntervalName[]} an array of interval names or an empty array\n * if not a valid pitch class set\n */\nexport function chromaToIntervals(chroma: PcsetChroma): IntervalName[] {\n const intervals = [];\n for (let i = 0; i < 12; i++) {\n // tslint:disable-next-line:curly\n if (chroma.charAt(i) === \"1\") intervals.push(IVLS[i]);\n }\n return intervals;\n}\n\n/**\n * Get a list of all possible pitch class sets (all possible chromas) *having\n * C as root*. There are 2048 different chromas. If you want them with another\n * note you have to transpose it\n *\n * @see http://allthescales.org/\n * @return {Array<PcsetChroma>} an array of possible chromas from '10000000000' to '11111111111'\n */\nexport function chromas(): PcsetChroma[] {\n return range(2048, 4095).map(setNumToChroma);\n}\n\n/**\n * Given a a list of notes or a pcset chroma, produce the rotations\n * of the chroma discarding the ones that starts with \"0\"\n *\n * This is used, for example, to get all the modes of a scale.\n *\n * @param {Array|string} set - the list of notes or pitchChr of the set\n * @param {boolean} normalize - (Optional, true by default) remove all\n * the rotations that starts with \"0\"\n * @return {Array<string>} an array with all the modes of the chroma\n *\n * @example\n * Pcset.modes([\"C\", \"D\", \"E\"]).map(Pcset.intervals)\n */\nexport function modes(set: Set, normalize = true): PcsetChroma[] {\n const pcs = get(set);\n\n const binary = pcs.chroma.split(\"\");\n return compact(\n binary.map((_, i) => {\n const r = rotate(i, binary);\n return normalize && r[0] === \"0\" ? null : r.join(\"\");\n })\n );\n}\n\n/**\n * Test if two pitch class sets are numentical\n *\n * @param {Array|string} set1 - one of the pitch class sets\n * @param {Array|string} set2 - the other pitch class set\n * @return {boolean} true if they are equal\n * @example\n * Pcset.isEqual([\"c2\", \"d3\"], [\"c5\", \"d2\"]) // => true\n */\nexport function isEqual(s1: Set, s2: Set) {\n return get(s1).setNum === get(s2).setNum;\n}\n\n/**\n * Create a function that test if a collection of notes is a\n * subset of a given set\n *\n * The function is curryfied.\n *\n * @param {PcsetChroma|NoteName[]} set - the superset to test against (chroma or\n * list of notes)\n * @return{function(PcsetChroma|NoteNames[]): boolean} a function accepting a set\n * to test against (chroma or list of notes)\n * @example\n * const inCMajor = Pcset.isSubsetOf([\"C\", \"E\", \"G\"])\n * inCMajor([\"e6\", \"c4\"]) // => true\n * inCMajor([\"e6\", \"c4\", \"d3\"]) // => false\n */\nexport function isSubsetOf(set: Set) {\n const s = get(set).setNum;\n\n return (notes: Set | Pcset) => {\n const o = get(notes).setNum;\n // tslint:disable-next-line: no-bitwise\n return s && s !== o && (o & s) === o;\n };\n}\n\n/**\n * Create a function that test if a collection of notes is a\n * superset of a given set (it contains all notes and at least one more)\n *\n * @param {Set} set - an array of notes or a chroma set string to test against\n * @return {(subset: Set): boolean} a function that given a set\n * returns true if is a subset of the first one\n * @example\n * const extendsCMajor = Pcset.isSupersetOf([\"C\", \"E\", \"G\"])\n * extendsCMajor([\"e6\", \"a\", \"c4\", \"g2\"]) // => true\n * extendsCMajor([\"c6\", \"e4\", \"g3\"]) // => false\n */\nexport function isSupersetOf(set: Set) {\n const s = get(set).setNum;\n return (notes: Set) => {\n const o = get(notes).setNum;\n // tslint:disable-next-line: no-bitwise\n return s && s !== o && (o | s) === o;\n };\n}\n\n/**\n * Test if a given pitch class set includes a note\n *\n * @param {Array<string>} set - the base set to test against\n * @param {string} note - the note to test\n * @return {boolean} true if the note is included in the pcset\n *\n * Can be partially applied\n *\n * @example\n * const isNoteInCMajor = isNoteIncludedIn(['C', 'E', 'G'])\n * isNoteInCMajor('C4') // => true\n * isNoteInCMajor('C#4') // => false\n */\nexport function isNoteIncludedIn(set: Set) {\n const s = get(set);\n\n return (noteName: NoteName): boolean => {\n const n = note(noteName);\n return s && !n.empty && s.chroma.charAt(n.chroma) === \"1\";\n };\n}\n\n/** @deprecated use: isNoteIncludedIn */\nexport const includes = isNoteIncludedIn;\n\n/**\n * Filter a list with a pitch class set\n *\n * @param {Array|string} set - the pitch class set notes\n * @param {Array|string} notes - the note list to be filtered\n * @return {Array} the filtered notes\n *\n * @example\n * Pcset.filter([\"C\", \"D\", \"E\"], [\"c2\", \"c#2\", \"d2\", \"c3\", \"c#3\", \"d3\"]) // => [ \"c2\", \"d2\", \"c3\", \"d3\" ])\n * Pcset.filter([\"C2\"], [\"c2\", \"c#2\", \"d2\", \"c3\", \"c#3\", \"d3\"]) // => [ \"c2\", \"c3\" ])\n */\nexport function filter(set: Set) {\n const isIncluded = isNoteIncludedIn(set);\n return (notes: NoteName[]) => {\n return notes.filter(isIncluded);\n };\n}\n\nexport default {\n get,\n chroma,\n num,\n intervals,\n chromas,\n isSupersetOf,\n isSubsetOf,\n isNoteIncludedIn,\n isEqual,\n filter,\n modes,\n // deprecated\n pcset,\n};\n\n//// PRIVATE ////\n\nfunction chromaRotations(chroma: string): string[] {\n const binary = chroma.split(\"\");\n return binary.map((_, i) => rotate(i, binary).join(\"\"));\n}\n\nfunction chromaToPcset(chroma: PcsetChroma): Pcset {\n const setNum = chromaToNumber(chroma);\n const normalizedNum = chromaRotations(chroma)\n .map(chromaToNumber)\n .filter((n) => n >= 2048)\n .sort()[0];\n const normalized = setNumToChroma(normalizedNum);\n\n const intervals = chromaToIntervals(chroma);\n\n return {\n empty: false,\n name: \"\",\n setNum,\n chroma,\n normalized,\n intervals,\n };\n}\n\nfunction listToChroma(set: any[]): PcsetChroma {\n if (set.length === 0) {\n return EmptyPcset.chroma;\n }\n\n let pitch: Note | Interval | NotFound;\n const binary = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n // tslint:disable-next-line:prefer-for-of\n for (let i = 0; i < set.length; i++) {\n pitch = note(set[i]);\n // tslint:disable-next-line: curly\n if (pitch.empty) pitch = interval(set[i]);\n // tslint:disable-next-line: curly\n if (!pitch.empty) binary[pitch.chroma] = 1;\n }\n return binary.join(\"\");\n}\n", "import { deprecate } from \"@tonaljs/core\";\nimport {\n EmptyPcset,\n get as pcset,\n Pcset,\n PcsetChroma,\n PcsetNum,\n} from \"@tonaljs/pcset\";\nimport data from \"./data\";\n\nexport type ChordQuality =\n | \"Major\"\n | \"Minor\"\n | \"Augmented\"\n | \"Diminished\"\n | \"Unknown\";\n\nexport interface ChordType extends Pcset {\n name: string;\n quality: ChordQuality;\n aliases: string[];\n}\nconst NoChordType: ChordType = {\n ...EmptyPcset,\n name: \"\",\n quality: \"Unknown\",\n intervals: [],\n aliases: [],\n};\n\ntype ChordTypeName = string | PcsetChroma | PcsetNum;\n\nlet dictionary: ChordType[] = [];\nlet index: Record<ChordTypeName, ChordType> = {};\n\n/**\n * Given a chord name or chroma, return the chord properties\n * @param {string} source - chord name or pitch class set chroma\n * @example\n * import { get } from 'tonaljs/chord-type'\n * get('major') // => { name: 'major', ... }\n */\nexport function get(type: ChordTypeName): ChordType {\n return index[type] || NoChordType;\n}\n\nexport const chordType = deprecate(\"ChordType.chordType\", \"ChordType.get\", get);\n\n/**\n * Get all chord (long) names\n */\nexport function names() {\n return dictionary.map((chord) => chord.name).filter((x) => x);\n}\n\n/**\n * Get all chord symbols\n */\nexport function symbols() {\n return dictionary.map((chord) => chord.aliases[0]).filter((x) => x);\n}\n\n/**\n * Keys used to reference chord types\n */\nexport function keys() {\n return Object.keys(index);\n}\n\n/**\n * Return a list of all chord types\n */\nexport function all(): ChordType[] {\n return dictionary.slice();\n}\n\nexport const entries = deprecate(\"ChordType.entries\", \"ChordType.all\", all);\n\n/**\n * Clear the dictionary\n */\nexport function removeAll() {\n dictionary = [];\n index = {};\n}\n\n/**\n * Add a chord to the dictionary.\n * @param intervals\n * @param aliases\n * @param [fullName]\n */\nexport function add(intervals: string[], aliases: string[], fullName?: string) {\n const quality = getQuality(intervals);\n const chord = {\n ...pcset(intervals),\n name: fullName || \"\",\n quality,\n intervals,\n aliases,\n };\n dictionary.push(chord);\n if (chord.name) {\n index[chord.name] = chord;\n }\n index[chord.setNum] = chord;\n index[chord.chroma] = chord;\n chord.aliases.forEach((alias) => addAlias(chord, alias));\n}\n\nexport function addAlias(chord: ChordType, alias: string) {\n index[alias] = chord;\n}\n\nfunction getQuality(intervals: string[]): ChordQuality {\n const has = (interval: string) => intervals.indexOf(interval) !== -1;\n return has(\"5A\")\n ? \"Augmented\"\n : has(\"3M\")\n ? \"Major\"\n : has(\"5d\")\n ? \"Diminished\"\n : has(\"3m\")\n ? \"Minor\"\n : \"Unknown\";\n}\n\ndata.forEach(([ivls, fullName, names]: string[]) =>\n add(ivls.split(\" \"), names.split(\" \"), fullName)\n);\ndictionary.sort((a, b) => a.setNum - b.setNum);\n\nexport default {\n names,\n symbols,\n get,\n all,\n add,\n removeAll,\n keys,\n // deprecated\n entries,\n chordType,\n};\n", "/**\n * @private\n * Chord List\n * Source: https://en.wikibooks.org/wiki/Music_Theory/Complete_List_of_Chord_Patterns\n * Format: [\"intervals\", \"full name\", \"abrv1 abrv2\"]\n */\nconst CHORDS: string[][] = [\n // ==Major==\n [\"1P 3M 5P\", \"major\", \"M ^ maj\"],\n [\"1P 3M 5P 7M\", \"major seventh\", \"maj7 \u0394 ma7 M7 Maj7 ^7\"],\n [\"1P 3M 5P 7M 9M\", \"major ninth\", \"maj9 \u03949 ^9\"],\n [\"1P 3M 5P 7M 9M 13M\", \"major thirteenth\", \"maj13 Maj13 ^13\"],\n [\"1P 3M 5P 6M\", \"sixth\", \"6 add6 add13 M6\"],\n [\"1P 3M 5P 6M 9M\", \"sixth/ninth\", \"6/9 69 M69\"],\n [\"1P 3M 6m 7M\", \"major seventh flat sixth\", \"M7b6 ^7b6\"],\n [\n \"1P 3M 5P 7M 11A\",\n \"major seventh sharp eleventh\",\n \"maj#4 \u0394#4 \u0394#11 M7#11 ^7#11 maj7#11\",\n ],\n // ==Minor==\n // '''Normal'''\n [\"1P 3m 5P\", \"minor\", \"m min -\"],\n [\"1P 3m 5P 7m\", \"minor seventh\", \"m7 min7 mi7 -7\"],\n [\n \"1P 3m 5P 7M\",\n \"minor/major seventh\",\n \"m/ma7 m/maj7 mM7 mMaj7 m/M7 -\u03947 m\u0394 -^7\",\n ],\n [\"1P 3m 5P 6M\", \"minor sixth\", \"m6 -6\"],\n [\"1P 3m 5P 7m 9M\", \"minor ninth\", \"m9 -9\"],\n [\"1P 3m 5P 7M 9M\", \"minor/major ninth\", \"mM9 mMaj9 -^9\"],\n [\"1P 3m 5P 7m 9M 11P\", \"minor eleventh\", \"m11 -11\"],\n [\"1P 3m 5P 7m 9M 13M\", \"minor thirteenth\", \"m13 -13\"],\n // '''Diminished'''\n [\"1P 3m 5d\", \"diminished\", \"dim \u00B0 o\"],\n [\"1P 3m 5d 7d\", \"diminished seventh\", \"dim7 \u00B07 o7\"],\n [\"1P 3m 5d 7m\", \"half-diminished\", \"m7b5 \u00F8 -7b5 h7 h\"],\n // ==Dominant/Seventh==\n // '''Normal'''\n [\"1P 3M 5P 7m\", \"dominant seventh\", \"7 dom\"],\n [\"1P 3M 5P 7m 9M\", \"dominant ninth\", \"9\"],\n [\"1P 3M 5P 7m 9M 13M\", \"dominant thirteenth\", \"13\"],\n [\"1P 3M 5P 7m 11A\", \"lydian dominant seventh\", \"7#11 7#4\"],\n // '''Altered'''\n [\"1P 3M 5P 7m 9m\", \"dominant flat ninth\", \"7b9\"],\n [\"1P 3M 5P 7m 9A\", \"dominant sharp ninth\", \"7#9\"],\n [\"1P 3M 7m 9m\", \"altered\", \"alt7\"],\n // '''Suspended'''\n [\"1P 4P 5P\", \"suspended fourth\", \"sus4 sus\"],\n [\"1P 2M 5P\", \"suspended second\", \"sus2\"],\n [\"1P 4P 5P 7m\", \"suspended fourth seventh\", \"7sus4 7sus\"],\n [\"1P 5P 7m 9M 11P\", \"eleventh\", \"11\"],\n [\n \"1P 4P 5P 7m 9m\",\n \"suspended fourth flat ninth\",\n \"b9sus phryg 7b9sus 7b9sus4\",\n ],\n // ==Other==\n [\"1P 5P\", \"fifth\", \"5\"],\n [\"1P 3M 5A\", \"augmented\", \"aug + +5 ^#5\"],\n [\"1P 3m 5A\", \"minor augmented\", \"m#5 -#5 m+\"],\n [\"1P 3M 5A 7M\", \"augmented seventh\", \"maj7#5 maj7+5 +maj7 ^7#5\"],\n [\n \"1P 3M 5P 7M 9M 11A\",\n \"major sharp eleventh (lydian)\",\n \"maj9#11 \u03949#11 ^9#11\",\n ],\n // ==Legacy==\n [\"1P 2M 4P 5P\", \"\", \"sus24 sus4add9\"],\n [\"1P 3M 5A 7M 9M\", \"\", \"maj9#5 Maj9#5\"],\n [\"1P 3M 5A 7m\", \"\", \"7#5 +7 7+ 7aug aug7\"],\n [\"1P 3M 5A 7m 9A\", \"\", \"7#5#9 7#9#5 7alt\"],\n [\"1P 3M 5A 7m 9M\", \"\", \"9#5 9+\"],\n [\"1P 3M 5A 7m 9M 11A\", \"\", \"9#5#11\"],\n [\"1P 3M 5A 7m 9m\", \"\", \"7#5b9 7b9#5\"],\n [\"1P 3M 5A 7m 9m 11A\", \"\", \"7#5b9#11\"],\n [\"1P 3M 5A 9A\", \"\", \"+add#9\"],\n [\"1P 3M 5A 9M\", \"\", \"M#5add9 +add9\"],\n [\"1P 3M 5P 6M 11A\", \"\", \"M6#11 M6b5 6#11 6b5\"],\n [\"1P 3M 5P 6M 7M 9M\", \"\", \"M7add13\"],\n [\"1P 3M 5P 6M 9M 11A\", \"\", \"69#11\"],\n [\"1P 3m 5P 6M 9M\", \"\", \"m69 -69\"],\n [\"1P 3M 5P 6m 7m\", \"\", \"7b6\"],\n [\"1P 3M 5P 7M 9A 11A\", \"\", \"maj7#9#11\"],\n [\"1P 3M 5P 7M 9M 11A 13M\", \"\", \"M13#11 maj13#11 M13+4 M13#4\"],\n [\"1P 3M 5P 7M 9m\", \"\", \"M7b9\"],\n [\"1P 3M 5P 7m 11A 13m\", \"\", \"7#11b13 7b5b13\"],\n [\"1P 3M 5P 7m 13M\", \"\", \"7add6 67 7add13\"],\n [\"1P 3M 5P 7m 9A 11A\", \"\", \"7#9#11 7b5#9 7#9b5\"],\n [\"1P 3M 5P 7m 9A 11A 13M\", \"\", \"13#9#11\"],\n [\"1P 3M 5P 7m 9A 11A 13m\", \"\", \"7#9#11b13\"],\n [\"1P 3M 5P 7m 9A 13M\", \"\", \"13#9\"],\n [\"1P 3M 5P 7m 9A 13m\", \"\", \"7#9b13\"],\n [\"1P 3M 5P 7m 9M 11A\", \"\", \"9#11 9+4 9#4\"],\n [\"1P 3M 5P 7m 9M 11A 13M\", \"\", \"13#11 13+4 13#4\"],\n [\"1P 3M 5P 7m 9M 11A 13m\", \"\", \"9#11b13 9b5b13\"],\n [\"1P 3M 5P 7m 9m 11A\", \"\", \"7b9#11 7b5b9 7b9b5\"],\n [\"1P 3M 5P 7m 9m 11A 13M\", \"\", \"13b9#11\"],\n [\"1P 3M 5P 7m 9m 11A 13m\", \"\", \"7b9b13#11 7b9#11b13 7b5b9b13\"],\n [\"1P 3M 5P 7m 9m 13M\", \"\", \"13b9\"],\n [\"1P 3M 5P 7m 9m 13m\", \"\", \"7b9b13\"],\n [\"1P 3M 5P 7m 9m 9A\", \"\", \"7b9#9\"],\n [\"1P 3M 5P 9M\", \"\", \"Madd9 2 add9 add2\"],\n [\"1P 3M 5P 9m\", \"\", \"Maddb9\"],\n [\"1P 3M 5d\", \"\", \"Mb5\"],\n [\"1P 3M 5d 6M 7m 9M\", \"\", \"13b5\"],\n [\"1P 3M 5d 7M\", \"\", \"M7b5\"],\n [\"1P 3M 5d 7M 9M\", \"\", \"M9b5\"],\n [\"1P 3M 5d 7m\", \"\", \"7b5\"],\n [\"1P 3M 5d 7m 9M\", \"\", \"9b5\"],\n [\"1P 3M 7m\", \"\", \"7no5\"],\n [\"1P 3M 7m 13m\", \"\", \"7b13\"],\n [\"1P 3M 7m 9M\", \"\", \"9no5\"],\n [\"1P 3M 7m 9M 13M\", \"\", \"13no5\"],\n [\"1P 3M 7m 9M 13m\", \"\", \"9b13\"],\n [\"1P 3m 4P 5P\", \"\", \"madd4\"],\n [\"1P 3m 5P 6m 7M\", \"\", \"mMaj7b6\"],\n [\"1P 3m 5P 6m 7M 9M\", \"\", \"mMaj9b6\"],\n [\"1P 3m 5P 7m 11P\", \"\", \"m7add11 m7add4\"],\n [\"1P 3m 5P 9M\", \"\", \"madd9\"],\n [\"1P 3m 5d 6M 7M\", \"\", \"o7M7\"],\n [\"1P 3m 5d 7M\", \"\", \"oM7\"],\n [\"1P 3m 6m 7M\", \"\", \"mb6M7\"],\n [\"1P 3m 6m 7m\", \"\", \"m7#5\"],\n [\"1P 3m 6m 7m 9M\", \"\", \"m9#5\"],\n [\"1P 3m 5A 7m 9M 11P\", \"\", \"m11A\"],\n [\"1P 3m 6m 9m\", \"\", \"mb6b9\"],\n [\"1P 2M 3m 5d 7m\", \"\", \"m9b5\"],\n [\"1P 4P 5A 7M\", \"\", \"M7#5sus4\"],\n [\"1P 4P 5A 7M 9M\", \"\", \"M9#5sus4\"],\n [\"1P 4P 5A 7m\", \"\", \"7#5sus4\"],\n [\"1P 4P 5P 7M\", \"\", \"M7sus4\"],\n [\"1P 4P 5P 7M 9M\", \"\", \"M9sus4\"],\n [\"1P 4P 5P 7m 9M\", \"\", \"9sus4 9sus\"],\n [\"1P 4P 5P 7m 9M 13M\", \"\", \"13sus4 13sus\"],\n [\"1P 4P 5P 7m 9m 13m\", \"\", \"7sus4b9b13 7b9b13sus4\"],\n [\"1P 4P 7m 10m\", \"\", \"4 quartal\"],\n [\"1P 5P 7m 9m 11P\", \"\", \"11b9\"],\n];\n\nexport default CHORDS;\n", "import { all } from \"@tonaljs/chord-type\";\nimport { note } from \"@tonaljs/core\";\nimport { modes } from \"@tonaljs/pcset\";\n\ninterface FoundChord {\n readonly weight: number;\n readonly name: string;\n}\n\nconst namedSet = (notes: string[]) => {\n const pcToName = notes.reduce<Record<number, string>>((record, n) => {\n const chroma = note(n).chroma;\n if (chroma !== undefined) {\n record[chroma] = record[chroma] || note(n).name;\n }\n return record;\n }, {});\n\n return (chroma: number) => pcToName[chroma];\n};\n\nexport function detect(source: string[]): string[] {\n const notes = source.map((n) => note(n).pc).filter((x) => x);\n if (note.length === 0) {\n return [];\n }\n\n const found: FoundChord[] = findExactMatches(notes, 1);\n\n return found\n .filter((chord) => chord.weight)\n .sort((a, b) => b.weight - a.weight)\n .map((chord) => chord.name);\n}\n\nfunction findExactMatches(notes: string[], weight: number): FoundChord[] {\n const tonic = notes[0];\n const tonicChroma = note(tonic).chroma;\n const noteName = namedSet(notes);\n // we need to test all chormas to get the correct baseNote\n const allModes = modes(notes, false);\n\n const found: FoundChord[] = [];\n allModes.forEach((mode, index) => {\n // some chords could have the same chroma but different interval spelling\n const chordTypes = all().filter((chordType) => chordType.chroma === mode);\n\n chordTypes.forEach((chordType) => {\n const chordName = chordType.aliases[0];\n const baseNote = noteName(index);\n const isInversion = index !== tonicChroma;\n if (isInversion) {\n found.push({\n weight: 0.5 * weight,\n name: `${baseNote}${chordName}/${tonic}`,\n });\n } else {\n found.push({ weight: 1 * weight, name: `${baseNote}${chordName}` });\n }\n });\n });\n\n return found;\n}\n\nexport default { detect };\n", "import { deprecate } from \"@tonaljs/core\";\nimport {\n EmptyPcset,\n get as pcset,\n Pcset,\n PcsetChroma,\n PcsetNum,\n} from \"@tonaljs/pcset\";\nimport data from \"./data\";\n\n/**\n * Properties for a scale in the scale dictionary. It's a pitch class set\n * properties with the following additional information:\n * - name: the scale name\n * - aliases: alternative list of names\n * - intervals: an array of interval names\n */\nexport interface ScaleType extends Pcset {\n readonly name: string;\n readonly aliases: string[];\n}\n\nexport const NoScaleType: ScaleType = {\n ...EmptyPcset,\n intervals: [],\n aliases: [],\n};\n\ntype ScaleTypeName = string | PcsetChroma | PcsetNum;\n\nlet dictionary: ScaleType[] = [];\nlet index: Record<ScaleTypeName, ScaleType> = {};\n\nexport function names() {\n return dictionary.map((scale) => scale.name);\n}\n\n/**\n * Given a scale name or chroma, return the scale properties\n *\n * @param {string} type - scale name or pitch class set chroma\n * @example\n * import { get } from 'tonaljs/scale-type'\n * get('major') // => { name: 'major', ... }\n */\nexport function get(type: ScaleTypeName): ScaleType {\n return index[type] || NoScaleType;\n}\n\nexport const scaleType = deprecate(\n \"ScaleDictionary.scaleType\",\n \"ScaleType.get\",\n get\n);\n\n/**\n * Return a list of all scale types\n */\nexport function all() {\n return dictionary.slice();\n}\n\nexport const entries = deprecate(\n \"ScaleDictionary.entries\",\n \"ScaleType.all\",\n all\n);\n\n/**\n * Keys used to reference scale types\n */\nexport function keys() {\n return Object.keys(index);\n}\n\n/**\n * Clear the dictionary\n */\nexport function removeAll() {\n dictionary = [];\n index = {};\n}\n\n/**\n * Add a scale into dictionary\n * @param intervals\n * @param name\n * @param aliases\n */\nexport function add(\n intervals: string[],\n name: string,\n aliases: string[] = []\n): ScaleType {\n const scale = { ...pcset(intervals), name, intervals, aliases };\n dictionary.push(scale);\n index[scale.name] = scale;\n index[scale.setNum] = scale;\n index[scale.chroma] = scale;\n scale.aliases.forEach((alias) => addAlias(scale, alias));\n return scale;\n}\n\nexport function addAlias(scale: ScaleType, alias: string) {\n index[alias] = scale;\n}\n\ndata.forEach(([ivls, name, ...aliases]: string[]) =>\n add(ivls.split(\" \"), name, aliases)\n);\n\nexport default {\n names,\n get,\n all,\n add,\n removeAll,\n keys,\n\n // deprecated\n entries,\n scaleType,\n};\n", "// SCALES\n// Format: [\"intervals\", \"name\", \"alias1\", \"alias2\", ...]\nconst SCALES: string[][] = [\n // 5-note scales\n [\"1P 2M 3M 5P 6M\", \"major pentatonic\", \"pentatonic\"],\n [\"1P 3M 4P 5P 7M\", \"ionian pentatonic\"],\n [\"1P 3M 4P 5P 7m\", \"mixolydian pentatonic\", \"indian\"],\n [\"1P 2M 4P 5P 6M\", \"ritusen\"],\n [\"1P 2M 4P 5P 7m\", \"egyptian\"],\n [\"1P 3M 4P 5d 7m\", \"neopolitan major pentatonic\"],\n [\"1P 3m 4P 5P 6m\", \"vietnamese 1\"],\n [\"1P 2m 3m 5P 6m\", \"pelog\"],\n [\"1P 2m 4P 5P 6m\", \"kumoijoshi\"],\n [\"1P 2M 3m 5P 6m\", \"hirajoshi\"],\n [\"1P 2m 4P 5d 7m\", \"iwato\"],\n [\"1P 2m 4P 5P 7m\", \"in-sen\"],\n [\"1P 3M 4A 5P 7M\", \"lydian pentatonic\", \"chinese\"],\n [\"1P 3m 4P 6m 7m\", \"malkos raga\"],\n [\"1P 3m 4P 5d 7m\", \"locrian pentatonic\", \"minor seven flat five pentatonic\"],\n [\"1P 3m 4P 5P 7m\", \"minor pentatonic\", \"vietnamese 2\"],\n [\"1P 3m 4P 5P 6M\", \"minor six pentatonic\"],\n [\"1P 2M 3m 5P 6M\", \"flat three pentatonic\", \"kumoi\"],\n [\"1P 2M 3M 5P 6m\", \"flat six pentatonic\"],\n [\"1P 2m 3M 5P 6M\", \"scriabin\"],\n [\"1P 3M 5d 6m 7m\", \"whole tone pentatonic\"],\n [\"1P 3M 4A 5A 7M\", \"lydian #5P pentatonic\"],\n [\"1P 3M 4A 5P 7m\", \"lydian dominant pentatonic\"],\n [\"1P 3m 4P 5P 7M\", \"minor #7M pentatonic\"],\n [\"1P 3m 4d 5d 7m\", \"super locrian pentatonic\"],\n\n // 6-note scales\n [\"1P 2M 3m 4P 5P 7M\", \"minor hexatonic\"],\n [\"1P 2A 3M 5P 5A 7M\", \"augmented\"],\n [\"1P 2M 3m 3M 5P 6M\", \"major blues\"],\n [\"1P 2M 4P 5P 6M 7m\", \"piongio\"],\n [\"1P 2m 3M 4A 6M 7m\", \"prometheus neopolitan\"],\n [\"1P 2M 3M 4A 6M 7m\", \"prometheus\"],\n [\"1P 2m 3M 5d 6m 7m\", \"mystery #1\"],\n [\"1P 2m 3M 4P 5A 6M\", \"six tone symmetric\"],\n [\"1P 2M 3M 4A 5A 6A\", \"whole tone\", \"messiaen's mode #1\"],\n [\"1P 2m 4P 4A 5P 7M\", \"messiaen's mode #5\"],\n [\"1P 3m 4P 5d 5P 7m\", \"minor blues\", \"blues\"],\n\n // 7-note scales\n [\"1P 2M 3M 4P 5d 6m 7m\", \"locrian major\", \"arabian\"],\n [\"1P 2m 3M 4A 5P 6m 7M\", \"double harmonic lydian\"],\n [\"1P 2M 3m 4P 5P 6m 7M\", \"harmonic minor\"],\n [\n \"1P 2m 2A 3M 4A 6m 7m\",\n \"altered\",\n \"super locrian\",\n \"diminished whole tone\",\n \"pomeroy\",\n ],\n [\"1P 2M 3m 4P 5d 6m 7m\", \"locrian #2\", \"half-diminished\", \"aeolian b5\"],\n [\n \"1P 2M 3M 4P 5P 6m 7m\",\n \"mixolydian b6\",\n \"melodic minor fifth mode\",\n \"hindu\",\n ],\n [\"1P 2M 3M 4A 5P 6M 7m\", \"lydian dominant\", \"lydian b7\", \"overtone\"],\n [\"1P 2M 3M 4A 5P 6M 7M\", \"lydian\"],\n [\"1P 2M 3M 4A 5A 6M 7M\", \"lydian augmented\"],\n [\n \"1P 2m 3m 4P 5P 6M 7m\",\n \"dorian b2\",\n \"phrygian #6\",\n \"melodic minor second mode\",\n ],\n [\"1P 2M 3m 4P 5P 6M 7M\", \"melodic minor\"],\n [\"1P 2m 3m 4P 5d 6m 7m\", \"locrian\"],\n [\n \"1P 2m 3m 4d 5d 6m 7d\",\n \"ultralocrian\",\n \"superlocrian bb7\",\n \"superlocrian diminished\",\n ],\n [\"1P 2m 3m 4P 5d 6M 7m\", \"locrian 6\", \"locrian natural 6\", \"locrian sharp 6\"],\n [\"1P 2A 3M 4P 5P 5A 7M\", \"augmented heptatonic\"],\n // Source https://en.wikipedia.org/wiki/Ukrainian_Dorian_scale\n [\n \"1P 2M 3m 4A 5P 6M 7m\",\n \"dorian #4\",\n \"ukrainian dorian\",\n \"romanian minor\",\n \"altered dorian\",\n ],\n [\"1P 2M 3m 4A 5P 6M 7M\", \"lydian diminished\"],\n [\"1P 2m 3m 4P 5P 6m 7m\", \"phrygian\"],\n [\"1P 2M 3M 4A 5A 7m 7M\", \"leading whole tone\"],\n [\"1P 2M 3M 4A 5P 6m 7m\", \"lydian minor\"],\n [\"1P 2m 3M 4P 5P 6m 7m\", \"phrygian dominant\", \"spanish\", \"phrygian major\"],\n [\"1P 2m 3m 4P 5P 6m 7M\", \"balinese\"],\n [\"1P 2m 3m 4P 5P 6M 7M\", \"neopolitan major\"],\n [\"1P 2M 3m 4P 5P 6m 7m\", \"aeolian\", \"minor\"],\n [\"1P 2M 3M 4P 5P 6m 7M\", \"harmonic major\"],\n [\"1P 2m 3M 4P 5P 6m 7M\", \"double harmonic major\", \"gypsy\"],\n [\"1P 2M 3m 4P 5P 6M 7m\", \"dorian\"],\n [\"1P 2M 3m 4A 5P 6m 7M\", \"hungarian minor\"],\n [\"1P 2A 3M 4A 5P 6M 7m\", \"hungarian major\"],\n [\"1P 2m 3M 4P 5d 6M 7m\", \"oriental\"],\n [\"1P 2m 3m 3M 4A 5P 7m\", \"flamenco\"],\n [\"1P 2m 3m 4A 5P 6m 7M\", \"todi raga\"],\n [\"1P 2M 3M 4P 5P 6M 7m\", \"mixolydian\", \"dominant\"],\n [\"1P 2m 3M 4P 5d 6m 7M\", \"persian\"],\n [\"1P 2M 3M 4P 5P 6M 7M\", \"major\", \"ionian\"],\n [\"1P 2m 3M 5d 6m 7m 7M\", \"enigmatic\"],\n [\n \"1P 2M 3M 4P 5A 6M 7M\",\n \"major augmented\",\n \"major #5\",\n \"ionian augmented\",\n \"ionian #5\",\n ],\n [\"1P 2A 3M 4A 5P 6M 7M\", \"lydian #9\"],\n\n // 8-note scales\n [\"1P 2m 2M 4P 4A 5P 6m 7M\", \"messiaen's mode #4\"],\n [\"1P 2m 3M 4P 4A 5P 6m 7M\", \"purvi raga\"],\n [\"1P 2m 3m 3M 4P 5P 6m 7m\", \"spanish heptatonic\"],\n [\"1P 2M 3M 4P 5P 6M 7m 7M\", \"bebop\"],\n [\"1P 2M 3m 3M 4P 5P 6M 7m\", \"bebop minor\"],\n [\"1P 2M 3M 4P 5P 5A 6M 7M\", \"bebop major\"],\n [\"1P 2m 3m 4P 5d 5P 6m 7m\", \"bebop locrian\"],\n [\"1P 2M 3m 4P 5P 6m 7m 7M\", \"minor bebop\"],\n [\"1P 2M 3m 4P 5d 6m 6M 7M\", \"diminished\", \"whole-half diminished\"],\n [\"1P 2M 3M 4P 5d 5P 6M 7M\", \"ichikosucho\"],\n [\"1P 2M 3m 4P 5P 6m 6M 7M\", \"minor six diminished\"],\n [\n \"1P 2m 3m 3M 4A 5P 6M 7m\",\n \"half-whole diminished\",\n \"dominant diminished\",\n \"messiaen's mode #2\",\n ],\n [\"1P 3m 3M 4P 5P 6M 7m 7M\", \"kafi raga\"],\n [\"1P 2M 3M 4P 4A 5A 6A 7M\", \"messiaen's mode #6\"],\n\n // 9-note scales\n [\"1P 2M 3m 3M 4P 5d 5P 6M 7m\", \"composite blues\"],\n [\"1P 2M 3m 3M 4A 5P 6m 7m 7M\", \"messiaen's mode #3\"],\n\n // 10-note scales\n [\"1P 2m 2M 3m 4P 4A 5P 6m 6M 7M\", \"messiaen's mode #7\"],\n\n // 12-note scales\n [\"1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M\", \"chromatic\"],\n];\n\nexport default SCALES;\n", "import { detect } from \"@tonaljs/chord-detect\";\nimport {\n all as chordTypes,\n ChordType,\n get as getChordType,\n} from \"@tonaljs/chord-type\";\n\nimport {\n deprecate,\n distance,\n note,\n NoteName,\n tokenizeNote,\n transpose as transposeNote,\n} from \"@tonaljs/core\";\n\nimport { isSubsetOf, isSupersetOf } from \"@tonaljs/pcset\";\n\nimport { all as scaleTypes } from \"@tonaljs/scale-type\";\nexport { detect } from \"@tonaljs/chord-detect\";\n\ntype ChordName = string;\ntype ChordNameTokens = [string, string]; // [TONIC, SCALE TYPE]\n\nexport interface Chord extends ChordType {\n tonic: string | null;\n type: string;\n root: string;\n rootDegree: number;\n symbol: string;\n notes: NoteName[];\n}\n\nconst NoChord: Chord = {\n empty: true,\n name: \"\",\n symbol: \"\",\n root: \"\",\n rootDegree: 0,\n type: \"\",\n tonic: null,\n setNum: NaN,\n quality: \"Unknown\",\n chroma: \"\",\n normalized: \"\",\n aliases: [],\n notes: [],\n intervals: [],\n};\n\n// 6, 64, 7, 9, 11 and 13 are consider part of the chord\n// (see https://github.com/danigb/tonal/issues/55)\nconst NUM_TYPES = /^(6|64|7|9|11|13)$/;\n/**\n * Tokenize a chord name. It returns an array with the tonic and chord type\n * If not tonic is found, all the name is considered the chord name.\n *\n * This function does NOT check if the chord type exists or not. It only tries\n * to split the tonic and chord type.\n *\n * @function\n * @param {string} name - the chord name\n * @return {Array} an array with [tonic, type]\n * @example\n * tokenize(\"Cmaj7\") // => [ \"C\", \"maj7\" ]\n * tokenize(\"C7\") // => [ \"C\", \"7\" ]\n * tokenize(\"mMaj7\") // => [ null, \"mMaj7\" ]\n * tokenize(\"Cnonsense\") // => [ null, \"nonsense\" ]\n */\nexport function tokenize(name: string): ChordNameTokens {\n const [letter, acc, oct, type] = tokenizeNote(name);\n if (letter === \"\") {\n return [\"\", name];\n }\n // aug is augmented (see https://github.com/danigb/tonal/issues/55)\n if (letter === \"A\" && type === \"ug\") {\n return [\"\", \"aug\"];\n }\n // see: https://github.com/tonaljs/tonal/issues/70\n if (!type && (oct === \"4\" || oct === \"5\")) {\n return [letter + acc, oct];\n }\n\n if (NUM_TYPES.test(oct)) {\n return [letter + acc, oct + type];\n } else {\n return [letter + acc + oct, type];\n }\n}\n\n/**\n * Get a Chord from a chord name.\n */\nexport function get(src: ChordName | ChordNameTokens): Chord {\n if (src === \"\") {\n return NoChord;\n }\n if (Array.isArray(src) && src.length === 2) {\n return getChord(src[1], src[0]);\n } else {\n const [tonic, type] = tokenize(src);\n const chord = getChord(type, tonic);\n return chord.empty ? getChord(src) : chord;\n }\n}\n\n/**\n * Get chord properties\n *\n * @param typeName - the chord type name\n * @param [tonic] - Optional tonic\n * @param [root] - Optional root (requires a tonic)\n */\nexport function getChord(\n typeName: string,\n optionalTonic?: string,\n optionalRoot?: string\n): Chord {\n const type = getChordType(typeName);\n const tonic = note(optionalTonic || \"\");\n const root = note(optionalRoot || \"\");\n\n if (\n type.empty ||\n (optionalTonic && tonic.empty) ||\n (optionalRoot && root.empty)\n ) {\n return NoChord;\n }\n\n const rootInterval = distance(tonic.pc, root.pc);\n const rootDegree = type.intervals.indexOf(rootInterval) + 1;\n if (!root.empty && !rootDegree) {\n return NoChord;\n }\n\n const intervals = Array.from(type.intervals);\n\n for (let i = 1; i < rootDegree; i++) {\n const num = intervals[0][0];\n const quality = intervals[0][1];\n const newNum = parseInt(num, 10) + 7;\n intervals.push(`${newNum}${quality}`);\n intervals.shift();\n }\n\n const notes = tonic.empty\n ? []\n : intervals.map((i) => transposeNote(tonic, i));\n\n typeName = type.aliases.indexOf(typeName) !== -1 ? typeName : type.aliases[0];\n const symbol = `${tonic.empty ? \"\" : tonic.pc}${typeName}${\n root.empty || rootDegree <= 1 ? \"\" : \"/\" + root.pc\n }`;\n const name = `${optionalTonic ? tonic.pc + \" \" : \"\"}${type.name}${\n rootDegree > 1 && optionalRoot ? \" over \" + root.pc : \"\"\n }`;\n return {\n ...type,\n name,\n symbol,\n type: type.name,\n root: root.name,\n intervals,\n rootDegree,\n tonic: tonic.name,\n notes,\n };\n}\n\nexport const chord = deprecate(\"Chord.chord\", \"Chord.get\", get);\n\n/**\n * Transpose a chord name\n *\n * @param {string} chordName - the chord name\n * @return {string} the transposed chord\n *\n * @example\n * transpose('Dm7', 'P4') // => 'Gm7\n */\nexport function transpose(chordName: string, interval: string): string {\n const [tonic, type] = tokenize(chordName);\n if (!tonic) {\n return chordName;\n }\n return transposeNote(tonic, interval) + type;\n}\n\n/**\n * Get all scales where the given chord fits\n *\n * @example\n * chordScales('C7b9')\n * // => [\"phrygian dominant\", \"flamenco\", \"spanish heptatonic\", \"half-whole diminished\", \"chromatic\"]\n */\nexport function chordScales(name: string): string[] {\n const s = get(name);\n const isChordIncluded = isSupersetOf(s.chroma);\n return scaleTypes()\n .filter((scale) => isChordIncluded(scale.chroma))\n .map((scale) => scale.name);\n}\n/**\n * Get all chords names that are a superset of the given one\n * (has the same notes and at least one more)\n *\n * @function\n * @example\n * extended(\"CMaj7\")\n * // => [ 'Cmaj#4', 'Cmaj7#9#11', 'Cmaj9', 'CM7add13', 'Cmaj13', 'Cmaj9#11', 'CM13#11', 'CM7b9' ]\n */\nexport function extended(chordName: string): string[] {\n const s = get(chordName);\n const isSuperset = isSupersetOf(s.chroma);\n return chordTypes()\n .filter((chord) => isSuperset(chord.chroma))\n .map((chord) => s.tonic + chord.aliases[0]);\n}\n\n/**\n * Find all chords names that are a subset of the given one\n * (has less notes but all from the given chord)\n *\n * @example\n */\nexport function reduced(chordName: string): string[] {\n const s = get(chordName);\n const isSubset = isSubsetOf(s.chroma);\n return chordTypes()\n .filter((chord) => isSubset(chord.chroma))\n .map((chord) => s.tonic + chord.aliases[0]);\n}\n\nexport default {\n getChord,\n get,\n detect,\n chordScales,\n extended,\n reduced,\n tokenize,\n transpose,\n // deprecate\n chord,\n};\n", "// source: https://en.wikipedia.org/wiki/Note_value\nconst DATA: [number, string, string[]][] = [\n [\n 0.125,\n \"dl\",\n [\"large\", \"duplex longa\", \"maxima\", \"octuple\", \"octuple whole\"],\n ],\n [0.25, \"l\", [\"long\", \"longa\"]],\n [0.5, \"d\", [\"double whole\", \"double\", \"breve\"]],\n [1, \"w\", [\"whole\", \"semibreve\"]],\n [2, \"h\", [\"half\", \"minim\"]],\n [4, \"q\", [\"quarter\", \"crotchet\"]],\n [8, \"e\", [\"eighth\", \"quaver\"]],\n [16, \"s\", [\"sixteenth\", \"semiquaver\"]],\n [32, \"t\", [\"thirty-second\", \"demisemiquaver\"]],\n [64, \"sf\", [\"sixty-fourth\", \"hemidemisemiquaver\"]],\n [128, \"h\", [\"hundred twenty-eighth\"]],\n [256, \"th\", [\"two hundred fifty-sixth\"]],\n];\n\nexport default DATA;\n", "import DATA from \"./data\";\n\ntype Fraction = [number, number];\n\nconst VALUES: DurationValue[] = [];\n\nDATA.forEach(([denominator, shorthand, names]) =>\n add(denominator, shorthand, names)\n);\n\nexport interface DurationValue {\n empty: boolean;\n value: number;\n name: string;\n fraction: Fraction;\n shorthand: string;\n dots: string;\n names: string[];\n}\n\nconst NoDuration: DurationValue = {\n empty: true,\n name: \"\",\n value: 0,\n fraction: [0, 0],\n shorthand: \"\",\n dots: \"\",\n names: [],\n};\n\nexport function names(): string[] {\n return VALUES.reduce((names, duration) => {\n duration.names.forEach((name) => names.push(name));\n return names;\n }, [] as string[]);\n}\n\nexport function shorthands(): string[] {\n return VALUES.map((dur) => dur.shorthand);\n}\n\nconst REGEX = /^([^.]+)(\\.*)$/;\n\nexport function get(name: string): DurationValue {\n const [_, simple, dots] = REGEX.exec(name) || [];\n const base = VALUES.find(\n (dur) => dur.shorthand === simple || dur.names.includes(simple)\n );\n if (!base) {\n return NoDuration;\n }\n\n const fraction = calcDots(base.fraction, dots.length);\n const value = fraction[0] / fraction[1];\n\n return { ...base, name, dots, value, fraction };\n}\n\nexport const value = (name: string) => get(name).value;\nexport const fraction = (name: string) => get(name).fraction;\n\nexport default { names, shorthands, get, value, fraction };\n\n//// PRIVATE ////\n\nfunction add(denominator: number, shorthand: string, names: string[]) {\n VALUES.push({\n empty: false,\n dots: \"\",\n name: \"\",\n value: 1 / denominator,\n fraction: denominator < 1 ? [1 / denominator, 1] : [1, denominator],\n shorthand,\n names,\n });\n}\n\nfunction calcDots(fraction: Fraction, dots: number): Fraction {\n const pow = Math.pow(2, dots);\n\n let numerator = fraction[0] * pow;\n let denominator = fraction[1] * pow;\n const base = numerator;\n\n // add fractions\n for (let i = 0; i < dots; i++) {\n numerator += base / Math.pow(2, i + 1);\n }\n\n // simplify\n while (numerator % 2 === 0 && denominator % 2 === 0) {\n numerator /= 2;\n denominator /= 2;\n }\n return [numerator, denominator];\n}\n", "import {\n coordToInterval,\n distance as dist,\n interval as props,\n IntervalCoordinates,\n IntervalName,\n NoteCoordinates,\n tokenizeInterval as tokenize,\n} from \"@tonaljs/core\";\n\n/**\n * Get the natural list of names\n */\nexport function names(): IntervalName[] {\n return \"1P 2M 3M 4P 5P 6m 7m\".split(\" \");\n}\n\n/**\n * Get properties of an interval\n *\n * @function\n * @example\n * Interval.get('P4') // => {\"alt\": 0, \"dir\": 1, \"name\": \"4P\", \"num\": 4, \"oct\": 0, \"q\": \"P\", \"semitones\": 5, \"simple\": 4, \"step\": 3, \"type\": \"perfectable\"}\n */\nexport const get = props;\n\n/**\n * Get name of an interval\n *\n * @function\n * @example\n * Interval.name('4P') // => \"4P\"\n * Interval.name('P4') // => \"4P\"\n * Interval.name('C4') // => \"\"\n */\nexport const name = (name: string) => props(name).name;\n\n/**\n * Get semitones of an interval\n * @function\n * @example\n * Interval.semitones('P4') // => 5\n */\nexport const semitones = (name: string) => props(name).semitones;\n\n/**\n * Get quality of an interval\n * @function\n * @example\n * Interval.quality('P4') // => \"P\"\n */\nexport const quality = (name: string) => props(name).q;\n\n/**\n * Get number of an interval\n * @function\n * @example\n * Interval.num('P4') // => 4\n */\nexport const num = (name: string) => props(name).num;\n\n/**\n * Get the simplified version of an interval.\n *\n * @function\n * @param {string} interval - the interval to simplify\n * @return {string} the simplified interval\n *\n * @example\n * Interval.simplify(\"9M\") // => \"2M\"\n * Interval.simplify(\"2M\") // => \"2M\"\n * Interval.simplify(\"-2M\") // => \"7m\"\n * [\"8P\", \"9M\", \"10M\", \"11P\", \"12P\", \"13M\", \"14M\", \"15P\"].map(Interval.simplify)\n * // => [ \"8P\", \"2M\", \"3M\", \"4P\", \"5P\", \"6M\", \"7M\", \"8P\" ]\n */\nexport function simplify(name: IntervalName): IntervalName {\n const i = props(name);\n return i.empty ? \"\" : i.simple + i.q;\n}\n\n/**\n * Get the inversion (https://en.wikipedia.org/wiki/Inversion_(music)#Intervals)\n * of an interval.\n *\n * @function\n * @param {string} interval - the interval to invert in interval shorthand\n * notation or interval array notation\n * @return {string} the inverted interval\n *\n * @example\n * Interval.invert(\"3m\") // => \"6M\"\n * Interval.invert(\"2M\") // => \"7m\"\n */\nexport function invert(name: IntervalName): IntervalName {\n const i = props(name);\n if (i.empty) {\n return \"\";\n }\n const step = (7 - i.step) % 7;\n const alt = i.type === \"perfectable\" ? -i.alt : -(i.alt + 1);\n return props({ step, alt, oct: i.oct, dir: i.dir }).name;\n}\n\n// interval numbers\nconst IN = [1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7];\n// interval qualities\nconst IQ = \"P m M m M P d P m M m M\".split(\" \");\n\n/**\n * Get interval name from semitones number. Since there are several interval\n * names for the same number, the name it's arbitrary, but deterministic.\n *\n * @param {Integer} num - the number of semitones (can be negative)\n * @return {string} the interval name\n * @example\n * Interval.fromSemitones(7) // => \"5P\"\n * Interval.fromSemitones(-7) // => \"-5P\"\n */\nexport function fromSemitones(semitones: number): IntervalName {\n const d = semitones < 0 ? -1 : 1;\n const n = Math.abs(semitones);\n const c = n % 12;\n const o = Math.floor(n / 12);\n return d * (IN[c] + 7 * o) + IQ[c];\n}\n\n/**\n * Find interval between two notes\n *\n * @example\n * Interval.distance(\"C4\", \"G4\"); // => \"5P\"\n */\nexport const distance = dist;\n\n/**\n * Adds two intervals\n *\n * @function\n * @param {string} interval1\n * @param {string} interval2\n * @return {string} the added interval name\n * @example\n * Interval.add(\"3m\", \"5P\") // => \"7m\"\n */\nexport const add = combinator((a, b) => [a[0] + b[0], a[1] + b[1]]);\n\n/**\n * Returns a function that adds an interval\n *\n * @function\n * @example\n * ['1P', '2M', '3M'].map(Interval.addTo('5P')) // => [\"5P\", \"6M\", \"7M\"]\n */\nexport const addTo = (interval: string) => (other: string) =>\n add(interval, other);\n\n/**\n * Subtracts two intervals\n *\n * @function\n * @param {string} minuendInterval\n * @param {string} subtrahendInterval\n * @return {string} the substracted interval name\n * @example\n * Interval.substract('5P', '3M') // => '3m'\n * Interval.substract('3M', '5P') // => '-3m'\n */\nexport const substract = combinator((a, b) => [a[0] - b[0], a[1] - b[1]]);\n\nexport function transposeFifths(\n interval: IntervalName,\n fifths: number\n): IntervalName {\n const ivl = get(interval);\n if (ivl.empty) return \"\";\n\n const [nFifths, nOcts, dir] = ivl.coord;\n return coordToInterval([nFifths + fifths, nOcts, dir]).name;\n}\n\nexport default {\n names,\n get,\n name,\n num,\n semitones,\n quality,\n fromSemitones,\n distance,\n invert,\n simplify,\n add,\n addTo,\n substract,\n transposeFifths,\n};\n\n//// PRIVATE ////\n\ntype Operation = (\n a: IntervalCoordinates,\n b: IntervalCoordinates\n) => NoteCoordinates;\n\nfunction combinator(fn: Operation) {\n return (a: IntervalName, b: IntervalName): IntervalName | undefined => {\n const coordA = props(a).coord;\n const coordB = props(b).coord;\n if (coordA && coordB) {\n const coord = fn(coordA, coordB);\n return coordToInterval(coord).name;\n }\n };\n}\n", "import { note as props, NoteName } from \"@tonaljs/core\";\n\ntype Midi = number;\n\nexport function isMidi(arg: any): arg is Midi {\n return +arg >= 0 && +arg <= 127;\n}\n\n/**\n * Get the note midi number (a number between 0 and 127)\n *\n * It returns undefined if not valid note name\n *\n * @function\n * @param {string|number} note - the note name or midi number\n * @return {Integer} the midi number or undefined if not valid note\n * @example\n * import { toMidi } from '@tonaljs/midi'\n * toMidi(\"C4\") // => 60\n * toMidi(60) // => 60\n * toMidi('60') // => 60\n */\nexport function toMidi(note: NoteName | number): number | null {\n if (isMidi(note)) {\n return +note;\n }\n const n = props(note);\n return n.empty ? null : n.midi;\n}\n\n/**\n * Get the frequency in hertzs from midi number\n *\n * @param {number} midi - the note midi number\n * @param {number} [tuning = 440] - A4 tuning frequency in Hz (440 by default)\n * @return {number} the frequency or null if not valid note midi\n * @example\n * import { midiToFreq} from '@tonaljs/midi'\n * midiToFreq(69) // => 440\n */\nexport function midiToFreq(midi: number, tuning = 440): number {\n return Math.pow(2, (midi - 69) / 12) * tuning;\n}\n\nconst L2 = Math.log(2);\nconst L440 = Math.log(440);\n\n/**\n * Get the midi number from a frequency in hertz. The midi number can\n * contain decimals (with two digits precision)\n *\n * @param {number} frequency\n * @return {number}\n * @example\n * import { freqToMidi} from '@tonaljs/midi'\n * freqToMidi(220)); //=> 57\n * freqToMidi(261.62)); //=> 60\n * freqToMidi(261)); //=> 59.96\n */\nexport function freqToMidi(freq: number): number {\n const v = (12 * (Math.log(freq) - L440)) / L2 + 69;\n return Math.round(v * 100) / 100;\n}\n\nexport interface ToNoteNameOptions {\n pitchClass?: boolean;\n sharps?: boolean;\n}\n\nconst SHARPS = \"C C# D D# E F F# G G# A A# B\".split(\" \");\nconst FLATS = \"C Db D Eb E F Gb G Ab A Bb B\".split(\" \");\n/**\n * Given a midi number, returns a note name. The altered notes will have\n * flats unless explicitly set with the optional `useSharps` parameter.\n *\n * @function\n * @param {number} midi - the midi note number\n * @param {Object} options = default: `{ sharps: false, pitchClass: false }`\n * @param {boolean} useSharps - (Optional) set to true to use sharps instead of flats\n * @return {string} the note name\n * @example\n * import { midiToNoteName } from '@tonaljs/midi'\n * midiToNoteName(61) // => \"Db4\"\n * midiToNoteName(61, { pitchClass: true }) // => \"Db\"\n * midiToNoteName(61, { sharps: true }) // => \"C#4\"\n * midiToNoteName(61, { pitchClass: true, sharps: true }) // => \"C#\"\n * // it rounds to nearest note\n * midiToNoteName(61.7) // => \"D4\"\n */\nexport function midiToNoteName(midi: number, options: ToNoteNameOptions = {}) {\n if (isNaN(midi) || midi === -Infinity || midi === Infinity) return \"\";\n midi = Math.round(midi);\n const pcs = options.sharps === true ? SHARPS : FLATS;\n const pc = pcs[midi % 12];\n if (options.pitchClass) {\n return pc;\n }\n const o = Math.floor(midi / 12) - 1;\n return pc + o;\n}\n\nexport default { isMidi, toMidi, midiToFreq, midiToNoteName, freqToMidi };\n", "import {\n coordToNote,\n IntervalName,\n Named,\n Note,\n note as props,\n NoteLiteral,\n NoteName,\n Pitch,\n transpose as _tr,\n} from \"@tonaljs/core\";\nimport { midiToNoteName, freqToMidi } from \"@tonaljs/midi\";\n\nconst NAMES = [\"C\", \"D\", \"E\", \"F\", \"G\", \"A\", \"B\"];\n\nconst toName = (n: Named) => n.name;\nconst onlyNotes = (array: any[]) =>\n array.map(props).filter((n) => !n.empty) as Note[];\n\n/**\n * Return the natural note names without octave\n * @function\n * @example\n * Note.names(); // => [\"C\", \"D\", \"E\", \"F\", \"G\", \"A\", \"B\"]\n */\nexport function names(array?: any[]): string[] {\n if (array === undefined) {\n return NAMES.slice();\n } else if (!Array.isArray(array)) {\n return [];\n } else {\n return onlyNotes(array).map(toName);\n }\n}\n\n/**\n * Get a note from a note name\n *\n * @function\n * @example\n * Note.get('Bb4') // => { name: \"Bb4\", midi: 70, chroma: 10, ... }\n */\nexport const get = props;\n\n/**\n * Get the note name\n * @function\n */\nexport const name = (note: NoteLiteral) => get(note).name;\n\n/**\n * Get the note pitch class name\n * @function\n */\nexport const pitchClass = (note: NoteLiteral) => get(note).pc;\n\n/**\n * Get the note accidentals\n * @function\n */\nexport const accidentals = (note: NoteLiteral) => get(note).acc;\n\n/**\n * Get the note octave\n * @function\n */\nexport const octave = (note: NoteLiteral) => get(note).oct;\n\n/**\n * Get the note midi\n * @function\n */\nexport const midi = (note: NoteLiteral) => get(note).midi;\n\n/**\n * Get the note midi\n * @function\n */\nexport const freq = (note: NoteLiteral) => get(note).freq;\n\n/**\n * Get the note chroma\n * @function\n */\nexport const chroma = (note: NoteLiteral) => get(note).chroma;\n\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n *\n * @function\n * @param {number} midi - the midi note number\n * @return {string} the note name\n * @example\n * Note.fromMidi(61) // => \"Db4\"\n * Note.fromMidi(61.7) // => \"D4\"\n */\nexport function fromMidi(midi: number) {\n return midiToNoteName(midi);\n}\n\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n */\nexport function fromFreq(freq: number) {\n return midiToNoteName(freqToMidi(freq));\n}\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n */\nexport function fromFreqSharps(freq: number) {\n return midiToNoteName(freqToMidi(freq), { sharps: true });\n}\n\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n *\n * @function\n * @param {number} midi - the midi note number\n * @return {string} the note name\n * @example\n * Note.fromMidiSharps(61) // => \"C#4\"\n */\n\nexport function fromMidiSharps(midi: number) {\n return midiToNoteName(midi, { sharps: true });\n}\n\n/**\n * Transpose a note by an interval\n */\nexport const transpose = _tr;\nexport const tr = _tr;\n\n/**\n * Transpose by an interval.\n * @function\n * @param {string} interval\n * @return {function} a function that transposes by the given interval\n * @example\n * [\"C\", \"D\", \"E\"].map(Note.transposeBy(\"5P\"));\n * // => [\"G\", \"A\", \"B\"]\n */\nexport const transposeBy = (interval: IntervalName) => (note: NoteName) =>\n transpose(note, interval);\nexport const trBy = transposeBy;\n\n/**\n * Transpose from a note\n * @function\n * @param {string} note\n * @return {function} a function that transposes the the note by an interval\n * [\"1P\", \"3M\", \"5P\"].map(Note.transposeFrom(\"C\"));\n * // => [\"C\", \"E\", \"G\"]\n */\nexport const transposeFrom = (note: NoteName) => (interval: IntervalName) =>\n transpose(note, interval);\nexport const trFrom = transposeFrom;\n\n/**\n * Transpose a note by a number of perfect fifths.\n *\n * @function\n * @param {string} note - the note name\n * @param {number} fifhts - the number of fifths\n * @return {string} the transposed note name\n *\n * @example\n * import { transposeFifths } from \"@tonaljs/note\"\n * transposeFifths(\"G4\", 1) // => \"D\"\n * [0, 1, 2, 3, 4].map(fifths => transposeFifths(\"C\", fifths)) // => [\"C\", \"G\", \"D\", \"A\", \"E\"]\n */\nexport function transposeFifths(noteName: NoteName, fifths: number): NoteName {\n const note = get(noteName);\n if (note.empty) {\n return \"\";\n }\n const [nFifths, nOcts] = note.coord;\n const transposed =\n nOcts === undefined\n ? coordToNote([nFifths + fifths])\n : coordToNote([nFifths + fifths, nOcts]);\n\n return transposed.name;\n}\nexport const trFifths = transposeFifths;\n\nexport type NoteComparator = (a: Note, b: Note) => number;\n\nexport const ascending: NoteComparator = (a, b) => a.height - b.height;\nexport const descending: NoteComparator = (a, b) => b.height - a.height;\n\nexport function sortedNames(\n notes: any[],\n comparator?: NoteComparator\n): string[] {\n comparator = comparator || ascending;\n return onlyNotes(notes).sort(comparator).map(toName);\n}\n\nexport function sortedUniqNames(notes: any[]): string[] {\n return sortedNames(notes, ascending).filter(\n (n, i, a) => i === 0 || n !== a[i - 1]\n );\n}\n\n/**\n * Simplify a note\n *\n * @function\n * @param {string} note - the note to be simplified\n * - sameAccType: default true. Use same kind of accidentals that source\n * @return {string} the simplified note or '' if not valid note\n * @example\n * simplify(\"C##\") // => \"D\"\n * simplify(\"C###\") // => \"D#\"\n * simplify(\"C###\")\n * simplify(\"B#4\") // => \"C5\"\n */\nexport const simplify = (noteName: NoteName | Pitch): string => {\n const note = get(noteName);\n if (note.empty) {\n return \"\";\n }\n return midiToNoteName(note.midi || note.chroma, {\n sharps: note.alt > 0,\n pitchClass: note.midi === null,\n });\n};\n/**\n * Get enharmonic of a note\n *\n * @function\n * @param {string} note\n * @param [string] - [optional] Destination pitch class\n * @return {string} the enharmonic note name or '' if not valid note\n * @example\n * Note.enharmonic(\"Db\") // => \"C#\"\n * Note.enharmonic(\"C\") // => \"C\"\n * Note.enharmonic(\"F2\",\"E#\") // => \"E#2\"\n */\nexport function enharmonic(noteName: string, destName?: string) {\n const src = get(noteName);\n if (src.empty) {\n return \"\";\n }\n\n // destination: use given or generate one\n const dest = get(\n destName ||\n midiToNoteName(src.midi || src.chroma, {\n sharps: src.alt < 0,\n pitchClass: true,\n })\n );\n\n // ensure destination is valid\n if (dest.empty || dest.chroma !== src.chroma) {\n return \"\";\n }\n\n // if src has no octave, no need to calculate anything else\n if (src.oct === undefined) {\n return dest.pc;\n }\n\n // detect any octave overflow\n const srcChroma = src.chroma - src.alt;\n const destChroma = dest.chroma - dest.alt;\n const destOctOffset =\n srcChroma > 11 || destChroma < 0\n ? -1\n : srcChroma < 0 || destChroma > 11\n ? +1\n : 0;\n // calculate the new octave\n const destOct = src.oct + destOctOffset;\n return dest.pc + destOct;\n}\n\nexport default {\n names,\n get,\n name,\n pitchClass,\n accidentals,\n octave,\n midi,\n ascending,\n descending,\n sortedNames,\n sortedUniqNames,\n fromMidi,\n fromMidiSharps,\n freq,\n fromFreq,\n fromFreqSharps,\n chroma,\n transpose,\n tr,\n transposeBy,\n trBy,\n transposeFrom,\n trFrom,\n transposeFifths,\n trFifths,\n simplify,\n enharmonic,\n};\n", "import {\n accToAlt,\n altToAcc,\n deprecate,\n interval,\n isNamed,\n isPitch,\n Named,\n Pitch,\n} from \"@tonaljs/core\";\n\nexport interface RomanNumeral extends Pitch, Named {\n readonly empty: boolean;\n readonly roman: string;\n readonly interval: string;\n readonly acc: string;\n readonly chordType: string;\n readonly major: boolean;\n readonly dir: 1;\n}\n\nexport interface NoRomanNumeral extends Partial<RomanNumeral> {\n readonly empty: true;\n readonly name: \"\";\n readonly chordType: \"\";\n}\nconst NoRomanNumeral: NoRomanNumeral = { empty: true, name: \"\", chordType: \"\" };\n\nconst cache: Record<string, RomanNumeral | NoRomanNumeral> = {};\n\n/**\n * Get properties of a roman numeral string\n *\n * @function\n * @param {string} - the roman numeral string (can have type, like: Imaj7)\n * @return {Object} - the roman numeral properties\n * @param {string} name - the roman numeral (tonic)\n * @param {string} type - the chord type\n * @param {string} num - the number (1 = I, 2 = II...)\n * @param {boolean} major - major or not\n *\n * @example\n * romanNumeral(\"VIIb5\") // => { name: \"VII\", type: \"b5\", num: 7, major: true }\n */\nexport function get(src: any): RomanNumeral | NoRomanNumeral {\n return typeof src === \"string\"\n ? cache[src] || (cache[src] = parse(src))\n : typeof src === \"number\"\n ? get(NAMES[src] || \"\")\n : isPitch(src)\n ? fromPitch(src)\n : isNamed(src)\n ? get(src.name)\n : NoRomanNumeral;\n}\n\nconst romanNumeral = deprecate(\n \"RomanNumeral.romanNumeral\",\n \"RomanNumeral.get\",\n get\n);\n\n/**\n * Get roman numeral names\n *\n * @function\n * @param {boolean} [isMajor=true]\n * @return {Array<String>}\n *\n * @example\n * names() // => [\"I\", \"II\", \"III\", \"IV\", \"V\", \"VI\", \"VII\"]\n */\nexport function names(major = true) {\n return (major ? NAMES : NAMES_MINOR).slice();\n}\n\nfunction fromPitch(pitch: Pitch): RomanNumeral | NoRomanNumeral {\n return get(altToAcc(pitch.alt) + NAMES[pitch.step]);\n}\n\nconst REGEX =\n /^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;\n\n// [name, accidentals, romanNumeral, chordType]\ntype RomanNumeralTokens = [string, string, string, string];\nexport function tokenize(str: string): RomanNumeralTokens {\n return (REGEX.exec(str) || [\"\", \"\", \"\", \"\"]) as RomanNumeralTokens;\n}\n\nconst ROMANS = \"I II III IV V VI VII\";\nconst NAMES = ROMANS.split(\" \");\nconst NAMES_MINOR = ROMANS.toLowerCase().split(\" \");\n\nfunction parse(src: string): RomanNumeral | NoRomanNumeral {\n const [name, acc, roman, chordType] = tokenize(src);\n if (!roman) {\n return NoRomanNumeral;\n }\n\n const upperRoman = roman.toUpperCase();\n const step = NAMES.indexOf(upperRoman);\n const alt = accToAlt(acc);\n const dir = 1;\n return {\n empty: false,\n name,\n roman,\n interval: interval({ step, alt, dir }).name,\n acc,\n chordType,\n alt,\n step,\n major: roman === upperRoman,\n oct: 0,\n dir,\n };\n}\n\nexport default {\n names,\n get,\n // deprecated\n romanNumeral,\n};\n", "import { accToAlt, altToAcc, note, transpose } from \"@tonaljs/core\";\nimport { transposeFifths } from \"@tonaljs/note\";\nimport { get as roman } from \"@tonaljs/roman-numeral\";\n\nconst Empty: readonly string[] = Object.freeze([] as string[]);\n\nexport interface Key {\n readonly type: \"major\" | \"minor\";\n readonly tonic: string;\n readonly alteration: number;\n readonly keySignature: string;\n}\n\nconst NoKey: Key = {\n type: \"major\",\n tonic: \"\",\n alteration: 0,\n keySignature: \"\",\n};\n\nexport interface KeyScale {\n readonly tonic: string;\n readonly grades: readonly string[];\n readonly intervals: readonly string[];\n readonly scale: readonly string[];\n readonly chords: readonly string[];\n readonly chordsHarmonicFunction: readonly string[];\n readonly chordScales: readonly string[];\n}\n\nconst NoKeyScale: KeyScale = {\n tonic: \"\",\n grades: Empty,\n intervals: Empty,\n scale: Empty,\n chords: Empty,\n chordsHarmonicFunction: Empty,\n chordScales: Empty,\n};\n\nexport interface MajorKey extends Key, KeyScale {\n readonly type: \"major\";\n readonly minorRelative: string;\n readonly scale: readonly string[];\n readonly secondaryDominants: readonly string[];\n readonly secondaryDominantsMinorRelative: readonly string[];\n readonly substituteDominants: readonly string[];\n readonly substituteDominantsMinorRelative: readonly string[];\n}\n\nconst NoMajorKey: MajorKey = {\n ...NoKey,\n ...NoKeyScale,\n type: \"major\",\n minorRelative: \"\",\n scale: Empty,\n secondaryDominants: Empty,\n secondaryDominantsMinorRelative: Empty,\n substituteDominants: Empty,\n substituteDominantsMinorRelative: Empty,\n};\n\nexport interface MinorKey extends Key {\n readonly type: \"minor\";\n readonly relativeMajor: string;\n readonly natural: KeyScale;\n readonly harmonic: KeyScale;\n readonly melodic: KeyScale;\n}\n\nconst NoMinorKey: MinorKey = {\n ...NoKey,\n type: \"minor\",\n relativeMajor: \"\",\n natural: NoKeyScale,\n harmonic: NoKeyScale,\n melodic: NoKeyScale,\n};\n\nconst mapScaleToType = (scale: string[], list: string[], sep = \"\") =>\n list.map((type, i) => `${scale[i]}${sep}${type}`);\n\nfunction keyScale(\n grades: string[],\n chords: string[],\n harmonicFunctions: string[],\n chordScales: string[]\n) {\n return (tonic: string): KeyScale => {\n const intervals = grades.map((gr) => roman(gr).interval || \"\");\n const scale = intervals.map((interval) => transpose(tonic, interval));\n\n return {\n tonic,\n grades,\n intervals,\n scale,\n chords: mapScaleToType(scale, chords),\n chordsHarmonicFunction: harmonicFunctions.slice(),\n chordScales: mapScaleToType(scale, chordScales, \" \"),\n };\n };\n}\n\nconst distInFifths = (from: string, to: string) => {\n const f = note(from);\n const t = note(to);\n return f.empty || t.empty ? 0 : t.coord[0] - f.coord[0];\n};\n\nconst MajorScale = keyScale(\n \"I II III IV V VI VII\".split(\" \"),\n \"maj7 m7 m7 maj7 7 m7 m7b5\".split(\" \"),\n \"T SD T SD D T D\".split(\" \"),\n \"major,dorian,phrygian,lydian,mixolydian,minor,locrian\".split(\",\")\n);\nconst NaturalScale = keyScale(\n \"I II bIII IV V bVI bVII\".split(\" \"),\n \"m7 m7b5 maj7 m7 m7 maj7 7\".split(\" \"),\n \"T SD T SD D SD SD\".split(\" \"),\n \"minor,locrian,major,dorian,phrygian,lydian,mixolydian\".split(\",\")\n);\nconst HarmonicScale = keyScale(\n \"I II bIII IV V bVI VII\".split(\" \"),\n \"mMaj7 m7b5 +maj7 m7 7 maj7 o7\".split(\" \"),\n \"T SD T SD D SD D\".split(\" \"),\n \"harmonic minor,locrian 6,major augmented,lydian diminished,phrygian dominant,lydian #9,ultralocrian\".split(\n \",\"\n )\n);\nconst MelodicScale = keyScale(\n \"I II bIII IV V VI VII\".split(\" \"),\n \"m6 m7 +maj7 7 7 m7b5 m7b5\".split(\" \"),\n \"T SD T SD D \".split(\" \"),\n \"melodic minor,dorian b2,lydian augmented,lydian dominant,mixolydian b6,locrian #2,altered\".split(\n \",\"\n )\n);\n\n/**\n * Get a major key properties in a given tonic\n * @param tonic\n */\nexport function majorKey(tonic: string): MajorKey {\n const pc = note(tonic).pc;\n if (!pc) return NoMajorKey;\n\n const keyScale = MajorScale(pc);\n const alteration = distInFifths(\"C\", pc);\n const romanInTonic = (src: string) => {\n const r = roman(src);\n if (r.empty) return \"\";\n\n return transpose(tonic, r.interval) + r.chordType;\n };\n\n return {\n ...keyScale,\n type: \"major\",\n minorRelative: transpose(pc, \"-3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n secondaryDominants: \"- VI7 VII7 I7 II7 III7 -\".split(\" \").map(romanInTonic),\n secondaryDominantsMinorRelative: \"- IIIm7b5 IV#m7 Vm7 VIm7 VIIm7b5 -\"\n .split(\" \")\n .map(romanInTonic),\n substituteDominants: \"- bIII7 IV7 bV7 bVI7 bVII7 -\"\n .split(\" \")\n .map(romanInTonic),\n substituteDominantsMinorRelative: \"- IIIm7 Im7 IIbm7 VIm7 IVm7 -\"\n .split(\" \")\n .map(romanInTonic),\n };\n}\n\n/**\n * Get minor key properties in a given tonic\n * @param tonic\n */\nexport function minorKey(tnc: string): MinorKey {\n const pc = note(tnc).pc;\n if (!pc) return NoMinorKey;\n\n const alteration = distInFifths(\"C\", pc) - 3;\n return {\n type: \"minor\",\n tonic: pc,\n relativeMajor: transpose(pc, \"3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n natural: NaturalScale(pc),\n harmonic: HarmonicScale(pc),\n melodic: MelodicScale(pc),\n };\n}\n\n/**\n * Given a key signature, returns the tonic of the major key\n * @param sigature\n * @example\n * majorTonicFromKeySignature('###') // => 'A'\n */\nexport function majorTonicFromKeySignature(\n sig: string | number\n): string | null {\n if (typeof sig === \"number\") {\n return transposeFifths(\"C\", sig);\n } else if (typeof sig === \"string\" && /^b+|#+$/.test(sig)) {\n return transposeFifths(\"C\", accToAlt(sig));\n }\n return null;\n}\n\nexport default { majorKey, majorTonicFromKeySignature, minorKey };\n", "import { rotate } from \"@tonaljs/collection\";\nimport { deprecate, Named, NoteName, transpose } from \"@tonaljs/core\";\nimport { simplify, transposeFifths } from \"@tonaljs/interval\";\nimport { EmptyPcset, Pcset } from \"@tonaljs/pcset\";\nimport { get as getType } from \"@tonaljs/scale-type\";\n\nconst MODES = [\n [0, 2773, 0, \"ionian\", \"\", \"Maj7\", \"major\"],\n [1, 2902, 2, \"dorian\", \"m\", \"m7\"],\n [2, 3418, 4, \"phrygian\", \"m\", \"m7\"],\n [3, 2741, -1, \"lydian\", \"\", \"Maj7\"],\n [4, 2774, 1, \"mixolydian\", \"\", \"7\"],\n [5, 2906, 3, \"aeolian\", \"m\", \"m7\", \"minor\"],\n [6, 3434, 5, \"locrian\", \"dim\", \"m7b5\"],\n] as const;\n\ntype ModeDatum = typeof MODES[number];\n\nexport interface Mode extends Pcset {\n readonly name: string;\n readonly modeNum: number;\n readonly alt: number; // number of alterations === number of fiths\n readonly triad: string;\n readonly seventh: string;\n readonly aliases: string[];\n}\n\nconst NoMode: Mode = {\n ...EmptyPcset,\n name: \"\",\n alt: 0,\n modeNum: NaN,\n triad: \"\",\n seventh: \"\",\n aliases: [],\n};\n\nconst modes: Mode[] = MODES.map(toMode);\nconst index: Record<string, Mode> = {};\nmodes.forEach((mode) => {\n index[mode.name] = mode;\n mode.aliases.forEach((alias) => {\n index[alias] = mode;\n });\n});\n\ntype ModeLiteral = string | Named;\n\n/**\n * Get a Mode by it's name\n *\n * @example\n * get('dorian')\n * // =>\n * // {\n * // intervals: [ '1P', '2M', '3m', '4P', '5P', '6M', '7m' ],\n * // modeNum: 1,\n * // chroma: '101101010110',\n * // normalized: '101101010110',\n * // name: 'dorian',\n * // setNum: 2902,\n * // alt: 2,\n * // triad: 'm',\n * // seventh: 'm7',\n * // aliases: []\n * // }\n */\nexport function get(name: ModeLiteral): Mode {\n return typeof name === \"string\"\n ? index[name.toLowerCase()] || NoMode\n : name && name.name\n ? get(name.name)\n : NoMode;\n}\n\nexport const mode = deprecate(\"Mode.mode\", \"Mode.get\", get);\n\n/**\n * Get a list of all modes\n */\nexport function all() {\n return modes.slice();\n}\nexport const entries = deprecate(\"Mode.mode\", \"Mode.all\", all);\n\n/**\n * Get a list of all mode names\n */\nexport function names() {\n return modes.map((mode) => mode.name);\n}\n\nfunction toMode(mode: ModeDatum): Mode {\n const [modeNum, setNum, alt, name, triad, seventh, alias] = mode;\n const aliases = alias ? [alias] : [];\n const chroma = Number(setNum).toString(2);\n const intervals = getType(name).intervals;\n return {\n empty: false,\n intervals,\n modeNum,\n chroma,\n normalized: chroma,\n name,\n setNum,\n alt,\n triad,\n seventh,\n aliases,\n };\n}\n\nexport function notes(modeName: ModeLiteral, tonic: NoteName) {\n return get(modeName).intervals.map((ivl) => transpose(tonic, ivl));\n}\n\nfunction chords(chords: string[]) {\n return (modeName: ModeLiteral, tonic: NoteName) => {\n const mode = get(modeName);\n if (mode.empty) return [];\n const triads = rotate(mode.modeNum, chords);\n const tonics = mode.intervals.map((i) => transpose(tonic, i));\n return triads.map((triad, i) => tonics[i] + triad);\n };\n}\n\nexport const triads = chords(MODES.map((x) => x[4]));\nexport const seventhChords = chords(MODES.map((x) => x[5]));\n\nexport function distance(destination: ModeLiteral, source: ModeLiteral) {\n const from = get(source);\n const to = get(destination);\n if (from.empty || to.empty) return \"\";\n return simplify(transposeFifths(\"1P\", to.alt - from.alt));\n}\n\nexport function relativeTonic(\n destination: ModeLiteral,\n source: ModeLiteral,\n tonic: NoteName\n) {\n return transpose(tonic, distance(destination, source));\n}\n\nexport default {\n get,\n names,\n all,\n distance,\n relativeTonic,\n notes,\n triads,\n seventhChords,\n // deprecated\n entries,\n mode,\n};\n", "import { tokenize } from \"@tonaljs/chord\";\nimport { distance, interval, NoteLiteral, transpose } from \"@tonaljs/core\";\nimport { get as romanNumeral } from \"@tonaljs/roman-numeral\";\n\n/**\n * Given a tonic and a chord list expressed with roman numeral notation\n * returns the progression expressed with leadsheet chords symbols notation\n * @example\n * fromRomanNumerals(\"C\", [\"I\", \"IIm7\", \"V7\"]);\n * // => [\"C\", \"Dm7\", \"G7\"]\n */\nexport function fromRomanNumerals(\n tonic: NoteLiteral,\n chords: string[]\n): string[] {\n const romanNumerals = chords.map(romanNumeral);\n return romanNumerals.map(\n (rn) => transpose(tonic, interval(rn)) + rn.chordType\n );\n}\n\n/**\n * Given a tonic and a chord list with leadsheet symbols notation,\n * return the chord list with roman numeral notation\n * @example\n * toRomanNumerals(\"C\", [\"CMaj7\", \"Dm7\", \"G7\"]);\n * // => [\"IMaj7\", \"IIm7\", \"V7\"]\n */\nexport function toRomanNumerals(\n tonic: NoteLiteral,\n chords: string[]\n): string[] {\n return chords.map((chord) => {\n const [note, chordType] = tokenize(chord);\n const intervalName = distance(tonic, note);\n const roman = romanNumeral(interval(intervalName));\n return roman.name + chordType;\n });\n}\n\nexport default { fromRomanNumerals, toRomanNumerals };\n", "import { compact, range } from \"@tonaljs/collection\";\nimport { midiToNoteName, toMidi, ToNoteNameOptions } from \"@tonaljs/midi\";\n\n/**\n * Create a numeric range. You supply a list of notes or numbers and it will\n * be connected to create complex ranges.\n *\n * @param {Array} notes - the list of notes or midi numbers used\n * @return {Array} an array of numbers or empty array if not valid parameters\n *\n * @example\n * numeric([\"C5\", \"C4\"]) // => [ 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60 ]\n * // it works midi notes\n * numeric([10, 5]) // => [ 10, 9, 8, 7, 6, 5 ]\n * // complex range\n * numeric([\"C4\", \"E4\", \"Bb3\"]) // => [60, 61, 62, 63, 64, 63, 62, 61, 60, 59, 58]\n */\nexport function numeric(notes: (string | number)[]): number[] {\n const midi: number[] = compact(notes.map(toMidi));\n if (!notes.length || midi.length !== notes.length) {\n // there is no valid notes\n return [];\n }\n\n return midi.reduce(\n (result, note) => {\n const last: number = result[result.length - 1];\n return result.concat(range(last, note).slice(1));\n },\n [midi[0]]\n );\n}\n\n/**\n * Create a range of chromatic notes. The altered notes will use flats.\n *\n * @function\n * @param {Array} notes - the list of notes or midi note numbers to create a range from\n * @param {Object} options - The same as `midiToNoteName` (`{ sharps: boolean, pitchClass: boolean }`)\n * @return {Array} an array of note names\n *\n * @example\n * Range.chromatic([\"C2, \"E2\", \"D2\"]) // => [\"C2\", \"Db2\", \"D2\", \"Eb2\", \"E2\", \"Eb2\", \"D2\"]\n * // with sharps\n * Range.chromatic([\"C2\", \"C3\"], { sharps: true }) // => [ \"C2\", \"C#2\", \"D2\", \"D#2\", \"E2\", \"F2\", \"F#2\", \"G2\", \"G#2\", \"A2\", \"A#2\", \"B2\", \"C3\" ]\n */\nexport function chromatic(\n notes: (string | number)[],\n options?: ToNoteNameOptions\n): string[] {\n return numeric(notes).map((midi) => midiToNoteName(midi, options));\n}\n\nexport default { numeric, chromatic };\n", "/**\n * References:\n * - https://www.researchgate.net/publication/327567188_An_Algorithm_for_Spelling_the_Pitches_of_Any_Musical_Scale\n * @module scale\n */\nimport { all as chordTypes } from \"@tonaljs/chord-type\";\nimport { rotate, range as nums } from \"@tonaljs/collection\";\nimport { deprecate, note, NoteName, transpose } from \"@tonaljs/core\";\nimport { sortedUniqNames, fromMidi, enharmonic } from \"@tonaljs/note\";\nimport { isSubsetOf, isSupersetOf, modes } from \"@tonaljs/pcset\";\nimport {\n all as scaleTypes,\n get as getScaleType,\n names as scaleTypeNames,\n ScaleType,\n} from \"@tonaljs/scale-type\";\n\ntype ScaleName = string;\ntype ScaleNameTokens = [string, string]; // [TONIC, SCALE TYPE]\n\nexport interface Scale extends ScaleType {\n tonic: string | null;\n type: string;\n notes: NoteName[];\n}\n\nconst NoScale: Scale = {\n empty: true,\n name: \"\",\n type: \"\",\n tonic: null,\n setNum: NaN,\n chroma: \"\",\n normalized: \"\",\n aliases: [],\n notes: [],\n intervals: [],\n};\n\n/**\n * Given a string with a scale name and (optionally) a tonic, split\n * that components.\n *\n * It retuns an array with the form [ name, tonic ] where tonic can be a\n * note name or null and name can be any arbitrary string\n * (this function doesn\"t check if that scale name exists)\n *\n * @function\n * @param {string} name - the scale name\n * @return {Array} an array [tonic, name]\n * @example\n * tokenize(\"C mixolydean\") // => [\"C\", \"mixolydean\"]\n * tokenize(\"anything is valid\") // => [\"\", \"anything is valid\"]\n * tokenize() // => [\"\", \"\"]\n */\nexport function tokenize(name: ScaleName): ScaleNameTokens {\n if (typeof name !== \"string\") {\n return [\"\", \"\"];\n }\n const i = name.indexOf(\" \");\n const tonic = note(name.substring(0, i));\n if (tonic.empty) {\n const n = note(name);\n return n.empty ? [\"\", name] : [n.name, \"\"];\n }\n\n const type = name.substring(tonic.name.length + 1);\n return [tonic.name, type.length ? type : \"\"];\n}\n\n/**\n * Get all scale names\n * @function\n */\nexport const names = scaleTypeNames;\n\n/**\n * Get a Scale from a scale name.\n */\nexport function get(src: ScaleName | ScaleNameTokens): Scale {\n const tokens = Array.isArray(src) ? src : tokenize(src);\n const tonic = note(tokens[0]).name;\n const st = getScaleType(tokens[1]);\n if (st.empty) {\n return NoScale;\n }\n\n const type = st.name;\n const notes: string[] = tonic\n ? st.intervals.map((i) => transpose(tonic, i))\n : [];\n\n const name = tonic ? tonic + \" \" + type : type;\n\n return { ...st, name, type, tonic, notes };\n}\n\nexport const scale = deprecate(\"Scale.scale\", \"Scale.get\", get);\n\n/**\n * Get all chords that fits a given scale\n *\n * @function\n * @param {string} name - the scale name\n * @return {Array<string>} - the chord names\n *\n * @example\n * scaleChords(\"pentatonic\") // => [\"5\", \"64\", \"M\", \"M6\", \"Madd9\", \"Msus2\"]\n */\nexport function scaleChords(name: string): string[] {\n const s = get(name);\n const inScale = isSubsetOf(s.chroma);\n return chordTypes()\n .filter((chord) => inScale(chord.chroma))\n .map((chord) => chord.aliases[0]);\n}\n/**\n * Get all scales names that are a superset of the given one\n * (has the same notes and at least one more)\n *\n * @function\n * @param {string} name\n * @return {Array} a list of scale names\n * @example\n * extended(\"major\") // => [\"bebop\", \"bebop dominant\", \"bebop major\", \"chromatic\", \"ichikosucho\"]\n */\nexport function extended(name: string): string[] {\n const s = get(name);\n const isSuperset = isSupersetOf(s.chroma);\n return scaleTypes()\n .filter((scale) => isSuperset(scale.chroma))\n .map((scale) => scale.name);\n}\n\n/**\n * Find all scales names that are a subset of the given one\n * (has less notes but all from the given scale)\n *\n * @function\n * @param {string} name\n * @return {Array} a list of scale names\n *\n * @example\n * reduced(\"major\") // => [\"ionian pentatonic\", \"major pentatonic\", \"ritusen\"]\n */\nexport function reduced(name: string): string[] {\n const isSubset = isSubsetOf(get(name).chroma);\n return scaleTypes()\n .filter((scale) => isSubset(scale.chroma))\n .map((scale) => scale.name);\n}\n\n/**\n * Given an array of notes, return the scale: a pitch class set starting from\n * the first note of the array\n *\n * @function\n * @param {string[]} notes\n * @return {string[]} pitch classes with same tonic\n * @example\n * scaleNotes(['C4', 'c3', 'C5', 'C4', 'c4']) // => [\"C\"]\n * scaleNotes(['D4', 'c#5', 'A5', 'F#6']) // => [\"D\", \"F#\", \"A\", \"C#\"]\n */\nexport function scaleNotes(notes: NoteName[]) {\n const pcset: string[] = notes.map((n) => note(n).pc).filter((x) => x);\n const tonic = pcset[0];\n const scale = sortedUniqNames(pcset);\n return rotate(scale.indexOf(tonic), scale);\n}\n\ntype ScaleMode = [string, string];\n/**\n * Find mode names of a scale\n *\n * @function\n * @param {string} name - scale name\n * @example\n * modeNames(\"C pentatonic\") // => [\n * [\"C\", \"major pentatonic\"],\n * [\"D\", \"egyptian\"],\n * [\"E\", \"malkos raga\"],\n * [\"G\", \"ritusen\"],\n * [\"A\", \"minor pentatonic\"]\n * ]\n */\nexport function modeNames(name: string): ScaleMode[] {\n const s = get(name);\n if (s.empty) {\n return [];\n }\n\n const tonics = s.tonic ? s.notes : s.intervals;\n return modes(s.chroma)\n .map((chroma: string, i: number): ScaleMode => {\n const modeName = get(chroma).name;\n return modeName ? [tonics[i], modeName] : [\"\", \"\"];\n })\n .filter((x) => x[0]);\n}\n\nfunction getNoteNameOf(scale: string | string[]) {\n const names = Array.isArray(scale) ? scaleNotes(scale) : get(scale).notes;\n const chromas = names.map((name) => note(name).chroma);\n\n return (noteOrMidi: string | number): string | undefined => {\n const currNote =\n typeof noteOrMidi === \"number\"\n ? note(fromMidi(noteOrMidi))\n : note(noteOrMidi);\n const height = currNote.height;\n\n if (height === undefined) return undefined;\n const chroma = height % 12;\n const position = chromas.indexOf(chroma);\n if (position === -1) return undefined;\n return enharmonic(currNote.name, names[position]);\n };\n}\n\nexport function rangeOf(scale: string | string[]) {\n const getName = getNoteNameOf(scale);\n return (fromNote: string, toNote: string) => {\n const from = note(fromNote).height;\n const to = note(toNote).height;\n if (from === undefined || to === undefined) return [];\n\n return nums(from, to)\n .map(getName)\n .filter((x) => x);\n };\n}\n\nexport default {\n get,\n names,\n extended,\n modeNames,\n reduced,\n scaleChords,\n scaleNotes,\n tokenize,\n rangeOf,\n // deprecated\n scale,\n};\n", "// TYPES: PARSING\nexport type TimeSignatureLiteral = string | [number, number] | [string, string];\ntype ParsedTimeSignature = [number | number[], number];\n\n// TYPES: PROPERTIES\nexport type ValidTimeSignature = {\n readonly empty: false;\n readonly name: string;\n readonly upper: number | number[];\n readonly lower: number;\n readonly type: \"simple\" | \"compound\" | \"irregular\" | \"irrational\";\n readonly additive: number[];\n};\n\nexport type InvalidTimeSignature = {\n readonly empty: true;\n readonly name: \"\";\n readonly upper: undefined;\n readonly lower: undefined;\n readonly type: undefined;\n readonly additive: [];\n};\n\nexport type TimeSignature = ValidTimeSignature | InvalidTimeSignature;\n\n// CONSTANTS\nconst NONE: InvalidTimeSignature = {\n empty: true,\n name: \"\",\n upper: undefined,\n lower: undefined,\n type: undefined,\n additive: [],\n};\n\nconst NAMES = [\"4/4\", \"3/4\", \"2/4\", \"2/2\", \"12/8\", \"9/8\", \"6/8\", \"3/8\"];\n\n// PUBLIC API\n\nexport function names() {\n return NAMES.slice();\n}\n\nconst REGEX = /^(\\d*\\d(?:\\+\\d)*)\\/(\\d+)$/;\nconst CACHE = new Map<TimeSignatureLiteral, TimeSignature>();\n\nexport function get(literal: TimeSignatureLiteral): TimeSignature {\n const stringifiedLiteral = JSON.stringify(literal);\n const cached = CACHE.get(stringifiedLiteral);\n if (cached) {\n return cached;\n }\n\n const ts = build(parse(literal));\n CACHE.set(stringifiedLiteral, ts);\n return ts;\n}\n\nexport function parse(literal: TimeSignatureLiteral): ParsedTimeSignature {\n if (typeof literal === \"string\") {\n const [_, up, low] = REGEX.exec(literal) || [];\n return parse([up, low]);\n }\n\n const [up, down] = literal;\n const denominator = +down;\n if (typeof up === \"number\") {\n return [up, denominator];\n }\n\n const list = up.split(\"+\").map((n) => +n);\n return list.length === 1 ? [list[0], denominator] : [list, denominator];\n}\n\nexport default { names, parse, get };\n\n// PRIVATE\n\nconst isPowerOfTwo = (x: number) => (Math.log(x) / Math.log(2)) % 1 === 0;\n\nfunction build([up, down]: ParsedTimeSignature): TimeSignature {\n const upper = Array.isArray(up) ? up.reduce((a, b) => a + b, 0) : up;\n const lower = down;\n if (upper === 0 || lower === 0) {\n return NONE;\n }\n\n const name = Array.isArray(up) ? `${up.join(\"+\")}/${down}` : `${up}/${down}`;\n const additive = Array.isArray(up) ? up : [];\n const type =\n lower === 4 || lower === 2\n ? \"simple\"\n : lower === 8 && upper % 3 === 0\n ? \"compound\"\n : isPowerOfTwo(lower)\n ? \"irregular\"\n : \"irrational\";\n\n return {\n empty: false,\n name,\n type,\n upper,\n lower,\n additive,\n };\n}\n", "import AbcNotation from \"@tonaljs/abc-notation\";\nimport * as Array from \"@tonaljs/array\";\nimport Chord from \"@tonaljs/chord\";\nimport ChordType from \"@tonaljs/chord-type\";\nimport Collection from \"@tonaljs/collection\";\nimport * as Core from \"@tonaljs/core\";\nimport DurationValue from \"@tonaljs/duration-value\";\nimport Interval from \"@tonaljs/interval\";\nimport Key from \"@tonaljs/key\";\nimport Midi from \"@tonaljs/midi\";\nimport Mode from \"@tonaljs/mode\";\nimport Note from \"@tonaljs/note\";\nimport Pcset from \"@tonaljs/pcset\";\nimport Progression from \"@tonaljs/progression\";\nimport Range from \"@tonaljs/range\";\nimport RomanNumeral from \"@tonaljs/roman-numeral\";\nimport Scale from \"@tonaljs/scale\";\nimport ScaleType from \"@tonaljs/scale-type\";\nimport TimeSignature from \"@tonaljs/time-signature\";\n\nexport * from \"@tonaljs/core\";\n\n// deprecated (backwards compatibility)\nconst Tonal = Core;\nconst PcSet = Pcset;\nconst ChordDictionary = ChordType;\nconst ScaleDictionary = ScaleType;\n\nexport {\n AbcNotation,\n Array,\n Chord,\n ChordType,\n Collection,\n Core,\n DurationValue,\n Note,\n Interval,\n Key,\n Midi,\n Mode,\n Pcset,\n Progression,\n Range,\n RomanNumeral,\n Scale,\n ScaleType,\n TimeSignature,\n // backwards API compatibility (3.0)\n Tonal,\n PcSet,\n ChordDictionary,\n ScaleDictionary,\n};\n"],
5
+ "mappings": "uZAMO,IAAMA,EAAU,CAACC,EAAWC,IAAc,MAAM,KAAK,IAAIA,CAAC,EAAI,CAAC,EAAE,KAAKD,CAAC,EAEvE,SAASE,EAEdC,EAAkBC,EAAqBC,EAAc,CACrD,OAAO,YAA4BC,EAAuC,CAExE,eAAQ,KAAK,GAAGH,wBAA+BC,IAAc,EACtDC,EAAG,MAAM,KAAMC,CAAI,CAC5B,CACF,CCHO,SAASC,EAAQC,EAAwB,CAC9C,OAAOA,IAAQ,MAAQ,OAAOA,GAAQ,UAAY,OAAOA,EAAI,MAAS,QAGxE,CCYO,SAASC,EAAQC,EAA4B,CAClD,OAAOA,IAAU,MACf,OAAOA,GAAU,UACjB,OAAOA,EAAM,MAAS,UACtB,OAAOA,EAAM,KAAQ,QAGzB,CAGA,IAAMC,GAAS,CAAC,EAAG,EAAG,EAAG,GAAI,EAAG,EAAG,CAAC,EAE9BC,GAAgBD,GAAO,IAAKE,GAChC,KAAK,MAAOA,EAAS,EAAK,EAAE,CAC9B,EAEO,SAASC,GAAOJ,EAAgC,CACrD,GAAM,CAAE,KAAAK,EAAM,IAAAC,E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I,GAAGA,EAAG,KAAK,GAAG,KAAKE,IAAS,GAAGF,KAAME,IAChEY,EAAW,MAAM,QAAQd,CAAE,EAAIA,EAAK,CAAC,EACrCe,EACJH,IAAU,GAAKA,IAAU,EACrB,SACAA,IAAU,GAAKH,EAAQ,IAAM,EAC7B,WACAF,GAAaK,CAAK,EAClB,YACA,aAEN,MAAO,CACL,MAAO,GACP,KAAAC,EACA,KAAAE,EACA,MAAAN,EACA,MAAAG,EACA,SAAAE,CACF,CACF,CCnFA,IAAME,GAAQC,GACRC,GAAQC,GACRC,GAAkBC,GAClBC,GAAkBC",
6
+ "names": ["fillStr", "s", "n", "deprecate", "original", "alternative", "fn", "args", "isNamed", "src", "isPitch", "pitch", "FIFTHS", "STEPS_TO_OCTS", "fifths", "encode", "step", "alt", "oct", "dir", "f", "o", "FIFTHS_TO_STEPS", "decode", "coord", "unaltered", "i", "NoNote", "cache", "stepToLetter", "altToAcc", "accToAlt", "acc", "note", "stringSrc", "cached", "value", "parse", "pitchName", "REGEX", "tokenizeNote", "str", "m", "coordToNote", "noteCoord", "mod", "SEMI", "noteName", "tokens", "letter", "octStr", "name", "pc", "chroma", "height", "midi", "freq", "props", "NoInterval", "INTERVAL_TONAL_REGEX", "INTERVAL_SHORTHAND_REGEX", "tokenizeInterval", "interval", "SIZES", "TYPES", "num", "q", "t", "type", "simple", "qToAlt", "semitones", "coordToInterval", "forceDescending", "isDescending", "ivl", "calcNum", "d", "altToQ", "transpose", "intervalName", "intervalCoord", "tr", "distance", "fromNote", "toNote", "from", "to", "fcoord", "tcoord", "octs", "fillStr", "character", "times", "REGEX", "tokenize", "str", "m", "abcToScientificNotation", "acc", "letter", "oct", "i", "scientificToAbcNotation", "n", "note", "l", "o", "transpose", "interval", "distance", "from", "to", "abc_notation_default", "isArray", "ascR", "b", "n", "a", "descR", "range", "from", "to", "rotate", "times", "arr", "len", "compact", "sortedNoteNames", "notes", "note", "sortedUniqNoteNames", "i", "shuffle", "rnd", "t", "m", "permutations", "acc", "perm", "e", "pos", "newPerm", "ascR", "b", "n", "a", "descR", "range", "from", "to", "rotate", "times", "arr", "len", "compact", "shuffle", "rnd", "i", "t", "m", "permutations", "acc", "perm", "e", "pos", "newPerm", "collection_default", "EmptyPcset", "setNumToChroma", "num", "chromaToNumber", "chroma", "REGEX", "isChroma", "set", "isPcsetNum", "isPcset", "cache", "get", "src", "listToChroma", "chromaToPcset", "pcset", "deprecate", "intervals", "IVLS", "chromaToIntervals", "i", "chromas", "range", "modes", "normalize", "binary", "compact", "_", "r", "rotate", "isEqual", "s1", "s2", "isSubsetOf", "s", "notes", "o", "isSupersetOf", "isNoteIncludedIn", "noteName", "n", "note", "filter", "set", "isIncluded", "isNoteIncludedIn", "notes", "pcset_default", "get", "chroma", "num", "intervals", "chromas", "isSupersetOf", "isSubsetOf", "isEqual", "modes", "pcset", "chromaRotations", "binary", "_", "i", "rotate", "chromaToPcset", "setNum", "chromaToNumber", "normalizedNum", "n", "normalized", "setNumToChroma", "chromaToIntervals", "listToChroma", "EmptyPcset", "pitch", "note", "interval", "CHORDS", "data_default", "NoChordType", "EmptyPcset", "dictionary", "index", "get", "type", "chordType", "deprecate", "names", "chord", "x", "symbols", "keys", "all", "entries", "removeAll", "add", "intervals", "aliases", "fullName", "quality", "getQuality", "alias", "addAlias", "has", "interval", "ivls", "a", "b", "chord_type_default", "namedSet", "notes", "pcToName", "record", "n", "chroma", "note", "detect", "source", "x", "findExactMatches", "chord", "a", "b", "weight", "tonic", "tonicChroma", "noteName", "allModes", "modes", "found", "mode", "index", "all", "chordType", "chordName", "baseNote", "SCALES", "data_default", "NoScaleType", "EmptyPcset", "dictionary", "index", "names", "scale", "get", "type", "scaleType", "deprecate", "all", "entries", "keys", "removeAll", "add", "intervals", "name", "aliases", "alias", "addAlias", "ivls", "scale_type_default", "NoChord", "NUM_TYPES", "tokenize", "name", "letter", "acc", "oct", "type", "tokenizeNote", "get", "src", "getChord", "tonic", "chord", "typeName", "optionalTonic", "optionalRoot", "note", "root", "rootInterval", "distance", "rootDegree", "intervals", "i", "num", "quality", "newNum", "notes", "transpose", "symbol", "deprecate", "chordName", "interval", "chordScales", "s", "isChordIncluded", "isSupersetOf", "all", "scale", "extended", "isSuperset", "reduced", "isSubset", "isSubsetOf", "chord_default", "detect", "DATA", "data_default", "VALUES", "denominator", "shorthand", "names", "add", "NoDuration", "duration", "name", "shorthands", "dur", "REGEX", "get", "_", "simple", "dots", "base", "fraction", "calcDots", "value", "duration_value_default", "pow", "numerator", "i", "names", "get", "interval", "name", "semitones", "quality", "num", "simplify", "i", "invert", "step", "alt", "IN", "IQ", "fromSemitones", "d", "c", "distance", "add", "combinator", "a", "b", "addTo", "other", "substract", "transposeFifths", "fifths", "ivl", "nFifths", "nOcts", "dir", "coordToInterval", "interval_default", "fn", "coordA", "coordB", "coord", "isMidi", "arg", "toMidi", "note", "n", "midiToFreq", "midi", "tuning", "L2", "L440", "freqToMidi", "freq", "v", "SHARPS", "FLATS", "midiToNoteName", "options", "pc", "midi_default", "NAMES", "toName", "n", "onlyNotes", "array", "note", "names", "get", "name", "pitchClass", "accidentals", "octave", "midi", "freq", "chroma", "fromMidi", "midiToNoteName", "fromFreq", "freqToMidi", "fromFreqSharps", "fromMidiSharps", "transpose", "tr", "transposeBy", "interval", "trBy", "transposeFrom", "trFrom", "transposeFifths", "noteName", "fifths", "nFifths", "nOcts", "coordToNote", "trFifths", "ascending", "a", "b", "descending", "sortedNames", "notes", "comparator", "sortedUniqNames", "i", "simplify", "enharmonic", "destName", "src", "dest", "srcChroma", "destChroma", "destOctOffset", "destOct", "note_default", "NoRomanNumeral", "cache", "get", "src", "parse", "NAMES", "isPitch", "fromPitch", "isNamed", "romanNumeral", "deprecate", "names", "major", "NAMES_MINOR", "pitch", "altToAcc", "REGEX", "tokenize", "str", "ROMANS", "name", "acc", "roman", "chordType", "upperRoman", "step", "alt", "accToAlt", "dir", "interval", "roman_numeral_default", "Empty", "NoKey", "NoKeyScale", "NoMajorKey", "NoMinorKey", "mapScaleToType", "scale", "list", "sep", "type", "i", "keyScale", "grades", "chords", "harmonicFunctions", "chordScales", "tonic", "intervals", "gr", "get", "interval", "transpose", "distInFifths", "from", "to", "f", "note", "t", "MajorScale", "NaturalScale", "HarmonicScale", "MelodicScale", "majorKey", "pc", "alteration", "romanInTonic", "src", "r", "altToAcc", "minorKey", "tnc", "majorTonicFromKeySignature", "sig", "transposeFifths", "accToAlt", "key_default", "MODES", "NoMode", "EmptyPcset", "modes", "toMode", "index", "mode", "alias", "get", "name", "deprecate", "all", "entries", "names", "modeNum", "setNum", "alt", "triad", "seventh", "aliases", "chroma", "notes", "modeName", "tonic", "ivl", "transpose", "chords", "triads", "rotate", "tonics", "i", "x", "seventhChords", "distance", "destination", "source", "from", "to", "simplify", "transposeFifths", "relativeTonic", "mode_default", "fromRomanNumerals", "tonic", "chords", "get", "rn", "transpose", "interval", "toRomanNumerals", "chord", "note", "chordType", "tokenize", "intervalName", "distance", "progression_default", "numeric", "notes", "midi", "compact", "toMidi", "result", "note", "last", "range", "chromatic", "options", "midiToNoteName", "range_default", "NoScale", "tokenize", "name", "i", "tonic", "note", "n", "type", "names", "get", "src", "tokens", "st", "notes", "transpose", "scale", "deprecate", "scaleChords", "s", "inScale", "isSubsetOf", "all", "chord", "extended", "isSuperset", "isSupersetOf", "reduced", "isSubset", "scaleNotes", "pcset", "x", "sortedUniqNames", "rotate", "modeNames", "tonics", "modes", "chroma", "modeName", "getNoteNameOf", "chromas", "noteOrMidi", "currNote", "fromMidi", "height", "position", "enharmonic", "rangeOf", "getName", "fromNote", "toNote", "from", "to", "range", "scale_default", "NONE", "NAMES", "names", "REGEX", "CACHE", "get", "literal", "stringifiedLiteral", "cached", "ts", "build", "parse", "_", "up", "low", "down", "denominator", "list", "n", "time_signature_default", "isPowerOfTwo", "x", "upper", "a", "b", "lower", "name", "additive", "type", "Tonal", "dist_exports", "PcSet", "pcset_default", "ChordDictionary", "chord_type_default", "ScaleDictionary", "scale_type_default"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tonal",
3
- "version": "4.7.2",
3
+ "version": "4.7.3",
4
4
  "description": "tonaljs music theory library",
5
5
  "keywords": [
6
6
  "music",
@@ -15,25 +15,25 @@
15
15
  ],
16
16
  "types": "dist/index.d.ts",
17
17
  "dependencies": {
18
- "@tonaljs/abc-notation": "^4.7.2",
19
- "@tonaljs/array": "^4.7.2",
20
- "@tonaljs/chord": "^4.7.2",
21
- "@tonaljs/chord-type": "^4.7.2",
22
- "@tonaljs/collection": "^4.7.2",
23
- "@tonaljs/core": "^4.7.2",
24
- "@tonaljs/duration-value": "^4.7.2",
25
- "@tonaljs/interval": "^4.7.2",
26
- "@tonaljs/key": "^4.7.2",
27
- "@tonaljs/midi": "^4.7.2",
28
- "@tonaljs/mode": "^4.7.2",
29
- "@tonaljs/note": "^4.7.2",
30
- "@tonaljs/pcset": "^4.7.2",
31
- "@tonaljs/progression": "^4.7.2",
32
- "@tonaljs/range": "^4.7.2",
33
- "@tonaljs/roman-numeral": "^4.7.2",
34
- "@tonaljs/scale": "^4.7.2",
35
- "@tonaljs/scale-type": "^4.7.2",
36
- "@tonaljs/time-signature": "^4.7.2"
18
+ "@tonaljs/abc-notation": "^4.7.3",
19
+ "@tonaljs/array": "^4.7.3",
20
+ "@tonaljs/chord": "^4.7.3",
21
+ "@tonaljs/chord-type": "^4.7.3",
22
+ "@tonaljs/collection": "^4.7.3",
23
+ "@tonaljs/core": "^4.7.3",
24
+ "@tonaljs/duration-value": "^4.7.3",
25
+ "@tonaljs/interval": "^4.7.3",
26
+ "@tonaljs/key": "^4.7.3",
27
+ "@tonaljs/midi": "^4.7.3",
28
+ "@tonaljs/mode": "^4.7.3",
29
+ "@tonaljs/note": "^4.7.3",
30
+ "@tonaljs/pcset": "^4.7.3",
31
+ "@tonaljs/progression": "^4.7.3",
32
+ "@tonaljs/range": "^4.7.3",
33
+ "@tonaljs/roman-numeral": "^4.7.3",
34
+ "@tonaljs/scale": "^4.7.3",
35
+ "@tonaljs/scale-type": "^4.7.3",
36
+ "@tonaljs/time-signature": "^4.7.3"
37
37
  },
38
38
  "author": "danigb@gmail.com",
39
39
  "license": "MIT",