Comparing version 10.4.2 to 10.4.3
# CHANGELOG | ||
## version 10.4.3 - 2020-01-27 | ||
- Fix: large files RIFF/RIFX conversion | ||
## version 10.4.2 - 2020-01-22 | ||
@@ -4,0 +7,0 @@ Better sinc resampling. |
@@ -1,87 +0,87 @@ | ||
try{if(!Uint8Array.prototype.slice)Object.defineProperty(Uint8Array.prototype,"slice",{value:function(begin,end){return new Uint8Array(Array.prototype.slice.call(this,begin,end))}})}catch(err){}var ca="function"==typeof Object.create?Object.create:function(n){function m(){}m.prototype=n;return new m},F; | ||
if("function"==typeof Object.setPrototypeOf)F=Object.setPrototypeOf;else{var P;a:{var da={D:!0},pa={};try{pa.__proto__=da;P=pa.D;break a}catch(n){}P=!1}F=P?function(n,m){n.__proto__=m;if(n.__proto__!==m)throw new TypeError(n+" is not extensible");return n}:null}var qa=F; | ||
function S(n,m){n.prototype=ca(m.prototype);n.prototype.constructor=n;if(qa)qa(n,m);else for(var l in m)if("prototype"!=l)if(Object.defineProperties){var p=Object.getOwnPropertyDescriptor(m,l);p&&Object.defineProperty(n,l,p)}else n[l]=m[l]}var ra="function"==typeof Object.defineProperties?Object.defineProperty:function(n,m,l){n!=Array.prototype&&n!=Object.prototype&&(n[m]=l.value)},sa="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this; | ||
function T(n,m){if(m){for(var l=sa,p=n.split("."),y=0;y<p.length-1;y++){var v=p[y];v in l||(l[v]={});l=l[v]}p=p[p.length-1];y=l[p];v=m(y);v!=y&&null!=v&&ra(l,p,{configurable:!0,writable:!0,value:v})}}T("Object.is",function(n){return n?n:function(m,l){return m===l?0!==m||1/m===1/l:m!==m&&l!==l}}); | ||
T("Array.prototype.includes",function(n){return n?n:function(m,l){var p=this;p instanceof String&&(p=String(p));var y=p.length,v=l||0;for(0>v&&(v=Math.max(v+y,0));v<y;v++){var w=p[v];if(w===m||Object.is(w,m))return!0}return!1}}); | ||
T("String.prototype.codePointAt",function(n){return n?n:function(m){if(null==this)throw new TypeError("The 'this' value for String.prototype.codePointAt must not be null or undefined");var l=this.length;m=Number(m)||0;if(0<=m&&m<l){m|=0;var p=this.charCodeAt(m);if(55296>p||56319<p||m+1===l)return p;m=this.charCodeAt(m+1);return 56320>m||57343<m?p:1024*(p-55296)+m+9216}}}); | ||
var ta="function"==typeof Object.assign?Object.assign:function(n,m){for(var l=1;l<arguments.length;l++){var p=arguments[l];if(p)for(var y in p)Object.prototype.hasOwnProperty.call(p,y)&&(n[y]=p[y])}return n};T("Object.assign",function(n){return n||ta});var U=this; | ||
function V(n){function m(a){a=void 0===a?null:a;var b=l.call(this)||this;a&&b.fromBuffer(a);return b}function l(){return w.apply(this,arguments)||this}function p(a,b,c){for(var d=[],e=0;e<a;e++)d.push(this.b({pa:b,oa:c,Q:.5/Math.sin(Math.PI/(2*a)*(e+.5))}));this.a=[];for(a=0;a<d.length;a++)this.a[a]={Ka:d[a].A[0],La:d[a].A[1],Ma:d[a].A[2],Ha:d[a].D[0],Ia:d[a].D[1],k:d[a].k,z:[0,0]}}function y(a,b,c){c=2*Math.PI*c/b;b=0;this.a=[];for(var d=0;d<=a;d++)0===d-a/2?this.a[d]=c:(this.a[d]=Math.sin(c*(d- | ||
a/2))/(d-a/2),this.a[d]*=.54-.46*Math.cos(2*Math.PI*d/a)),b+=this.a[d];for(c=0;c<=a;c++)this.a[c]/=b;this.z=this.b()}function v(a,b,c){this.v=a;this.j=(a-1)/b;this.P=this.K;"point"===c.method?this.P=this.J:"linear"===c.method?this.P=this.I:"cubic"===c.method&&(this.P=this.C);this.l=ua;"periodic"===c.clip?(this.j=a/b,this.l=ea):"mirror"===c.clip&&(this.l=va);this.L=1-Math.max(0,Math.min(1,c.tension||0));this.B=c.sincFilterSize||1;this.H=wa(c.sincWindow||xa)}function w(){return D.apply(this,arguments)|| | ||
this}function D(){return t.apply(this,arguments)||this}function t(){var a=r.call(this)||this;a.bitDepth="0";a.f={h:0,o:!1,G:!1,O:!1};a.H={4:17,8:1,"8a":6,"8m":7,16:1,24:1,32:1,"32f":3,64:3};return a}function r(){return u.apply(this,arguments)||this}function u(){var a=B.call(this)||this;a.$.push("RF64");a.fmt={chunkId:"",chunkSize:0,audioFormat:0,numChannels:0,sampleRate:0,byteRate:0,blockAlign:0,bitsPerSample:0,cbSize:0,validBitsPerSample:0,dwChannelMask:0,subformat:[]};a.fact={chunkId:"",chunkSize:0, | ||
try{if(!Uint8Array.prototype.slice)Object.defineProperty(Uint8Array.prototype,"slice",{value:function(begin,end){return new Uint8Array(Array.prototype.slice.call(this,begin,end))}})}catch(err){}var aa="function"==typeof Object.create?Object.create:function(n){function m(){}m.prototype=n;return new m},H; | ||
if("function"==typeof Object.setPrototypeOf)H=Object.setPrototypeOf;else{var O;a:{var ba={D:!0},pa={};try{pa.__proto__=ba;O=pa.D;break a}catch(n){}O=!1}H=O?function(n,m){n.__proto__=m;if(n.__proto__!==m)throw new TypeError(n+" is not extensible");return n}:null}var qa=H; | ||
function Q(n,m){n.prototype=aa(m.prototype);n.prototype.constructor=n;if(qa)qa(n,m);else for(var l in m)if("prototype"!=l)if(Object.defineProperties){var p=Object.getOwnPropertyDescriptor(m,l);p&&Object.defineProperty(n,l,p)}else n[l]=m[l]}var ra="function"==typeof Object.defineProperties?Object.defineProperty:function(n,m,l){n!=Array.prototype&&n!=Object.prototype&&(n[m]=l.value)},sa="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this; | ||
function R(n,m){if(m){for(var l=sa,p=n.split("."),y=0;y<p.length-1;y++){var v=p[y];v in l||(l[v]={});l=l[v]}p=p[p.length-1];y=l[p];v=m(y);v!=y&&null!=v&&ra(l,p,{configurable:!0,writable:!0,value:v})}}R("Object.is",function(n){return n?n:function(m,l){return m===l?0!==m||1/m===1/l:m!==m&&l!==l}}); | ||
R("Array.prototype.includes",function(n){return n?n:function(m,l){var p=this;p instanceof String&&(p=String(p));var y=p.length,v=l||0;for(0>v&&(v=Math.max(v+y,0));v<y;v++){var w=p[v];if(w===m||Object.is(w,m))return!0}return!1}}); | ||
R("String.prototype.codePointAt",function(n){return n?n:function(m){if(null==this)throw new TypeError("The 'this' value for String.prototype.codePointAt must not be null or undefined");var l=this.length;m=Number(m)||0;if(0<=m&&m<l){m|=0;var p=this.charCodeAt(m);if(55296>p||56319<p||m+1===l)return p;m=this.charCodeAt(m+1);return 56320>m||57343<m?p:1024*(p-55296)+m+9216}}}); | ||
var ta="function"==typeof Object.assign?Object.assign:function(n,m){for(var l=1;l<arguments.length;l++){var p=arguments[l];if(p)for(var y in p)Object.prototype.hasOwnProperty.call(p,y)&&(n[y]=p[y])}return n};R("Object.assign",function(n){return n||ta});var S=this; | ||
function T(n){function m(a){a=void 0===a?null:a;var b=l.call(this)||this;a&&b.fromBuffer(a);return b}function l(){return w.apply(this,arguments)||this}function p(a,b,c){for(var d=[],e=0;e<a;e++)d.push(this.b({oa:b,na:c,Q:.5/Math.sin(Math.PI/(2*a)*(e+.5))}));this.a=[];for(a=0;a<d.length;a++)this.a[a]={Ja:d[a].A[0],Ka:d[a].A[1],La:d[a].A[2],Ga:d[a].D[0],Ha:d[a].D[1],k:d[a].k,z:[0,0]}}function y(a,b,c){c=2*Math.PI*c/b;b=0;this.a=[];for(var d=0;d<=a;d++)0===d-a/2?this.a[d]=c:(this.a[d]=Math.sin(c*(d- | ||
a/2))/(d-a/2),this.a[d]*=.54-.46*Math.cos(2*Math.PI*d/a)),b+=this.a[d];for(c=0;c<=a;c++)this.a[c]/=b;this.z=this.b()}function v(a,b,c){this.v=a;this.i=(a-1)/b;this.O=this.J;"point"===c.method?this.O=this.I:"linear"===c.method?this.O=this.H:"cubic"===c.method&&(this.O=this.C);this.m=ua;"periodic"===c.clip?(this.i=a/b,this.m=ca):"mirror"===c.clip&&(this.m=va);this.K=1-Math.max(0,Math.min(1,c.tension||0));this.B=c.sincFilterSize||1;this.G=wa(c.sincWindow||xa)}function w(){return C.apply(this,arguments)|| | ||
this}function C(){return t.apply(this,arguments)||this}function t(){var a=r.call(this)||this;a.bitDepth="0";a.f={g:0,o:!1,F:!1,N:!1};a.G={4:17,8:1,"8a":6,"8m":7,16:1,24:1,32:1,"32f":3,64:3};return a}function r(){return u.apply(this,arguments)||this}function u(){var a=B.call(this)||this;a.Y.push("RF64");a.fmt={chunkId:"",chunkSize:0,audioFormat:0,numChannels:0,sampleRate:0,byteRate:0,blockAlign:0,bitsPerSample:0,cbSize:0,validBitsPerSample:0,dwChannelMask:0,subformat:[]};a.fact={chunkId:"",chunkSize:0, | ||
dwSampleLength:0};a.cue={chunkId:"",chunkSize:0,dwCuePoints:0,points:[]};a.smpl={chunkId:"",chunkSize:0,dwManufacturer:0,dwProduct:0,dwSamplePeriod:0,dwMIDIUnityNote:0,dwMIDIPitchFraction:0,dwSMPTEFormat:0,dwSMPTEOffset:0,dwNumSampleLoops:0,dwSamplerData:0,loops:[]};a.bext={chunkId:"",chunkSize:0,description:"",originator:"",originatorReference:"",originationDate:"",originationTime:"",timeReference:[0,0],version:0,UMID:"",loudnessValue:0,loudnessRange:0,maxTruePeakLevel:0,maxMomentaryLoudness:0,maxShortTermLoudness:0, | ||
reserved:"",codingHistory:""};a.iXML={chunkId:"",chunkSize:0,value:""};a.ds64={chunkId:"",chunkSize:0,riffSizeHigh:0,riffSizeLow:0,dataSizeHigh:0,dataSizeLow:0,originationTime:0,sampleCountHigh:0,sampleCountLow:0};a.data={chunkId:"",chunkSize:0,samples:new Uint8Array(0)};a.LIST=[];a.junk={chunkId:"",chunkSize:0,chunkData:[]};a._PMX={chunkId:"",chunkSize:0,value:""};a.g={h:16,o:!1,G:!1,O:!1};return a}function B(){this.container="";this.chunkSize=0;this.format="";this.Z={};this.c=0;this.a={h:32,o:!1, | ||
G:!1,O:!1};this.$=["RIFF","RIFX"]}function J(a,b,c){this.a=this.c(a,b,c);this.offset=Math.ceil(a/8)}function N(a){a=C.call(this,a)||this;a.max=Math.pow(2,a.h)/2-1;a.min=-a.max-1;return a}function C(a){this.h=a;this.b=8>a?1:Math.ceil(a/8);this.max=Math.pow(2,a)-1;this.min=0;a=8-((a-1|7)+1-a);this.f=Math.pow(2,0<a?a:8)-1}function K(a,b){this.b=a;this.c=b;this.a=(1<<a-1)-1;this.f=Math.ceil((a+b)/8);this.g=Math.pow(2,this.a+1);this.i=a+b;this.j=Math.pow(2,-(8*this.f-1-a))}function ya(a){for(var b=new Uint8Array(256), | ||
c=0;64>c;c++)b["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(c)]=c;c=.75*a.length;"="===a[a.length-1]&&(c--,"="===a[a.length-2]&&c--);c=new ArrayBuffer(c);for(var d=new Uint8Array(c),e=0,f=0;e<a.length;e+=4){var h=b[a.charCodeAt(e)],k=b[a.charCodeAt(e+1)],q=b[a.charCodeAt(e+2)],z=b[a.charCodeAt(e+3)];d[f++]=h<<2|k>>4;d[f++]=(k&15)<<4|q>>2;d[f++]=(q&3)<<6|z&63}return c}function za(a,b){return a=0<a?parseInt(a/b.fa*b.da,10):parseInt(a/b.ga*b.ea,10)}function Aa(a,b){return parseInt(0< | ||
a?a*b.da:a*b.ea,10)}function Ba(a,b){return 0<a?a/b.fa:a/b.ga}function Ca(a,b){function c(d){return d}a!=b&&(c=["32f","64"].includes(a)?Aa:["32f","64"].includes(b)?Ba:za);return c}function fa(a){if("32f"!=a&&"64"!=a&&("8">parseInt(a,10)||"53"<parseInt(a,10)))throw Error("Invalid bit depth.");}function ha(a,b,c){if("8"==a)for(a=c?-128:128,c=0;c<b.length;c++)b[c]=b[c]+=a}function Da(a){for(var b=new Uint8Array(a.length),c=[],d=0,e=0,f=0;f<a.length;f++)0==f%505&&0!=f&&(b.set(Ea(c),d),d+=256,c=[],e++), | ||
c.push(a[f]);a=a.length/2;a%2&&a++;return b.slice(0,a+512+4*e)}function Fa(a,b){b=void 0===b?256:b;for(var c=new Int16Array(2*a.length),d=[],e=0,f=0;f<a.length;f++){if(0==f%b&&0!=f){var h=d[1]<<8|d[0];E=32768<h?h-65536:h;G=d[2];L=W[G];h=[E,E];for(var k=4;k<d.length;k++){var q=d[k],z=q>>4;h.push(ia(z<<4^q));h.push(ia(z))}d=h;c.set(d,e);e+=d.length;d=[]}d.push(a[f])}return c}function Ea(a){var b=a[0];X(b);var c=[];c.push(b&255);c.push(b>>8&255);c.push(I);c.push(0);for(b=3;b<a.length;b+=2){var d=X(a[b]), | ||
e=X(a[b+1]);c.push(e<<4|d)}return c}function X(a){var b=a-H;0<=b?a=0:(a=8,b=-b);var c=W[I],d=c>>3;b>c&&(a|=4,b-=c,d+=c);c>>=1;b>c&&(a|=2,b-=c,d+=c);c>>=1;b>c&&(a|=1,d+=c);b=a;H=b&8?H-d:H+d;-32768>H?H=-32768:32767<H&&(H=32767);I+=ja[b&7];0>I?I=0:88<I&&(I=88);return a}function ia(a){var b=0;a&4&&(b+=L);a&2&&(b+=L>>1);a&1&&(b+=L>>2);b+=L>>3;a&8&&(b=-b);E+=b;32767<E?E=32767:-32767>E&&(E=-32767);G+=ja[a];0>G?G=0:88<G&&(G=88);L=W[G];return E}function Ga(a){for(var b=new Uint8Array(a.length),c=0;c<a.length;c++){var d= | ||
c;var e=a[c];e=-32768==e?-32767:e;var f=~e>>8&128;f||(e*=-1);32635<e&&(e=32635);if(256<=e){var h=Ha[e>>8&127];e=h<<4|e>>h+3&15}else e>>=4;b[d]=e^f^85}return b}function Ia(a){for(var b=new Int16Array(a.length),c=0;c<a.length;c++){var d=c,e=a[c],f=0;e^=85;e&128&&(e&=-129,f=-1);var h=((e&240)>>4)+4;e=4!=h?1<<h|(e&15)<<h-4|1<<h-5:e<<1|1;b[d]=-8*(0===f?e:-e)}return b}function Ja(a){for(var b=new Uint8Array(a.length),c=0;c<a.length;c++){var d=c,e=a[c];var f=e>>8&128;0!=f&&(e=-e);32635<e&&(e=32635);e+=132; | ||
var h=Ka[e>>7&255];b[d]=~(f|h<<4|e>>h+3&15)}return b}function La(a){for(var b=new Int16Array(a.length),c=0;c<a.length;c++){var d=c,e=a[c];e=~e;var f=e>>4&7;f=Ma[f]+((e&15)<<f+3);0!=(e&128)&&(f=-f);b[d]=f}return b}function Y(a,b,c,d){d=void 0===d?a.length:d;if(d%b)throw Error("Bad buffer length.");for(c=void 0===c?0:c;c<d;c+=b){var e=a,f=b,h=c;f--;for(var k=0;k<f;k++){var q=e[h+k];e[h+k]=e[h+f];e[h+f]=q;f--}}}function Z(a,b,c){c=void 0===c?0:c;for(var d=0,e=a.length;d<e;d++){var f=a.codePointAt(d); | ||
if(128>f)b[c]=f,c++;else{var h=0,k=0;2047>=f?(h=1,k=192):65535>=f?(h=2,k=224):1114111>=f&&(h=3,k=240,d++);b[c]=(f>>6*h)+k;for(c++;0<h;)b[c]=128|f>>6*(h-1)&63,c++,h--}}return c}function aa(a){var b=Math.floor(a);a-=b;return.5>a?b:.5<a?b+1:b%2?b+1:b}function M(a,b,c){c=void 0===c?a.length:c;var d=void 0===b?0:b;c=void 0===c?a.length:c;b="";for(d=void 0===d?0:d;d<c;){var e=128,f=191,h=!1,k=a[d++];if(0<=k&&127>=k)b+=String.fromCharCode(k);else{var q=0;194<=k&&223>=k?q=1:224<=k&&239>=k?(q=2,224===a[d]&& | ||
(e=160),237===a[d]&&(f=159)):240<=k&&244>=k?(q=3,240===a[d]&&(e=144),244===a[d]&&(f=143)):h=!0;k&=(1<<8-q-1)-1;for(var z=0;z<q;z++){if(a[d]<e||a[d]>f)h=!0;k=k<<6|a[d]&63;d++}h?b+=String.fromCharCode(65533):65535>=k?b+=String.fromCharCode(k):(k-=65536,b+=String.fromCharCode((k>>10&1023)+55296,(k&1023)+56320))}}return b}function x(a){var b=[];Z(a,b,0);return b}function Q(a,b,c,d){d=void 0===d?0:d;b=b||{};var e=new J(b.h,b.O,b.G),f=0,h=d;try{for(var k=a.length;f<k;f++)d=e.F(c,a[f],d);b.o&&Y(c,e.offset, | ||
h,d)}catch(q){ka(q,a[f],f)}return d}function O(a,b,c,d,e,f){d=void 0===d?0:d;e=void 0===e?a.length:e;f=void 0===f?!1:f;b=b||{};var h=new J(b.h,b.O,b.G),k=h.offset,q=(e-d)%k;if(f&&(q||a.length<k))throw Error("Bad buffer length");e-=q;f=0;q=d;try{for(b.o&&Y(a,k,d,e);q<e;q+=k,f++)c[f]=h.R(a,q);b.o&&Y(a,k,d,e)}catch(z){ka(z,a.slice(q,q+k),q)}}function g(a,b){var c=[];Q([a],b,c,0);return c}function ba(a,b,c,d,e){d=void 0===d?a.length:d;var f=[];O(a,b,f,void 0===c?0:c,d,void 0===e?!1:e);return f}function R(a, | ||
b,c){c=void 0===c?0:c;return ba(a,b,c,c+Math.ceil(b.h/8),!0)[0]}function ka(a,b,c){a.message=a.constructor.name+" at index "+c+": "+b;throw a;}function A(a,b,c){c=void 0===c?!0:c;a=x(a);if(c)for(c=a.length;c<b;c++)a.push(0);return a}function la(a,b){for(var c=8===b?255:Math.pow(2,b)/2-1,d=8===b?0:-c-1,e=0,f=a.length;e<f;e++)a[e]=Math.round(a[e]),a[e]>c?a[e]=c:a[e]<d&&(a[e]=d)}function xa(a){return Math.exp(-a/2*a/2)}function wa(a){return function(b){return(0===b?1:Math.sin(Math.PI*b)/(Math.PI*b))* | ||
a(b)}}function ua(a,b){return Math.max(0,Math.min(a,b-1))}function ea(a,b){a%=b;0>a&&(a+=b);return a}function va(a,b){var c=2*(b-1);a=ea(a,c);a>b-1&&(a=c-a);return a}function ma(a,b,c,d){d=void 0===d?{}:d;var e=new Float64Array(a.length*((c-b)/b+1));d.method=d.method||"cubic";var f=new v(a.length,e.length,{method:d.method,tension:d.tension||0,sincFilterSize:d.sincFilterSize||6,sincWindow:d.sincWindow||void 0,clip:d.clip||"mirror"});void 0===d.LPF&&(d.LPF=Na[d.method]);if(d.LPF){d.LPFType=d.LPFType|| | ||
"IIR";var h=Oa[d.LPFType];if(c>b){b=new h(d.LPForder||na[d.LPFType],c,b/2);c=0;for(d=e.length;c<d;c++)e[c]=b.filter(f.P(c,a));b.reset();for(a=e.length-1;0<=a;a--)e[a]=b.filter(e[a])}else{b=new h(d.LPForder||na[d.LPFType],b,c/2);c=0;for(d=a.length;c<d;c++)a[c]=b.filter(a[c]);b.reset();for(c=a.length-1;0<=c;c--)a[c]=b.filter(a[c]);oa(a,e,f)}}else oa(a,e,f);return e}function oa(a,b,c){for(var d=0,e=b.length;d<e;d++)b[d]=c.P(d,a)}var ja=[-1,-1,-1,-1,2,4,6,8,-1,-1,-1,-1,2,4,6,8],W=[7,8,9,10,11,12,13,14, | ||
16,17,19,21,23,25,28,31,34,37,41,45,50,55,60,66,73,80,88,97,107,118,130,143,157,173,190,209,230,253,279,307,337,371,408,449,494,544,598,658,724,796,876,963,1060,1166,1282,1411,1552,1707,1878,2066,2272,2499,2749,3024,3327,3660,4026,4428,4871,5358,5894,6484,7132,7845,8630,9493,10442,11487,12635,13899,15289,16818,18500,20350,22385,24623,27086,29794,32767],H=0,I=0,E=0,G=0,L=7,Ha=[1,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, | ||
6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],Ka=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, | ||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],Ma=[0,132,396,924,1980,4092,8316,16764];K.prototype.F=function(a,b,c){if("number"!=typeof b)throw new TypeError;Math.abs(b)>this.g-2*this.i&&(b=0>b?-Infinity:Infinity);var d=0>((b=+b)||1/b)?1:0>b?1:0;b=Math.abs(b);var e=Math.min(Math.floor(Math.log(b)/Math.LN2),1023),f=aa(b/Math.pow(2,e)*Math.pow(2,this.c));b!==b?(f=Math.pow(2,this.c-1),e=(1<<this.b)- | ||
1):0!==b&&(b>=Math.pow(2,1-this.a)?(2<=f/Math.pow(2,this.c)&&(e+=1,f=1),e>this.a?(e=(1<<this.b)-1,f=0):(e+=this.a,f=aa(f)-Math.pow(2,this.c))):(f=aa(b/Math.pow(2,1-this.a-this.c)),e=0));return this.m(a,c,d,e,f)};K.prototype.R=function(a,b){for(var c=(1<<this.b)-1,d="",e=this.f-1;0<=e;e--){var f=a[e+b].toString(2);d+="00000000".substring(f.length)+f}e="1"==d.charAt(0)?-1:1;d=d.substring(1);f=parseInt(d.substring(0,this.b),2);d=d.substring(this.b);if(f==c)return 0!==parseInt(d,2)?NaN:Infinity*e;0=== | ||
f?(f+=1,c=parseInt(d,2)):c=parseInt("1"+d,2);return e*c*this.j*Math.pow(2,f-this.a)};K.prototype.m=function(a,b,c,d,e){var f=[];f.push(c);for(c=this.b;0<c;--c)f[c]=d%2?1:0,d=Math.floor(d/2);d=f.length;for(c=this.c;0<c;--c)f[d+c]=e%2?1:0,e=Math.floor(e/2);e=f.join("");f=this.f+b-1;for(d=b;f>=b;)a[f]=parseInt(e.substring(0,8),2),e=e.substring(8),f--,d++;return d};C.prototype.F=function(a,b,c){c=void 0===c?0:c;if(b!==b||"number"!=typeof b)throw new TypeError;this.a(b);return this.g(a,b,c)};C.prototype.R= | ||
function(a,b){var c=this.c(a,void 0===b?0:b);this.a(c);return c};C.prototype.c=function(a,b){b=void 0===b?0:b;for(var c=0,d=0;d<this.b;d++)c+=a[b+d]*Math.pow(256,d);return c};C.prototype.a=function(a){if(a>this.max||a<this.min)throw new RangeError;};C.prototype.g=function(a,b,c){c=void 0===c?0:c;a[c]=(0>b?b+Math.pow(2,this.h):b)&255;c++;for(var d=this.b,e=2;e<d;e++)a[c]=Math.floor(b/Math.pow(2,8*(e-1)))&255,c++;8<this.h&&(a[c]=Math.floor(b/Math.pow(2,8*(this.b-1)))&this.f,c++);return c};S(N,C);N.prototype.F= | ||
function(a,b,c){return C.prototype.F.call(this,a,b,void 0===c?0:c)};N.prototype.R=function(a,b){var c=C.prototype.c.call(this,a,void 0===b?0:b);c=this.i(c);this.a(c);return c};N.prototype.i=function(a){a>this.max&&(a-=2*this.max+2);return a};J.prototype.R=function(a,b){return this.a.R(a,void 0===b?0:b)};J.prototype.F=function(a,b,c){return this.a.F(a,b,void 0===c?0:c)};J.prototype.c=function(a,b,c){if(b){if(!a||16!==a&&32!==a&&64!==a)throw Error("Unsupported type: float, bits: "+a);return this.b(a)}if(!a|| | ||
1>a||53<a)throw Error("Unsupported type: int, bits: "+a);return c?new N(a):new C(a)};J.prototype.b=function(a){return 16===a?new K(5,11):32===a?new K(8,23):new K(11,52)};B.prototype.wa=function(a){this.c=0;this.container=this.s(a,4);if(-1===this.$.indexOf(this.container))throw Error("Not a supported format.");this.a.o="RIFX"===this.container;this.chunkSize=this.b(a);this.format=this.s(a,4);this.Z={chunkId:this.container,chunkSize:this.chunkSize,format:this.format,subChunks:this.W(a)}};B.prototype.m= | ||
function(a,b){b=void 0===b?!1:b;for(var c=this.Z.subChunks,d=[],e=0;e<c.length;e++)if(c[e].chunkId==a)if(b)d.push(c[e]);else return c[e];return"LIST"==a?d.length?d:null:null};B.prototype.s=function(a,b){var c=M(a,this.c,this.c+b);this.c+=b;return c};B.prototype.b=function(a){a=R(a,this.a,this.c);this.c+=4;return a};B.prototype.W=function(a){for(var b=[],c=this.c;c<=a.length-8;)b.push(this.ab(a,c)),c+=8+b[b.length-1].chunkSize,c=c%2?c+1:c;return b};B.prototype.ab=function(a,b){var c={chunkId:this.Fa(a, | ||
b),chunkSize:this.Ga(a,b)};"LIST"==c.chunkId?(c.format=M(a,b+8,b+12),this.c+=4,c.subChunks=this.W(a)):(this.c=b+8+(c.chunkSize%2?c.chunkSize+1:c.chunkSize),c.chunkData={start:b+8,end:this.c});return c};B.prototype.Fa=function(a,b){this.c+=4;return M(a,b,b+4)};B.prototype.Ga=function(a,b){this.c+=4;return R(a,this.a,b+4)};S(u,B);u.prototype.fromBuffer=function(a,b){b=void 0===b?!0:b;this.V();this.wa(a);this.g.o=this.a.o;if("WAVE"!=this.format)throw Error('Could not find the "WAVE" format identifier'); | ||
this.ib(a);this.kb(a);this.jb(a);this.fb(a);this.ra(a);this.gb(a);this.na(a);this.hb(a,b);this.ia(a);this.ja(a);this.qa(a)};u.prototype.V=function(){var a=new u;Object.assign(this.fmt,a.fmt);Object.assign(this.fact,a.fact);Object.assign(this.cue,a.cue);Object.assign(this.smpl,a.smpl);Object.assign(this.bext,a.bext);Object.assign(this.iXML,a.iXML);Object.assign(this.ds64,a.ds64);Object.assign(this.data,a.data);this.LIST=[];Object.assign(this.junk,a.junk);Object.assign(this._PMX,a._PMX)};u.prototype.kb= | ||
function(a){var b=this.m("fmt ");if(b)this.c=b.chunkData.start,this.fmt.chunkId=b.chunkId,this.fmt.chunkSize=b.chunkSize,this.fmt.audioFormat=this.i(a),this.fmt.numChannels=this.i(a),this.fmt.sampleRate=this.b(a),this.fmt.byteRate=this.b(a),this.fmt.blockAlign=this.i(a),this.fmt.bitsPerSample=this.i(a),this.lb(a);else throw Error('Could not find the "fmt " chunk');};u.prototype.lb=function(a){16<this.fmt.chunkSize&&(this.fmt.cbSize=this.i(a),18<this.fmt.chunkSize&&(this.fmt.validBitsPerSample=this.i(a), | ||
20<this.fmt.chunkSize&&(this.fmt.dwChannelMask=this.b(a),this.fmt.subformat=[this.b(a),this.b(a),this.b(a),this.b(a)])))};u.prototype.jb=function(a){var b=this.m("fact");b&&(this.c=b.chunkData.start,this.fact.chunkId=b.chunkId,this.fact.chunkSize=b.chunkSize,this.fact.dwSampleLength=this.b(a))};u.prototype.gb=function(a){var b=this.m("cue ");if(b)for(this.c=b.chunkData.start,this.cue.chunkId=b.chunkId,this.cue.chunkSize=b.chunkSize,this.cue.dwCuePoints=this.b(a),b=0;b<this.cue.dwCuePoints;b++)this.cue.points.push({dwName:this.b(a), | ||
dwPosition:this.b(a),fccChunk:this.s(a,4),dwChunkStart:this.b(a),dwBlockStart:this.b(a),dwSampleOffset:this.b(a)})};u.prototype.na=function(a){var b=this.m("smpl");if(b)for(this.c=b.chunkData.start,this.smpl.chunkId=b.chunkId,this.smpl.chunkSize=b.chunkSize,this.smpl.dwManufacturer=this.b(a),this.smpl.dwProduct=this.b(a),this.smpl.dwSamplePeriod=this.b(a),this.smpl.dwMIDIUnityNote=this.b(a),this.smpl.dwMIDIPitchFraction=this.b(a),this.smpl.dwSMPTEFormat=this.b(a),this.smpl.dwSMPTEOffset=this.b(a), | ||
this.smpl.dwNumSampleLoops=this.b(a),this.smpl.dwSamplerData=this.b(a),b=0;b<this.smpl.dwNumSampleLoops;b++)this.smpl.loops.push({dwName:this.b(a),dwType:this.b(a),dwStart:this.b(a),dwEnd:this.b(a),dwFraction:this.b(a),dwPlayCount:this.b(a)})};u.prototype.hb=function(a,b){var c=this.m("data");if(c)this.data.chunkId="data",this.data.chunkSize=c.chunkSize,b&&(this.data.samples=a.slice(c.chunkData.start,c.chunkData.end));else throw Error('Could not find the "data" chunk');};u.prototype.fb=function(a){var b= | ||
this.m("bext");b&&(this.c=b.chunkData.start,this.bext.chunkId=b.chunkId,this.bext.chunkSize=b.chunkSize,this.bext.description=this.s(a,256),this.bext.originator=this.s(a,32),this.bext.originatorReference=this.s(a,32),this.bext.originationDate=this.s(a,10),this.bext.originationTime=this.s(a,8),this.bext.timeReference=[this.b(a),this.b(a)],this.bext.version=this.i(a),this.bext.UMID=this.s(a,64),this.bext.loudnessValue=this.i(a),this.bext.loudnessRange=this.i(a),this.bext.maxTruePeakLevel=this.i(a), | ||
this.bext.maxMomentaryLoudness=this.i(a),this.bext.maxShortTermLoudness=this.i(a),this.bext.reserved=this.s(a,180),this.bext.codingHistory=this.s(a,this.bext.chunkSize-602))};u.prototype.ra=function(a){var b=this.m("iXML");b&&(this.c=b.chunkData.start,this.iXML.chunkId=b.chunkId,this.iXML.chunkSize=b.chunkSize,this.iXML.value=M(a,this.c,this.c+this.iXML.chunkSize))};u.prototype.ib=function(a){var b=this.m("ds64");if(b)this.c=b.chunkData.start,this.ds64.chunkId=b.chunkId,this.ds64.chunkSize=b.chunkSize, | ||
this.ds64.riffSizeHigh=this.b(a),this.ds64.riffSizeLow=this.b(a),this.ds64.dataSizeHigh=this.b(a),this.ds64.dataSizeLow=this.b(a),this.ds64.originationTime=this.b(a),this.ds64.sampleCountHigh=this.b(a),this.ds64.sampleCountLow=this.b(a);else if("RF64"==this.container)throw Error('Could not find the "ds64" chunk');};u.prototype.ja=function(a){var b=this.m("LIST",!0);if(null!==b)for(var c=0;c<b.length;c++){var d=b[c];this.LIST.push({chunkId:d.chunkId,chunkSize:d.chunkSize,format:d.format,subChunks:[]}); | ||
for(var e=0;e<d.subChunks.length;e++)this.la(d.subChunks[e],d.format,a)}};u.prototype.la=function(a,b,c){"adtl"==b?-1<["labl","note","ltxt"].indexOf(a.chunkId)&&this.ma(c,a):"INFO"==b&&this.ka(c,a)};u.prototype.ma=function(a,b){this.c=b.chunkData.start;var c={chunkId:b.chunkId,chunkSize:b.chunkSize,dwName:this.b(a)};"ltxt"==b.chunkId?(c.dwSampleLength=this.b(a),c.dwPurposeID=this.b(a),c.dwCountry=this.i(a),c.dwLanguage=this.i(a),c.dwDialect=this.i(a),c.dwCodePage=this.i(a),c.value=""):c.value=this.Y(a, | ||
this.c);this.LIST[this.LIST.length-1].subChunks.push(c)};u.prototype.ka=function(a,b){this.c=b.chunkData.start;this.LIST[this.LIST.length-1].subChunks.push({chunkId:b.chunkId,chunkSize:b.chunkSize,value:this.Y(a,this.c)})};u.prototype.ia=function(a){var b=this.m("junk");b&&(this.junk={chunkId:b.chunkId,chunkSize:b.chunkSize,chunkData:[].slice.call(a.slice(b.chunkData.start,b.chunkData.end))})};u.prototype.qa=function(a){var b=this.m("_PMX");b&&(this.c=b.chunkData.start,this._PMX.chunkId=b.chunkId, | ||
this._PMX.chunkSize=b.chunkSize,this._PMX.value=M(a,this.c,this.c+this._PMX.chunkSize))};u.prototype.Y=function(a,b){for(var c=b=void 0===b?0:b;c<a.length&&(this.c++,0!==a[c]);c++);return M(a,b,this.c-1)};u.prototype.i=function(a){a=R(a,this.g,this.c);this.c+=2;return a};S(r,u);r.prototype.toBuffer=function(){this.g.o="RIFX"===this.container;this.a.o=this.g.o;for(var a=[this.Ta(),this.Pa(),this.Ea(),this.cb(),this.Ra(),this.Qa(),x(this.data.chunkId),g(this.data.samples.length,this.a),this.data.samples, | ||
this.ha(),this.Za(),this.Ua(),this.bb()],b=0,c=0;c<a.length;c++)b+=a[c].length;c=new Uint8Array(b+12);var d=Z(this.container,c,0);d=Q([b+4],this.a,c,void 0===d?0:d);d=Z(this.format,c,void 0===d?0:d);for(b=0;b<a.length;b++)c.set(a[b],d),d+=a[b].length;return c};r.prototype.Ea=function(){var a=[];this.Da();this.bext.chunkId&&(this.bext.chunkSize=602+this.bext.codingHistory.length,a=a.concat(x(this.bext.chunkId),g(602+this.bext.codingHistory.length,this.a),A(this.bext.description,256),A(this.bext.originator, | ||
32),A(this.bext.originatorReference,32),A(this.bext.originationDate,10),A(this.bext.originationTime,8),g(this.bext.timeReference[0],this.a),g(this.bext.timeReference[1],this.a),g(this.bext.version,this.g),A(this.bext.UMID,64),g(this.bext.loudnessValue,this.g),g(this.bext.loudnessRange,this.g),g(this.bext.maxTruePeakLevel,this.g),g(this.bext.maxMomentaryLoudness,this.g),g(this.bext.maxShortTermLoudness,this.g),A(this.bext.reserved,180),A(this.bext.codingHistory,this.bext.codingHistory.length)));this.j(a); | ||
return a};r.prototype.Da=function(){for(var a in this.bext)if(this.bext.hasOwnProperty(a)&&this.bext[a]&&"timeReference"!=a){this.bext.chunkId="bext";break}if(this.bext.timeReference[0]||this.bext.timeReference[1])this.bext.chunkId="bext"};r.prototype.cb=function(){var a=[];if(this.iXML.chunkId){var b=x(this.iXML.value);this.iXML.chunkSize=b.length;a=a.concat(x(this.iXML.chunkId),g(this.iXML.chunkSize,this.a),b)}this.j(a);return a};r.prototype.Pa=function(){var a=[];this.ds64.chunkId&&(a=a.concat(x(this.ds64.chunkId), | ||
g(this.ds64.chunkSize,this.a),g(this.ds64.riffSizeHigh,this.a),g(this.ds64.riffSizeLow,this.a),g(this.ds64.dataSizeHigh,this.a),g(this.ds64.dataSizeLow,this.a),g(this.ds64.originationTime,this.a),g(this.ds64.sampleCountHigh,this.a),g(this.ds64.sampleCountLow,this.a)));this.j(a);return a};r.prototype.ha=function(){var a=[];if(this.cue.chunkId){var b=this.Na();a=a.concat(x(this.cue.chunkId),g(b.length+4,this.a),g(this.cue.dwCuePoints,this.a),b)}this.j(a);return a};r.prototype.Na=function(){for(var a= | ||
[],b=0;b<this.cue.dwCuePoints;b++)a=a.concat(g(this.cue.points[b].dwName,this.a),g(this.cue.points[b].dwPosition,this.a),x(this.cue.points[b].fccChunk),g(this.cue.points[b].dwChunkStart,this.a),g(this.cue.points[b].dwBlockStart,this.a),g(this.cue.points[b].dwSampleOffset,this.a));return a};r.prototype.Za=function(){var a=[];if(this.smpl.chunkId){var b=this.$a();a=a.concat(x(this.smpl.chunkId),g(b.length+36,this.a),g(this.smpl.dwManufacturer,this.a),g(this.smpl.dwProduct,this.a),g(this.smpl.dwSamplePeriod, | ||
this.a),g(this.smpl.dwMIDIUnityNote,this.a),g(this.smpl.dwMIDIPitchFraction,this.a),g(this.smpl.dwSMPTEFormat,this.a),g(this.smpl.dwSMPTEOffset,this.a),g(this.smpl.dwNumSampleLoops,this.a),g(this.smpl.dwSamplerData,this.a),b)}this.j(a);return a};r.prototype.$a=function(){for(var a=[],b=0;b<this.smpl.dwNumSampleLoops;b++)a=a.concat(g(this.smpl.loops[b].dwName,this.a),g(this.smpl.loops[b].dwType,this.a),g(this.smpl.loops[b].dwStart,this.a),g(this.smpl.loops[b].dwEnd,this.a),g(this.smpl.loops[b].dwFraction, | ||
this.a),g(this.smpl.loops[b].dwPlayCount,this.a));return a};r.prototype.Qa=function(){var a=[];this.fact.chunkId&&(a=a.concat(x(this.fact.chunkId),g(this.fact.chunkSize,this.a),g(this.fact.dwSampleLength,this.a)));this.j(a);return a};r.prototype.Ra=function(){var a=[];if(this.fmt.chunkId)return a=a.concat(x(this.fmt.chunkId),g(this.fmt.chunkSize,this.a),g(this.fmt.audioFormat,this.g),g(this.fmt.numChannels,this.g),g(this.fmt.sampleRate,this.a),g(this.fmt.byteRate,this.a),g(this.fmt.blockAlign,this.g), | ||
g(this.fmt.bitsPerSample,this.g),this.Sa()),this.j(a),a;throw Error('Could not find the "fmt " chunk');};r.prototype.Sa=function(){var a=[];16<this.fmt.chunkSize&&(a=a.concat(g(this.fmt.cbSize,this.g)));18<this.fmt.chunkSize&&(a=a.concat(g(this.fmt.validBitsPerSample,this.g)));20<this.fmt.chunkSize&&(a=a.concat(g(this.fmt.dwChannelMask,this.a)));24<this.fmt.chunkSize&&(a=a.concat(g(this.fmt.subformat[0],this.a),g(this.fmt.subformat[1],this.a),g(this.fmt.subformat[2],this.a),g(this.fmt.subformat[3], | ||
this.a)));return a};r.prototype.Ua=function(){for(var a=[],b=0;b<this.LIST.length;b++){var c=this.Wa(this.LIST[b].subChunks,this.LIST[b].format);a=a.concat(x(this.LIST[b].chunkId),g(c.length+4,this.a),x(this.LIST[b].format),c)}this.j(a);return a};r.prototype.Wa=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)"INFO"==b?c=c.concat(this.Va(a[d])):"adtl"==b&&(c=c.concat(this.Xa(a[d]))),this.j(c);return c};r.prototype.Va=function(a){var b=[],c=A(a.value,a.value.length);b=b.concat(x(a.chunkId),g(c.length+ | ||
1,this.a),c);b.push(0);return b};r.prototype.Xa=function(a){var b=[];if(-1<["labl","note"].indexOf(a.chunkId)){var c=A(a.value,a.value.length);b=b.concat(x(a.chunkId),g(c.length+5,this.a),g(a.dwName,this.a),c);b.push(0)}else"ltxt"==a.chunkId&&(b=b.concat(this.Ya(a)));return b};r.prototype.Ya=function(a){return x(a.chunkId).concat(g(a.value.length+20,this.a),g(a.dwName,this.a),g(a.dwSampleLength,this.a),g(a.dwPurposeID,this.a),g(a.dwCountry,this.g),g(a.dwLanguage,this.g),g(a.dwDialect,this.g),g(a.dwCodePage, | ||
this.g),A(a.value,a.value.length))};r.prototype.bb=function(){var a=[];if(this._PMX.chunkId){var b=x(this._PMX.value);this._PMX.chunkSize=b.length;a=a.concat(x(this._PMX.chunkId),g(this._PMX.chunkSize,this.a),b)}this.j(a);return a};r.prototype.Ta=function(){var a=[];if(this.junk.chunkId)return a.concat(x(this.junk.chunkId),g(this.junk.chunkData.length,this.a),this.junk.chunkData);this.j(a);return a};r.prototype.j=function(a){a.length%2&&a.push(0)};S(t,r);t.prototype.fromScratch=function(a,b,c,d,e){e= | ||
void 0===e?{}:e;this.V();this.X(a,b,c,d,e)};t.prototype.fromBuffer=function(a,b){r.prototype.fromBuffer.call(this,a,void 0===b?!0:b);this.za();this.aa()};t.prototype.toBuffer=function(){this.ba();return r.prototype.toBuffer.call(this)};t.prototype.getSamples=function(a,b){a=void 0===a?!1:a;b=void 0===b?Float64Array:b;var c=new b(this.data.samples.length/(this.f.h/8));O(this.data.samples,this.f,c);if(!a&&1<this.fmt.numChannels){var d=this.fmt.numChannels,e=b;e=void 0===e?Float64Array:e;for(var f=[], | ||
h=0;h<d;h++)f[h]=new e(c.length/d);for(e=0;e<d;e++){h=0;for(var k=e;k<c.length;k+=d)f[e][h++]=c[k]}c=f}return c};t.prototype.getSample=function(a){a*=this.f.h/8;if(a+this.f.h/8>this.data.samples.length)throw Error("Range error");return R(this.data.samples.slice(a,a+this.f.h/8),this.f)};t.prototype.setSample=function(a,b){a*=this.f.h/8;if(a+this.f.h/8>this.data.samples.length)throw Error("Range error");Q([b],this.f,this.data.samples,void 0===a?0:a)};t.prototype.getiXML=function(){return this.iXML.value}; | ||
t.prototype.setiXML=function(a){if("string"!==typeof a)throw new TypeError("iXML value must be a string.");this.iXML.value=a;this.iXML.chunkId="iXML"};t.prototype.get_PMX=function(){return this._PMX.value};t.prototype.set_PMX=function(a){if("string"!==typeof a)throw new TypeError("_PMX value must be a string.");this._PMX.value=a;this._PMX.chunkId="_PMX"};t.prototype.X=function(a,b,c,d,e){e=void 0===e?{}:e;e.container||(e.container="RIFF");this.container=e.container;this.bitDepth=c;var f=[];if(0<d.length)if(d[0].constructor!== | ||
Number){f=new Float64Array(d[0].length*d.length);for(var h=0,k=0,q=d[0].length;k<q;k++)for(var z=0,Pa=d.length;z<Pa;z++)f[h]=d[z][k],h++}else f=d;d=f;this.aa();f=this.f.h/8;this.data.samples=new Uint8Array(d.length*f);Q(d,this.f,this.data.samples);this.eb(c,a,b,f,this.data.samples.length,e);this.data.chunkId="data";this.data.chunkSize=this.data.samples.length;this.ba()};t.prototype.eb=function(a,b,c,d,e,f){"4"==a?this.Aa(a,b,c,d,e,f):"8a"==a||"8m"==a?this.Ba(a,b,c,d,e,f):-1==Object.keys(this.H).indexOf(a)|| | ||
2<b?this.Ca(a,b,c,d,e,f):this.B(a,b,c,d,e,f)};t.prototype.B=function(a,b,c,d,e,f){this.container=f.container;this.chunkSize=36+e;this.format="WAVE";this.bitDepth=a;this.fmt={chunkId:"fmt ",chunkSize:16,audioFormat:this.H[a]||65534,numChannels:b,sampleRate:c,byteRate:b*d*c,blockAlign:b*d,bitsPerSample:parseInt(a,10),cbSize:0,validBitsPerSample:0,dwChannelMask:0,subformat:[]}};t.prototype.Aa=function(a,b,c,d,e,f){this.B(a,b,c,d,e,f);this.chunkSize=40+e;this.fmt.chunkSize=20;this.fmt.byteRate=4055;this.fmt.blockAlign= | ||
256;this.fmt.bitsPerSample=4;this.fmt.cbSize=2;this.fmt.validBitsPerSample=505;this.fact={chunkId:"fact",chunkSize:4,dwSampleLength:2*e}};t.prototype.Ca=function(a,b,c,d,e,f){this.B(a,b,c,d,e,f);this.chunkSize=60+e;this.fmt.chunkSize=40;this.fmt.bitsPerSample=(parseInt(a,10)-1|7)+1;this.fmt.cbSize=22;this.fmt.validBitsPerSample=parseInt(a,10);a=this.fmt;c=0;1===b?c=4:2===b?c=3:4===b?c=51:6===b?c=63:8===b&&(c=1599);a.dwChannelMask=c;this.fmt.subformat=[1,1048576,2852126848,1905997824]};t.prototype.Ba= | ||
function(a,b,c,d,e,f){this.B(a,b,c,d,e,f);this.chunkSize=40+e;this.fmt.chunkSize=20;this.fmt.cbSize=2;this.fmt.validBitsPerSample=8;this.fact={chunkId:"fact",chunkSize:4,dwSampleLength:e}};t.prototype.za=function(){3===this.fmt.audioFormat&&32===this.fmt.bitsPerSample?this.bitDepth="32f":6===this.fmt.audioFormat?this.bitDepth="8a":7===this.fmt.audioFormat?this.bitDepth="8m":this.bitDepth=this.fmt.bitsPerSample.toString()};t.prototype.xa=function(){if(!(this.H[this.bitDepth]||8<parseInt(this.bitDepth, | ||
10)&&54>parseInt(this.bitDepth,10)))throw Error("Invalid bit depth.");};t.prototype.aa=function(){this.f={h:(parseInt(this.bitDepth,10)-1|7)+1,O:"32f"==this.bitDepth||"64"==this.bitDepth,G:"8"!=this.bitDepth,o:"RIFX"==this.container};-1<["4","8a","8m"].indexOf(this.bitDepth)&&(this.f.h=8,this.f.G=!1)};t.prototype.ba=function(){this.xa();var a=this.fmt.numChannels;if(1>a||65535<a*this.fmt.bitsPerSample/8)throw Error("Invalid number of channels.");a=this.fmt.sampleRate;if(1>a||4294967295<this.fmt.bitsPerSample/ | ||
8*this.fmt.numChannels*a)throw Error("Invalid sample rate.");};S(D,t);D.prototype.getTag=function(a){a=this.L(a);return null!==a.w?this.LIST[a.LIST].subChunks[a.w].value:null};D.prototype.setTag=function(a,b){var c=a;if(c.constructor!==String)throw Error("Invalid tag name.");if(4>c.length)for(var d=0,e=4-c.length;d<e;d++)c+=" ";a=c;c=this.L(a);null!==c.w?(this.LIST[c.LIST].subChunks[c.w].chunkSize=b.length+1,this.LIST[c.LIST].subChunks[c.w].value=b):null!==c.LIST?this.LIST[c.LIST].subChunks.push({chunkId:a, | ||
chunkSize:b.length+1,value:b}):(this.LIST.push({chunkId:"LIST",chunkSize:b.length+9,format:"INFO",subChunks:[]}),this.LIST[this.LIST.length-1].subChunks.push({chunkId:a,chunkSize:b.length+1,value:b}))};D.prototype.deleteTag=function(a){a=this.L(a);return null!==a.w?(this.LIST[a.LIST].subChunks.splice(a.w,1),!0):!1};D.prototype.listTags=function(){var a=this.C("INFO"),b={};if(null!==a)for(var c=0,d=this.LIST[a].subChunks.length;c<d;c++)b[this.LIST[a].subChunks[c].chunkId]=this.LIST[a].subChunks[c].value; | ||
return b};D.prototype.C=function(a){for(var b=0,c=this.LIST.length;b<c;b++)if(this.LIST[b].format==a)return b;return null};D.prototype.L=function(a){for(var b={LIST:null,w:null},c=0,d=this.LIST.length;c<d;c++)if("INFO"==this.LIST[c].format){b.LIST=c;d=0;for(var e=this.LIST[c].subChunks.length;d<e;d++)if(this.LIST[c].subChunks[d].chunkId==a){b.w=d;break}break}return b};S(w,D);w.prototype.listCuePoints=function(){for(var a=this.K(),b=0,c=a.length;b<c;b++)a[b].position=a[b].dwSampleOffset/this.fmt.sampleRate* | ||
1E3,a[b].dwSampleLength?(a[b].end=a[b].dwSampleLength/this.fmt.sampleRate*1E3,a[b].end+=a[b].position):a[b].end=null,delete a[b].value;return a};w.prototype.setCuePoint=function(a){this.cue.chunkId="cue ";a.label||(a.label="");var b=this.K();this.J();this.cue.points=[];a.dwSampleOffset=a.position*this.fmt.sampleRate/1E3;a.dwSampleLength=0;a.end&&(a.dwSampleLength=a.end*this.fmt.sampleRate/1E3-a.dwSampleOffset);0===b.length?this.v(a,1):this.sa(b,a);this.cue.dwCuePoints=this.cue.points.length};w.prototype.deleteCuePoint= | ||
function(a){this.cue.chunkId="cue ";var b=this.K();this.J();var c=this.cue.points.length;this.cue.points=[];for(var d=0;d<c;d++)d+1!==a&&this.v(b[d],d+1);this.cue.dwCuePoints=this.cue.points.length;this.cue.dwCuePoints?this.cue.chunkId="cue ":(this.cue.chunkId="",this.J())};w.prototype.updateLabel=function(a,b){var c=this.C("adtl");if(null!==c)for(var d=0,e=this.LIST[c].subChunks.length;d<e;d++)this.LIST[c].subChunks[d].dwName==a&&(this.LIST[c].subChunks[d].value=b)};w.prototype.K=function(){for(var a= | ||
[],b=0;b<this.cue.points.length;b++){var c=this.cue.points[b],d=this.Oa(c.dwName);d.label=d.value?d.value:"";d.dwPosition=c.dwPosition;d.fccChunk=c.fccChunk;d.dwChunkStart=c.dwChunkStart;d.dwBlockStart=c.dwBlockStart;d.dwSampleOffset=c.dwSampleOffset;a.push(d)}return a};w.prototype.Oa=function(a){var b=this.C("adtl"),c={};null!==b&&this.Ja(c,b,a);return c};w.prototype.Ja=function(a,b,c){for(var d=0,e=this.LIST[b].subChunks.length;d<e;d++)if(this.LIST[b].subChunks[d].dwName==c){var f=this.LIST[b].subChunks[d]; | ||
a.value=f.value||a.value;a.dwName=f.dwName||0;a.dwSampleLength=f.dwSampleLength||0;a.dwPurposeID=f.dwPurposeID||0;a.dwCountry=f.dwCountry||0;a.dwLanguage=f.dwLanguage||0;a.dwDialect=f.dwDialect||0;a.dwCodePage=f.dwCodePage||0}};w.prototype.v=function(a,b){this.cue.points.push({dwName:b,dwPosition:a.dwPosition?a.dwPosition:0,fccChunk:a.fccChunk?a.fccChunk:"data",dwChunkStart:a.dwChunkStart?a.dwChunkStart:0,dwBlockStart:a.dwBlockStart?a.dwBlockStart:0,dwSampleOffset:a.dwSampleOffset});this.ua(a,b)}; | ||
w.prototype.sa=function(a,b){for(var c=!1,d=0;d<a.length;d++)a[d].dwSampleOffset>b.dwSampleOffset&&!c?(this.v(b,d+1),this.v(a[d],d+2),c=!0):this.v(a[d],c?d+2:d+1);c||this.v(b,this.cue.points.length+1)};w.prototype.J=function(){for(var a=0,b=this.LIST.length;a<b;a++)"adtl"==this.LIST[a].format&&this.LIST.splice(a)};w.prototype.ua=function(a,b){var c=this.C("adtl");null===c&&(this.LIST.push({chunkId:"LIST",chunkSize:4,format:"adtl",subChunks:[]}),c=this.LIST.length-1);this.ta(c,a,b);a.dwSampleLength&& | ||
this.va(c,a,b)};w.prototype.ta=function(a,b,c){this.LIST[a].subChunks.push({chunkId:"labl",chunkSize:4,dwName:c,value:b.label});this.LIST[a].chunkSize+=12};w.prototype.va=function(a,b,c){this.LIST[a].subChunks.push({chunkId:"ltxt",chunkSize:20,dwName:c,dwSampleLength:b.dwSampleLength,dwPurposeID:b.dwPurposeID||0,dwCountry:b.dwCountry||0,dwLanguage:b.dwLanguage||0,dwDialect:b.dwDialect||0,dwCodePage:b.dwCodePage||0,value:b.label});this.LIST[a].chunkSize+=28};v.prototype.J=function(a,b){return this.f(Math.round(this.j* | ||
a),b)};v.prototype.I=function(a,b){a*=this.j;var c=Math.floor(a);a-=c;return(1-a)*this.f(c,b)+a*this.f(c+1,b)};v.prototype.C=function(a,b){a*=this.j;var c=Math.floor(a),d=[this.u(c,b),this.u(c+1,b)],e=[this.f(c,b),this.f(c+1,b)];a-=c;c=a*a;var f=a*c;return(2*f-3*c+1)*e[0]+(f-2*c+a)*d[0]+(-2*f+3*c)*e[1]+(f-c)*d[1]};v.prototype.K=function(a,b){a*=this.j;var c=Math.floor(a),d=c+this.B,e=0;for(c=c-this.B+1;c<=d;c++)e+=this.H(a-c)*this.f(c,b);return e};v.prototype.u=function(a,b){return this.L*(this.f(a+ | ||
1,b)-this.f(a-1,b))/2};v.prototype.f=function(a,b){return 0<=a&&a<this.v?b[a]:b[this.l(a,this.v)]};y.prototype.filter=function(a){this.z.N[this.z.S]=a;for(var b=a=0,c=this.z.N.length;b<c;b++)a+=this.a[b]*this.z.N[(this.z.S+b)%this.z.N.length];this.z.S=(this.z.S+1)%this.z.N.length;return a};y.prototype.reset=function(){this.z=this.b()};y.prototype.b=function(){for(var a=[],b=0;b<this.a.length-1;b++)a.push(0);return{N:a,S:0}};p.prototype.filter=function(a){for(var b=0,c=this.a.length;b<c;b++)a=this.f(b, | ||
a);return a};p.prototype.b=function(a){var b={z:[0,0],D:[],A:[]};a=this.c(a,b);b.k=1;b.A.push((1-a.ca)/(2*a.M));b.A.push(2*b.A[0]);b.A.push(b.A[0]);return b};p.prototype.c=function(a,b){var c={},d=2*Math.PI*a.oa/a.pa;c.alpha=Math.sin(d)/(2*a.Q);c.ca=Math.cos(d);c.M=1+c.alpha;b.M=c.M;b.D.push(-2*c.ca/c.M);b.k=1;b.D.push((1-c.alpha)/c.M);return c};p.prototype.f=function(a,b){var c=b*this.a[a].k-this.a[a].Ha*this.a[a].z[0]-this.a[a].Ia*this.a[a].z[1],d=this.a[a].Ka*c+this.a[a].La*this.a[a].z[0]+this.a[a].Ma* | ||
this.a[a].z[1];this.a[a].z[1]=this.a[a].z[0];this.a[a].z[0]=c;return d};p.prototype.reset=function(){for(var a=0;a<this.a.length;a++)this.a[a].z=[0,0]};var Na={point:!1,linear:!1,cubic:!0,sinc:!0},na={IIR:16,FIR:71},Oa={IIR:p,FIR:y};S(l,w);l.prototype.toRIFF=function(){this.l(this.fmt.numChannels,this.fmt.sampleRate,this.bitDepth,ba(this.data.samples,this.f))};l.prototype.toRIFX=function(){this.l(this.fmt.numChannels,this.fmt.sampleRate,this.bitDepth,ba(this.data.samples,this.f),{container:"RIFX"})}; | ||
l.prototype.toIMAADPCM=function(){if(8E3!==this.fmt.sampleRate)throw Error("Only 8000 Hz files can be compressed as IMA-ADPCM.");if(1!==this.fmt.numChannels)throw Error("Only mono files can be compressed as IMA-ADPCM.");this.I();var a=new Int16Array(this.T());O(this.data.samples,this.f,a);this.l(this.fmt.numChannels,this.fmt.sampleRate,"4",Da(a),{container:this.u()})};l.prototype.fromIMAADPCM=function(a){a=void 0===a?"16":a;this.l(this.fmt.numChannels,this.fmt.sampleRate,"16",Fa(this.data.samples, | ||
this.fmt.blockAlign),{container:this.u()});"16"!=a&&this.toBitDepth(a)};l.prototype.toALaw=function(){this.I();var a=new Int16Array(this.T());O(this.data.samples,this.f,a);this.l(this.fmt.numChannels,this.fmt.sampleRate,"8a",Ga(a),{container:this.u()})};l.prototype.fromALaw=function(a){a=void 0===a?"16":a;this.l(this.fmt.numChannels,this.fmt.sampleRate,"16",Ia(this.data.samples),{container:this.u()});"16"!=a&&this.toBitDepth(a)};l.prototype.toMuLaw=function(){this.I();var a=new Int16Array(this.T()); | ||
O(this.data.samples,this.f,a);this.l(this.fmt.numChannels,this.fmt.sampleRate,"8m",Ja(a),{container:this.u()})};l.prototype.fromMuLaw=function(a){a=void 0===a?"16":a;this.l(this.fmt.numChannels,this.fmt.sampleRate,"16",La(this.data.samples),{container:this.u()});"16"!=a&&this.toBitDepth(a)};l.prototype.toBitDepth=function(a,b){var c=a,d=this.bitDepth;void 0===b||b||("32f"!=a&&(c=this.f.h.toString()),d=""+this.f.h);this.U();var e=this.getSamples(!0),f=new Float64Array(e.length),h=d;if(-1<["32f","64"].indexOf(h)&& | ||
-1<["32f","64"].indexOf(c))f.set(e);else{fa(h);fa(c);d=Ca(h,c);var k={ga:Math.pow(2,parseInt(h,10))/2,ea:Math.pow(2,parseInt(c,10))/2,fa:Math.pow(2,parseInt(h,10))/2-1,da:Math.pow(2,parseInt(c,10))/2-1};ha(h,e,!0);if(-1<["32f","64"].indexOf(h)){h=e.length;for(var q=0;q<h;q++)1<e[q]?e[q]=1:-1>e[q]&&(e[q]=-1)}for(h=0;h<e.length;h++)f[h]=d(e[h],k);ha(c,f,!1)}this.l(this.fmt.numChannels,this.fmt.sampleRate,a,f,{container:this.u()})};l.prototype.toSampleRate=function(a,b){b=void 0===b?{}:b;this.ya(a); | ||
var c=this.getSamples(),d=[];if(c.constructor===Float64Array)d=ma(c,this.fmt.sampleRate,a,b);else for(var e=0;e<c.length;e++)d.push(ma(c[e],this.fmt.sampleRate,a,b));if("64"!==this.bitDepth&&"32f"!==this.bitDepth)if(d[0].constructor===Number)la(d,this.f.h);else for(c=0;c<d.length;c++)la(d[c],this.f.h);this.l(this.fmt.numChannels,a,this.bitDepth,d,{container:this.u()})};l.prototype.ya=function(a){if(1>a||4294967295<this.fmt.bitsPerSample/8*this.fmt.numChannels*a)throw Error("Invalid sample rate."); | ||
if(-1<["4","8a","8m"].indexOf(this.bitDepth))throw Error("wavefile can't change the sample rate of compressed files.");};l.prototype.I=function(){this.U();"16"!=this.bitDepth&&this.toBitDepth("16")};l.prototype.U=function(){"8a"==this.bitDepth?this.fromALaw():"8m"==this.bitDepth?this.fromMuLaw():"4"==this.bitDepth&&this.fromIMAADPCM()};l.prototype.u=function(){return"RF64"==this.container?"RIFF":this.container};l.prototype.l=function(a,b,c,d,e){e=void 0===e?{}:e;var f=new w;Object.assign(this.fmt, | ||
f.fmt);Object.assign(this.fact,f.fact);Object.assign(this.ds64,f.ds64);Object.assign(this.data,f.data);this.X(a,b,c,d,e)};l.prototype.T=function(){var a=this.data.samples.length/2;a%2&&a++;return a};S(m,l);m.prototype.fromBase64=function(a){this.fromBuffer(new Uint8Array(ya(a)))};m.prototype.toBase64=function(){for(var a=this.toBuffer(),b="",c=0;c<a.length;c+=3)b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[a[c]>>2],b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(a[c]& | ||
3)<<4|a[c+1]>>4],b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(a[c+1]&15)<<2|a[c+2]>>6],b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[a[c+2]&63];2===a.length%3?b=b.substring(0,b.length-1)+"=":1===a.length%3&&(b=b.substring(0,b.length-2)+"==");return b};m.prototype.toDataURI=function(){return"data:audio/wav;base64,"+this.toBase64()};m.prototype.fromDataURI=function(a){this.fromBase64(a.replace("data:audio/wav;base64,",""))};n.WaveFile=m;Object.defineProperty(n, | ||
"__esModule",{value:!0})}"object"===typeof exports&&"undefined"!==typeof module?V(exports):"function"===typeof define&&define.amd?define(["exports"],V):(U=U||self,V(U.wavefile={})); | ||
reserved:"",codingHistory:""};a.iXML={chunkId:"",chunkSize:0,value:""};a.ds64={chunkId:"",chunkSize:0,riffSizeHigh:0,riffSizeLow:0,dataSizeHigh:0,dataSizeLow:0,originationTime:0,sampleCountHigh:0,sampleCountLow:0};a.data={chunkId:"",chunkSize:0,samples:new Uint8Array(0)};a.LIST=[];a.junk={chunkId:"",chunkSize:0,chunkData:[]};a._PMX={chunkId:"",chunkSize:0,value:""};a.h={g:16,o:!1,F:!1,N:!1};return a}function B(){this.container="";this.chunkSize=0;this.format="";this.X={};this.c=0;this.a={g:32,o:!1, | ||
F:!1,N:!1};this.Y=["RIFF","RIFX"]}function K(a,b){this.b=a;this.c=b;this.a=(1<<a-1)-1;this.f=Math.ceil((a+b)/8);this.h=Math.pow(2,this.a+1);this.j=a+b;this.i=Math.pow(2,-(8*this.f-1-a))}function E(a,b,c){this.g=a;this.b=8>a?1:Math.ceil(a/8);this.max=Math.pow(2,a)-1;this.min=0;var d=8-((a-1|7)+1-a);this.f=Math.pow(2,0<d?d:8)-1;this.R=this.l;if(void 0===b?0:b)this.max=Math.pow(2,a)/2-1,this.min=-this.max-1,this.R=this.i;if(void 0===c?0:c)this.a=this.h}function ya(a){for(var b=new Uint8Array(256),c= | ||
0;64>c;c++)b["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(c)]=c;c=.75*a.length;"="===a[a.length-1]&&(c--,"="===a[a.length-2]&&c--);c=new ArrayBuffer(c);for(var d=new Uint8Array(c),e=0,f=0;e<a.length;e+=4){var g=b[a.charCodeAt(e)],k=b[a.charCodeAt(e+1)],q=b[a.charCodeAt(e+2)],z=b[a.charCodeAt(e+3)];d[f++]=g<<2|k>>4;d[f++]=(k&15)<<4|q>>2;d[f++]=(q&3)<<6|z&63}return c}function za(a,b){return a=0<a?parseInt(a/b.da*b.ba,10):parseInt(a/b.ea*b.ca,10)}function Aa(a,b){return parseInt(0< | ||
a?a*b.ba:a*b.ca,10)}function Ba(a,b){return 0<a?a/b.da:a/b.ea}function Ca(a,b){function c(d){return d}a!=b&&(c=["32f","64"].includes(a)?Aa:["32f","64"].includes(b)?Ba:za);return c}function da(a){if("32f"!=a&&"64"!=a&&("8">parseInt(a,10)||"53"<parseInt(a,10)))throw Error("Invalid bit depth.");}function ea(a,b,c){if("8"==a)for(a=c?-128:128,c=0;c<b.length;c++)b[c]=b[c]+=a}function Da(a){for(var b=new Uint8Array(a.length),c=[],d=0,e=0,f=0;f<a.length;f++)0==f%505&&0!=f&&(b.set(Ea(c),d),d+=256,c=[],e++), | ||
c.push(a[f]);a=a.length/2;a%2&&a++;return b.slice(0,a+512+4*e)}function Fa(a,b){b=void 0===b?256:b;for(var c=new Int16Array(2*a.length),d=[],e=0,f=0;f<a.length;f++){if(0==f%b&&0!=f){var g=d[1]<<8|d[0];D=32768<g?g-65536:g;F=d[2];L=U[F];g=[D,D];for(var k=4;k<d.length;k++){var q=d[k],z=q>>4;g.push(fa(z<<4^q));g.push(fa(z))}d=g;c.set(d,e);e+=d.length;d=[]}d.push(a[f])}return c}function Ea(a){var b=a[0];V(b);var c=[];c.push(b&255);c.push(b>>8&255);c.push(I);c.push(0);for(b=3;b<a.length;b+=2){var d=V(a[b]), | ||
e=V(a[b+1]);c.push(e<<4|d)}return c}function V(a){var b=a-G;0<=b?a=0:(a=8,b=-b);var c=U[I],d=c>>3;b>c&&(a|=4,b-=c,d+=c);c>>=1;b>c&&(a|=2,b-=c,d+=c);c>>=1;b>c&&(a|=1,d+=c);b=a;G=b&8?G-d:G+d;-32768>G?G=-32768:32767<G&&(G=32767);I+=ha[b&7];0>I?I=0:88<I&&(I=88);return a}function fa(a){var b=0;a&4&&(b+=L);a&2&&(b+=L>>1);a&1&&(b+=L>>2);b+=L>>3;a&8&&(b=-b);D+=b;32767<D?D=32767:-32767>D&&(D=-32767);F+=ha[a];0>F?F=0:88<F&&(F=88);L=U[F];return D}function Ga(a){for(var b=new Uint8Array(a.length),c=0;c<a.length;c++){var d= | ||
c;var e=a[c];e=-32768==e?-32767:e;var f=~e>>8&128;f||(e*=-1);32635<e&&(e=32635);if(256<=e){var g=Ha[e>>8&127];e=g<<4|e>>g+3&15}else e>>=4;b[d]=e^f^85}return b}function Ia(a){for(var b=new Int16Array(a.length),c=0;c<a.length;c++){var d=c,e=a[c],f=0;e^=85;e&128&&(e&=-129,f=-1);var g=((e&240)>>4)+4;e=4!=g?1<<g|(e&15)<<g-4|1<<g-5:e<<1|1;b[d]=-8*(0===f?e:-e)}return b}function Ja(a){for(var b=new Uint8Array(a.length),c=0;c<a.length;c++){var d=c,e=a[c];var f=e>>8&128;0!=f&&(e=-e);32635<e&&(e=32635);e+=132; | ||
var g=Ka[e>>7&255];b[d]=~(f|g<<4|e>>g+3&15)}return b}function La(a){for(var b=new Int16Array(a.length),c=0;c<a.length;c++){var d=c,e=a[c];e=~e;var f=e>>4&7;f=Ma[f]+((e&15)<<f+3);0!=(e&128)&&(f=-f);b[d]=f}return b}function W(a,b,c,d){d=void 0===d?a.length:d;if(d%b)throw Error("Bad buffer length.");for(c=void 0===c?0:c;c<d;c+=b){var e=a,f=b,g=c;f--;for(var k=0;k<f;k++){var q=e[g+k];e[g+k]=e[g+f];e[g+f]=q;f--}}}function X(a,b,c){c=void 0===c?0:c;for(var d=0,e=a.length;d<e;d++){var f=a.codePointAt(d); | ||
if(128>f)b[c]=f,c++;else{var g=0,k=0;2047>=f?(g=1,k=192):65535>=f?(g=2,k=224):1114111>=f&&(g=3,k=240,d++);b[c]=(f>>6*g)+k;for(c++;0<g;)b[c]=128|f>>6*(g-1)&63,c++,g--}}return c}function Y(a){var b=Math.floor(a);a-=b;return.5>a?b:.5<a?b+1:b%2?b+1:b}function M(a,b,c){c=void 0===c?a.length:c;var d=void 0===b?0:b;c=void 0===c?a.length:c;b="";for(d=void 0===d?0:d;d<c;){var e=128,f=191,g=!1,k=a[d++];if(0<=k&&127>=k)b+=String.fromCharCode(k);else{var q=0;194<=k&&223>=k?q=1:224<=k&&239>=k?(q=2,224===a[d]&& | ||
(e=160),237===a[d]&&(f=159)):240<=k&&244>=k?(q=3,240===a[d]&&(e=144),244===a[d]&&(f=143)):g=!0;k&=(1<<8-q-1)-1;for(var z=0;z<q;z++){if(a[d]<e||a[d]>f)g=!0;k=k<<6|a[d]&63;d++}g?b+=String.fromCharCode(65533):65535>=k?b+=String.fromCharCode(k):(k-=65536,b+=String.fromCharCode((k>>10&1023)+55296,(k&1023)+56320))}}return b}function x(a){var b=[];X(a,b,0);return b}function ia(a,b,c,d,e){d=void 0===d?0:d;b=b||{};e=ja(b.g,b.N,b.F,void 0===e?!1:e);var f=Math.ceil(b.g/8),g=0,k=d;try{for(var q=a.length;g<q;g++)d= | ||
e.fa(c,a[g],d);b.o&&W(c,f,k,d)}catch(z){ka(z,a[g],g)}return d}function J(a,b,c,d,e,f,g){d=void 0===d?0:d;e=void 0===e?a.length:e;f=void 0===f?!1:f;b=b||{};g=ja(b.g,b.N,b.F,void 0===g?!1:g);var k=Math.ceil(b.g/8),q=(e-d)%k;if(f&&(q||a.length<k))throw Error("Bad buffer length");e-=q;f=0;q=d;try{for(b.o&&W(a,k,d,e);q<e;q+=k,f++)c[f]=g.R(a,q);b.o&&W(a,k,d,e)}catch(z){ka(z,a.slice(q,q+k),q)}}function Z(a,b,c,d,e){return ia([a],b,c,void 0===d?0:d,void 0===e?!1:e)}function h(a,b,c){var d=[];Z(a,b,d,0,void 0=== | ||
c?!1:c);return d}function P(a,b,c,d){c=void 0===c?0:c;var e=c+Math.ceil(b.g/8);d=void 0===d?!1:d;e=void 0===e?a.length:e;var f=[];J(a,b,f,void 0===c?0:c,e,!0,void 0===d?!1:d);return f[0]}function ka(a,b,c){a.message=a.constructor.name+" at index "+c+": "+b;throw a;}function ja(a,b,c,d){if(b){if(!a||16!==a&&32!==a&&64!==a)throw Error("Unsupported type: float, bits: "+a);}else if(!a||1>a||53<a)throw Error("Unsupported type: int, bits: "+a);return b&&16===a?new K(5,11):b&&32==a?new K(8,23):b&&64==a? | ||
new K(11,52):new E(a,c,d)}function A(a,b,c){c=void 0===c?!0:c;a=x(a);if(c)for(c=a.length;c<b;c++)a.push(0);return a}function la(a,b){for(var c=8===b?255:Math.pow(2,b)/2-1,d=8===b?0:-c-1,e=0,f=a.length;e<f;e++)a[e]=Math.round(a[e]),a[e]>c?a[e]=c:a[e]<d&&(a[e]=d)}function xa(a){return Math.exp(-a/2*a/2)}function wa(a){return function(b){return(0===b?1:Math.sin(Math.PI*b)/(Math.PI*b))*a(b)}}function ua(a,b){return Math.max(0,Math.min(a,b-1))}function ca(a,b){a%=b;0>a&&(a+=b);return a}function va(a,b){var c= | ||
2*(b-1);a=ca(a,c);a>b-1&&(a=c-a);return a}function ma(a,b,c,d){d=void 0===d?{}:d;var e=new Float64Array(a.length*((c-b)/b+1));d.method=d.method||"cubic";var f=new v(a.length,e.length,{method:d.method,tension:d.tension||0,sincFilterSize:d.sincFilterSize||6,sincWindow:d.sincWindow||void 0,clip:d.clip||"mirror"});void 0===d.LPF&&(d.LPF=Na[d.method]);if(d.LPF){d.LPFType=d.LPFType||"IIR";var g=Oa[d.LPFType];if(c>b){b=new g(d.LPForder||na[d.LPFType],c,b/2);c=0;for(d=e.length;c<d;c++)e[c]=b.filter(f.O(c, | ||
a));b.reset();for(a=e.length-1;0<=a;a--)e[a]=b.filter(e[a])}else{b=new g(d.LPForder||na[d.LPFType],b,c/2);c=0;for(d=a.length;c<d;c++)a[c]=b.filter(a[c]);b.reset();for(c=a.length-1;0<=c;c--)a[c]=b.filter(a[c]);oa(a,e,f)}}else oa(a,e,f);return e}function oa(a,b,c){for(var d=0,e=b.length;d<e;d++)b[d]=c.O(d,a)}function N(a,b){var c=a/b;c%2&&c++;return c}var ha=[-1,-1,-1,-1,2,4,6,8,-1,-1,-1,-1,2,4,6,8],U=[7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45,50,55,60,66,73,80,88,97,107,118,130,143, | ||
157,173,190,209,230,253,279,307,337,371,408,449,494,544,598,658,724,796,876,963,1060,1166,1282,1411,1552,1707,1878,2066,2272,2499,2749,3024,3327,3660,4026,4428,4871,5358,5894,6484,7132,7845,8630,9493,10442,11487,12635,13899,15289,16818,18500,20350,22385,24623,27086,29794,32767],G=0,I=0,D=0,F=0,L=7,Ha=[1,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, | ||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],Ka=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, | ||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],Ma=[0,132,396,924,1980,4092,8316,16764];E.prototype.fa=function(a,b,c){c=void 0===c?0:c;if(b!==b||b.constructor!=Number)throw new TypeError;b=this.a(b);a[c]=(0>b?b+Math.pow(2,this.g):b)&255;c++;for(var d=2,e=this.b;d<e;d++)a[c]=Math.floor(b/Math.pow(2,8*(d-1)))&255,c++;8<this.g&&(a[c]=Math.floor(b/Math.pow(2,8*(this.b-1)))&this.f,c++);return c};E.prototype.c=function(a,b){b=void 0===b?0:b;for(var c=0,d=0;d<this.b;d++)c+=a[b+ | ||
d]*Math.pow(256,d);return c};E.prototype.l=function(a,b){return this.a(this.c(a,void 0===b?0:b))};E.prototype.i=function(a,b){return this.a(this.j(this.c(a,void 0===b?0:b)))};E.prototype.a=function(a){if(a>this.max||a<this.min)throw new RangeError;return a};E.prototype.h=function(a){return a>this.max?this.max:a<this.min?this.min:a};E.prototype.j=function(a){a>this.max&&(a-=2*this.max+2);return a};K.prototype.fa=function(a,b,c){if("number"!=typeof b)throw new TypeError;Math.abs(b)>this.h-2*this.j&& | ||
(b=0>b?-Infinity:Infinity);var d=0>((b=+b)||1/b)?1:0>b?1:0;b=Math.abs(b);var e=Math.min(Math.floor(Math.log(b)/Math.LN2),1023),f=Y(b/Math.pow(2,e)*Math.pow(2,this.c));b!==b?(f=Math.pow(2,this.c-1),e=(1<<this.b)-1):0!==b&&(b>=Math.pow(2,1-this.a)?(2<=f/Math.pow(2,this.c)&&(e+=1,f=1),e>this.a?(e=(1<<this.b)-1,f=0):(e+=this.a,f=Y(f)-Math.pow(2,this.c))):(f=Y(b/Math.pow(2,1-this.a-this.c)),e=0));return this.l(a,c,d,e,f)};K.prototype.R=function(a,b){for(var c=(1<<this.b)-1,d="",e=this.f-1;0<=e;e--){var f= | ||
a[e+b].toString(2);d+="00000000".substring(f.length)+f}e="1"==d.charAt(0)?-1:1;d=d.substring(1);f=parseInt(d.substring(0,this.b),2);d=d.substring(this.b);if(f==c)return 0!==parseInt(d,2)?NaN:Infinity*e;0===f?(f+=1,c=parseInt(d,2)):c=parseInt("1"+d,2);return e*c*this.i*Math.pow(2,f-this.a)};K.prototype.l=function(a,b,c,d,e){var f=[];f.push(c);for(c=this.b;0<c;--c)f[c]=d%2?1:0,d=Math.floor(d/2);d=f.length;for(c=this.c;0<c;--c)f[d+c]=e%2?1:0,e=Math.floor(e/2);e=f.join("");f=this.f+b-1;for(d=b;f>=b;)a[f]= | ||
parseInt(e.substring(0,8),2),e=e.substring(8),f--,d++;return d};B.prototype.ua=function(a){this.c=0;this.container=this.s(a,4);if(-1===this.Y.indexOf(this.container))throw Error("Not a supported format.");this.a.o="RIFX"===this.container;this.chunkSize=this.b(a);this.format=this.s(a,4);this.X={chunkId:this.container,chunkSize:this.chunkSize,format:this.format,subChunks:this.U(a)}};B.prototype.l=function(a,b){b=void 0===b?!1:b;for(var c=this.X.subChunks,d=[],e=0;e<c.length;e++)if(c[e].chunkId==a)if(b)d.push(c[e]); | ||
else return c[e];return"LIST"==a?d.length?d:null:null};B.prototype.s=function(a,b){var c=M(a,this.c,this.c+b);this.c+=b;return c};B.prototype.b=function(a){a=P(a,this.a,this.c);this.c+=4;return a};B.prototype.U=function(a){for(var b=[],c=this.c;c<=a.length-8;)b.push(this.Za(a,c)),c+=8+b[b.length-1].chunkSize,c=c%2?c+1:c;return b};B.prototype.Za=function(a,b){var c={chunkId:this.Da(a,b),chunkSize:this.Ea(a,b)};"LIST"==c.chunkId?(c.format=M(a,b+8,b+12),this.c+=4,c.subChunks=this.U(a)):(this.c=b+8+(c.chunkSize% | ||
2?c.chunkSize+1:c.chunkSize),c.chunkData={start:b+8,end:this.c});return c};B.prototype.Da=function(a,b){this.c+=4;return M(a,b,b+4)};B.prototype.Ea=function(a,b){this.c+=4;return P(a,this.a,b+4)};Q(u,B);u.prototype.fromBuffer=function(a,b){b=void 0===b?!0:b;this.T();this.ua(a);this.h.o=this.a.o;if("WAVE"!=this.format)throw Error('Could not find the "WAVE" format identifier');this.gb(a);this.ib(a);this.hb(a);this.cb(a);this.pa(a);this.eb(a);this.la(a);this.fb(a,b);this.kb(a);this.ha(a);this.ma(a)}; | ||
u.prototype.T=function(){var a=new u;Object.assign(this.fmt,a.fmt);Object.assign(this.fact,a.fact);Object.assign(this.cue,a.cue);Object.assign(this.smpl,a.smpl);Object.assign(this.bext,a.bext);Object.assign(this.iXML,a.iXML);Object.assign(this.ds64,a.ds64);Object.assign(this.data,a.data);this.LIST=[];Object.assign(this.junk,a.junk);Object.assign(this._PMX,a._PMX)};u.prototype.ib=function(a){var b=this.l("fmt ");if(b)this.c=b.chunkData.start,this.fmt.chunkId=b.chunkId,this.fmt.chunkSize=b.chunkSize, | ||
this.fmt.audioFormat=this.j(a),this.fmt.numChannels=this.j(a),this.fmt.sampleRate=this.b(a),this.fmt.byteRate=this.b(a),this.fmt.blockAlign=this.j(a),this.fmt.bitsPerSample=this.j(a),this.jb(a);else throw Error('Could not find the "fmt " chunk');};u.prototype.jb=function(a){16<this.fmt.chunkSize&&(this.fmt.cbSize=this.j(a),18<this.fmt.chunkSize&&(this.fmt.validBitsPerSample=this.j(a),20<this.fmt.chunkSize&&(this.fmt.dwChannelMask=this.b(a),this.fmt.subformat=[this.b(a),this.b(a),this.b(a),this.b(a)])))}; | ||
u.prototype.hb=function(a){var b=this.l("fact");b&&(this.c=b.chunkData.start,this.fact.chunkId=b.chunkId,this.fact.chunkSize=b.chunkSize,this.fact.dwSampleLength=this.b(a))};u.prototype.eb=function(a){var b=this.l("cue ");if(b)for(this.c=b.chunkData.start,this.cue.chunkId=b.chunkId,this.cue.chunkSize=b.chunkSize,this.cue.dwCuePoints=this.b(a),b=0;b<this.cue.dwCuePoints;b++)this.cue.points.push({dwName:this.b(a),dwPosition:this.b(a),fccChunk:this.s(a,4),dwChunkStart:this.b(a),dwBlockStart:this.b(a), | ||
dwSampleOffset:this.b(a)})};u.prototype.la=function(a){var b=this.l("smpl");if(b)for(this.c=b.chunkData.start,this.smpl.chunkId=b.chunkId,this.smpl.chunkSize=b.chunkSize,this.smpl.dwManufacturer=this.b(a),this.smpl.dwProduct=this.b(a),this.smpl.dwSamplePeriod=this.b(a),this.smpl.dwMIDIUnityNote=this.b(a),this.smpl.dwMIDIPitchFraction=this.b(a),this.smpl.dwSMPTEFormat=this.b(a),this.smpl.dwSMPTEOffset=this.b(a),this.smpl.dwNumSampleLoops=this.b(a),this.smpl.dwSamplerData=this.b(a),b=0;b<this.smpl.dwNumSampleLoops;b++)this.smpl.loops.push({dwName:this.b(a), | ||
dwType:this.b(a),dwStart:this.b(a),dwEnd:this.b(a),dwFraction:this.b(a),dwPlayCount:this.b(a)})};u.prototype.fb=function(a,b){var c=this.l("data");if(c)this.data.chunkId="data",this.data.chunkSize=c.chunkSize,b&&(this.data.samples=a.slice(c.chunkData.start,c.chunkData.end));else throw Error('Could not find the "data" chunk');};u.prototype.cb=function(a){var b=this.l("bext");b&&(this.c=b.chunkData.start,this.bext.chunkId=b.chunkId,this.bext.chunkSize=b.chunkSize,this.bext.description=this.s(a,256), | ||
this.bext.originator=this.s(a,32),this.bext.originatorReference=this.s(a,32),this.bext.originationDate=this.s(a,10),this.bext.originationTime=this.s(a,8),this.bext.timeReference=[this.b(a),this.b(a)],this.bext.version=this.j(a),this.bext.UMID=this.s(a,64),this.bext.loudnessValue=this.j(a),this.bext.loudnessRange=this.j(a),this.bext.maxTruePeakLevel=this.j(a),this.bext.maxMomentaryLoudness=this.j(a),this.bext.maxShortTermLoudness=this.j(a),this.bext.reserved=this.s(a,180),this.bext.codingHistory=this.s(a, | ||
this.bext.chunkSize-602))};u.prototype.pa=function(a){var b=this.l("iXML");b&&(this.c=b.chunkData.start,this.iXML.chunkId=b.chunkId,this.iXML.chunkSize=b.chunkSize,this.iXML.value=M(a,this.c,this.c+this.iXML.chunkSize))};u.prototype.gb=function(a){var b=this.l("ds64");if(b)this.c=b.chunkData.start,this.ds64.chunkId=b.chunkId,this.ds64.chunkSize=b.chunkSize,this.ds64.riffSizeHigh=this.b(a),this.ds64.riffSizeLow=this.b(a),this.ds64.dataSizeHigh=this.b(a),this.ds64.dataSizeLow=this.b(a),this.ds64.originationTime= | ||
this.b(a),this.ds64.sampleCountHigh=this.b(a),this.ds64.sampleCountLow=this.b(a);else if("RF64"==this.container)throw Error('Could not find the "ds64" chunk');};u.prototype.ha=function(a){var b=this.l("LIST",!0);if(null!==b)for(var c=0;c<b.length;c++){var d=b[c];this.LIST.push({chunkId:d.chunkId,chunkSize:d.chunkSize,format:d.format,subChunks:[]});for(var e=0;e<d.subChunks.length;e++)this.ja(d.subChunks[e],d.format,a)}};u.prototype.ja=function(a,b,c){"adtl"==b?-1<["labl","note","ltxt"].indexOf(a.chunkId)&& | ||
this.ka(c,a):"INFO"==b&&this.ia(c,a)};u.prototype.ka=function(a,b){this.c=b.chunkData.start;var c={chunkId:b.chunkId,chunkSize:b.chunkSize,dwName:this.b(a)};"ltxt"==b.chunkId?(c.dwSampleLength=this.b(a),c.dwPurposeID=this.b(a),c.dwCountry=this.j(a),c.dwLanguage=this.j(a),c.dwDialect=this.j(a),c.dwCodePage=this.j(a),c.value=""):c.value=this.W(a,this.c);this.LIST[this.LIST.length-1].subChunks.push(c)};u.prototype.ia=function(a,b){this.c=b.chunkData.start;this.LIST[this.LIST.length-1].subChunks.push({chunkId:b.chunkId, | ||
chunkSize:b.chunkSize,value:this.W(a,this.c)})};u.prototype.kb=function(a){var b=this.l("junk");b&&(this.junk={chunkId:b.chunkId,chunkSize:b.chunkSize,chunkData:[].slice.call(a.slice(b.chunkData.start,b.chunkData.end))})};u.prototype.ma=function(a){var b=this.l("_PMX");b&&(this.c=b.chunkData.start,this._PMX.chunkId=b.chunkId,this._PMX.chunkSize=b.chunkSize,this._PMX.value=M(a,this.c,this.c+this._PMX.chunkSize))};u.prototype.W=function(a,b){for(var c=b=void 0===b?0:b;c<a.length&&(this.c++,0!==a[c]);c++); | ||
return M(a,b,this.c-1)};u.prototype.j=function(a){a=P(a,this.h,this.c);this.c+=2;return a};Q(r,u);r.prototype.toBuffer=function(){this.h.o="RIFX"===this.container;this.a.o=this.h.o;for(var a=[this.Ra(),this.Na(),this.Ca(),this.ab(),this.Pa(),this.Oa(),x(this.data.chunkId),h(this.data.samples.length,this.a),this.data.samples,this.Fa(),this.Xa(),this.Sa(),this.$a()],b=0,c=0;c<a.length;c++)b+=a[c].length;c=new Uint8Array(b+12);var d=X(this.container,c,0);d=Z(b+4,this.a,c,d);d=X(this.format,c,void 0=== | ||
d?0:d);for(b=0;b<a.length;b++)c.set(a[b],d),d+=a[b].length;return c};r.prototype.Ca=function(){var a=[];this.Ba();this.bext.chunkId&&(this.bext.chunkSize=602+this.bext.codingHistory.length,a=a.concat(x(this.bext.chunkId),h(602+this.bext.codingHistory.length,this.a),A(this.bext.description,256),A(this.bext.originator,32),A(this.bext.originatorReference,32),A(this.bext.originationDate,10),A(this.bext.originationTime,8),h(this.bext.timeReference[0],this.a),h(this.bext.timeReference[1],this.a),h(this.bext.version, | ||
this.h),A(this.bext.UMID,64),h(this.bext.loudnessValue,this.h),h(this.bext.loudnessRange,this.h),h(this.bext.maxTruePeakLevel,this.h),h(this.bext.maxMomentaryLoudness,this.h),h(this.bext.maxShortTermLoudness,this.h),A(this.bext.reserved,180),A(this.bext.codingHistory,this.bext.codingHistory.length)));this.i(a);return a};r.prototype.Ba=function(){for(var a in this.bext)if(this.bext.hasOwnProperty(a)&&this.bext[a]&&"timeReference"!=a){this.bext.chunkId="bext";break}if(this.bext.timeReference[0]||this.bext.timeReference[1])this.bext.chunkId= | ||
"bext"};r.prototype.ab=function(){var a=[];if(this.iXML.chunkId){var b=x(this.iXML.value);this.iXML.chunkSize=b.length;a=a.concat(x(this.iXML.chunkId),h(this.iXML.chunkSize,this.a),b)}this.i(a);return a};r.prototype.Na=function(){var a=[];this.ds64.chunkId&&(a=a.concat(x(this.ds64.chunkId),h(this.ds64.chunkSize,this.a),h(this.ds64.riffSizeHigh,this.a),h(this.ds64.riffSizeLow,this.a),h(this.ds64.dataSizeHigh,this.a),h(this.ds64.dataSizeLow,this.a),h(this.ds64.originationTime,this.a),h(this.ds64.sampleCountHigh, | ||
this.a),h(this.ds64.sampleCountLow,this.a)));this.i(a);return a};r.prototype.Fa=function(){var a=[];if(this.cue.chunkId){var b=this.Ia();a=a.concat(x(this.cue.chunkId),h(b.length+4,this.a),h(this.cue.dwCuePoints,this.a),b)}this.i(a);return a};r.prototype.Ia=function(){for(var a=[],b=0;b<this.cue.dwCuePoints;b++)a=a.concat(h(this.cue.points[b].dwName,this.a),h(this.cue.points[b].dwPosition,this.a),x(this.cue.points[b].fccChunk),h(this.cue.points[b].dwChunkStart,this.a),h(this.cue.points[b].dwBlockStart, | ||
this.a),h(this.cue.points[b].dwSampleOffset,this.a));return a};r.prototype.Xa=function(){var a=[];if(this.smpl.chunkId){var b=this.Ya();a=a.concat(x(this.smpl.chunkId),h(b.length+36,this.a),h(this.smpl.dwManufacturer,this.a),h(this.smpl.dwProduct,this.a),h(this.smpl.dwSamplePeriod,this.a),h(this.smpl.dwMIDIUnityNote,this.a),h(this.smpl.dwMIDIPitchFraction,this.a),h(this.smpl.dwSMPTEFormat,this.a),h(this.smpl.dwSMPTEOffset,this.a),h(this.smpl.dwNumSampleLoops,this.a),h(this.smpl.dwSamplerData,this.a), | ||
b)}this.i(a);return a};r.prototype.Ya=function(){for(var a=[],b=0;b<this.smpl.dwNumSampleLoops;b++)a=a.concat(h(this.smpl.loops[b].dwName,this.a),h(this.smpl.loops[b].dwType,this.a),h(this.smpl.loops[b].dwStart,this.a),h(this.smpl.loops[b].dwEnd,this.a),h(this.smpl.loops[b].dwFraction,this.a),h(this.smpl.loops[b].dwPlayCount,this.a));return a};r.prototype.Oa=function(){var a=[];this.fact.chunkId&&(a=a.concat(x(this.fact.chunkId),h(this.fact.chunkSize,this.a),h(this.fact.dwSampleLength,this.a)));this.i(a); | ||
return a};r.prototype.Pa=function(){var a=[];if(this.fmt.chunkId)return a=a.concat(x(this.fmt.chunkId),h(this.fmt.chunkSize,this.a),h(this.fmt.audioFormat,this.h),h(this.fmt.numChannels,this.h),h(this.fmt.sampleRate,this.a),h(this.fmt.byteRate,this.a),h(this.fmt.blockAlign,this.h),h(this.fmt.bitsPerSample,this.h),this.Qa()),this.i(a),a;throw Error('Could not find the "fmt " chunk');};r.prototype.Qa=function(){var a=[];16<this.fmt.chunkSize&&(a=a.concat(h(this.fmt.cbSize,this.h)));18<this.fmt.chunkSize&& | ||
(a=a.concat(h(this.fmt.validBitsPerSample,this.h)));20<this.fmt.chunkSize&&(a=a.concat(h(this.fmt.dwChannelMask,this.a)));24<this.fmt.chunkSize&&(a=a.concat(h(this.fmt.subformat[0],this.a),h(this.fmt.subformat[1],this.a),h(this.fmt.subformat[2],this.a),h(this.fmt.subformat[3],this.a)));return a};r.prototype.Sa=function(){for(var a=[],b=0;b<this.LIST.length;b++){var c=this.Ua(this.LIST[b].subChunks,this.LIST[b].format);a=a.concat(x(this.LIST[b].chunkId),h(c.length+4,this.a),x(this.LIST[b].format), | ||
c)}this.i(a);return a};r.prototype.Ua=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)"INFO"==b?c=c.concat(this.Ta(a[d])):"adtl"==b&&(c=c.concat(this.Va(a[d]))),this.i(c);return c};r.prototype.Ta=function(a){var b=[],c=A(a.value,a.value.length);b=b.concat(x(a.chunkId),h(c.length+1,this.a),c);b.push(0);return b};r.prototype.Va=function(a){var b=[];if(-1<["labl","note"].indexOf(a.chunkId)){var c=A(a.value,a.value.length);b=b.concat(x(a.chunkId),h(c.length+5,this.a),h(a.dwName,this.a),c);b.push(0)}else"ltxt"== | ||
a.chunkId&&(b=b.concat(this.Wa(a)));return b};r.prototype.Wa=function(a){return x(a.chunkId).concat(h(a.value.length+20,this.a),h(a.dwName,this.a),h(a.dwSampleLength,this.a),h(a.dwPurposeID,this.a),h(a.dwCountry,this.h),h(a.dwLanguage,this.h),h(a.dwDialect,this.h),h(a.dwCodePage,this.h),A(a.value,a.value.length))};r.prototype.$a=function(){var a=[];if(this._PMX.chunkId){var b=x(this._PMX.value);this._PMX.chunkSize=b.length;a=a.concat(x(this._PMX.chunkId),h(this._PMX.chunkSize,this.a),b)}this.i(a); | ||
return a};r.prototype.Ra=function(){var a=[];if(this.junk.chunkId)return a.concat(x(this.junk.chunkId),h(this.junk.chunkData.length,this.a),this.junk.chunkData);this.i(a);return a};r.prototype.i=function(a){a.length%2&&a.push(0)};Q(t,r);t.prototype.fromScratch=function(a,b,c,d,e){e=void 0===e?{}:e;this.T();this.V(a,b,c,d,e)};t.prototype.fromBuffer=function(a,b){r.prototype.fromBuffer.call(this,a,void 0===b?!0:b);this.xa();this.Z()};t.prototype.toBuffer=function(){this.$();return r.prototype.toBuffer.call(this)}; | ||
t.prototype.getSamples=function(a,b){a=void 0===a?!1:a;b=void 0===b?Float64Array:b;var c=new b(this.data.samples.length/(this.f.g/8));J(this.data.samples,this.f,c,0,this.data.samples.length,!1,!1);if(!a&&1<this.fmt.numChannels){var d=this.fmt.numChannels,e=b;e=void 0===e?Float64Array:e;for(var f=[],g=0;g<d;g++)f[g]=new e(c.length/d);for(e=0;e<d;e++){g=0;for(var k=e;k<c.length;k+=d)f[e][g++]=c[k]}c=f}return c};t.prototype.getSample=function(a){a*=this.f.g/8;if(a+this.f.g/8>this.data.samples.length)throw Error("Range error"); | ||
return P(this.data.samples.slice(a,a+this.f.g/8),this.f,0,!1)};t.prototype.setSample=function(a,b){a*=this.f.g/8;if(a+this.f.g/8>this.data.samples.length)throw Error("Range error");Z(b,this.f,this.data.samples,a,!1)};t.prototype.getiXML=function(){return this.iXML.value};t.prototype.setiXML=function(a){if("string"!==typeof a)throw new TypeError("iXML value must be a string.");this.iXML.value=a;this.iXML.chunkId="iXML"};t.prototype.get_PMX=function(){return this._PMX.value};t.prototype.set_PMX=function(a){if("string"!== | ||
typeof a)throw new TypeError("_PMX value must be a string.");this._PMX.value=a;this._PMX.chunkId="_PMX"};t.prototype.V=function(a,b,c,d,e){e=void 0===e?{}:e;e.container||(e.container="RIFF");this.container=e.container;this.bitDepth=c;var f=[];if(0<d.length)if(d[0].constructor!==Number){f=new Float64Array(d[0].length*d.length);for(var g=0,k=0,q=d[0].length;k<q;k++)for(var z=0,Pa=d.length;z<Pa;z++)f[g]=d[z][k],g++}else f=d;d=f;this.Z();f=this.f.g/8;this.data.samples=new Uint8Array(d.length*f);ia(d, | ||
this.f,this.data.samples,0,!1);this.bb(c,a,b,f,this.data.samples.length,e);this.data.chunkId="data";this.data.chunkSize=this.data.samples.length;this.$()};t.prototype.bb=function(a,b,c,d,e,f){"4"==a?this.ya(a,b,c,d,e,f):"8a"==a||"8m"==a?this.za(a,b,c,d,e,f):-1==Object.keys(this.G).indexOf(a)||2<b?this.Aa(a,b,c,d,e,f):this.B(a,b,c,d,e,f)};t.prototype.B=function(a,b,c,d,e,f){this.container=f.container;this.chunkSize=36+e;this.format="WAVE";this.bitDepth=a;this.fmt={chunkId:"fmt ",chunkSize:16,audioFormat:this.G[a]|| | ||
65534,numChannels:b,sampleRate:c,byteRate:b*d*c,blockAlign:b*d,bitsPerSample:parseInt(a,10),cbSize:0,validBitsPerSample:0,dwChannelMask:0,subformat:[]}};t.prototype.ya=function(a,b,c,d,e,f){this.B(a,b,c,d,e,f);this.chunkSize=40+e;this.fmt.chunkSize=20;this.fmt.byteRate=4055;this.fmt.blockAlign=256;this.fmt.bitsPerSample=4;this.fmt.cbSize=2;this.fmt.validBitsPerSample=505;this.fact={chunkId:"fact",chunkSize:4,dwSampleLength:2*e}};t.prototype.Aa=function(a,b,c,d,e,f){this.B(a,b,c,d,e,f);this.chunkSize= | ||
60+e;this.fmt.chunkSize=40;this.fmt.bitsPerSample=(parseInt(a,10)-1|7)+1;this.fmt.cbSize=22;this.fmt.validBitsPerSample=parseInt(a,10);a=this.fmt;c=0;1===b?c=4:2===b?c=3:4===b?c=51:6===b?c=63:8===b&&(c=1599);a.dwChannelMask=c;this.fmt.subformat=[1,1048576,2852126848,1905997824]};t.prototype.za=function(a,b,c,d,e,f){this.B(a,b,c,d,e,f);this.chunkSize=40+e;this.fmt.chunkSize=20;this.fmt.cbSize=2;this.fmt.validBitsPerSample=8;this.fact={chunkId:"fact",chunkSize:4,dwSampleLength:e}};t.prototype.xa=function(){3=== | ||
this.fmt.audioFormat&&32===this.fmt.bitsPerSample?this.bitDepth="32f":6===this.fmt.audioFormat?this.bitDepth="8a":7===this.fmt.audioFormat?this.bitDepth="8m":this.bitDepth=this.fmt.bitsPerSample.toString()};t.prototype.va=function(){if(!(this.G[this.bitDepth]||8<parseInt(this.bitDepth,10)&&54>parseInt(this.bitDepth,10)))throw Error("Invalid bit depth.");};t.prototype.Z=function(){this.f={g:(parseInt(this.bitDepth,10)-1|7)+1,N:"32f"==this.bitDepth||"64"==this.bitDepth,F:"8"!=this.bitDepth,o:"RIFX"== | ||
this.container};-1<["4","8a","8m"].indexOf(this.bitDepth)&&(this.f.g=8,this.f.F=!1)};t.prototype.$=function(){this.va();var a=this.fmt.numChannels;if(1>a||65535<a*this.fmt.bitsPerSample/8)throw Error("Invalid number of channels.");a=this.fmt.sampleRate;if(1>a||4294967295<this.fmt.bitsPerSample/8*this.fmt.numChannels*a)throw Error("Invalid sample rate.");};Q(C,t);C.prototype.getTag=function(a){a=this.K(a);return null!==a.w?this.LIST[a.LIST].subChunks[a.w].value:null};C.prototype.setTag=function(a, | ||
b){var c=a;if(c.constructor!==String)throw Error("Invalid tag name.");if(4>c.length)for(var d=0,e=4-c.length;d<e;d++)c+=" ";a=c;c=this.K(a);null!==c.w?(this.LIST[c.LIST].subChunks[c.w].chunkSize=b.length+1,this.LIST[c.LIST].subChunks[c.w].value=b):null!==c.LIST?this.LIST[c.LIST].subChunks.push({chunkId:a,chunkSize:b.length+1,value:b}):(this.LIST.push({chunkId:"LIST",chunkSize:b.length+9,format:"INFO",subChunks:[]}),this.LIST[this.LIST.length-1].subChunks.push({chunkId:a,chunkSize:b.length+1,value:b}))}; | ||
C.prototype.deleteTag=function(a){a=this.K(a);return null!==a.w?(this.LIST[a.LIST].subChunks.splice(a.w,1),!0):!1};C.prototype.listTags=function(){var a=this.C("INFO"),b={};if(null!==a)for(var c=0,d=this.LIST[a].subChunks.length;c<d;c++)b[this.LIST[a].subChunks[c].chunkId]=this.LIST[a].subChunks[c].value;return b};C.prototype.C=function(a){for(var b=0,c=this.LIST.length;b<c;b++)if(this.LIST[b].format==a)return b;return null};C.prototype.K=function(a){for(var b={LIST:null,w:null},c=0,d=this.LIST.length;c< | ||
d;c++)if("INFO"==this.LIST[c].format){b.LIST=c;d=0;for(var e=this.LIST[c].subChunks.length;d<e;d++)if(this.LIST[c].subChunks[d].chunkId==a){b.w=d;break}break}return b};Q(w,C);w.prototype.listCuePoints=function(){for(var a=this.J(),b=0,c=a.length;b<c;b++)a[b].position=a[b].dwSampleOffset/this.fmt.sampleRate*1E3,a[b].dwSampleLength?(a[b].end=a[b].dwSampleLength/this.fmt.sampleRate*1E3,a[b].end+=a[b].position):a[b].end=null,delete a[b].value;return a};w.prototype.setCuePoint=function(a){this.cue.chunkId= | ||
"cue ";a.label||(a.label="");var b=this.J();this.I();this.cue.points=[];a.dwSampleOffset=a.position*this.fmt.sampleRate/1E3;a.dwSampleLength=0;a.end&&(a.dwSampleLength=a.end*this.fmt.sampleRate/1E3-a.dwSampleOffset);0===b.length?this.v(a,1):this.qa(b,a);this.cue.dwCuePoints=this.cue.points.length};w.prototype.deleteCuePoint=function(a){this.cue.chunkId="cue ";var b=this.J();this.I();var c=this.cue.points.length;this.cue.points=[];for(var d=0;d<c;d++)d+1!==a&&this.v(b[d],d+1);this.cue.dwCuePoints= | ||
this.cue.points.length;this.cue.dwCuePoints?this.cue.chunkId="cue ":(this.cue.chunkId="",this.I())};w.prototype.updateLabel=function(a,b){var c=this.C("adtl");if(null!==c)for(var d=0,e=this.LIST[c].subChunks.length;d<e;d++)this.LIST[c].subChunks[d].dwName==a&&(this.LIST[c].subChunks[d].value=b)};w.prototype.J=function(){for(var a=[],b=0;b<this.cue.points.length;b++){var c=this.cue.points[b],d=this.Ma(c.dwName);d.label=d.value?d.value:"";d.dwPosition=c.dwPosition;d.fccChunk=c.fccChunk;d.dwChunkStart= | ||
c.dwChunkStart;d.dwBlockStart=c.dwBlockStart;d.dwSampleOffset=c.dwSampleOffset;a.push(d)}return a};w.prototype.Ma=function(a){var b=this.C("adtl"),c={};null!==b&&this.ga(c,b,a);return c};w.prototype.ga=function(a,b,c){for(var d=0,e=this.LIST[b].subChunks.length;d<e;d++)if(this.LIST[b].subChunks[d].dwName==c){var f=this.LIST[b].subChunks[d];a.value=f.value||a.value;a.dwName=f.dwName||0;a.dwSampleLength=f.dwSampleLength||0;a.dwPurposeID=f.dwPurposeID||0;a.dwCountry=f.dwCountry||0;a.dwLanguage=f.dwLanguage|| | ||
0;a.dwDialect=f.dwDialect||0;a.dwCodePage=f.dwCodePage||0}};w.prototype.v=function(a,b){this.cue.points.push({dwName:b,dwPosition:a.dwPosition?a.dwPosition:0,fccChunk:a.fccChunk?a.fccChunk:"data",dwChunkStart:a.dwChunkStart?a.dwChunkStart:0,dwBlockStart:a.dwBlockStart?a.dwBlockStart:0,dwSampleOffset:a.dwSampleOffset});this.sa(a,b)};w.prototype.qa=function(a,b){for(var c=!1,d=0;d<a.length;d++)a[d].dwSampleOffset>b.dwSampleOffset&&!c?(this.v(b,d+1),this.v(a[d],d+2),c=!0):this.v(a[d],c?d+2:d+1);c||this.v(b, | ||
this.cue.points.length+1)};w.prototype.I=function(){for(var a=0,b=this.LIST.length;a<b;a++)"adtl"==this.LIST[a].format&&this.LIST.splice(a)};w.prototype.sa=function(a,b){var c=this.C("adtl");null===c&&(this.LIST.push({chunkId:"LIST",chunkSize:4,format:"adtl",subChunks:[]}),c=this.LIST.length-1);this.ra(c,a,b);a.dwSampleLength&&this.ta(c,a,b)};w.prototype.ra=function(a,b,c){this.LIST[a].subChunks.push({chunkId:"labl",chunkSize:4,dwName:c,value:b.label});this.LIST[a].chunkSize+=12};w.prototype.ta=function(a, | ||
b,c){this.LIST[a].subChunks.push({chunkId:"ltxt",chunkSize:20,dwName:c,dwSampleLength:b.dwSampleLength,dwPurposeID:b.dwPurposeID||0,dwCountry:b.dwCountry||0,dwLanguage:b.dwLanguage||0,dwDialect:b.dwDialect||0,dwCodePage:b.dwCodePage||0,value:b.label});this.LIST[a].chunkSize+=28};v.prototype.I=function(a,b){return this.f(Math.round(this.i*a),b)};v.prototype.H=function(a,b){a*=this.i;var c=Math.floor(a);a-=c;return(1-a)*this.f(c,b)+a*this.f(c+1,b)};v.prototype.C=function(a,b){a*=this.i;var c=Math.floor(a), | ||
d=[this.u(c,b),this.u(c+1,b)],e=[this.f(c,b),this.f(c+1,b)];a-=c;c=a*a;var f=a*c;return(2*f-3*c+1)*e[0]+(f-2*c+a)*d[0]+(-2*f+3*c)*e[1]+(f-c)*d[1]};v.prototype.J=function(a,b){a*=this.i;var c=Math.floor(a),d=c+this.B,e=0;for(c=c-this.B+1;c<=d;c++)e+=this.G(a-c)*this.f(c,b);return e};v.prototype.u=function(a,b){return this.K*(this.f(a+1,b)-this.f(a-1,b))/2};v.prototype.f=function(a,b){return 0<=a&&a<this.v?b[a]:b[this.m(a,this.v)]};y.prototype.filter=function(a){this.z.M[this.z.P]=a;for(var b=a=0,c= | ||
this.z.M.length;b<c;b++)a+=this.a[b]*this.z.M[(this.z.P+b)%this.z.M.length];this.z.P=(this.z.P+1)%this.z.M.length;return a};y.prototype.reset=function(){this.z=this.b()};y.prototype.b=function(){for(var a=[],b=0;b<this.a.length-1;b++)a.push(0);return{M:a,P:0}};p.prototype.filter=function(a){for(var b=0,c=this.a.length;b<c;b++)a=this.f(b,a);return a};p.prototype.b=function(a){var b={z:[0,0],D:[],A:[]};a=this.c(a,b);b.k=1;b.A.push((1-a.aa)/(2*a.L));b.A.push(2*b.A[0]);b.A.push(b.A[0]);return b};p.prototype.c= | ||
function(a,b){var c={},d=2*Math.PI*a.na/a.oa;c.alpha=Math.sin(d)/(2*a.Q);c.aa=Math.cos(d);c.L=1+c.alpha;b.L=c.L;b.D.push(-2*c.aa/c.L);b.k=1;b.D.push((1-c.alpha)/c.L);return c};p.prototype.f=function(a,b){var c=b*this.a[a].k-this.a[a].Ga*this.a[a].z[0]-this.a[a].Ha*this.a[a].z[1],d=this.a[a].Ja*c+this.a[a].Ka*this.a[a].z[0]+this.a[a].La*this.a[a].z[1];this.a[a].z[1]=this.a[a].z[0];this.a[a].z[0]=c;return d};p.prototype.reset=function(){for(var a=0;a<this.a.length;a++)this.a[a].z=[0,0]};var Na={point:!1, | ||
linear:!1,cubic:!0,sinc:!0},na={IIR:16,FIR:71},Oa={IIR:p,FIR:y};Q(l,w);l.prototype.toRIFF=function(){var a=new Float64Array(N(this.data.samples.length,this.f.g/8));J(this.data.samples,this.f,a,0,this.data.samples.length,!1,!1);this.m(this.fmt.numChannels,this.fmt.sampleRate,this.bitDepth,a)};l.prototype.toRIFX=function(){var a=new Float64Array(N(this.data.samples.length,this.f.g/8));J(this.data.samples,this.f,a,0,this.data.samples.length,!1,!1);this.m(this.fmt.numChannels,this.fmt.sampleRate,this.bitDepth, | ||
a,{container:"RIFX"})};l.prototype.toIMAADPCM=function(){if(8E3!==this.fmt.sampleRate)throw Error("Only 8000 Hz files can be compressed as IMA-ADPCM.");if(1!==this.fmt.numChannels)throw Error("Only mono files can be compressed as IMA-ADPCM.");this.H();var a=new Int16Array(N(this.data.samples.length,2));J(this.data.samples,this.f,a,0,this.data.samples.length,!1,!1);this.m(this.fmt.numChannels,this.fmt.sampleRate,"4",Da(a),{container:this.u()})};l.prototype.fromIMAADPCM=function(a){a=void 0===a?"16": | ||
a;this.m(this.fmt.numChannels,this.fmt.sampleRate,"16",Fa(this.data.samples,this.fmt.blockAlign),{container:this.u()});"16"!=a&&this.toBitDepth(a)};l.prototype.toALaw=function(){this.H();var a=new Int16Array(N(this.data.samples.length,2));J(this.data.samples,this.f,a,0,this.data.samples.length,!1,!1);this.m(this.fmt.numChannels,this.fmt.sampleRate,"8a",Ga(a),{container:this.u()})};l.prototype.fromALaw=function(a){a=void 0===a?"16":a;this.m(this.fmt.numChannels,this.fmt.sampleRate,"16",Ia(this.data.samples), | ||
{container:this.u()});"16"!=a&&this.toBitDepth(a)};l.prototype.toMuLaw=function(){this.H();var a=new Int16Array(N(this.data.samples.length,2));J(this.data.samples,this.f,a,0,this.data.samples.length,!1,!1);this.m(this.fmt.numChannels,this.fmt.sampleRate,"8m",Ja(a),{container:this.u()})};l.prototype.fromMuLaw=function(a){a=void 0===a?"16":a;this.m(this.fmt.numChannels,this.fmt.sampleRate,"16",La(this.data.samples),{container:this.u()});"16"!=a&&this.toBitDepth(a)};l.prototype.toBitDepth=function(a, | ||
b){var c=a,d=this.bitDepth;void 0===b||b||("32f"!=a&&(c=this.f.g.toString()),d=""+this.f.g);this.S();var e=this.getSamples(!0),f=new Float64Array(e.length),g=d;if(-1<["32f","64"].indexOf(g)&&-1<["32f","64"].indexOf(c))f.set(e);else{da(g);da(c);d=Ca(g,c);var k={ea:Math.pow(2,parseInt(g,10))/2,ca:Math.pow(2,parseInt(c,10))/2,da:Math.pow(2,parseInt(g,10))/2-1,ba:Math.pow(2,parseInt(c,10))/2-1};ea(g,e,!0);if(-1<["32f","64"].indexOf(g)){g=e.length;for(var q=0;q<g;q++)1<e[q]?e[q]=1:-1>e[q]&&(e[q]=-1)}for(g= | ||
0;g<e.length;g++)f[g]=d(e[g],k);ea(c,f,!1)}this.m(this.fmt.numChannels,this.fmt.sampleRate,a,f,{container:this.u()})};l.prototype.toSampleRate=function(a,b){b=void 0===b?{}:b;this.wa(a);var c=this.getSamples(),d=[];if(c.constructor===Float64Array)d=ma(c,this.fmt.sampleRate,a,b);else for(var e=0;e<c.length;e++)d.push(ma(c[e],this.fmt.sampleRate,a,b));if("64"!==this.bitDepth&&"32f"!==this.bitDepth)if(d[0].constructor===Number)la(d,this.f.g);else for(c=0;c<d.length;c++)la(d[c],this.f.g);this.m(this.fmt.numChannels, | ||
a,this.bitDepth,d,{container:this.u()})};l.prototype.wa=function(a){if(1>a||4294967295<this.fmt.bitsPerSample/8*this.fmt.numChannels*a)throw Error("Invalid sample rate.");if(-1<["4","8a","8m"].indexOf(this.bitDepth))throw Error("wavefile can't change the sample rate of compressed files.");};l.prototype.H=function(){this.S();"16"!=this.bitDepth&&this.toBitDepth("16")};l.prototype.S=function(){"8a"==this.bitDepth?this.fromALaw():"8m"==this.bitDepth?this.fromMuLaw():"4"==this.bitDepth&&this.fromIMAADPCM()}; | ||
l.prototype.u=function(){return"RF64"==this.container?"RIFF":this.container};l.prototype.m=function(a,b,c,d,e){e=void 0===e?{}:e;var f=new w;Object.assign(this.fmt,f.fmt);Object.assign(this.fact,f.fact);Object.assign(this.ds64,f.ds64);Object.assign(this.data,f.data);this.V(a,b,c,d,e)};Q(m,l);m.prototype.fromBase64=function(a){this.fromBuffer(new Uint8Array(ya(a)))};m.prototype.toBase64=function(){for(var a=this.toBuffer(),b="",c=0;c<a.length;c+=3)b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[a[c]>> | ||
2],b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(a[c]&3)<<4|a[c+1]>>4],b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(a[c+1]&15)<<2|a[c+2]>>6],b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[a[c+2]&63];2===a.length%3?b=b.substring(0,b.length-1)+"=":1===a.length%3&&(b=b.substring(0,b.length-2)+"==");return b};m.prototype.toDataURI=function(){return"data:audio/wav;base64,"+this.toBase64()};m.prototype.fromDataURI=function(a){this.fromBase64(a.replace("data:audio/wav;base64,", | ||
""))};n.WaveFile=m;Object.defineProperty(n,"__esModule",{value:!0})}"object"===typeof exports&&"undefined"!==typeof module?T(exports):"function"===typeof define&&define.amd?define(["exports"],T):(S=S||self,T(S.wavefile={})); |
@@ -33,3 +33,3 @@ /* | ||
import * as alawmulaw from 'alawmulaw'; | ||
import { unpackArray, unpackArrayTo } from 'byte-data'; | ||
import { unpackArrayTo } from 'byte-data'; | ||
import { WaveFileCueEditor } from './wavefile-cue-editor'; | ||
@@ -51,2 +51,7 @@ import { truncateIntSamples } from './parsers/truncate-samples'; | ||
toRIFF() { | ||
/** @type {!Float64Array} */ | ||
let output = new Float64Array( | ||
outputSize_(this.data.samples.length, this.dataType.bits / 8)); | ||
unpackArrayTo(this.data.samples, this.dataType, output, | ||
0, this.data.samples.length, false, false); | ||
this.fromExisting_( | ||
@@ -56,3 +61,3 @@ this.fmt.numChannels, | ||
this.bitDepth, | ||
unpackArray(this.data.samples, this.dataType)); | ||
output); | ||
} | ||
@@ -64,2 +69,7 @@ | ||
toRIFX() { | ||
/** @type {!Float64Array} */ | ||
let output = new Float64Array( | ||
outputSize_(this.data.samples.length, this.dataType.bits / 8)); | ||
unpackArrayTo(this.data.samples, this.dataType, output, | ||
0, this.data.samples.length, false, false); | ||
this.fromExisting_( | ||
@@ -69,3 +79,3 @@ this.fmt.numChannels, | ||
this.bitDepth, | ||
unpackArray(this.data.samples, this.dataType), | ||
output, | ||
{container: 'RIFX'}); | ||
@@ -89,4 +99,6 @@ } | ||
/** @type {!Int16Array} */ | ||
let output = new Int16Array(this.outputSize_()); | ||
unpackArrayTo(this.data.samples, this.dataType, output); | ||
let output = new Int16Array( | ||
outputSize_(this.data.samples.length, 2)); | ||
unpackArrayTo(this.data.samples, this.dataType, output, | ||
0, this.data.samples.length, false, false); | ||
this.fromExisting_( | ||
@@ -125,4 +137,6 @@ this.fmt.numChannels, | ||
/** @type {!Int16Array} */ | ||
let output = new Int16Array(this.outputSize_()); | ||
unpackArrayTo(this.data.samples, this.dataType, output); | ||
let output = new Int16Array( | ||
outputSize_(this.data.samples.length, 2)); | ||
unpackArrayTo(this.data.samples, this.dataType, output, | ||
0, this.data.samples.length, false, false); | ||
this.fromExisting_( | ||
@@ -160,4 +174,6 @@ this.fmt.numChannels, | ||
/** @type {!Int16Array} */ | ||
let output = new Int16Array(this.outputSize_()); | ||
unpackArrayTo(this.data.samples, this.dataType, output); | ||
let output = new Int16Array( | ||
outputSize_(this.data.samples.length, 2)); | ||
unpackArrayTo(this.data.samples, this.dataType, output, | ||
0, this.data.samples.length, false, false); | ||
this.fromExisting_( | ||
@@ -347,17 +363,17 @@ this.fmt.numChannels, | ||
} | ||
} | ||
/** | ||
* Return the size in bytes of the output sample array when applying | ||
* compression to 16-bit samples. | ||
* @return {number} | ||
* @private | ||
*/ | ||
outputSize_() { | ||
/** @type {number} */ | ||
let outputSize = this.data.samples.length / 2; | ||
if (outputSize % 2) { | ||
outputSize++; | ||
} | ||
return outputSize; | ||
/** | ||
* Return the size in bytes of the output sample array when applying | ||
* compression to 16-bit samples. | ||
* @return {number} | ||
* @private | ||
*/ | ||
function outputSize_(byteLen, byteOffset) { | ||
/** @type {number} */ | ||
let outputSize = byteLen / byteOffset; | ||
if (outputSize % 2) { | ||
outputSize++; | ||
} | ||
return outputSize; | ||
} |
@@ -140,3 +140,4 @@ /* | ||
// Unpack all the samples | ||
unpackArrayTo(this.data.samples, this.dataType, samples); | ||
unpackArrayTo(this.data.samples, this.dataType, samples, | ||
0, this.data.samples.length, false, false); | ||
if (!interleaved && this.fmt.numChannels > 1) { | ||
@@ -161,3 +162,3 @@ return deInterleave(samples, this.fmt.numChannels, OutputObject); | ||
this.data.samples.slice(index, index + this.dataType.bits / 8), | ||
this.dataType); | ||
this.dataType, 0, false); | ||
} | ||
@@ -176,3 +177,3 @@ | ||
} | ||
packTo(sample, this.dataType, this.data.samples, index); | ||
packTo(sample, this.dataType, this.data.samples, index, false); | ||
} | ||
@@ -247,3 +248,3 @@ | ||
this.data.samples = new Uint8Array(samples.length * numBytes); | ||
packArrayTo(samples, this.dataType, this.data.samples); | ||
packArrayTo(samples, this.dataType, this.data.samples, 0, false); | ||
this.makeWavHeader_( | ||
@@ -250,0 +251,0 @@ bitDepthCode, numChannels, sampleRate, |
{ | ||
"name": "wavefile", | ||
"version": "10.4.2", | ||
"version": "10.4.3", | ||
"description": "Create, read and write wav files according to the specs.", | ||
@@ -104,5 +104,5 @@ "homepage": "https://github.com/rochars/wavefile", | ||
"bitdepth": "^9.0.0", | ||
"byte-data": "^18.0.4", | ||
"byte-data": "^18.1.1", | ||
"imaadpcm": "^5.0.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
260895
4989
Updatedbyte-data@^18.1.1