Socket
Socket
Sign inDemoInstall

wavefile

Package Overview
Dependencies
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wavefile - npm Package Compare versions

Comparing version 10.4.0 to 10.4.1

3

CHANGELOG.md
# CHANGELOG
## version 10.4.1 - 2020-01-21
Faster sinc resampling.
## version 10.4.0 - 2020-01-20

@@ -4,0 +7,0 @@ - Default LPF for resample is IIR

56

dist/wavefile.js

@@ -14,14 +14,14 @@ 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;

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 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.fa*b.da,10):parseInt(a/b.ga*b.ea,10)}function Aa(a,b){return parseInt(0<
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 g=d[1]<<8|d[0];E=32768<g?g-65536:g;G=d[2];L=W[G];g=[E,E];for(var k=4;k<d.length;k++){var q=d[k],z=q>>4;g.push(ia(z<<4^q));g.push(ia(z))}d=g;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]),
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 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 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,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 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 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 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,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=[];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,g=d;try{for(var k=a.length;f<k;f++)d=e.F(c,a[f],d);b.o&&Y(c,e.offset,
g,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 g=new J(b.h,b.O,b.G),k=g.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]=g.R(a,q);b.o&&Y(a,k,d,e)}catch(z){ka(z,a.slice(q,q+k),q)}}function h(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,
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*a)}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 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.P(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.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,
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,

@@ -47,18 +47,18 @@ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,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,

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),h(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),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.g),A(this.bext.UMID,64),h(this.bext.loudnessValue,this.g),h(this.bext.loudnessRange,this.g),h(this.bext.maxTruePeakLevel,this.g),h(this.bext.maxMomentaryLoudness,this.g),h(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),h(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),
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.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),h(b.length+4,this.a),h(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(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.Za=function(){var a=[];if(this.smpl.chunkId){var b=this.$a();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.j(a);return a};r.prototype.$a=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.Qa=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.j(a);return a};r.prototype.Ra=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.g),h(this.fmt.numChannels,this.g),h(this.fmt.sampleRate,this.a),h(this.fmt.byteRate,this.a),h(this.fmt.blockAlign,this.g),
h(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(h(this.fmt.cbSize,this.g)));18<this.fmt.chunkSize&&(a=a.concat(h(this.fmt.validBitsPerSample,this.g)));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.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),h(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),h(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),h(c.length+5,this.a),h(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(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.g),h(a.dwLanguage,this.g),h(a.dwDialect,this.g),h(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),h(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),h(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=
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=[],
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.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};
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 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.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)||
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=

@@ -77,10 +77,10 @@ 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=

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+1;c+=this.B;for(var e=0,f=d,g=d;d<=c?g<=c:g>=c;f=d<=c?++g:--g)e+=this.H(a-f)*this.f(f,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"})};
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),g=d;if(-1<["32f","64"].indexOf(g)&&
-1<["32f","64"].indexOf(c))f.set(e);else{fa(g);fa(c);d=Ca(g,c);var k={ga:Math.pow(2,parseInt(g,10))/2,ea:Math.pow(2,parseInt(c,10))/2,fa:Math.pow(2,parseInt(g,10))/2-1,da:Math.pow(2,parseInt(c,10))/2-1};ha(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);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);
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.");

@@ -87,0 +87,0 @@ 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,

@@ -26,3 +26,3 @@ /*

/**
* @fileoverview Externs for wavefile 10.2
* @fileoverview Externs for wavefile 10.4
* @see https://github.com/rochars/wavefile

@@ -29,0 +29,0 @@ * @externs

@@ -1,2 +0,2 @@

// Type definitions for wavefile 10.2
// Type definitions for wavefile 10.4
// Project: https://github.com/rochars/wavefile

@@ -3,0 +3,0 @@ // Definitions by: Rafael da Silva Rocha <https://github.com/rochars>

@@ -150,5 +150,3 @@ /*

let sum = 0;
for (let n = ref, j = ref;
ref <= ref1 ? j <= ref1 : j >= ref1;
n = ref <= ref1 ? ++j : --j) {
for (let n = ref; n <= ref1; n++) {
sum += this.kernel_(t - n) * this.getClippedInput_(n, samples);

@@ -155,0 +153,0 @@ }

{
"name": "wavefile",
"version": "10.4.0",
"version": "10.4.1",
"description": "Create, read and write wav files according to the specs.",

@@ -76,3 +76,3 @@ "homepage": "https://github.com/rochars/wavefile",

"test-sr-cubic": "node ./node_modules/mocha/bin/_mocha test/resampler-full/cubic.js -R dot --timeout=1600000",
"test-sr-sinc": "node ./node_modules/mocha/bin/_mocha test/resampler-full/sinc.js test/resampler-full/sinc-no-LPF.js -R dot --timeout=1600000",
"test-sr-sinc": "node ./node_modules/mocha/bin/_mocha test/resampler-full/sinc.js test/resampler-full/sinc-IIR.js -R dot --timeout=1600000",
"test-umd": "node ./node_modules/mocha/bin/_mocha test/resampler test/dist test/src --umd --recursive -R dot --timeout=240000",

@@ -79,0 +79,0 @@ "test-tsc": "tsc ./test/TypeScript/index.ts && node -r esm ./test/TypeScript/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc