-
Notifications
You must be signed in to change notification settings - Fork 1
/
poco.min.js
1 lines (1 loc) · 1.33 KB
/
poco.min.js
1
!function(){var n=function(){var e={},o=["C","C#","D","Eb","E","F","F#","G","Ab","A","Bb","B"],r=["","min","aug","dim","sus4","maj7","min7","7#5","7b5","dim7","7sus4","7","mM7","m7#5","m7b5","sus2","6","m6","9","6add9","m9","9#5","9b5","add9","maj7b5","7sus2","5","11","m11","13","m13","maj13","7#9","7b9","7b5b9","7#11","7b9b13","7#9#11","13b9","13b9b5"];this.count=0;var i=function(){teoria||console.error("Poco requires teoria."),n.count=0;for(var i in o)for(var a in r)for(var u=o[i]+r[a],s=teoria.chord(u),m=s.notes(),d=0;d<m.length;d++){m=t(m,d);var f=[];for(var b in m){var v=m[b];f.push(v.name()+v.accidental())}var h=d>0?u+("/"+m[0].name().toUpperCase()+m[0].accidental()):u;c(f,"bb","a#"),c(f,"c#","db"),f=f.join("-");var l=e[f];l?d<l.inversion?(l.othernames.push(l.name),l.name=h,l.inversion=d,e.chord=s):l.othernames.push(h):e[f]={name:h,t:s,othernames:[],inversion:d},n.count++}},t=function(n,e){if(e>0){for(var o in n){var r=n[o],i=r.name(),t=r.accidental(),u=i+t;n[o]=teoria.note(u)}return a(n,1)}return n},a=function(n,e){return 0===e?n:n.slice(e,n.length).concat(n.slice(0,e))},u=function(){e={}},c=function(n,e,o){var r=n.indexOf(e);~r&&(n[r]=o)},s=function(n){return e[n.join("-").toLowerCase()]};return{init:i,destroy:u,count:this.count,find:s}}();"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=n:window.poco=n}();