Files
2018-05-19 02:20:19 +02:00

4 lines
37 KiB
JavaScript

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.synth=t()}}(function(){return function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var h=new Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h}var f=r[a]={exports:{}};e[a][0].call(f.exports,function(t){var r=e[a][1][t];return i(r||t)},f,f.exports,t,e,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(t,e,r){"use strict";e.exports={WAV:t("./src/wav"),MIDIStream:t("./src/midi"),midiToWav:t("./src/midi2wav")}},{"./src/midi":5,"./src/midi2wav":6,"./src/wav":8}],2:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function o(t){var e,r,i,o,a,s,u=t.length;a=n(t),s=new l(3*u/4-a),i=a>0?u-4:u;var h=0;for(e=0,r=0;e<i;e+=4,r+=3)o=f[t.charCodeAt(e)]<<18|f[t.charCodeAt(e+1)]<<12|f[t.charCodeAt(e+2)]<<6|f[t.charCodeAt(e+3)],s[h++]=o>>16&255,s[h++]=o>>8&255,s[h++]=255&o;return 2===a?(o=f[t.charCodeAt(e)]<<2|f[t.charCodeAt(e+1)]>>4,s[h++]=255&o):1===a&&(o=f[t.charCodeAt(e)]<<10|f[t.charCodeAt(e+1)]<<4|f[t.charCodeAt(e+2)]>>2,s[h++]=o>>8&255,s[h++]=255&o),s}function a(t){return h[t>>18&63]+h[t>>12&63]+h[t>>6&63]+h[63&t]}function s(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(a(n));return i.join("")}function u(t){for(var e,r=t.length,n=r%3,i="",o=[],a=0,u=r-n;a<u;a+=16383)o.push(s(t,a,a+16383>u?u:a+16383));return 1===n?(e=t[r-1],i+=h[e>>2],i+=h[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=h[e>>10],i+=h[e>>4&63],i+=h[e<<2&63],i+="="),o.push(i),o.join("")}r.byteLength=i,r.toByteArray=o,r.fromByteArray=u;for(var h=[],f=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,d=c.length;p<d;++p)h[p]=c[p],f[c.charCodeAt(p)]=p;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){"use strict";function n(t){if(t>Z)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return u(t)}return o(t,e,r)}function o(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?l(t,e,r):"string"==typeof t?h(t,e):c(t)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t,e,r){return a(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}function u(t){return a(t),n(t<0?0:0|p(t))}function h(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|g(t,e),o=n(r),a=o.write(t,e);return a!==r&&(o=o.slice(0,a)),o}function f(t){for(var e=t.length<0?0:0|p(t.length),r=n(e),i=0;i<e;i+=1)r[i]=255&t[i];return r}function l(t,e,r){if(e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),n.__proto__=i.prototype,n}function c(t){if(i.isBuffer(t)){var e=0|p(t.length),r=n(e);return 0===r.length?r:(t.copy(r,0,0,e),r)}if(t){if(G(t)||"length"in t)return"number"!=typeof t.length||W(t.length)?n(0):f(t);if("Buffer"===t.type&&Array.isArray(t.data))return f(t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function p(t){if(t>=Z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Z.toString(16)+" bytes");return 0|t}function d(t){return+t!=t&&(t=0),i.alloc(+t)}function g(t,e){if(i.isBuffer(t))return t.length;if(G(t)||t instanceof ArrayBuffer)return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(n)return z(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return M(this,e,r);case"base64":return B(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,W(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:w(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function w(t,e,r,n,i){function o(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}var a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}var h;if(i){var f=-1;for(h=r;h<s;h++)if(o(t,h)===o(e,-1===f?0:h-f)){if(-1===f&&(f=h),h-f+1===u)return f*a}else-1!==f&&(h-=h-f),f=-1}else for(r+u>s&&(r=s-u),h=r;h>=0;h--){for(var l=!0,c=0;c<u;c++)if(o(t,h+c)!==o(e,c)){l=!1;break}if(l)return h}return-1}function m(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(W(s))return a;t[r+a]=s}return a}function k(t,e,r,n){return Y(z(e,t.length-r),t,r,n)}function E(t,e,r,n){return Y(j(e),t,r,n)}function S(t,e,r,n){return E(t,e,r,n)}function U(t,e,r,n){return Y(q(e),t,r,n)}function A(t,e,r,n){return Y(V(e,t.length-r),t,r,n)}function B(t,e,r){return 0===e&&r===t.length?X.fromByteArray(t):X.fromByteArray(t.slice(e,r))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=r){var u,h,f,l;switch(s){case 1:o<128&&(a=o);break;case 2:u=t[i+1],128==(192&u)&&(l=(31&o)<<6|63&u)>127&&(a=l);break;case 3:u=t[i+1],h=t[i+2],128==(192&u)&&128==(192&h)&&(l=(15&o)<<12|(63&u)<<6|63&h)>2047&&(l<55296||l>57343)&&(a=l);break;case 4:u=t[i+1],h=t[i+2],f=t[i+3],128==(192&u)&&128==(192&h)&&128==(192&f)&&(l=(15&o)<<18|(63&u)<<12|(63&h)<<6|63&f)>65535&&l<1114112&&(a=l)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=s}return C(n)}function C(t){var e=t.length;if(e<=H)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=H));return r}function I(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function M(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function x(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=F(t[o]);return i}function O(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function _(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,n,o,a){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<a)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function P(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,n,i){return e=+e,r>>>=0,i||P(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,i){return e=+e,r>>>=0,i||P(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(t,e,r,n,52,8),r+8}function D(t){if(t=t.trim().replace(K,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function z(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function j(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function V(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function q(t){return X.toByteArray(D(t))}function Y(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function G(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function W(t){return t!==t}var X=t("base64-js"),J=t("ieee754");r.Buffer=i,r.SlowBuffer=d,r.INSPECT_MAX_BYTES=50;var Z=2147483647;r.kMaxLength=Z,i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return o(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return s(t,e,r)},i.allocUnsafe=function(t){return u(t)},i.allocUnsafeSlow=function(t){return u(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,a=Math.min(r,n);o<a;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return i.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=i.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var a=t[r];if(!i.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,o),o+=a.length}return n},i.byteLength=g,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)v(this,e,e+1);return this},i.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},i.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},i.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?T(this,0,t):y.apply(this,arguments)},i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===i.compare(this,t)},i.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},i.prototype.compare=function(t,e,r,n,o){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var a=o-n,s=r-e,u=Math.min(a,s),h=this.slice(n,o),f=t.slice(e,r),l=0;l<u;++l)if(h[l]!==f[l]){a=h[l],s=f[l];break}return a<s?-1:s<a?1:0},i.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},i.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},i.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},i.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return k(this,t,e,r);case"ascii":return E(this,t,e,r);case"latin1":case"binary":return S(this,t,e,r);case"base64":return U(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var H=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return n.__proto__=i.prototype,n},i.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||_(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},i.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||_(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||_(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||_(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||_(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||_(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||_(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||_(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||_(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},i.prototype.readInt8=function(t,e){return t>>>=0,e||_(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||_(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||_(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||_(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||_(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||_(t,4,this.length),J.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||_(t,4,this.length),J.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||_(t,8,this.length),J.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||_(t,8,this.length),J.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){R(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},i.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){R(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);R(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);R(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},i.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var a;if("number"==typeof t)for(a=e;a<r;++a)this[a]=t;else{var s=i.isBuffer(t)?t:new i(t,n),u=s.length;for(a=0;a<r-e;++a)this[a+e]=s[a%u]}return this};var K=/[^+\/0-9A-Za-z-_]/g},{"base64-js":2,ieee754:4}],4:[function(t,e,r){r.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,h=u>>1,f=-7,l=r?i-1:0,c=r?-1:1,p=t[e+l];for(l+=c,o=p&(1<<-f)-1,p>>=-f,f+=s;f>0;o=256*o+t[e+l],l+=c,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=256*a+t[e+l],l+=c,f-=8);if(0===o)o=1-h;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=h}return(p?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,u,h=8*o-i-1,f=(1<<h)-1,l=f>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),e+=a+l>=1?c/u:c*Math.pow(2,1-l),e*u>=2&&(a++,u/=2),a+l>=f?(s=0,a=f):a+l>=1?(s=(e*u-1)*Math.pow(2,i),a+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&s,p+=d,s/=256,i-=8);for(a=a<<i|s,h+=i;h>0;t[r+p]=255&a,p+=d,a/=256,h-=8);t[r+p-d]|=128*g}},{}],5:[function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o=function(){function t(e){n(this,t),this.data=new Uint8Array(e),this.byteOffset=0,this.lastEventTypeByte=0}return i(t,[{key:"readString",value:function(t){for(var e=this.byteOffset,r=0,n="";r<t;r++)n+=String.fromCharCode(this.data[e+r]);return this.byteOffset+=t,n}},{key:"readUint32",value:function(){var t=this.byteOffset,e=this.data[t]<<24|this.data[t+1]<<16|this.data[t+2]<<8|this.data[t+3];return this.byteOffset+=4,e}},{key:"readUint24",value:function(){var t=this.byteOffset,e=this.data[t]<<16|this.data[t+1]<<8|this.data[t+2];return this.byteOffset+=3,e}},{key:"readUint16",value:function(){var t=this.byteOffset,e=this.data[t]<<8|this.data[t+1];return this.byteOffset+=2,e}},{key:"readUint8",value:function(){var t=this.byteOffset,e=this.data[t];return this.byteOffset+=1,e}},{key:"readInt8",value:function(){var t=this.byteOffset,e=this.data[t];return!0&e&&(e^=4294967040),this.byteOffset+=1,e}},{key:"readVarUint",value:function(){var t,e=0;do{t=this.readUint8(),e=(e<<7)+(127&t)}while(128==(128&t));return e}},{key:"skip",value:function(t){this.byteOffset+=t}},{key:"readChunk",value:function(){var t=this.readString(4),e=this.readUint32(),r=this.byteOffset;return this.byteOffset+=e,{id:t,length:e,data:this.data.slice(r,this.byteOffset).buffer}}},{key:"readEvent",value:function(){var t={};t.delta=this.readVarUint();var e=this.readUint8();if(240==(240&e))switch(e){case 255:t.type="meta";var r=this.readUint8(),n=this.readVarUint();switch(r){case 0:t.subType="sequenceNumber",2===n?t.value=this.readUint16():this.skip(n);break;case 1:t.subType="text",t.value=this.readString(n);break;case 2:t.subType="copyrightNotice",t.value=this.readString(n);break;case 3:t.subType="trackName",t.value=this.readString(n);break;case 4:t.subType="instrumentName",t.value=this.readString(n);break;case 5:t.subType="lyrics",t.value=this.readString(n);break;case 6:t.subType="marker",t.value=this.readString(n);break;case 7:t.subType="cuePoint",t.value=this.readString(n);break;case 32:t.subType="midiChannelPrefix",1===n?t.value=this.readUint8():this.skip(n);break;case 47:t.subType="endOfTrack",n>0&&this.skip(n);break;case 81:t.subType="setTempo",3===n?t.value=this.readUint24():this.skip(n);break;case 84:if(t.subType="smpteOffset",5===n){var i=this.readUint8();t.value={frameRate:{0:24,1:25,2:29.97,3:30}[i>>>6],hour:63&i,minute:this.readUint8(),second:this.readUint8(),frame:this.readUint8(),subFrame:this.readUint8()}}else this.skip(n);break;case 88:t.subType="timeSignature",4===n?t.value={numerator:this.readUint8(),denominator:1<<this.readUint8(),metronome:this.readUint8(),thirtyseconds:this.readUint8()}:this.skip(n);break;case 89:t.subType="keySignature",2===n?t.value={key:this.readInt8(),scale:this.readUint8()}:this.skip(n);break;case 127:t.subType="sequencerSpecific",t.value=this.readString(n);break;default:t.subType="unknown",t.value=this.readString(n)}break;case 240:t.type="sysEx";var n=this.readVarUint();t.value=this.readString(n);break;case 247:t.type="dividedSysEx";var n=this.readVarUint();t.value=this.readString(n);break;default:t.type="unknown";var n=this.readVarUint();t.value=this.readString(n)}else{var o;0==(128&e)?(o=e,e=this.lastEventTypeByte):(o=this.readUint8(),this.lastEventTypeByte=e);var a=e>>4;switch(t.channel=15&e,t.type="channel",a){case 8:t.subType="noteOff",t.value={noteNumber:o,velocity:this.readUint8()};break;case 9:t.value={noteNumber:o,velocity:this.readUint8()},0===t.value.velocity?t.subType="noteOff":t.subType="noteOn";break;case 10:t.subType="noteAftertouch",t.value={noteNumber:o,amount:this.readUint8()};break;case 11:t.subType="controller",t.value={controllerNumber:o,controllerValue:this.readUint8()};break;case 12:t.subType="programChange",t.value=o;break;case 13:t.subType="channelAftertouch",t.value=o;break;case 14:t.subType="pitchBend",t.value=o+(this.readUint8()<<7);break;default:t.subType="unknown",t.value=(o<<8)+this.readUint8()}}return t}}]),t}();e.exports=o},{}],6:[function(t,e,r){"use strict";var n=t("./wav"),i=t("./midi"),o=t("./utils/timer");e.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.verbose&&console.log("parsing MIDI header...");var r=new i(t),a=r.readChunk();if("MThd"!==a.id||6!==a.length)throw new SyntaxError("malformed header");for(var s=new i(a.data),u=(s.readUint16(),s.readUint16()),h=s.readUint16(),f=[],l=[],c=[],p=void 0,d=0;d<u;d++){e.verbose&&console.log("parsing track "+(d+1)+"...");var g=r.readChunk();if("MTrk"===g.id){for(var y=new i(g.data),v=[],b=!0;b&&y.byteOffset<g.length;){var w=y.readEvent();if(v.push(w),"string"==typeof w.value&&(e.verbose&&console.log('{"'+w.subType+'":"'+w.value+'"}'),Array.isArray(e.Skip)))for(var m=0;m<e.Skip.length;m++)if(e.Skip[m][w.subType]===w.value){e.verbose&&console.log('skip match found: {"'+w.subType+'":"'+w.value+'"}'),b=!1;break}}"function"==typeof e.Skip&&(b=!e.Skip(v)),b?f.push(v):e.verbose&&console.log("skipping track "+(d+1)+"...")}}if(h>>>15!=0)return console.log("Detected unsupported MIDI timing mode"),null;var k=new o(h);e.verbose&&console.log("initializing timer...");for(var E,S=0,U=0,A=0;S<f[0].length;S++)E=f[0][S],U+=E.delta,A+=E.delta,"setTempo"===E.subType&&(k.addCriticalPoint(U,E.value),U=0);for(var B=0;B<f.length;B++){e.verbose&&console.log("generating progression from track "+(B+1)+"...");for(var T=f[B],C=0,I=new Map,M=0;M<T.length;M++){var x=T[M];if(C+=x.delta,"channel"===x.type){var O=x.value.noteNumber;if("noteOn"===x.subType){var _=x.value.velocity,R=k.getTime(C);I.has(O)?I.get(O).push({offset:R,velocity:_}):I.set(O,[{offset:R,velocity:_}]),c.push({velocity:_,delta:C,note:!0})}else if("noteOff"===x.subType){var P=I.get(O).pop();l.push({note:n.note(O),time:k.getTime(C)-P.offset,amplitude:P.velocity/128,offset:P.offset}),c.push({velocity:P.velocity,delta:C,note:!1})}}else e.verbose&&"meta"===x.type&&"string"==typeof x.value&&console.log(k.getTime(C).toFixed(2)+"s "+x.subType+": "+x.value)}}e.verbose&&console.log("normalizing volume..."),c.sort(function(t,e){return t.delta-e.delta||t.note-e.note}),e.verbose&&(console.log("total notes:",l.length),console.log("total time:",k.getTime(c[c.length-1].delta),"seconds"));var L=1,N=0,D=1,F=0,z=0,j=0,V=!0,q=!1,Y=void 0;try{for(var G,W=c[Symbol.iterator]();!(V=(G=W.next()).done);V=!0){var X=G.value;X.note?(D+=X.velocity,j++,D>L&&(L=D,N=k.getTime(X.delta)),j>F&&(F=j,z=k.getTime(X.delta))):(D-=X.velocity,j--)}}catch(t){q=!0,Y=t}finally{try{!V&&W.return&&W.return()}finally{if(q)throw Y}}p=128/L,e.verbose&&(console.log("setting volume to",p),console.log(" maximum chord of",F,"at",z,"seconds"),console.log(" maximum velocity of",L-1,"at",N,"seconds")),e.channels=1,e.verbose&&console.log("generating WAV buffer...");var J=new n(e.channels,e.sampleRate,e.bitsPerSample);return J.writeProgression(l,p,[0],!0,!0,e.duration),J}},{"./midi":5,"./utils/timer":7,"./wav":8}],7:[function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o=function(){function t(e){n(this,t),this.ticksPerBeat=e,this.criticalPoints=[]}return i(t,[{key:"addCriticalPoint",value:function(t,e){this.criticalPoints.push({delta:t,microsecondsPerBeat:e})}},{key:"getTime",value:function(t){for(var e,r=0,n=5e5,i=0;i<this.criticalPoints.length&&t>0;i++)e=this.criticalPoints[i],t>=e.delta?(r+=e.delta*n/this.ticksPerBeat/1e6,t-=e.delta):(r+=t*n/this.ticksPerBeat/1e6,t=0),n=e.microsecondsPerBeat;return r+=t*n/this.ticksPerBeat/1e6}}]),t}();e.exports=o},{}],8:[function(t,e,r){(function(t){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=function(){function t(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:44100,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];r(this,e);var s=i>>>3;this.header=new ArrayBuffer(44),this.view=new DataView(this.header),this.data=a,Object.defineProperty(this,"littleEndian",{configurable:!1,enumerable:!0,value:o,writable:!1}),this.pointer=0,this.ChunkID=o?"RIFF":"RIFX",this.ChunkSize=this.header.byteLength-8,this.Format="WAVE",this.SubChunk1ID="fmt ",this.SubChunk1Size=16,this.AudioFormat=1,this.NumChannels=t,this.SampleRate=n,this.ByteRate=t*n*s,this.BlockAlign=t*s,this.BitsPerSample=i,this.SubChunk2ID="data",this.SubChunk2Size=a.length*s}return i(e,null,[{key:"semitone",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"REST",e=/^([A-G])(\-?\d+)(b{0,2}|#{0,2})$/;if(!e.test(t))return-1/0;var r=t.match(e),i=n(r,4),o=i[1],a=i[2],s=i[3],u={C:0,D:2,E:4,F:5,G:7,A:9,B:11
},h={"-1":0,0:1,1:2,2:3,3:4,4:5,5:6,6:7,7:8,8:9,9:10,10:11},f={bb:-2,b:-1,"":0,"#":1,"##":2};return void 0===u[o]||void 0===h[a]||void 0===f[s]?-1/0:u[o]+12*h[a]+f[s]}},{key:"note",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1/0,e=[-1,0,1,2,3,4,5,6,7,8,9,10],r=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],n=Math.floor(t/12),i=Math.floor(t-12*n),o=e[n],a=r[i];return void 0===o||void 0===a?"REST":a.charAt(0)+o.toString()+a.charAt(1)}},{key:"frequency",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1/0;return 440*Math.pow(2,(t-69)/12)}}]),i(e,[{key:"setString",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=0;n<e;n++)this.view.setUint8(r+n,t.charCodeAt(n))}},{key:"getString",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=0,n="";r<t;r++)n+=String.fromCharCode(this.view.getUint8(e+r));return n}},{key:"toBlob",value:function(){return new Blob([this.header,this.typedData],{type:"audio/wav"})}},{key:"toBuffer",value:function(){return t.concat([t.from(this.header),t.from(this.typedData)])}},{key:"tell",value:function(){return this.pointer/this.NumChannels/this.SampleRate}},{key:"seek",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.data,n=Math.round(this.SampleRate*t);if(this.pointer=this.NumChannels*n,e)for(;r.length<this.pointer;)r[r.length]=0;else this.pointer=r.length}},{key:"writeNote",value:function(t){var r,n,i,o,a=t.note,s=t.time,u=t.amplitude,h=void 0===u?1:u,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],c=arguments.length>3&&void 0!==arguments[3]&&arguments[3],p=this.data,d=this.NumChannels,g=this.SampleRate,y=e.semitone(a),v=e.frequency(y)*Math.PI*2/g,b=(Math.PI,Math.round(g*s)),w=b-.001*g,m=b-w+1,k=this.pointer,E=p.length,S=Math.min(Math.floor((E-k)/d),b);if(0===f.length)for(f=[],r=0;r<d;r++)f[r]=r;var U=[];for(r=0;r<d;r++)U[r]=-1===f.indexOf(r);for(r=0;r<S;r++)for(n=0;n<f.length;n++)i=k+r*d+f[n],o=0,v>0&&(o=h*Math.sin(v*r)*(r<m?r:r>w?b-r+1:m)/m),p[i]=o+(l?p[i]:0);for(r=S;r<b;r++)for(i=k+r*d,n=0;n<d;n++)o=0,(v>0||!U[n])&&(o=h*Math.sin(v*r)*(r<m?r:r>w?b-r+1:m)/m),p[i+n]=o;var A=Math.max(k+b*d,E)*this.BitsPerSample>>>3;this.ChunkSize=A+this.header.byteLength-8,this.SubChunk2Size=A,c||(this.pointer=k+b*d)}},{key:"writeProgression",value:function(t){for(var e,r,n,i,o,a,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],h=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],f=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,c=this.pointer,p=0;p<t.length;p++){var d=t[p];e=d.note,r=d.time,n=d.amplitude,i=d.offset,void 0!==i&&this.seek(i),1===l||"REST"===e?this.writeNote({note:e,time:r,amplitude:void 0===n?s:n*s},u,h,!1):(o=r*l,a=r-o,this.writeNote({note:e,time:o,amplitude:void 0===n?s:n*s},u,h,!1),this.writeNote({note:"REST",time:a},u,h,!1))}f&&(this.pointer=c)}},{key:"ChunkID",set:function(t){this.setString(t,4,0)},get:function(){return this.getString(4,0)}},{key:"ChunkSize",set:function(t){this.view.setUint32(4,t,this.littleEndian)},get:function(){return this.view.getUint32(4,this.littleEndian)}},{key:"Format",set:function(t){this.setString(t,4,8)},get:function(){return this.getString(4,8)}},{key:"SubChunk1ID",set:function(t){this.setString(t,4,12)},get:function(){return this.getString(4,12)}},{key:"SubChunk1Size",set:function(t){this.view.setUint32(16,t,this.littleEndian)},get:function(){return this.view.getUint32(16,this.littleEndian)}},{key:"AudioFormat",set:function(t){this.view.setUint16(20,t,this.littleEndian)},get:function(){return this.view.getUint16(20,this.littleEndian)}},{key:"NumChannels",set:function(t){this.view.setUint16(22,t,this.littleEndian)},get:function(){return this.view.getUint16(22,this.littleEndian)}},{key:"SampleRate",set:function(t){this.view.setUint32(24,t,this.littleEndian)},get:function(){return this.view.getUint32(24,this.littleEndian)}},{key:"ByteRate",set:function(t){this.view.setUint32(28,t,this.littleEndian)},get:function(){return this.view.getUint32(28,this.littleEndian)}},{key:"BlockAlign",set:function(t){this.view.setUint16(32,t,this.littleEndian)},get:function(){return this.view.getUint16(32,this.littleEndian)}},{key:"BitsPerSample",set:function(t){this.view.setUint16(34,t,this.littleEndian)},get:function(){return this.view.getUint16(34,this.littleEndian)}},{key:"SubChunk2ID",set:function(t){this.setString(t,4,36)},get:function(){return this.getString(4,36)}},{key:"SubChunk2Size",set:function(t){this.view.setUint32(40,t,this.littleEndian)},get:function(){return this.view.getUint32(40,this.littleEndian)}},{key:"typedData",get:function(){var t,e,r=this.BitsPerSample>>>3,n=this.data,i=this.SubChunk2Size,o=i/r,a=new ArrayBuffer(i),s=new Uint8Array(a),u=Math.pow(2,(r<<3)-1)-1;switch(r){case 1:for(t=0;t<o;t++)s[t]=n[t]*u+128&255;break;case 2:if(this.littleEndian)for(t=0;t<o;t++)e=n[t]*u+65536&65535,s[2*t]=255&e,s[2*t+1]=e>>>8;else for(t=0;t<o;t++)e=n[t]*u+65536&65535,s[2*t]=e>>>8,s[2*t+1]=255&e;break;case 3:if(this.littleEndian)for(t=0;t<o;t++)e=n[t]*u+16777216&16777215,s[3*t]=255&e,s[3*t+1]=e>>>8&255,s[3*t+2]=e>>>16;else for(t=0;t<o;t++)e=n[t]*u+16777216&16777215,s[3*t]=e>>>16,s[3*t+1]=e>>>8&255,s[3*t+2]=255&e;case 4:if(this.littleEndian)for(t=0;t<o;t++)e=n[t]*u+4294967296&4294967295,s[4*t]=255&e,s[4*t+1]=e>>>8&255,s[4*t+2]=e>>>16&255,s[4*t+3]=e>>>24;else for(t=0;t<o;t++)e=n[t]*u+4294967296&4294967295,s[4*t]=e>>>24,s[4*t+1]=e>>>16&255,s[4*t+2]=e>>>8&255,s[4*t+3]=255&e}return a}}]),e}();e.exports=o}).call(this,t("buffer").Buffer)},{buffer:3}]},{},[1])(1)});
//# sourceMappingURL=synth.min.js.map