Advertisement
Guest User

skid me bleach

a guest
Nov 22nd, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. !function(t, e) {
  2.     "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.MidiConvert = e() : t.MidiConvert = e()
  3. }(this, function() {
  4.     return function(t) {
  5.         function e(r) {
  6.             if (n[r])
  7.                 return n[r].exports;
  8.             var i = n[r] = {
  9.                 i: r,
  10.                 l: !1,
  11.                 exports: {}
  12.             };
  13.             return t[r].call(i.exports, i, i.exports, e),
  14.             i.l = !0,
  15.             i.exports
  16.         }
  17.         var n = {};
  18.         return e.m = t,
  19.         e.c = n,
  20.         e.i = function(t) {
  21.             return t
  22.         }
  23.         ,
  24.         e.d = function(t, n, r) {
  25.             e.o(t, n) || Object.defineProperty(t, n, {
  26.                 configurable: !1,
  27.                 enumerable: !0,
  28.                 get: r
  29.             })
  30.         }
  31.         ,
  32.         e.n = function(t) {
  33.             var n = t && t.__esModule ? function() {
  34.                 return t.default
  35.             }
  36.             : function() {
  37.                 return t
  38.             }
  39.             ;
  40.             return e.d(n, "a", n),
  41.             n
  42.         }
  43.         ,
  44.         e.o = function(t, e) {
  45.             return Object.prototype.hasOwnProperty.call(t, e)
  46.         }
  47.         ,
  48.         e.p = "",
  49.         e(e.s = 7)
  50.     }([function(t, e, n) {
  51.         "use strict";
  52.         n.d(e, "a", function() {
  53.             return r
  54.         }),
  55.         n.d(e, "b", function() {
  56.             return i
  57.         }),
  58.         n.d(e, "c", function() {
  59.             return a
  60.         });
  61.         var r = ["acoustic grand piano", "bright acoustic piano", "electric grand piano", "honky-tonk piano", "electric piano 1", "electric piano 2", "harpsichord", "clavi", "celesta", "glockenspiel", "music box", "vibraphone", "marimba", "xylophone", "tubular bells", "dulcimer", "drawbar organ", "percussive organ", "rock organ", "church organ", "reed organ", "accordion", "harmonica", "tango accordion", "acoustic guitar (nylon)", "acoustic guitar (steel)", "electric guitar (jazz)", "electric guitar (clean)", "electric guitar (muted)", "overdriven guitar", "distortion guitar", "guitar harmonics", "acoustic bass", "electric bass (finger)", "electric bass (pick)", "fretless bass", "slap bass 1", "slap bass 2", "synth bass 1", "synth bass 2", "violin", "viola", "cello", "contrabass", "tremolo strings", "pizzicato strings", "orchestral harp", "timpani", "string ensemble 1", "string ensemble 2", "synthstrings 1", "synthstrings 2", "choir aahs", "voice oohs", "synth voice", "orchestra hit", "trumpet", "trombone", "tuba", "muted trumpet", "french horn", "brass section", "synthbrass 1", "synthbrass 2", "soprano sax", "alto sax", "tenor sax", "baritone sax", "oboe", "english horn", "bassoon", "clarinet", "piccolo", "flute", "recorder", "pan flute", "blown bottle", "shakuhachi", "whistle", "ocarina", "lead 1 (square)", "lead 2 (sawtooth)", "lead 3 (calliope)", "lead 4 (chiff)", "lead 5 (charang)", "lead 6 (voice)", "lead 7 (fifths)", "lead 8 (bass + lead)", "pad 1 (new age)", "pad 2 (warm)", "pad 3 (polysynth)", "pad 4 (choir)", "pad 5 (bowed)", "pad 6 (metallic)", "pad 7 (halo)", "pad 8 (sweep)", "fx 1 (rain)", "fx 2 (soundtrack)", "fx 3 (crystal)", "fx 4 (atmosphere)", "fx 5 (brightness)", "fx 6 (goblins)", "fx 7 (echoes)", "fx 8 (sci-fi)", "sitar", "banjo", "shamisen", "koto", "kalimba", "bag pipe", "fiddle", "shanai", "tinkle bell", "agogo", "steel drums", "woodblock", "taiko drum", "melodic tom", "synth drum", "reverse cymbal", "guitar fret noise", "breath noise", "seashore", "bird tweet", "telephone ring", "helicopter", "applause", "gunshot"]
  62.           , i = ["piano", "chromatic percussion", "organ", "guitar", "bass", "strings", "ensemble", "brass", "reed", "pipe", "synth lead", "synth pad", "synth effects", "ethnic", "percussive", "sound effects"]
  63.           , a = {
  64.             0: "standard kit",
  65.             8: "room kit",
  66.             16: "power kit",
  67.             24: "electronic kit",
  68.             25: "tr-808 kit",
  69.             32: "jazz kit",
  70.             40: "brush kit",
  71.             48: "orchestra kit",
  72.             56: "sound fx kit"
  73.         }
  74.     }
  75.     , function(t, e, n) {
  76.         "use strict";
  77.         function r(t) {
  78.             return t.replace(/\u0000/g, "")
  79.         }
  80.         function i(t, e) {
  81.             return 60 / e.bpm * (t / e.PPQ)
  82.         }
  83.         function a(t) {
  84.             return "number" == typeof t
  85.         }
  86.         function o(t) {
  87.             return "string" == typeof t
  88.         }
  89.         function s(t) {
  90.             return ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"][t % 12] + (Math.floor(t / 12) - 1)
  91.         }
  92.         e.b = r,
  93.         e.a = i,
  94.         e.c = a,
  95.         n.d(e, "d", function() {
  96.             return u
  97.         }),
  98.         e.e = s,
  99.         n.d(e, "f", function() {
  100.             return c
  101.         });
  102.         var u = function() {
  103.             var t = /^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i;
  104.             return function(e) {
  105.                 return o(e) && t.test(e)
  106.             }
  107.         }()
  108.           , c = function() {
  109.             var t = /^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i
  110.               , e = {
  111.                 cbb: -2,
  112.                 cb: -1,
  113.                 c: 0,
  114.                 "c#": 1,
  115.                 cx: 2,
  116.                 dbb: 0,
  117.                 db: 1,
  118.                 d: 2,
  119.                 "d#": 3,
  120.                 dx: 4,
  121.                 ebb: 2,
  122.                 eb: 3,
  123.                 e: 4,
  124.                 "e#": 5,
  125.                 ex: 6,
  126.                 fbb: 3,
  127.                 fb: 4,
  128.                 f: 5,
  129.                 "f#": 6,
  130.                 fx: 7,
  131.                 gbb: 5,
  132.                 gb: 6,
  133.                 g: 7,
  134.                 "g#": 8,
  135.                 gx: 9,
  136.                 abb: 7,
  137.                 ab: 8,
  138.                 a: 9,
  139.                 "a#": 10,
  140.                 ax: 11,
  141.                 bbb: 9,
  142.                 bb: 10,
  143.                 b: 11,
  144.                 "b#": 12,
  145.                 bx: 13
  146.             };
  147.             return function(n) {
  148.                 var r = t.exec(n)
  149.                   , i = r[1]
  150.                   , a = r[2];
  151.                 return e[i.toLowerCase()] + 12 * (parseInt(a) + 1)
  152.             }
  153.         }()
  154.     }
  155.     , function(t, e, n) {
  156.         "use strict";
  157.         function r(t, e) {
  158.             if (!(t instanceof e))
  159.                 throw new TypeError("Cannot call a class as a function")
  160.         }
  161.         n.d(e, "a", function() {
  162.             return h
  163.         });
  164.         var i = n(11)
  165.           , a = (n.n(i),
  166.         n(10))
  167.           , o = (n.n(a),
  168.         n(1))
  169.           , s = n(9)
  170.           , u = n(5)
  171.           , c = function() {
  172.             function t(t, e) {
  173.                 for (var n = 0; n < e.length; n++) {
  174.                     var r = e[n];
  175.                     r.enumerable = r.enumerable || !1,
  176.                     r.configurable = !0,
  177.                     "value"in r && (r.writable = !0),
  178.                     Object.defineProperty(t, r.key, r)
  179.                 }
  180.             }
  181.             return function(e, n, r) {
  182.                 return n && t(e.prototype, n),
  183.                 r && t(e, r),
  184.                 e
  185.             }
  186.         }()
  187.           , h = function() {
  188.             function t() {
  189.                 r(this, t),
  190.                 this.header = {
  191.                     bpm: 120,
  192.                     timeSignature: [4, 4],
  193.                     PPQ: 480
  194.                 },
  195.                 this.tracks = []
  196.             }
  197.             return c(t, null, [{
  198.                 key: "fromJSON",
  199.                 value: function(e) {
  200.                     var n = new t;
  201.                     return n.header = e.header,
  202.                     e.tracks.forEach(function(t) {
  203.                         var e = s.a.fromJSON(t);
  204.                         n.tracks.push(e)
  205.                     }),
  206.                     n
  207.                 }
  208.             }]),
  209.             c(t, [{
  210.                 key: "load",
  211.                 value: function(t) {
  212.                     var e = this
  213.                       , n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null
  214.                       , r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "GET";
  215.                     return new Promise(function(i, a) {
  216.                         var o = new XMLHttpRequest;
  217.                         o.open(r, t),
  218.                         o.responseType = "arraybuffer",
  219.                         o.addEventListener("load", function() {
  220.                             4 === o.readyState && 200 === o.status ? i(e.decode(o.response)) : a(o.status)
  221.                         }),
  222.                         o.addEventListener("error", a),
  223.                         o.send(n)
  224.                     }
  225.                     ).catch(function(t) {
  226.                         console.log(t)
  227.                     })
  228.                 }
  229.             }, {
  230.                 key: "decode",
  231.                 value: function(t) {
  232.                     var e = this;
  233.                     if (t instanceof ArrayBuffer) {
  234.                         var r = new Uint8Array(t);
  235.                         t = String.fromCharCode.apply(null, r)
  236.                     }
  237.                     var a = i(t);
  238.                     return this.header = n.i(u.a)(a),
  239.                     this.tracks = [],
  240.                     a.tracks.forEach(function(t, n) {
  241.                         var r = new s.a;
  242.                         r.id = n,
  243.                         e.tracks.push(r);
  244.                         var i = 0;
  245.                         t.forEach(function(t) {
  246.                             i += o.a(t.deltaTime, e.header),
  247.                             "meta" === t.type && "trackName" === t.subtype ? r.name = o.b(t.text) : "noteOn" === t.subtype ? (r.noteOn(t.noteNumber, i, t.velocity / 127),
  248.                             -1 === r.channelNumber && (r.channelNumber = t.channel)) : "noteOff" === t.subtype ? r.noteOff(t.noteNumber, i) : "controller" === t.subtype && t.controllerType ? r.cc(t.controllerType, i, t.value / 127) : "meta" === t.type && "instrumentName" === t.subtype ? r.instrument = t.text : "channel" === t.type && "programChange" === t.subtype && (r.patch(t.programNumber),
  249.                             r.channelNumber = t.channel)
  250.                         }),
  251.                         e.header.name || r.length || !r.name || (e.header.name = r.name)
  252.                     }),
  253.                     this
  254.                 }
  255.             }, {
  256.                 key: "encode",
  257.                 value: function() {
  258.                     var t = this
  259.                       , e = new a.File({
  260.                         ticks: this.header.PPQ
  261.                     })
  262.                       , n = this.tracks.filter(function(t) {
  263.                         return !t.length
  264.                     })[0];
  265.                     if (this.header.name && (!n || n.name !== this.header.name)) {
  266.                         e.addTrack().addEvent(new a.MetaEvent({
  267.                             time: 0,
  268.                             type: a.MetaEvent.TRACK_NAME,
  269.                             data: this.header.name
  270.                         }))
  271.                     }
  272.                     return this.tracks.forEach(function(n) {
  273.                         var r = e.addTrack();
  274.                         r.setTempo(t.bpm),
  275.                         n.name && r.addEvent(new a.MetaEvent({
  276.                             time: 0,
  277.                             type: a.MetaEvent.TRACK_NAME,
  278.                             data: n.name
  279.                         })),
  280.                         n.encode(r, t.header)
  281.                     }),
  282.                     e.toBytes()
  283.                 }
  284.             }, {
  285.                 key: "toArray",
  286.                 value: function() {
  287.                     for (var t = this.encode(), e = new Array(t.length), n = 0; n < t.length; n++)
  288.                         e[n] = t.charCodeAt(n);
  289.                     return e
  290.                 }
  291.             }, {
  292.                 key: "toJSON",
  293.                 value: function() {
  294.                     var t = {
  295.                         header: this.header,
  296.                         startTime: this.startTime,
  297.                         duration: this.duration,
  298.                         tracks: (this.tracks || []).map(function(t) {
  299.                             return t.toJSON()
  300.                         })
  301.                     };
  302.                     return t.header.name || (t.header.name = ""),
  303.                     t
  304.                 }
  305.             }, {
  306.                 key: "track",
  307.                 value: function(t) {
  308.                     var e = new s.a(t);
  309.                     return this.tracks.push(e),
  310.                     e
  311.                 }
  312.             }, {
  313.                 key: "get",
  314.                 value: function(t) {
  315.                     return o.c(t) ? this.tracks[t] : this.tracks.find(function(e) {
  316.                         return e.name === t
  317.                     })
  318.                 }
  319.             }, {
  320.                 key: "slice",
  321.                 value: function() {
  322.                     var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0
  323.                       , n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.duration
  324.                       , r = new t;
  325.                     return r.header = this.header,
  326.                     r.tracks = this.tracks.map(function(t) {
  327.                         return t.slice(e, n)
  328.                     }),
  329.                     r
  330.                 }
  331.             }, {
  332.                 key: "startTime",
  333.                 get: function() {
  334.                     var t = this.tracks.map(function(t) {
  335.                         return t.startTime
  336.                     });
  337.                     return t.length ? Math.min.apply(Math, t) || 0 : 0
  338.                 }
  339.             }, {
  340.                 key: "bpm",
  341.                 get: function() {
  342.                     return this.header.bpm
  343.                 },
  344.                 set: function(t) {
  345.                     var e = this.header.bpm;
  346.                     this.header.bpm = t;
  347.                     var n = e / t;
  348.                     this.tracks.forEach(function(t) {
  349.                         return t.scale(n)
  350.                     })
  351.                 }
  352.             }, {
  353.                 key: "timeSignature",
  354.                 get: function() {
  355.                     return this.header.timeSignature
  356.                 },
  357.                 set: function(t) {
  358.                     this.header.timeSignature = t
  359.                 }
  360.             }, {
  361.                 key: "duration",
  362.                 get: function() {
  363.                     var t = this.tracks.map(function(t) {
  364.                         return t.duration
  365.                     });
  366.                     return t.length ? Math.max.apply(Math, t) || 0 : 0
  367.                 }
  368.             }]),
  369.             t
  370.         }()
  371.     }
  372.     , function(t, e, n) {
  373.         "use strict";
  374.         function r(t, e) {
  375.             var n = 0
  376.               , r = t.length
  377.               , i = r;
  378.             if (r > 0 && t[r - 1].time <= e)
  379.                 return r - 1;
  380.             for (; n < i; ) {
  381.                 var a = Math.floor(n + (i - n) / 2)
  382.                   , o = t[a]
  383.                   , s = t[a + 1];
  384.                 if (o.time === e) {
  385.                     for (var u = a; u < t.length; u++) {
  386.                         t[u].time === e && (a = u)
  387.                     }
  388.                     return a
  389.                 }
  390.                 if (o.time < e && s.time > e)
  391.                     return a;
  392.                 o.time > e ? i = a : o.time < e && (n = a + 1)
  393.             }
  394.             return -1
  395.         }
  396.         function i(t, e) {
  397.             if (t.length) {
  398.                 var n = r(t, e.time);
  399.                 t.splice(n + 1, 0, e)
  400.             } else
  401.                 t.push(e)
  402.         }
  403.         n.d(e, "a", function() {
  404.             return i
  405.         })
  406.     }
  407.     , function(t, e, n) {
  408.         "use strict";
  409.         function r(t, e) {
  410.             if (!(t instanceof e))
  411.                 throw new TypeError("Cannot call a class as a function")
  412.         }
  413.         n.d(e, "a", function() {
  414.             return o
  415.         });
  416.         var i = function() {
  417.             function t(t, e) {
  418.                 for (var n = 0; n < e.length; n++) {
  419.                     var r = e[n];
  420.                     r.enumerable = r.enumerable || !1,
  421.                     r.configurable = !0,
  422.                     "value"in r && (r.writable = !0),
  423.                     Object.defineProperty(t, r.key, r)
  424.                 }
  425.             }
  426.             return function(e, n, r) {
  427.                 return n && t(e.prototype, n),
  428.                 r && t(e, r),
  429.                 e
  430.             }
  431.         }()
  432.           , a = {
  433.             1: "modulationWheel",
  434.             2: "breath",
  435.             4: "footController",
  436.             5: "portamentoTime",
  437.             7: "volume",
  438.             8: "balance",
  439.             10: "pan",
  440.             64: "sustain",
  441.             65: "portamentoTime",
  442.             66: "sostenuto",
  443.             67: "softPedal",
  444.             68: "legatoFootswitch",
  445.             84: "portamentoContro"
  446.         }
  447.           , o = function() {
  448.             function t(e, n, i) {
  449.                 r(this, t),
  450.                 this.number = e,
  451.                 this.time = n,
  452.                 this.value = i
  453.             }
  454.             return i(t, [{
  455.                 key: "name",
  456.                 get: function() {
  457.                     if (a.hasOwnProperty(this.number))
  458.                         return a[this.number]
  459.                 }
  460.             }]),
  461.             t
  462.         }()
  463.     }
  464.     , function(t, e, n) {
  465.         "use strict";
  466.         function r(t) {
  467.             for (var e = {
  468.                 PPQ: t.header.ticksPerBeat
  469.             }, n = 0; n < t.tracks.length; n++)
  470.                 for (var r = t.tracks[n], i = 0; i < r.length; i++) {
  471.                     var a = r[i];
  472.                     "meta" === a.type && ("timeSignature" === a.subtype ? e.timeSignature = [a.numerator, a.denominator] : "setTempo" === a.subtype && (e.bpm || (e.bpm = 6e7 / a.microsecondsPerBeat)))
  473.                 }
  474.             return e.bpm = e.bpm || 120,
  475.             e
  476.         }
  477.         n.d(e, "a", function() {
  478.             return r
  479.         })
  480.     }
  481.     , function(t, e, n) {
  482.         "use strict";
  483.         function r(t, e) {
  484.             for (var n = 0; n < t.length; n++) {
  485.                 var r = t[n]
  486.                   , i = e[n];
  487.                 if (r.length > i)
  488.                     return !0
  489.             }
  490.             return !1
  491.         }
  492.         function i(t, e, n) {
  493.             for (var r = 0, i = 1 / 0, a = 0; a < t.length; a++) {
  494.                 var o = t[a]
  495.                   , s = e[a];
  496.                 o[s] && o[s].time < i && (r = a,
  497.                 i = o[s].time)
  498.             }
  499.             n[r](t[r][e[r]]),
  500.             e[r] += 1
  501.         }
  502.         function a() {
  503.             for (var t = arguments.length, e = Array(t), n = 0; n < t; n++)
  504.                 e[n] = arguments[n];
  505.             for (var a = e.filter(function(t, e) {
  506.                 return e % 2 == 0
  507.             }), o = new Uint32Array(a.length), s = e.filter(function(t, e) {
  508.                 return e % 2 == 1
  509.             }); r(a, o); )
  510.                 i(a, o, s)
  511.         }
  512.         n.d(e, "a", function() {
  513.             return a
  514.         })
  515.     }
  516.     , function(t, e, n) {
  517.         "use strict";
  518.         function r(t) {
  519.             return (new s.a).decode(t)
  520.         }
  521.         function i(t, e) {
  522.             var n = (new s.a).load(t);
  523.             return e && n.then(e),
  524.             n
  525.         }
  526.         function a() {
  527.             return new s.a
  528.         }
  529.         function o(t) {
  530.             return s.a.fromJSON(t)
  531.         }
  532.         Object.defineProperty(e, "__esModule", {
  533.             value: !0
  534.         }),
  535.         e.parse = r,
  536.         e.load = i,
  537.         e.create = a,
  538.         e.fromJSON = o;
  539.         var s = n(2)
  540.           , u = n(0);
  541.         n.d(e, "instrumentByPatchID", function() {
  542.             return u.a
  543.         }),
  544.         n.d(e, "instrumentFamilyByID", function() {
  545.             return u.b
  546.         }),
  547.         n.d(e, "drumKitByPatchID", function() {
  548.             return u.c
  549.         })
  550.     }
  551.     , function(t, e, n) {
  552.         "use strict";
  553.         function r(t, e) {
  554.             if (!(t instanceof e))
  555.                 throw new TypeError("Cannot call a class as a function")
  556.         }
  557.         n.d(e, "a", function() {
  558.             return o
  559.         });
  560.         var i = n(1)
  561.           , a = function() {
  562.             function t(t, e) {
  563.                 for (var n = 0; n < e.length; n++) {
  564.                     var r = e[n];
  565.                     r.enumerable = r.enumerable || !1,
  566.                     r.configurable = !0,
  567.                     "value"in r && (r.writable = !0),
  568.                     Object.defineProperty(t, r.key, r)
  569.                 }
  570.             }
  571.             return function(e, n, r) {
  572.                 return n && t(e.prototype, n),
  573.                 r && t(e, r),
  574.                 e
  575.             }
  576.         }()
  577.           , o = function() {
  578.             function t(e, n) {
  579.                 var a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0
  580.                   , o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1;
  581.                 if (r(this, t),
  582.                 i.c(e))
  583.                     this.midi = e;
  584.                 else {
  585.                     if (!i.d(e))
  586.                         throw new Error("the midi value must either be in Pitch Notation (e.g. C#4) or a midi value");
  587.                     this.name = e
  588.                 }
  589.                 this.time = n,
  590.                 this.duration = a,
  591.                 this.velocity = o
  592.             }
  593.             return a(t, null, [{
  594.                 key: "fromJSON",
  595.                 value: function(e) {
  596.                     return new t(e.midi,e.time,e.duration,e.velocity)
  597.                 }
  598.             }]),
  599.             a(t, [{
  600.                 key: "match",
  601.                 value: function(t) {
  602.                     return i.c(t) ? this.midi === t : i.d(t) ? this.name.toLowerCase() === t.toLowerCase() : void 0
  603.                 }
  604.             }, {
  605.                 key: "toJSON",
  606.                 value: function() {
  607.                     return {
  608.                         name: this.name,
  609.                         midi: this.midi,
  610.                         time: this.time,
  611.                         velocity: this.velocity,
  612.                         duration: this.duration
  613.                     }
  614.                 }
  615.             }, {
  616.                 key: "name",
  617.                 get: function() {
  618.                     return i.e(this.midi)
  619.                 },
  620.                 set: function(t) {
  621.                     this.midi = i.f(t)
  622.                 }
  623.             }, {
  624.                 key: "noteOn",
  625.                 get: function() {
  626.                     return this.time
  627.                 },
  628.                 set: function(t) {
  629.                     this.time = t
  630.                 }
  631.             }, {
  632.                 key: "noteOff",
  633.                 get: function() {
  634.                     return this.time + this.duration
  635.                 },
  636.                 set: function(t) {
  637.                     this.duration = t - this.time
  638.                 }
  639.             }]),
  640.             t
  641.         }()
  642.     }
  643.     , function(t, e, n) {
  644.         "use strict";
  645.         function r(t, e) {
  646.             if (!(t instanceof e))
  647.                 throw new TypeError("Cannot call a class as a function")
  648.         }
  649.         n.d(e, "a", function() {
  650.             return h
  651.         });
  652.         var i = n(3)
  653.           , a = n(4)
  654.           , o = n(6)
  655.           , s = n(8)
  656.           , u = n(0)
  657.           , c = function() {
  658.             function t(t, e) {
  659.                 for (var n = 0; n < e.length; n++) {
  660.                     var r = e[n];
  661.                     r.enumerable = r.enumerable || !1,
  662.                     r.configurable = !0,
  663.                     "value"in r && (r.writable = !0),
  664.                     Object.defineProperty(t, r.key, r)
  665.                 }
  666.             }
  667.             return function(e, n, r) {
  668.                 return n && t(e.prototype, n),
  669.                 r && t(e, r),
  670.                 e
  671.             }
  672.         }()
  673.           , h = function() {
  674.             function t(e) {
  675.                 var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1
  676.                   , i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : -1;
  677.                 r(this, t),
  678.                 this.name = e,
  679.                 this.channelNumber = i,
  680.                 this.notes = [],
  681.                 this.controlChanges = {},
  682.                 this.instrumentNumber = n
  683.             }
  684.             return c(t, null, [{
  685.                 key: "fromJSON",
  686.                 value: function(e) {
  687.                     var n = new t(e.name,e.instrumentNumber,e.channelNumber);
  688.                     return n.id = e.id,
  689.                     e.notes && e.notes.forEach(function(t) {
  690.                         var e = s.a.fromJSON(t);
  691.                         n.notes.push(e)
  692.                     }),
  693.                     e.controlChanges && (n.controlChanges = e.controlChanges),
  694.                     n
  695.                 }
  696.             }]),
  697.             c(t, [{
  698.                 key: "note",
  699.                 value: function(t, e) {
  700.                     var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0
  701.                       , a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1
  702.                       , o = new s.a(t,e,r,a);
  703.                     return n.i(i.a)(this.notes, o),
  704.                     this
  705.                 }
  706.             }, {
  707.                 key: "noteOn",
  708.                 value: function(t, e) {
  709.                     var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1
  710.                       , a = new s.a(t,e,0,r);
  711.                     return n.i(i.a)(this.notes, a),
  712.                     this
  713.                 }
  714.             }, {
  715.                 key: "noteOff",
  716.                 value: function(t, e) {
  717.                     for (var n = 0; n < this.notes.length; n++) {
  718.                         var r = this.notes[n];
  719.                         if (r.match(t) && 0 === r.duration) {
  720.                             r.noteOff = e;
  721.                             break
  722.                         }
  723.                     }
  724.                     return this
  725.                 }
  726.             }, {
  727.                 key: "cc",
  728.                 value: function(t, e, r) {
  729.                     this.controlChanges.hasOwnProperty(t) || (this.controlChanges[t] = []);
  730.                     var o = new a.a(t,e,r);
  731.                     return n.i(i.a)(this.controlChanges[t], o),
  732.                     this
  733.                 }
  734.             }, {
  735.                 key: "patch",
  736.                 value: function(t) {
  737.                     return this.instrumentNumber = t,
  738.                     this
  739.                 }
  740.             }, {
  741.                 key: "channel",
  742.                 value: function(t) {
  743.                     return this.channelNumber = t,
  744.                     this
  745.                 }
  746.             }, {
  747.                 key: "scale",
  748.                 value: function(t) {
  749.                     return this.notes.forEach(function(e) {
  750.                         e.time *= t,
  751.                         e.duration *= t
  752.                     }),
  753.                     this
  754.                 }
  755.             }, {
  756.                 key: "slice",
  757.                 value: function() {
  758.                     var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0
  759.                       , n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.duration
  760.                       , r = Math.max(this.notes.findIndex(function(t) {
  761.                         return t.time >= e
  762.                     }), 0)
  763.                       , i = this.notes.findIndex(function(t) {
  764.                         return t.noteOff >= n
  765.                     }) + 1
  766.                       , a = new t(this.name);
  767.                     return a.notes = this.notes.slice(r, i),
  768.                     a.notes.forEach(function(t) {
  769.                         return t.time = t.time - e
  770.                     }),
  771.                     a
  772.                 }
  773.             }, {
  774.                 key: "encode",
  775.                 value: function(t, e) {
  776.                     function r(t) {
  777.                         var e = Math.floor(i * t)
  778.                           , n = Math.max(e - a, 0);
  779.                         return a = e,
  780.                         n
  781.                     }
  782.                     var i = e.PPQ / (60 / e.bpm)
  783.                       , a = 0
  784.                       , s = Math.max(0, this.channelNumber);
  785.                     -1 !== this.instrumentNumber && t.instrument(s, this.instrumentNumber),
  786.                     n.i(o.a)(this.noteOns, function(e) {
  787.                         t.addNoteOn(s, e.name, r(e.time), Math.floor(127 * e.velocity))
  788.                     }, this.noteOffs, function(e) {
  789.                         t.addNoteOff(s, e.name, r(e.time))
  790.                     })
  791.                 }
  792.             }, {
  793.                 key: "toJSON",
  794.                 value: function() {
  795.                     var t = {
  796.                         startTime: this.startTime,
  797.                         duration: this.duration,
  798.                         length: this.length,
  799.                         notes: [],
  800.                         controlChanges: {}
  801.                     };
  802.                     return void 0 !== this.id && (t.id = this.id),
  803.                     t.name = this.name,
  804.                     -1 !== this.instrumentNumber && (t.instrumentNumber = this.instrumentNumber,
  805.                     t.instrument = this.instrument,
  806.                     t.instrumentFamily = this.instrumentFamily),
  807.                     -1 !== this.channelNumber && (t.channelNumber = this.channelNumber,
  808.                     t.isPercussion = this.isPercussion),
  809.                     this.notes.length && (t.notes = this.notes.map(function(t) {
  810.                         return t.toJSON()
  811.                     })),
  812.                     Object.keys(this.controlChanges).length && (t.controlChanges = this.controlChanges),
  813.                     t
  814.                 }
  815.             }, {
  816.                 key: "noteOns",
  817.                 get: function() {
  818.                     var t = [];
  819.                     return this.notes.forEach(function(e) {
  820.                         t.push({
  821.                             time: e.noteOn,
  822.                             midi: e.midi,
  823.                             name: e.name,
  824.                             velocity: e.velocity
  825.                         })
  826.                     }),
  827.                     t
  828.                 }
  829.             }, {
  830.                 key: "noteOffs",
  831.                 get: function() {
  832.                     var t = [];
  833.                     return this.notes.forEach(function(e) {
  834.                         t.push({
  835.                             time: e.noteOff,
  836.                             midi: e.midi,
  837.                             name: e.name
  838.                         })
  839.                     }),
  840.                     t
  841.                 }
  842.             }, {
  843.                 key: "length",
  844.                 get: function() {
  845.                     return this.notes.length
  846.                 }
  847.             }, {
  848.                 key: "startTime",
  849.                 get: function() {
  850.                     if (this.notes.length) {
  851.                         return this.notes[0].noteOn
  852.                     }
  853.                     return 0
  854.                 }
  855.             }, {
  856.                 key: "duration",
  857.                 get: function() {
  858.                     if (this.notes.length) {
  859.                         return this.notes[this.notes.length - 1].noteOff
  860.                     }
  861.                     return 0
  862.                 }
  863.             }, {
  864.                 key: "instrument",
  865.                 get: function() {
  866.                     return this.isPercussion ? u.c[this.instrumentNumber] : u.a[this.instrumentNumber]
  867.                 },
  868.                 set: function(t) {
  869.                     var e = u.a.indexOf(t);
  870.                     -1 !== e && (this.instrumentNumber = e)
  871.                 }
  872.             }, {
  873.                 key: "isPercussion",
  874.                 get: function() {
  875.                     return [9, 10].includes(this.channelNumber)
  876.                 }
  877.             }, {
  878.                 key: "instrumentFamily",
  879.                 get: function() {
  880.                     return this.isPercussion ? "drums" : u.b[Math.floor(this.instrumentNumber / 8)]
  881.                 }
  882.             }]),
  883.             t
  884.         }()
  885.     }
  886.     , function(t, e, n) {
  887.         (function(t) {
  888.             var n = {};
  889.             !function(t) {
  890.                 var e = t.DEFAULT_VOLUME = 90
  891.                   , n = (t.DEFAULT_DURATION = 128,
  892.                 t.DEFAULT_CHANNEL = 0,
  893.                 {
  894.                     midi_letter_pitches: {
  895.                         a: 21,
  896.                         b: 23,
  897.                         c: 12,
  898.                         d: 14,
  899.                         e: 16,
  900.                         f: 17,
  901.                         g: 19
  902.                     },
  903.                     midiPitchFromNote: function(t) {
  904.                         var e = /([a-g])(#+|b+)?([0-9]+)$/i.exec(t)
  905.                           , r = e[1].toLowerCase()
  906.                           , i = e[2] || "";
  907.                         return 12 * parseInt(e[3], 10) + n.midi_letter_pitches[r] + ("#" == i.substr(0, 1) ? 1 : -1) * i.length
  908.                     },
  909.                     ensureMidiPitch: function(t) {
  910.                         return "number" != typeof t && /[^0-9]/.test(t) ? n.midiPitchFromNote(t) : parseInt(t, 10)
  911.                     },
  912.                     midi_pitches_letter: {
  913.                         12: "c",
  914.                         13: "c#",
  915.                         14: "d",
  916.                         15: "d#",
  917.                         16: "e",
  918.                         17: "f",
  919.                         18: "f#",
  920.                         19: "g",
  921.                         20: "g#",
  922.                         21: "a",
  923.                         22: "a#",
  924.                         23: "b"
  925.                     },
  926.                     midi_flattened_notes: {
  927.                         "a#": "bb",
  928.                         "c#": "db",
  929.                         "d#": "eb",
  930.                         "f#": "gb",
  931.                         "g#": "ab"
  932.                     },
  933.                     noteFromMidiPitch: function(t, e) {
  934.                         var r, i = 0, a = t, e = e || !1;
  935.                         return t > 23 && (i = Math.floor(t / 12) - 1,
  936.                         a = t - 12 * i),
  937.                         r = n.midi_pitches_letter[a],
  938.                         e && r.indexOf("#") > 0 && (r = n.midi_flattened_notes[r]),
  939.                         r + i
  940.                     },
  941.                     mpqnFromBpm: function(t) {
  942.                         var e = Math.floor(6e7 / t)
  943.                           , n = [];
  944.                         do {
  945.                             n.unshift(255 & e),
  946.                             e >>= 8
  947.                         } while (e);for (; n.length < 3; )
  948.                             n.push(0);
  949.                         return n
  950.                     },
  951.                     bpmFromMpqn: function(t) {
  952.                         var e = t;
  953.                         if (void 0 !== t[0]) {
  954.                             e = 0;
  955.                             for (var n = 0, r = t.length - 1; r >= 0; ++n,
  956.                             --r)
  957.                                 e |= t[n] << r
  958.                         }
  959.                         return Math.floor(6e7 / t)
  960.                     },
  961.                     codes2Str: function(t) {
  962.                         return String.fromCharCode.apply(null, t)
  963.                     },
  964.                     str2Bytes: function(t, e) {
  965.                         if (e)
  966.                             for (; t.length / 2 < e; )
  967.                                 t = "0" + t;
  968.                         for (var n = [], r = t.length - 1; r >= 0; r -= 2) {
  969.                             var i = 0 === r ? t[r] : t[r - 1] + t[r];
  970.                             n.unshift(parseInt(i, 16))
  971.                         }
  972.                         return n
  973.                     },
  974.                     translateTickTime: function(t) {
  975.                         for (var e = 127 & t; t >>= 7; )
  976.                             e <<= 8,
  977.                             e |= 127 & t | 128;
  978.                         for (var n = []; ; ) {
  979.                             if (n.push(255 & e),
  980.                             !(128 & e))
  981.                                 break;
  982.                             e >>= 8
  983.                         }
  984.                         return n
  985.                     }
  986.                 })
  987.                   , r = function(t) {
  988.                     if (!this)
  989.                         return new r(t);
  990.                     !t || null === t.type && void 0 === t.type || null === t.channel && void 0 === t.channel || null === t.param1 && void 0 === t.param1 || (this.setTime(t.time),
  991.                     this.setType(t.type),
  992.                     this.setChannel(t.channel),
  993.                     this.setParam1(t.param1),
  994.                     this.setParam2(t.param2))
  995.                 };
  996.                 r.NOTE_OFF = 128,
  997.                 r.NOTE_ON = 144,
  998.                 r.AFTER_TOUCH = 160,
  999.                 r.CONTROLLER = 176,
  1000.                 r.PROGRAM_CHANGE = 192,
  1001.                 r.CHANNEL_AFTERTOUCH = 208,
  1002.                 r.PITCH_BEND = 224,
  1003.                 r.prototype.setTime = function(t) {
  1004.                     this.time = n.translateTickTime(t || 0)
  1005.                 }
  1006.                 ,
  1007.                 r.prototype.setType = function(t) {
  1008.                     if (t < r.NOTE_OFF || t > r.PITCH_BEND)
  1009.                         throw new Error("Trying to set an unknown event: " + t);
  1010.                     this.type = t
  1011.                 }
  1012.                 ,
  1013.                 r.prototype.setChannel = function(t) {
  1014.                     if (t < 0 || t > 15)
  1015.                         throw new Error("Channel is out of bounds.");
  1016.                     this.channel = t
  1017.                 }
  1018.                 ,
  1019.                 r.prototype.setParam1 = function(t) {
  1020.                     this.param1 = t
  1021.                 }
  1022.                 ,
  1023.                 r.prototype.setParam2 = function(t) {
  1024.                     this.param2 = t
  1025.                 }
  1026.                 ,
  1027.                 r.prototype.toBytes = function() {
  1028.                     var t = []
  1029.                       , e = this.type | 15 & this.channel;
  1030.                     return t.push.apply(t, this.time),
  1031.                     t.push(e),
  1032.                     t.push(this.param1),
  1033.                     void 0 !== this.param2 && null !== this.param2 && t.push(this.param2),
  1034.                     t
  1035.                 }
  1036.                 ;
  1037.                 var i = function(t) {
  1038.                     if (!this)
  1039.                         return new i(t);
  1040.                     this.setTime(t.time),
  1041.                     this.setType(t.type),
  1042.                     this.setData(t.data)
  1043.                 };
  1044.                 i.SEQUENCE = 0,
  1045.                 i.TEXT = 1,
  1046.                 i.COPYRIGHT = 2,
  1047.                 i.TRACK_NAME = 3,
  1048.                 i.INSTRUMENT = 4,
  1049.                 i.LYRIC = 5,
  1050.                 i.MARKER = 6,
  1051.                 i.CUE_POINT = 7,
  1052.                 i.CHANNEL_PREFIX = 32,
  1053.                 i.END_OF_TRACK = 47,
  1054.                 i.TEMPO = 81,
  1055.                 i.SMPTE = 84,
  1056.                 i.TIME_SIG = 88,
  1057.                 i.KEY_SIG = 89,
  1058.                 i.SEQ_EVENT = 127,
  1059.                 i.prototype.setTime = function(t) {
  1060.                     this.time = n.translateTickTime(t || 0)
  1061.                 }
  1062.                 ,
  1063.                 i.prototype.setType = function(t) {
  1064.                     this.type = t
  1065.                 }
  1066.                 ,
  1067.                 i.prototype.setData = function(t) {
  1068.                     this.data = t
  1069.                 }
  1070.                 ,
  1071.                 i.prototype.toBytes = function() {
  1072.                     if (!this.type)
  1073.                         throw new Error("Type for meta-event not specified.");
  1074.                     var t = [];
  1075.                     if (t.push.apply(t, this.time),
  1076.                     t.push(255, this.type),
  1077.                     Array.isArray(this.data))
  1078.                         t.push(this.data.length),
  1079.                         t.push.apply(t, this.data);
  1080.                     else if ("number" == typeof this.data)
  1081.                         t.push(1, this.data);
  1082.                     else if (null !== this.data && void 0 !== this.data) {
  1083.                         t.push(this.data.length);
  1084.                         var e = this.data.split("").map(function(t) {
  1085.                             return t.charCodeAt(0)
  1086.                         });
  1087.                         t.push.apply(t, e)
  1088.                     } else
  1089.                         t.push(0);
  1090.                     return t
  1091.                 }
  1092.                 ;
  1093.                 var a = function(t) {
  1094.                     if (!this)
  1095.                         return new a(t);
  1096.                     var e = t || {};
  1097.                     this.events = e.events || []
  1098.                 };
  1099.                 a.START_BYTES = [77, 84, 114, 107],
  1100.                 a.END_BYTES = [0, 255, 47, 0],
  1101.                 a.prototype.addEvent = function(t) {
  1102.                     return this.events.push(t),
  1103.                     this
  1104.                 }
  1105.                 ,
  1106.                 a.prototype.addNoteOn = a.prototype.noteOn = function(t, i, a, o) {
  1107.                     return this.events.push(new r({
  1108.                         type: r.NOTE_ON,
  1109.                         channel: t,
  1110.                         param1: n.ensureMidiPitch(i),
  1111.                         param2: o || e,
  1112.                         time: a || 0
  1113.                     })),
  1114.                     this
  1115.                 }
  1116.                 ,
  1117.                 a.prototype.addNoteOff = a.prototype.noteOff = function(t, i, a, o) {
  1118.                     return this.events.push(new r({
  1119.                         type: r.NOTE_OFF,
  1120.                         channel: t,
  1121.                         param1: n.ensureMidiPitch(i),
  1122.                         param2: o || e,
  1123.                         time: a || 0
  1124.                     })),
  1125.                     this
  1126.                 }
  1127.                 ,
  1128.                 a.prototype.addNote = a.prototype.note = function(t, e, n, r, i) {
  1129.                     return this.noteOn(t, e, r, i),
  1130.                     n && this.noteOff(t, e, n, i),
  1131.                     this
  1132.                 }
  1133.                 ,
  1134.                 a.prototype.addChord = a.prototype.chord = function(t, e, n, r) {
  1135.                     if (!Array.isArray(e) && !e.length)
  1136.                         throw new Error("Chord must be an array of pitches");
  1137.                     return e.forEach(function(e) {
  1138.                         this.noteOn(t, e, 0, r)
  1139.                     }, this),
  1140.                     e.forEach(function(e, r) {
  1141.                         0 === r ? this.noteOff(t, e, n) : this.noteOff(t, e)
  1142.                     }, this),
  1143.                     this
  1144.                 }
  1145.                 ,
  1146.                 a.prototype.setInstrument = a.prototype.instrument = function(t, e, n) {
  1147.                     return this.events.push(new r({
  1148.                         type: r.PROGRAM_CHANGE,
  1149.                         channel: t,
  1150.                         param1: e,
  1151.                         time: n || 0
  1152.                     })),
  1153.                     this
  1154.                 }
  1155.                 ,
  1156.                 a.prototype.setTempo = a.prototype.tempo = function(t, e) {
  1157.                     return this.events.push(new i({
  1158.                         type: i.TEMPO,
  1159.                         data: n.mpqnFromBpm(t),
  1160.                         time: e || 0
  1161.                     })),
  1162.                     this
  1163.                 }
  1164.                 ,
  1165.                 a.prototype.toBytes = function() {
  1166.                     var t = 0
  1167.                       , e = []
  1168.                       , r = a.START_BYTES
  1169.                       , i = a.END_BYTES
  1170.                       , o = function(n) {
  1171.                         var r = n.toBytes();
  1172.                         t += r.length,
  1173.                         e.push.apply(e, r)
  1174.                     };
  1175.                     this.events.forEach(o),
  1176.                     t += i.length;
  1177.                     var s = n.str2Bytes(t.toString(16), 4);
  1178.                     return r.concat(s, e, i)
  1179.                 }
  1180.                 ;
  1181.                 var o = function(t) {
  1182.                     if (!this)
  1183.                         return new o(t);
  1184.                     var e = t || {};
  1185.                     if (e.ticks) {
  1186.                         if ("number" != typeof e.ticks)
  1187.                             throw new Error("Ticks per beat must be a number!");
  1188.                         if (e.ticks <= 0 || e.ticks >= 32768 || e.ticks % 1 != 0)
  1189.                             throw new Error("Ticks per beat must be an integer between 1 and 32767!")
  1190.                     }
  1191.                     this.ticks = e.ticks || 128,
  1192.                     this.tracks = e.tracks || []
  1193.                 };
  1194.                 o.HDR_CHUNKID = "MThd",
  1195.                 o.HDR_CHUNK_SIZE = "\0\0\0",
  1196.                 o.HDR_TYPE0 = "\0\0",
  1197.                 o.HDR_TYPE1 = "\0",
  1198.                 o.prototype.addTrack = function(t) {
  1199.                     return t ? (this.tracks.push(t),
  1200.                     this) : (t = new a,
  1201.                     this.tracks.push(t),
  1202.                     t)
  1203.                 }
  1204.                 ,
  1205.                 o.prototype.toBytes = function() {
  1206.                     var t = this.tracks.length.toString(16)
  1207.                       , e = o.HDR_CHUNKID + o.HDR_CHUNK_SIZE;
  1208.                     return parseInt(t, 16) > 1 ? e += o.HDR_TYPE1 : e += o.HDR_TYPE0,
  1209.                     e += n.codes2Str(n.str2Bytes(t, 2)),
  1210.                     e += String.fromCharCode(this.ticks / 256, this.ticks % 256),
  1211.                     this.tracks.forEach(function(t) {
  1212.                         e += n.codes2Str(t.toBytes())
  1213.                     }),
  1214.                     e
  1215.                 }
  1216.                 ,
  1217.                 t.Util = n,
  1218.                 t.File = o,
  1219.                 t.Track = a,
  1220.                 t.Event = r,
  1221.                 t.MetaEvent = i
  1222.             }(n),
  1223.             void 0 !== t && null !== t ? t.exports = n : void 0 !== e && null !== e ? e = n : this.Midi = n
  1224.         }
  1225.         ).call(e, n(12)(t))
  1226.     }
  1227.     , function(t, e) {
  1228.         function n(t) {
  1229.             function e(t) {
  1230.                 var e = t.read(4)
  1231.                   , n = t.readInt32();
  1232.                 return {
  1233.                     id: e,
  1234.                     length: n,
  1235.                     data: t.read(n)
  1236.                 }
  1237.             }
  1238.             var n;
  1239.             stream = r(t);
  1240.             var i = e(stream);
  1241.             if ("MThd" != i.id || 6 != i.length)
  1242.                 throw "Bad .mid file - header not found";
  1243.             var a = r(i.data)
  1244.               , o = a.readInt16()
  1245.               , s = a.readInt16()
  1246.               , u = a.readInt16();
  1247.             if (32768 & u)
  1248.                 throw "Expressing time division in SMTPE frames is not supported yet";
  1249.             ticksPerBeat = u;
  1250.             for (var c = {
  1251.                 formatType: o,
  1252.                 trackCount: s,
  1253.                 ticksPerBeat: ticksPerBeat
  1254.             }, h = [], f = 0; f < c.trackCount; f++) {
  1255.                 h[f] = [];
  1256.                 var d = e(stream);
  1257.                 if ("MTrk" != d.id)
  1258.                     throw "Unexpected chunk - expected MTrk, got " + d.id;
  1259.                 for (var l = r(d.data); !l.eof(); ) {
  1260.                     var p = function(t) {
  1261.                         var e = {};
  1262.                         e.deltaTime = t.readVarInt();
  1263.                         var r = t.readInt8();
  1264.                         if (240 == (240 & r)) {
  1265.                             if (255 == r) {
  1266.                                 e.type = "meta";
  1267.                                 var i = t.readInt8()
  1268.                                   , a = t.readVarInt();
  1269.                                 switch (i) {
  1270.                                 case 0:
  1271.                                     if (e.subtype = "sequenceNumber",
  1272.                                     2 != a)
  1273.                                         throw "Expected length for sequenceNumber event is 2, got " + a;
  1274.                                     return e.number = t.readInt16(),
  1275.                                     e;
  1276.                                 case 1:
  1277.                                     return e.subtype = "text",
  1278.                                     e.text = t.read(a),
  1279.                                     e;
  1280.                                 case 2:
  1281.                                     return e.subtype = "copyrightNotice",
  1282.                                     e.text = t.read(a),
  1283.                                     e;
  1284.                                 case 3:
  1285.                                     return e.subtype = "trackName",
  1286.                                     e.text = t.read(a),
  1287.                                     e;
  1288.                                 case 4:
  1289.                                     return e.subtype = "instrumentName",
  1290.                                     e.text = t.read(a),
  1291.                                     e;
  1292.                                 case 5:
  1293.                                     return e.subtype = "lyrics",
  1294.                                     e.text = t.read(a),
  1295.                                     e;
  1296.                                 case 6:
  1297.                                     return e.subtype = "marker",
  1298.                                     e.text = t.read(a),
  1299.                                     e;
  1300.                                 case 7:
  1301.                                     return e.subtype = "cuePoint",
  1302.                                     e.text = t.read(a),
  1303.                                     e;
  1304.                                 case 32:
  1305.                                     if (e.subtype = "midiChannelPrefix",
  1306.                                     1 != a)
  1307.                                         throw "Expected length for midiChannelPrefix event is 1, got " + a;
  1308.                                     return e.channel = t.readInt8(),
  1309.                                     e;
  1310.                                 case 47:
  1311.                                     if (e.subtype = "endOfTrack",
  1312.                                     0 != a)
  1313.                                         throw "Expected length for endOfTrack event is 0, got " + a;
  1314.                                     return e;
  1315.                                 case 81:
  1316.                                     if (e.subtype = "setTempo",
  1317.                                     3 != a)
  1318.                                         throw "Expected length for setTempo event is 3, got " + a;
  1319.                                     return e.microsecondsPerBeat = (t.readInt8() << 16) + (t.readInt8() << 8) + t.readInt8(),
  1320.                                     e;
  1321.                                 case 84:
  1322.                                     if (e.subtype = "smpteOffset",
  1323.                                     5 != a)
  1324.                                         throw "Expected length for smpteOffset event is 5, got " + a;
  1325.                                     var o = t.readInt8();
  1326.                                     return e.frameRate = {
  1327.                                         0: 24,
  1328.                                         32: 25,
  1329.                                         64: 29,
  1330.                                         96: 30
  1331.                                     }[96 & o],
  1332.                                     e.hour = 31 & o,
  1333.                                     e.min = t.readInt8(),
  1334.                                     e.sec = t.readInt8(),
  1335.                                     e.frame = t.readInt8(),
  1336.                                     e.subframe = t.readInt8(),
  1337.                                     e;
  1338.                                 case 88:
  1339.                                     if (e.subtype = "timeSignature",
  1340.                                     4 != a)
  1341.                                         throw "Expected length for timeSignature event is 4, got " + a;
  1342.                                     return e.numerator = t.readInt8(),
  1343.                                     e.denominator = Math.pow(2, t.readInt8()),
  1344.                                     e.metronome = t.readInt8(),
  1345.                                     e.thirtyseconds = t.readInt8(),
  1346.                                     e;
  1347.                                 case 89:
  1348.                                     if (e.subtype = "keySignature",
  1349.                                     2 != a)
  1350.                                         throw "Expected length for keySignature event is 2, got " + a;
  1351.                                     return e.key = t.readInt8(!0),
  1352.                                     e.scale = t.readInt8(),
  1353.                                     e;
  1354.                                 case 127:
  1355.                                     return e.subtype = "sequencerSpecific",
  1356.                                     e.data = t.read(a),
  1357.                                     e;
  1358.                                 default:
  1359.                                     return e.subtype = "unknown",
  1360.                                     e.data = t.read(a),
  1361.                                     e
  1362.                                 }
  1363.                                 return e.data = t.read(a),
  1364.                                 e
  1365.                             }
  1366.                             if (240 == r) {
  1367.                                 e.type = "sysEx";
  1368.                                 var a = t.readVarInt();
  1369.                                 return e.data = t.read(a),
  1370.                                 e
  1371.                             }
  1372.                             if (247 == r) {
  1373.                                 e.type = "dividedSysEx";
  1374.                                 var a = t.readVarInt();
  1375.                                 return e.data = t.read(a),
  1376.                                 e
  1377.                             }
  1378.                             throw "Unrecognised MIDI event type byte: " + r
  1379.                         }
  1380.                         var s;
  1381.                         0 == (128 & r) ? (s = r,
  1382.                         r = n) : (s = t.readInt8(),
  1383.                         n = r);
  1384.                         var u = r >> 4;
  1385.                         switch (e.channel = 15 & r,
  1386.                         e.type = "channel",
  1387.                         u) {
  1388.                         case 8:
  1389.                             return e.subtype = "noteOff",
  1390.                             e.noteNumber = s,
  1391.                             e.velocity = t.readInt8(),
  1392.                             e;
  1393.                         case 9:
  1394.                             return e.noteNumber = s,
  1395.                             e.velocity = t.readInt8(),
  1396.                             0 == e.velocity ? e.subtype = "noteOff" : e.subtype = "noteOn",
  1397.                             e;
  1398.                         case 10:
  1399.                             return e.subtype = "noteAftertouch",
  1400.                             e.noteNumber = s,
  1401.                             e.amount = t.readInt8(),
  1402.                             e;
  1403.                         case 11:
  1404.                             return e.subtype = "controller",
  1405.                             e.controllerType = s,
  1406.                             e.value = t.readInt8(),
  1407.                             e;
  1408.                         case 12:
  1409.                             return e.subtype = "programChange",
  1410.                             e.programNumber = s,
  1411.                             e;
  1412.                         case 13:
  1413.                             return e.subtype = "channelAftertouch",
  1414.                             e.amount = s,
  1415.                             e;
  1416.                         case 14:
  1417.                             return e.subtype = "pitchBend",
  1418.                             e.value = s + (t.readInt8() << 7),
  1419.                             e;
  1420.                         default:
  1421.                             throw "Unrecognised MIDI event type: " + u
  1422.                         }
  1423.                     }(l);
  1424.                     h[f].push(p)
  1425.                 }
  1426.             }
  1427.             return {
  1428.                 header: c,
  1429.                 tracks: h
  1430.             }
  1431.         }
  1432.         function r(t) {
  1433.             function e(e) {
  1434.                 var n = t.substr(s, e);
  1435.                 return s += e,
  1436.                 n
  1437.             }
  1438.             function n() {
  1439.                 var e = (t.charCodeAt(s) << 24) + (t.charCodeAt(s + 1) << 16) + (t.charCodeAt(s + 2) << 8) + t.charCodeAt(s + 3);
  1440.                 return s += 4,
  1441.                 e
  1442.             }
  1443.             function r() {
  1444.                 var e = (t.charCodeAt(s) << 8) + t.charCodeAt(s + 1);
  1445.                 return s += 2,
  1446.                 e
  1447.             }
  1448.             function i(e) {
  1449.                 var n = t.charCodeAt(s);
  1450.                 return e && n > 127 && (n -= 256),
  1451.                 s += 1,
  1452.                 n
  1453.             }
  1454.             function a() {
  1455.                 return s >= t.length
  1456.             }
  1457.             function o() {
  1458.                 for (var t = 0; ; ) {
  1459.                     var e = i();
  1460.                     if (!(128 & e))
  1461.                         return t + e;
  1462.                     t += 127 & e,
  1463.                     t <<= 7
  1464.                 }
  1465.             }
  1466.             var s = 0;
  1467.             return {
  1468.                 eof: a,
  1469.                 read: e,
  1470.                 readInt32: n,
  1471.                 readInt16: r,
  1472.                 readInt8: i,
  1473.                 readVarInt: o
  1474.             }
  1475.         }
  1476.         t.exports = function(t) {
  1477.             return n(t)
  1478.         }
  1479.     }
  1480.     , function(t, e) {
  1481.         t.exports = function(t) {
  1482.             return t.webpackPolyfill || (t.deprecate = function() {}
  1483.             ,
  1484.             t.paths = [],
  1485.             t.children || (t.children = []),
  1486.             Object.defineProperty(t, "loaded", {
  1487.                 enumerable: !0,
  1488.                 get: function() {
  1489.                     return t.l
  1490.                 }
  1491.             }),
  1492.             Object.defineProperty(t, "id", {
  1493.                 enumerable: !0,
  1494.                 get: function() {
  1495.                     return t.i
  1496.                 }
  1497.             }),
  1498.             t.webpackPolyfill = 1),
  1499.             t
  1500.         }
  1501.     }
  1502.     ])
  1503. });
  1504. //# sourceMappingURL=MidiConvert.js.map
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement