museaikit
Version:
A powerful music-focused AI toolkit
1 lines • 213 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@tensorflow/tfjs"),require("tone")):"function"==typeof define&&define.amd?define(["tf","Tone"],t):"object"==typeof exports?exports.piano_genie=t(require("@tensorflow/tfjs"),require("tone")):e.piano_genie=t(e.tf,e.Tone)}(self,((__WEBPACK_EXTERNAL_MODULE__6364__,__WEBPACK_EXTERNAL_MODULE__4446__)=>(()=>{var __webpack_modules__={381:e=>{"use strict";e.exports={}},488:(e,t,n)=>{"use strict";n(6364),n(1758),n(5447),n(8171),n(584),n(3920),n(2596)},584:(e,t,n)=>{"use strict";n.d(t,{Melody:()=>s,MelodyRhythm:()=>a,MelodyShape:()=>u});var r=n(6364),i=n(1758),o=n(2596);class s{events;minPitch;maxPitch;constructor(e,t,n){this.events=e,this.minPitch=t,this.maxPitch=n}static fromNoteSequence(e,t,n,r=!0,i){o.assertIsQuantizedSequence(e);const a=e.notes.sort(((e,t)=>e.quantizedStartStep===t.quantizedStartStep?t.pitch-e.pitch:e.quantizedStartStep-t.quantizedStartStep)),u=new Int32Array(i||e.totalQuantizedSteps);let c=-1;return a.forEach((e=>{if(e.quantizedStartStep===c){if(r)return;throw new Error("`NoteSequence` is not monophonic.")}if(e.pitch<t||e.pitch>n)throw Error(`\`NoteSequence\` has a pitch outside of the valid range: ${e.pitch}`);u[e.quantizedStartStep]=e.pitch-t+2,u[e.quantizedEndStep]=1,c=e.quantizedStartStep})),new s(u,t,n)}toNoteSequence(e,t){const n=o.createQuantizedNoteSequence(e,t);let r=null;for(let e=0;e<this.events.length;++e){const t=this.events[e];switch(t){case 0:break;case 1:r&&(r.quantizedEndStep=e,n.notes.push(r),r=null);break;default:r&&(r.quantizedEndStep=e,n.notes.push(r)),r=i.A.Note.create({pitch:t-2+this.minPitch,quantizedStartStep:e})}}return r&&(r.quantizedEndStep=this.events.length,n.notes.push(r)),n.totalQuantizedSteps=this.events.length,n}}class a{depth=1;extract(e){const t=e.events.length,n=r.buffer([t,1]);for(let r=0;r<t;++r)n.set(e.events[r]>=2?1:0,r,0);return n.toTensor().as2D(t,1)}}class u{depth=3;extract(e){const t=e.events.length,n=r.buffer([t,3]);let i=null,o=null;for(let r=0;r<t;++r)if(e.events[r]>=2){if(null!==i){let t;0===n.get(i,0)&&0===n.get(i,1)&&0===n.get(i,2)&&(i=-1),t=e.events[r]<o?0:e.events[r]>o?2:1;for(let e=r;e>i;--e)n.set(1,e,t)}i=r,o=e.events[r]}if(i!==t-1)if(null===i||0===n.get(i,0)&&0===n.get(i,1)&&0===n.get(i,2))for(let e=0;e<t;++e)n.set(1,e,1);else for(let e=t-1;e>i;--e)for(let t=0;t<3;t++)n.set(n.get(i,t),e,t);return n.toTensor().as2D(t,3)}}},649:(e,t,n)=>{t.parseMidi=n(9718),t.writeMidi=n(8062)},760:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(8871),i=new WeakMap,o=function(){function e(e,t){if(this.number=0,i.set(this,t),this.number=0,e){var n=e.find((function(e){return"programChange"===e.type}));n&&(this.number=n.programNumber)}}return Object.defineProperty(e.prototype,"name",{get:function(){return this.percussion?r.DrumKitByPatchID[this.number]:r.instrumentByPatchID[this.number]},set:function(e){var t=r.instrumentByPatchID.indexOf(e);-1!==t&&(this.number=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"family",{get:function(){return this.percussion?"drums":r.InstrumentFamilyByID[Math.floor(this.number/8)]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"percussion",{get:function(){return 9===i.get(this).channel},enumerable:!0,configurable:!0}),e.prototype.toJSON=function(){return{family:this.family,name:this.name,number:this.number}},e.prototype.fromJSON=function(e){this.number=e.number},e}();t.Instrument=o},955:(e,t,n)=>{"use strict";n.r(t),n.d(t,{userAgent:()=>r});const r=""},1137:(e,t,n)=>{"use strict";e.exports=u;var r,i=n(5382),o=i.LongBits,s=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function u(e){this.buf=e,this.pos=0,this.len=e.length}var c,l="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new u(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new u(e);throw Error("illegal buffer")},h=function(){return i.Buffer?function(e){return(u.create=function(e){return i.Buffer.isBuffer(e)?new r(e):l(e)})(e)}:l};function p(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function m(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(m(this.buf,this.pos+=4),m(this.buf,this.pos+=4))}u.create=h(),u.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,u.prototype.uint32=(c=4294967295,function(){if(c=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return c;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return c}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return m(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|m(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},u.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},u.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},u.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},u.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},u.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},u._configure=function(e){r=e,u.create=h(),r._configure();var t=i.Long?"toLong":"toNumber";i.merge(u.prototype,{int64:function(){return p.call(this)[t](!1)},uint64:function(){return p.call(this)[t](!0)},sint64:function(){return p.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},1705:(e,t)=>{"use strict";function n(e){return["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"][e%12]}Object.defineProperty(t,"__esModule",{value:!0});var r,i,o=(r=/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i,i={cbb:-2,cb:-1,c:0,"c#":1,cx:2,dbb:0,db:1,d:2,"d#":3,dx:4,ebb:2,eb:3,e:4,"e#":5,ex:6,fbb:3,fb:4,f:5,"f#":6,fx:7,gbb:5,gb:6,g:7,"g#":8,gx:9,abb:7,ab:8,a:9,"a#":10,ax:11,bbb:9,bb:10,b:11,"b#":12,bx:13},function(e){var t=r.exec(e),n=t[1],o=t[2];return i[n.toLowerCase()]+12*(parseInt(o,10)+1)}),s=new WeakMap,a=function(){function e(e,t,n){s.set(this,n),this.midi=e.midi,this.velocity=e.velocity,this.noteOffVelocity=t.velocity,this.ticks=e.ticks,this.durationTicks=t.ticks-e.ticks}return Object.defineProperty(e.prototype,"name",{get:function(){return e=this.midi,t=Math.floor(e/12)-1,n(e)+t.toString();var e,t},set:function(e){this.midi=o(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"octave",{get:function(){return Math.floor(this.midi/12)-1},set:function(e){var t=e-this.octave;this.midi+=12*t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pitch",{get:function(){return n(this.midi)},set:function(e){this.midi=12*(this.octave+1)+["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"].indexOf(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){var e=s.get(this);return e.ticksToSeconds(this.ticks+this.durationTicks)-e.ticksToSeconds(this.ticks)},set:function(e){var t=s.get(this).secondsToTicks(this.time+e);this.durationTicks=t-this.ticks},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"time",{get:function(){return s.get(this).ticksToSeconds(this.ticks)},set:function(e){var t=s.get(this);this.ticks=t.secondsToTicks(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bars",{get:function(){return s.get(this).ticksToMeasures(this.ticks)},enumerable:!0,configurable:!0}),e.prototype.toJSON=function(){return{duration:this.duration,durationTicks:this.durationTicks,midi:this.midi,name:this.name,ticks:this.ticks,time:this.time,velocity:this.velocity}},e}();t.Note=a},1720:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(649),s=n(8767),a=n(3752),u=n(5578),c=function(){function e(e){var t=this,n=null;e&&(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(n=o.parseMidi(e)).tracks.forEach((function(e){var t=0;e.forEach((function(e){t+=e.deltaTime,e.absoluteTime=t}))})),n.tracks=function(e){for(var t=[],n=0;n<e.length;n++)for(var r=t.length,i=new Map,o=Array(16).fill(0),s=0,a=e[n];s<a.length;s++){var u=a[s],c=r,l=u.channel;if(void 0!==l){"programChange"===u.type&&(o[l]=u.programNumber);var h=o[l]+" "+l;i.has(h)?c=i.get(h):(c=r+i.size,i.set(h,c))}t[c]||t.push([]),t[c].push(u)}return t}(n.tracks)),this.header=new a.Header(n),this.tracks=[],e&&(this.tracks=n.tracks.map((function(e){return new u.Track(e,t.header)})),1===n.header.format&&0===this.tracks[0].duration&&this.tracks.shift())}return e.fromUrl=function(t){return r(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return[4,fetch(t)];case 1:return(n=r.sent()).ok?[4,n.arrayBuffer()]:[3,3];case 2:return[2,new e(r.sent())];case 3:throw new Error("could not load "+t)}}))}))},Object.defineProperty(e.prototype,"name",{get:function(){return this.header.name},set:function(e){this.header.name=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){var e=this.tracks.map((function(e){return e.duration}));return Math.max.apply(Math,e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"durationTicks",{get:function(){var e=this.tracks.map((function(e){return e.durationTicks}));return Math.max.apply(Math,e)},enumerable:!0,configurable:!0}),e.prototype.addTrack=function(){var e=new u.Track(void 0,this.header);return this.tracks.push(e),e},e.prototype.toArray=function(){return s.encode(this)},e.prototype.toJSON=function(){return{header:this.header.toJSON(),tracks:this.tracks.map((function(e){return e.toJSON()}))}},e.prototype.fromJSON=function(e){var t=this;this.header=new a.Header,this.header.fromJSON(e.header),this.tracks=e.tracks.map((function(e){var n=new u.Track(void 0,t.header);return n.fromJSON(e),n}))},e.prototype.clone=function(){var t=new e;return t.fromJSON(this.toJSON()),t},e}();t.Midi=c;var l=n(5578);t.Track=l.Track;var h=n(3752);t.Header=h.Header},1758:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(7151),i=r.tensorflow.magenta.NoteSequence},1925:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},1979:(e,t)=>{"use strict";var n=t;n.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var r=new Array(64),i=new Array(123),o=0;o<64;)i[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;n.encode=function(e,t,n){for(var i,o=null,s=[],a=0,u=0;t<n;){var c=e[t++];switch(u){case 0:s[a++]=r[c>>2],i=(3&c)<<4,u=1;break;case 1:s[a++]=r[i|c>>4],i=(15&c)<<2,u=2;break;case 2:s[a++]=r[i|c>>6],s[a++]=r[63&c],u=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return u&&(s[a++]=r[i],s[a++]=61,1===u&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";n.decode=function(e,t,n){for(var r,o=n,a=0,u=0;u<e.length;){var c=e.charCodeAt(u++);if(61===c&&a>1)break;if(void 0===(c=i[c]))throw Error(s);switch(a){case 0:r=c,a=1;break;case 1:t[n++]=r<<2|(48&c)>>4,r=c,a=2;break;case 2:t[n++]=(15&r)<<4|(60&c)>>2,r=c,a=3;break;case 3:t[n++]=(3&r)<<6|c,a=0}}if(1===a)throw Error(s);return n-o},n.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},2596:(e,t,n)=>{"use strict";n.d(t,{assertIsQuantizedSequence:()=>S,assertIsRelativeQuantizedSequence:()=>b,clone:()=>h,createQuantizedNoteSequence:()=>P,isQuantizedSequence:()=>g,isRelativeQuantizedSequence:()=>y,quantizeNoteSequence:()=>d,unquantizeSequence:()=>w});var r=n(1758),i=n(5447);const o=.5;class s extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class a extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class u extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class c extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class l extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}function h(e){return r.A.decode(r.A.encode(e).finish())}function p(e,t,n=o){const r=e*t;return Math.floor(r+(1-n))}function m(e){return e.controlChanges.concat(e.textAnnotations)}function f(e){if(e.tempos&&0!==e.tempos.length){if(e.tempos.sort(((e,t)=>e.time-t.time)),0!==e.tempos[0].time&&e.tempos[0].qpm!==i.DEFAULT_QUARTERS_PER_MINUTE)throw new c(`NoteSequence has an implicit tempo change from initial ${i.DEFAULT_QUARTERS_PER_MINUTE} qpm to ${e.tempos[0].qpm} qpm at ${e.tempos[0].time} seconds.`);for(let t=1;t<e.tempos.length;t++)if(e.tempos[t].qpm!==e.tempos[0].qpm)throw new c(`NoteSequence has at least one tempo change from ${e.tempos[0].qpm} qpm to ${e.tempos[t].qpm}qpm at ${e.tempos[t].time} seconds.`)}}function d(e,t){const n=h(e);if(n.quantizationInfo=r.A.QuantizationInfo.create({stepsPerQuarter:t}),n.timeSignatures.length>0){if(n.timeSignatures.sort(((e,t)=>e.time-t.time)),0!==n.timeSignatures[0].time&&(4!==n.timeSignatures[0].numerator||4!==n.timeSignatures[0].denominator))throw new s(`NoteSequence has an implicit change from initial 4/4 time signature to ${n.timeSignatures[0].numerator}/${n.timeSignatures[0].denominator} at ${n.timeSignatures[0].time} seconds.`);for(let e=1;e<n.timeSignatures.length;e++){const t=n.timeSignatures[e];if(t.numerator!==n.timeSignatures[0].numerator||t.denominator!==n.timeSignatures[0].denominator)throw new s(`NoteSequence has at least one time signature change from ${n.timeSignatures[0].numerator}/${n.timeSignatures[0].denominator} to ${t.numerator}/${t.denominator} at ${t.time} seconds`)}n.timeSignatures[0].time=0,n.timeSignatures=[n.timeSignatures[0]]}else{const e=r.A.TimeSignature.create({numerator:4,denominator:4,time:0});n.timeSignatures.push(e)}const o=n.timeSignatures[0];if(!(c=o.denominator)||c&c-1)throw new a(`Denominator is not a power of 2. Time signature: ${o.numerator}/${o.denominator}`);var c;if(0===o.numerator)throw new a(`Numerator is 0. Time signature: ${o.numerator}/${o.denominator}`);if(n.tempos.length>0)f(n),n.tempos[0].time=0,n.tempos=[n.tempos[0]];else{const e=r.A.Tempo.create({qpm:i.DEFAULT_QUARTERS_PER_MINUTE,time:0});n.tempos.push(e)}const l=function(e,t){return e*t/60}(t,n.tempos[0].qpm);return n.totalQuantizedSteps=p(e.totalTime,l),function(e,t){for(const n of e.notes){if(n.quantizedStartStep=p(n.startTime,t),n.quantizedEndStep=p(n.endTime,t),n.quantizedEndStep===n.quantizedStartStep&&(n.quantizedEndStep+=1),n.quantizedStartStep<0||n.quantizedEndStep<0)throw new u(`Got negative note time: start_step = ${n.quantizedStartStep}, end_step = ${n.quantizedEndStep}`);n.quantizedEndStep>e.totalQuantizedSteps&&(e.totalQuantizedSteps=n.quantizedEndStep)}m(e).forEach((e=>{if(e.quantizedStep=p(e.time,t),e.quantizedStep<0)throw new u(`Got negative event time: step = ${e.quantizedStep}`)}))}(n,l),n}function g(e){return e.quantizationInfo&&(e.quantizationInfo.stepsPerQuarter>0||e.quantizationInfo.stepsPerSecond>0)}function S(e){if(!g(e))throw new l(`NoteSequence ${e.id} is not quantized (missing quantizationInfo)`)}function y(e){return e.quantizationInfo&&e.quantizationInfo.stepsPerQuarter>0}function b(e){if(!y(e))throw new l(`NoteSequence ${e.id} is not quantized or is quantized based on absolute timing`)}function w(e,t){b(e),f(e);const n=h(e);t?n.tempos&&n.tempos.length>0?n.tempos[0].qpm=t:n.tempos.push(r.A.Tempo.create({time:0,qpm:t})):t=e.tempos&&e.tempos.length>0?n.tempos[0].qpm:i.DEFAULT_QUARTERS_PER_MINUTE;const o=e=>e/n.quantizationInfo.stepsPerQuarter*(60/t);return n.totalTime=o(n.totalQuantizedSteps),n.notes.forEach((e=>{e.startTime=o(e.quantizedStartStep),e.endTime=o(e.quantizedEndStep),n.totalTime=Math.max(n.totalTime,e.endTime),delete e.quantizedStartStep,delete e.quantizedEndStep})),m(n).forEach((e=>{e.time=o(e.time)})),delete n.totalQuantizedSteps,delete n.quantizationInfo,n}function P(e=i.DEFAULT_STEPS_PER_QUARTER,t=i.DEFAULT_QUARTERS_PER_MINUTE){return r.A.create({quantizationInfo:{stepsPerQuarter:e},tempos:[{qpm:t}]})}},2623:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3248);t.createControlChanges=function(){return new Proxy({},{get:function(e,t){return e[t]?e[t]:r.controlChangeIds.hasOwnProperty(t)?e[r.controlChangeIds[t]]:void 0},set:function(e,t,n){return r.controlChangeIds.hasOwnProperty(t)?e[r.controlChangeIds[t]]=n:e[t]=n,!0}})}},2971:(e,t)=>{"use strict";var n=t;n.length=function(e){for(var t=0,n=0,r=0;r<e.length;++r)(n=e.charCodeAt(r))<128?t+=1:n<2048?t+=2:55296==(64512&n)&&56320==(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},n.read=function(e,t,n){if(n-t<1)return"";for(var r,i=null,o=[],s=0;t<n;)(r=e[t++])<128?o[s++]=r:r>191&&r<224?o[s++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(r>>10),o[s++]=56320+(1023&r)):o[s++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))},n.write=function(e,t,n){for(var r,i,o=n,s=0;s<e.length;++s)(r=e.charCodeAt(s))<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&56320==(64512&(i=e.charCodeAt(s+1)))?(r=65536+((1023&r)<<10)+(1023&i),++s,t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128);return n-o}},3248:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.controlChangeNames={1:"modulationWheel",2:"breath",4:"footController",5:"portamentoTime",7:"volume",8:"balance",10:"pan",64:"sustain",65:"portamentoTime",66:"sostenuto",67:"softPedal",68:"legatoFootswitch",84:"portamentoControl"},t.controlChangeIds=Object.keys(t.controlChangeNames).reduce((function(e,n){return e[t.controlChangeNames[n]]=n,e}),{});var n=new WeakMap,r=new WeakMap,i=function(){function e(e,t){n.set(this,t),r.set(this,e.controllerType),this.ticks=e.absoluteTime,this.value=e.value}return Object.defineProperty(e.prototype,"number",{get:function(){return r.get(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return t.controlChangeNames[this.number]?t.controlChangeNames[this.number]:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"time",{get:function(){return n.get(this).ticksToSeconds(this.ticks)},set:function(e){var t=n.get(this);this.ticks=t.secondsToTicks(e)},enumerable:!0,configurable:!0}),e.prototype.toJSON=function(){return{number:this.number,ticks:this.ticks,time:this.time,value:this.value}},e}();t.ControlChange=i},3331:e=>{"use strict";function t(e){return r(e,[])}function n(e,t){if("number"!=typeof t)throw new TypeError("Expected the depth to be a number");return i(e,[],t)}function r(e,t){for(var n=0;n<e.length;n++){var i=e[n];Array.isArray(i)?r(i,t):t.push(i)}return t}function i(e,t,n){n--;for(var r=0;r<e.length;r++){var o=e[r];n>-1&&Array.isArray(o)?i(o,t,n):t.push(o)}return t}e.exports=function(e){if(!Array.isArray(e))throw new TypeError("Expected value to be an array");return t(e)},e.exports.from=t,e.exports.depth=function(e,t){if(!Array.isArray(e))throw new TypeError("Expected value to be an array");return n(e,t)},e.exports.fromDepth=n},3474:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var n=this._listeners[e],r=0;r<n.length;)n[r].fn===t?n.splice(r,1):++r;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,n)}return this}},3576:(e,t,n)=>{"use strict";n(6364);var r="C C# Db D D# Eb E F F# Gb G G# Ab A A# Bb B".split(" "),i=function(e){return"string"!=typeof e?r.slice():r.filter((function(t){var n=t[1]||" ";return-1!==e.indexOf(n)}))},o=(i(" #"),i(" b"),/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/);var s=Object.freeze({pc:null,name:null,step:null,alt:null,oct:null,octStr:null,chroma:null,midi:null,freq:null}),a=[0,2,4,5,7,9,11],u=function(e,t){return void 0===t&&(t={}),function(n){return t[n]||(t[n]=e(n))}}((function(e){var t=function(e){"string"!=typeof e&&(e="");var t=o.exec(e);return[t[1].toUpperCase(),t[2].replace(/x/g,"##"),t[3],t[4]]}(e);if(""===t[0]||""!==t[3])return s;var n=t[0],r=t[1],i=t[2],u={letter:n,acc:r,octStr:i,pc:n+r,name:n+r+i,step:(n.charCodeAt(0)+3)%7,alt:"b"===r[0]?-r.length:r.length,oct:i.length?+i:null,chroma:0,midi:null,freq:null};return u.chroma=(a[u.step]+u.alt+120)%12,u.midi=null!==u.oct?a[u.step]+u.alt+12*(u.oct+1):null,u.freq=c(u.midi),Object.freeze(u)})),c=function(e,t){return void 0===t&&(t=440),"number"==typeof e?Math.pow(2,(e-69)/12)*t:null};Math.log(2),Math.log(440);var l=new RegExp("^([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})|(AA|A|P|M|m|d|dd)([-+]?\\d+)$"),h=[0,2,4,5,7,9,11],p="PMMPPMM",m=("1P 2m 2M 3m 3M 4P 5P 6m 6M 7m 7M 8P".split(" "),Object.freeze({name:null,num:null,q:null,step:null,alt:null,dir:null,type:null,simple:null,semitones:null,chroma:null,oct:null})),f=function(e){return(Math.abs(e)-1)%7},d=function(e){var t=function(e){var t=l.exec(""+e);return null===t?null:t[1]?[t[1],t[2]]:[t[4],t[3]]}(e);if(null===t)return m;var n,r,i={num:0,q:"d",name:"",type:"M",step:0,dir:-1,simple:1,alt:0,oct:0,semitones:0,chroma:0,ic:0};return i.num=+t[0],i.q=t[1],i.step=f(i.num),i.type=p[i.step],"M"===i.type&&"P"===i.q?m:(i.name=""+i.num+i.q,i.dir=i.num<0?-1:1,i.simple=8===i.num||-8===i.num?i.num:i.dir*(i.step+1),i.alt=(n=i.type,"M"===(r=i.q)&&"M"===n||"P"===r&&"P"===n?0:"m"===r&&"M"===n?-1:/^A+$/.test(r)?r.length:/^d+$/.test(r)?"P"===n?-r.length:-r.length-1:null),i.oct=Math.floor((Math.abs(i.num)-1)/7),i.semitones=i.dir*(h[i.step]+i.alt+12*i.oct),i.chroma=(i.dir*(h[i.step]+i.alt)%12+12)%12,Object.freeze(i))},g={};function S(e){return"string"!=typeof e?m:g[e]||(g[e]=d(e))}"P m M m M P d P m M m M".split(" ");var y=[0,2,4,-1,1,3,5],b=y.map((function(e){return Math.floor(7*e/12)}));var w=function(e){return function(e,t){return void 0===t&&(t={}),function(n){return t[n]||(t[n]=e(n))}}((function(t){var n=e(t);return null===n.name?null:function(e){var t=e.step,n=e.alt,r=e.oct,i=e.dir;void 0===i&&(i=1);var o=y[t]+7*n;return null===r?[i*o]:[i*o,i*(r-b[t]-4*n)]}(n)}))};w(u),w(S);const P=JSON.parse('{"chromatic":["1P 2m 2M 3m 3M 4P 4A 5P 6m 6M 7m 7M"],"lydian":["1P 2M 3M 4A 5P 6M 7M"],"major":["1P 2M 3M 4P 5P 6M 7M",["ionian"]],"mixolydian":["1P 2M 3M 4P 5P 6M 7m",["dominant"]],"dorian":["1P 2M 3m 4P 5P 6M 7m"],"aeolian":["1P 2M 3m 4P 5P 6m 7m",["minor"]],"phrygian":["1P 2m 3m 4P 5P 6m 7m"],"locrian":["1P 2m 3m 4P 5d 6m 7m"],"melodic minor":["1P 2M 3m 4P 5P 6M 7M"],"melodic minor second mode":["1P 2m 3m 4P 5P 6M 7m"],"lydian augmented":["1P 2M 3M 4A 5A 6M 7M"],"lydian dominant":["1P 2M 3M 4A 5P 6M 7m",["lydian b7"]],"melodic minor fifth mode":["1P 2M 3M 4P 5P 6m 7m",["hindu","mixolydian b6M"]],"locrian #2":["1P 2M 3m 4P 5d 6m 7m",["half-diminished"]],"altered":["1P 2m 3m 3M 5d 6m 7m",["super locrian","diminished whole tone","pomeroy"]],"harmonic minor":["1P 2M 3m 4P 5P 6m 7M"],"phrygian dominant":["1P 2m 3M 4P 5P 6m 7m",["spanish","phrygian major"]],"half-whole diminished":["1P 2m 3m 3M 4A 5P 6M 7m",["dominant diminished"]],"diminished":["1P 2M 3m 4P 5d 6m 6M 7M",["whole-half diminished"]],"major pentatonic":["1P 2M 3M 5P 6M",["pentatonic"]],"lydian pentatonic":["1P 3M 4A 5P 7M",["chinese"]],"mixolydian pentatonic":["1P 3M 4P 5P 7m",["indian"]],"locrian pentatonic":["1P 3m 4P 5d 7m",["minor seven flat five pentatonic"]],"minor pentatonic":["1P 3m 4P 5P 7m"],"minor six pentatonic":["1P 3m 4P 5P 6M"],"minor hexatonic":["1P 2M 3m 4P 5P 7M"],"flat three pentatonic":["1P 2M 3m 5P 6M",["kumoi"]],"flat six pentatonic":["1P 2M 3M 5P 6m"],"major flat two pentatonic":["1P 2m 3M 5P 6M"],"whole tone pentatonic":["1P 3M 5d 6m 7m"],"ionian pentatonic":["1P 3M 4P 5P 7M"],"lydian #5P pentatonic":["1P 3M 4A 5A 7M"],"lydian dominant pentatonic":["1P 3M 4A 5P 7m"],"minor #7M pentatonic":["1P 3m 4P 5P 7M"],"super locrian pentatonic":["1P 3m 4d 5d 7m"],"in-sen":["1P 2m 4P 5P 7m"],"iwato":["1P 2m 4P 5d 7m"],"hirajoshi":["1P 2M 3m 5P 6m"],"kumoijoshi":["1P 2m 4P 5P 6m"],"pelog":["1P 2m 3m 5P 6m"],"vietnamese 1":["1P 3m 4P 5P 6m"],"vietnamese 2":["1P 3m 4P 5P 7m"],"prometheus":["1P 2M 3M 4A 6M 7m"],"prometheus neopolitan":["1P 2m 3M 4A 6M 7m"],"ritusen":["1P 2M 4P 5P 6M"],"scriabin":["1P 2m 3M 5P 6M"],"piongio":["1P 2M 4P 5P 6M 7m"],"major blues":["1P 2M 3m 3M 5P 6M"],"minor blues":["1P 3m 4P 5d 5P 7m",["blues"]],"composite blues":["1P 2M 3m 3M 4P 5d 5P 6M 7m"],"augmented":["1P 2A 3M 5P 5A 7M"],"augmented heptatonic":["1P 2A 3M 4P 5P 5A 7M"],"dorian #4":["1P 2M 3m 4A 5P 6M 7m"],"lydian diminished":["1P 2M 3m 4A 5P 6M 7M"],"whole tone":["1P 2M 3M 4A 5A 7m"],"leading whole tone":["1P 2M 3M 4A 5A 7m 7M"],"lydian minor":["1P 2M 3M 4A 5P 6m 7m"],"locrian major":["1P 2M 3M 4P 5d 6m 7m",["arabian"]],"neopolitan":["1P 2m 3m 4P 5P 6m 7M"],"neopolitan minor":["1P 2m 3m 4P 5P 6m 7M"],"neopolitan major":["1P 2m 3m 4P 5P 6M 7M",["dorian b2"]],"neopolitan major pentatonic":["1P 3M 4P 5d 7m"],"romanian minor":["1P 2M 3m 5d 5P 6M 7m"],"double harmonic lydian":["1P 2m 3M 4A 5P 6m 7M"],"harmonic major":["1P 2M 3M 4P 5P 6m 7M"],"double harmonic major":["1P 2m 3M 4P 5P 6m 7M",["gypsy"]],"egyptian":["1P 2M 4P 5P 7m"],"hungarian minor":["1P 2M 3m 4A 5P 6m 7M"],"hungarian major":["1P 2A 3M 4A 5P 6M 7m"],"oriental":["1P 2m 3M 4P 5d 6M 7m"],"spanish heptatonic":["1P 2m 3m 3M 4P 5P 6m 7m"],"flamenco":["1P 2m 3m 3M 4A 5P 7m"],"balinese":["1P 2m 3m 4P 5P 6m 7M"],"todi raga":["1P 2m 3m 4A 5P 6m 7M"],"malkos raga":["1P 3m 4P 6m 7m"],"kafi raga":["1P 3m 3M 4P 5P 6M 7m 7M"],"purvi raga":["1P 2m 3M 4P 4A 5P 6m 7M"],"persian":["1P 2m 3M 4P 5d 6m 7M"],"bebop":["1P 2M 3M 4P 5P 6M 7m 7M"],"bebop dominant":["1P 2M 3M 4P 5P 6M 7m 7M"],"bebop minor":["1P 2M 3m 3M 4P 5P 6M 7m"],"bebop major":["1P 2M 3M 4P 5P 5A 6M 7M"],"bebop locrian":["1P 2m 3m 4P 5d 5P 6m 7m"],"minor bebop":["1P 2M 3m 4P 5P 6m 7m 7M"],"mystery #1":["1P 2m 3M 5d 6m 7m"],"enigmatic":["1P 2m 3M 5d 6m 7m 7M"],"minor six diminished":["1P 2M 3m 4P 5P 6m 6M 7M"],"ionian augmented":["1P 2M 3M 4P 5A 6M 7M"],"lydian #9":["1P 2m 3M 4A 5P 6M 7M"],"ichikosucho":["1P 2M 3M 4P 5d 5P 6M 7M"],"six tone symmetric":["1P 2m 3M 4P 5A 6M"]}'),N=JSON.parse('{"4":["1P 4P 7m 10m",["quartal"]],"5":["1P 5P"],"7":["1P 3M 5P 7m",["Dominant","Dom"]],"9":["1P 3M 5P 7m 9M",["79"]],"11":["1P 5P 7m 9M 11P"],"13":["1P 3M 5P 7m 9M 13M",["13_"]],"64":["5P 8P 10M"],"M":["1P 3M 5P",["Major",""]],"M#5":["1P 3M 5A",["augmented","maj#5","Maj#5","+","aug"]],"M#5add9":["1P 3M 5A 9M",["+add9"]],"M13":["1P 3M 5P 7M 9M 13M",["maj13","Maj13"]],"M13#11":["1P 3M 5P 7M 9M 11A 13M",["maj13#11","Maj13#11","M13+4","M13#4"]],"M6":["1P 3M 5P 13M",["6"]],"M6#11":["1P 3M 5P 6M 11A",["M6b5","6#11","6b5"]],"M69":["1P 3M 5P 6M 9M",["69"]],"M69#11":["1P 3M 5P 6M 9M 11A"],"M7#11":["1P 3M 5P 7M 11A",["maj7#11","Maj7#11","M7+4","M7#4"]],"M7#5":["1P 3M 5A 7M",["maj7#5","Maj7#5","maj9#5","M7+"]],"M7#5sus4":["1P 4P 5A 7M"],"M7#9#11":["1P 3M 5P 7M 9A 11A"],"M7add13":["1P 3M 5P 6M 7M 9M"],"M7b5":["1P 3M 5d 7M"],"M7b6":["1P 3M 6m 7M"],"M7b9":["1P 3M 5P 7M 9m"],"M7sus4":["1P 4P 5P 7M"],"M9":["1P 3M 5P 7M 9M",["maj9","Maj9"]],"M9#11":["1P 3M 5P 7M 9M 11A",["maj9#11","Maj9#11","M9+4","M9#4"]],"M9#5":["1P 3M 5A 7M 9M",["Maj9#5"]],"M9#5sus4":["1P 4P 5A 7M 9M"],"M9b5":["1P 3M 5d 7M 9M"],"M9sus4":["1P 4P 5P 7M 9M"],"Madd9":["1P 3M 5P 9M",["2","add9","add2"]],"Maj7":["1P 3M 5P 7M",["maj7","M7"]],"Mb5":["1P 3M 5d"],"Mb6":["1P 3M 13m"],"Msus2":["1P 2M 5P",["add9no3","sus2"]],"Msus4":["1P 4P 5P",["sus","sus4"]],"Maddb9":["1P 3M 5P 9m"],"11b9":["1P 5P 7m 9m 11P"],"13#11":["1P 3M 5P 7m 9M 11A 13M",["13+4","13#4"]],"13#9":["1P 3M 5P 7m 9A 13M",["13#9_"]],"13#9#11":["1P 3M 5P 7m 9A 11A 13M"],"13b5":["1P 3M 5d 6M 7m 9M"],"13b9":["1P 3M 5P 7m 9m 13M"],"13b9#11":["1P 3M 5P 7m 9m 11A 13M"],"13no5":["1P 3M 7m 9M 13M"],"13sus4":["1P 4P 5P 7m 9M 13M",["13sus"]],"69#11":["1P 3M 5P 6M 9M 11A"],"7#11":["1P 3M 5P 7m 11A",["7+4","7#4","7#11_","7#4_"]],"7#11b13":["1P 3M 5P 7m 11A 13m",["7b5b13"]],"7#5":["1P 3M 5A 7m",["+7","7aug","aug7"]],"7#5#9":["1P 3M 5A 7m 9A",["7alt","7#5#9_","7#9b13_"]],"7#5b9":["1P 3M 5A 7m 9m"],"7#5b9#11":["1P 3M 5A 7m 9m 11A"],"7#5sus4":["1P 4P 5A 7m"],"7#9":["1P 3M 5P 7m 9A",["7#9_"]],"7#9#11":["1P 3M 5P 7m 9A 11A",["7b5#9"]],"7#9#11b13":["1P 3M 5P 7m 9A 11A 13m"],"7#9b13":["1P 3M 5P 7m 9A 13m"],"7add6":["1P 3M 5P 7m 13M",["67","7add13"]],"7b13":["1P 3M 7m 13m"],"7b5":["1P 3M 5d 7m"],"7b6":["1P 3M 5P 6m 7m"],"7b9":["1P 3M 5P 7m 9m"],"7b9#11":["1P 3M 5P 7m 9m 11A",["7b5b9"]],"7b9#9":["1P 3M 5P 7m 9m 9A"],"7b9b13":["1P 3M 5P 7m 9m 13m"],"7b9b13#11":["1P 3M 5P 7m 9m 11A 13m",["7b9#11b13","7b5b9b13"]],"7no5":["1P 3M 7m"],"7sus4":["1P 4P 5P 7m",["7sus"]],"7sus4b9":["1P 4P 5P 7m 9m",["susb9","7susb9","7b9sus","7b9sus4","phryg"]],"7sus4b9b13":["1P 4P 5P 7m 9m 13m",["7b9b13sus4"]],"9#11":["1P 3M 5P 7m 9M 11A",["9+4","9#4","9#11_","9#4_"]],"9#11b13":["1P 3M 5P 7m 9M 11A 13m",["9b5b13"]],"9#5":["1P 3M 5A 7m 9M",["9+"]],"9#5#11":["1P 3M 5A 7m 9M 11A"],"9b13":["1P 3M 7m 9M 13m"],"9b5":["1P 3M 5d 7m 9M"],"9no5":["1P 3M 7m 9M"],"9sus4":["1P 4P 5P 7m 9M",["9sus"]],"m":["1P 3m 5P"],"m#5":["1P 3m 5A",["m+","mb6"]],"m11":["1P 3m 5P 7m 9M 11P",["_11"]],"m11A 5":["1P 3m 6m 7m 9M 11P"],"m11b5":["1P 3m 7m 12d 2M 4P",["h11","_11b5"]],"m13":["1P 3m 5P 7m 9M 11P 13M",["_13"]],"m6":["1P 3m 4P 5P 13M",["_6"]],"m69":["1P 3m 5P 6M 9M",["_69"]],"m7":["1P 3m 5P 7m",["minor7","_","_7"]],"m7#5":["1P 3m 6m 7m"],"m7add11":["1P 3m 5P 7m 11P",["m7add4"]],"m7b5":["1P 3m 5d 7m",["half-diminished","h7","_7b5"]],"m9":["1P 3m 5P 7m 9M",["_9"]],"m9#5":["1P 3m 6m 7m 9M"],"m9b5":["1P 3m 7m 12d 2M",["h9","-9b5"]],"mMaj7":["1P 3m 5P 7M",["mM7","_M7"]],"mMaj7b6":["1P 3m 5P 6m 7M",["mM7b6"]],"mM9":["1P 3m 5P 7M 9M",["mMaj9","-M9"]],"mM9b6":["1P 3m 5P 6m 7M 9M",["mMaj9b6"]],"mb6M7":["1P 3m 6m 7M"],"mb6b9":["1P 3m 6m 9m"],"o":["1P 3m 5d",["mb5","dim"]],"o7":["1P 3m 5d 13M",["diminished","m6b5","dim7"]],"o7M7":["1P 3m 5d 6M 7M"],"oM7":["1P 3m 5d 7M"],"sus24":["1P 2M 4P 5P",["sus4add9"]],"+add#9":["1P 3M 5A 9A"],"madd4":["1P 3m 4P 5P"],"madd9":["1P 3m 5P 9M"]}');var T=function(e){return function(e){return u(e).chroma}(e)||function(e){return S(e).chroma}(e)||0};function A(e){if(I(e))return e;if(!Array.isArray(e))return"";var t=[0,0,0,0,0,0,0,0,0,0,0,0];return e.map(T).forEach((function(e){t[e]=1})),t.join("")}var v=/^[01]{12}$/;function I(e){return v.test(e)}"1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M".split(" ");var M,O,k,_=function(e){var t=Object.keys(e).sort(),n=[],r=[],i=function(e,t,i){n[e]=t,r[i]=r[i]||[],r[i].push(e)};t.forEach((function(t){var n=e[t][0].split(" "),r=e[t][1],o=A(n);i(t,n,o),r&&r.forEach((function(e){return i(e,n,o)}))}));var o=Object.keys(n).sort(),s=function(e){return n[e]};return s.names=function(e){return"string"==typeof e?(r[e]||[]).slice():(!0===e?o:t).slice()},s},E=_(P),q=_(N),x=(M=E,O=q,(k=function(e){return M(e)||O(e)}).names=function(e){return M.names(e).concat(O.names(e))},Object.freeze({name:null,intervals:[],names:[],chroma:null,setnum:null}));E.names;q.names;var C=Object.freeze({name:null,names:[],intervals:[],chroma:null,setnum:null});!function(e,t){void 0===t&&(t={})}((function(e){var t=q(e);if(!t)return C;var n={intervals:t,name:e};return n.chroma=A(t),n.setnum=parseInt(n.chroma,2),n.names=q.names(n.chroma),n}));n(5447);var L;!function(e){e[e.Major=0]="Major",e[e.Minor=1]="Minor",e[e.Augmented=2]="Augmented",e[e.Diminished=3]="Diminished",e[e.Other=4]="Other"}(L||(L={}));Error;Error},3752:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(7488),i=new WeakMap;t.keySignatureKeys=["Cb","Gb","Db","Ab","Eb","Bb","F","C","G","D","A","E","B","F#","C#"];var o=function(){function e(e){var n=this;this.tempos=[],this.timeSignatures=[],this.keySignatures=[],this.meta=[],this.name="",i.set(this,480),e&&(i.set(this,e.header.ticksPerBeat),e.tracks.forEach((function(e){return e.forEach((function(e){e.meta&&("timeSignature"===e.type?n.timeSignatures.push({ticks:e.absoluteTime,timeSignature:[e.numerator,e.denominator]}):"setTempo"===e.type?n.tempos.push({bpm:6e7/e.microsecondsPerBeat,ticks:e.absoluteTime}):"keySignature"===e.type&&n.keySignatures.push({key:t.keySignatureKeys[e.key+7],scale:0===e.scale?"major":"minor",ticks:e.absoluteTime}))}))})),e.tracks[0].forEach((function(e){e.meta&&("trackName"===e.type?n.name=e.text:"text"!==e.type&&"cuePoint"!==e.type&&"marker"!==e.type&&"lyrics"!==e.type||n.meta.push({text:e.text,ticks:e.absoluteTime,type:e.type}))})),this.update())}return e.prototype.update=function(){var e=this,t=0,n=0;this.tempos.sort((function(e,t){return e.ticks-t.ticks})),this.tempos.forEach((function(r,i){var o=i>0?e.tempos[i-1].bpm:e.tempos[0].bpm,s=r.ticks/e.ppq-n,a=60/o*s;r.time=a+t,t=r.time,n+=s})),this.timeSignatures.sort((function(e,t){return e.ticks-t.ticks})),this.timeSignatures.forEach((function(t,n){var r=n>0?e.timeSignatures[n-1]:e.timeSignatures[0],i=(t.ticks-r.ticks)/e.ppq/r.timeSignature[0]/(r.timeSignature[1]/4);r.measures=r.measures||0,t.measures=i+r.measures}))},e.prototype.ticksToSeconds=function(e){var t=r.search(this.tempos,e);if(-1!==t){var n=this.tempos[t],i=n.time,o=(e-n.ticks)/this.ppq;return i+60/n.bpm*o}return.5*(e/this.ppq)},e.prototype.ticksToMeasures=function(e){var t=r.search(this.timeSignatures,e);if(-1!==t){var n=this.timeSignatures[t],i=(e-n.ticks)/this.ppq;return n.measures+i/(n.timeSignature[0]/n.timeSignature[1])/4}return e/this.ppq/4},Object.defineProperty(e.prototype,"ppq",{get:function(){return i.get(this)},enumerable:!0,configurable:!0}),e.prototype.secondsToTicks=function(e){var t=r.search(this.tempos,e,"time");if(-1!==t){var n=this.tempos[t],i=(e-n.time)/(60/n.bpm);return Math.round(n.ticks+i*this.ppq)}var o=e/.5;return Math.round(o*this.ppq)},e.prototype.toJSON=function(){return{keySignatures:this.keySignatures,meta:this.meta,name:this.name,ppq:this.ppq,tempos:this.tempos.map((function(e){return{bpm:e.bpm,ticks:e.ticks}})),timeSignatures:this.timeSignatures}},e.prototype.fromJSON=function(e){this.name=e.name,this.tempos=e.tempos.map((function(e){return Object.assign({},e)})),this.timeSignatures=e.timeSignatures.map((function(e){return Object.assign({},e)})),this.keySignatures=e.keySignatures.map((function(e){return Object.assign({},e)})),this.meta=e.meta.map((function(e){return Object.assign({},e)})),i.set(this,e.ppq),this.update()},e.prototype.setTempo=function(e){this.tempos=[{bpm:e,ticks:0}],this.update()},e}();t.Header=o},3918:(e,t,n)=>{"use strict";n.r(t),n.d(t,{now:()=>i,timing:()=>o});const r=global.process.hrtime(),i=()=>{const e=global.process.hrtime(r);return e[0]+e[1]/1e9},o={navigationStart:Date.now()}},3920:(e,t,n)=>{"use strict";n.d(t,{Performance:()=>a});var r=n(1758),i=n(5447),o=n(2596),s=n(8171);class a{events;maxShiftSteps;numVelocityBins;program;isDrum;constructor(e,t,n,r,i){this.events=e,this.maxShiftSteps=t,this.numVelocityBins=n,this.program=r,this.isDrum=i}static fromNoteSequence(e,t,n,r){o.assertIsQuantizedSequence(e);const s=e.notes.filter(((e,t)=>void 0===r||e.instrument===r)),u=s.sort(((e,t)=>e.startTime===t.startTime?e.pitch-t.pitch:e.startTime-t.startTime)),c=u.map(((e,t)=>({step:e.quantizedStartStep,index:t,isOffset:0}))),l=u.map(((e,t)=>({step:e.quantizedEndStep,index:t,isOffset:1}))),h=c.concat(l).sort(((e,t)=>e.step===t.step?e.index===t.index?e.isOffset-t.isOffset:e.index-t.index:e.step-t.step)),p=n?Math.ceil((i.MIDI_VELOCITIES-1)/n):void 0,m=[];let f=0,d=n;for(const e of h){if(e.step>f){for(;e.step>f+t;)m.push({type:"time-shift",steps:t}),f+=t;m.push({type:"time-shift",steps:e.step-f}),f=e.step}if(e.isOffset)m.push({type:"note-off",pitch:u[e.index].pitch});else{if(p){const t=Math.floor((u[e.index].velocity-i.MIN_MIDI_VELOCITY-1)/p)+1;t!==d&&(m.push({type:"velocity-change",velocityBin:t}),d=t)}m.push({type:"note-on",pitch:u[e.index].pitch})}}const g=!!s.some((e=>e.isDrum))&&(!s.some((e=>!e.isDrum))||void 0),S=Array.from(new Set(s.map((e=>e.program)))),y=g||1!==S.length?void 0:S[0],b=new a(m,t,n,y,g);return b.setNumSteps(e.totalQuantizedSteps),b}getNumSteps(){return this.events.filter((e=>"time-shift"===e.type)).map((e=>e.steps)).reduce(((e,t)=>e+t),0)}setNumSteps(e){let t=this.getNumSteps();if(t<e){if(this.events.length){const n=this.events[this.events.length-1];if("time-shift"===n.type){const r=Math.min(e-t,this.maxShiftSteps-n.steps);n.steps+=r,t+=r}}for(;t<e;)t+this.maxShiftSteps>e?(this.events.push({type:"time-shift",steps:e-t}),t=e):(this.events.push({type:"time-shift",steps:this.maxShiftSteps}),t+=this.maxShiftSteps)}else if(t>e)for(;this.events.length&&t>e;){const n=this.events[this.events.length-1];"time-shift"===n.type?t-n.steps<e?(n.steps-=t-e,t=e):(this.events.pop(),t-=n.steps):this.events.pop()}}toNoteSequence(e){const t=this.numVelocityBins?Math.ceil((i.MIDI_VELOCITIES-1)/this.numVelocityBins):void 0,n=r.A.create();let o,a=0;const u=new Map;for(let e=i.MIN_MIDI_PITCH;e<=i.MAX_MIDI_PITCH;++e)u.set(e,[]);for(const c of this.events)switch(c.type){case"note-on":u.get(c.pitch).push([a,o]);break;case"note-off":{const t=u.get(c.pitch);if(t.length){const[i,o]=t.shift();a>i?n.notes.push(r.A.Note.create({pitch:c.pitch,velocity:o,instrument:e,quantizedStartStep:i,quantizedEndStep:a,program:this.program,isDrum:this.isDrum})):s.log(`Ignoring zero-length note: (pitch = ${c.pitch}, step = ${a})`,"Performance")}else s.log(`Ignoring note-off with no previous note-on:(pitch = ${c.pitch}, step = ${a})`,"Performance");break}case"time-shift":a+=c.steps;break;case"velocity-change":if(!t)throw new Error(`Unexpected velocity change event: ${c}`);o=i.MIN_MIDI_VELOCITY+(c.velocityBin-1)*t+1;break;default:throw new Error(`Unrecognized performance event: ${c}`)}return u.forEach(((t,i)=>{for(const[o,u]of t)a>o?n.notes.push(r.A.Note.create({pitch:i,velocity:u,instrument:e,quantizedStartStep:o,quantizedEndStep:a,program:this.program,isDrum:this.isDrum})):s.log(`Ignoring zero-length note: (pitch = ${i}, step = ${a})`,"Performance")})),n.totalQuantizedSteps=a,n}}},4010:(e,t,n)=>{"use strict";e.exports=o;var r=n(1137);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(5382);function o(e){r.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},4110:(e,t,n)=>{"use strict";e.exports=n(7134)},4226:e=>{"use strict";e.exports=function(e,t,n){var r=n||8192,i=r>>>1,o=null,s=r;return function(n){if(n<1||n>i)return e(n);s+n>r&&(o=e(r),s=0);var a=t.call(o,s,s+=n);return 7&s&&(s=1+(7|s)),a}}},4301:(e,t,n)=>{"use strict";e.exports=h;var r,i=n(5382),o=i.LongBits,s=i.base64,a=i.utf8;function u(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function c(){}function l(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new u(c,0,0),this.tail=this.head,this.states=null}var p=function(){return i.Buffer?function(){return(h.create=function(){return new r})()}:function(){return new h}};function m(e,t,n){t[n]=255&e}function f(e,t){this.len=e,this.next=void 0,this.val=t}function d(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function g(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}h.create=p(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,n){return this.tail=this.tail.next=new u(e,t,n),this.len+=t,this},f.prototype=Object.create(u.prototype),f.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new f((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(d,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(d,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(d,t.length(),t)},h.prototype.bool=function(e){return this._push(m,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var S=i.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(m,1,0);if(i.isString(e)){var n=h.alloc(t=s.length(e));s.decode(e,n,0),e=n}return this.uint32(t)._push(S,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(m,1,0)},h.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new u(c,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new u(c,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},h._configure=function(e){r=e,h.create=p(),r._configure()}},4446:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__4446__},4447:(e,t,n)=>{"use strict";e.exports=i;var r=n(5382);function i(e,t,n){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(i.prototype=Object.create(r.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,n,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return r.asPromise(e,a,t,n,i,o);if(a.rpcImpl)try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,n){if(e)return a.emit("error",e,t),s(e);if(null!==n){if(!(n instanceof i))try{n=i[a.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",n,t),s(null,n)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){s(e)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},5003:(e,t,n)=>{"use strict";e.exports=i;var r=n(5382);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"==typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},5264:e=>{self,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){"use strict";n.r(t),n.d(t,"SVGNS",(function(){return r})),n.d(t,"drawSVGPath",(function(){return i})),n.d(t,"drawSVGText",(function(){return o})),n.d(t,"createSVGGroupChild",(function(){return s})),n.d(t,"setFade",(function(){return a}));const r="http://www.w3.org/2000/svg";function i(e,t,n,i,o,s,a=1){const u=document.createElementNS(r,"path");return u.setAttributeNS(null,"d",t),u.setAttributeNS(null,"transform",`translate(${n}, ${i}) scale(${o}, ${s})`),u.setAttributeNS(null,"opacity",`${a}`),e.appendChild(u),u}function