Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 1.0.3 to 1.0.4

docs/docs/index.html

78

dist/wavefile-min.js

@@ -37,3 +37,3 @@ /*

(function(a){function k(h){if(g[h])return g[h].exports;var l=g[h]={i:h,l:!1,exports:{}};a[h].call(l.exports,l,l.exports,k);l.l=!0;return l.exports}var g={};k.m=a;k.c=g;k.d=function(a,g,f){k.o(a,g)||Object.defineProperty(a,g,{configurable:!1,enumerable:!0,get:f})};k.n=function(a){var h=a&&a.__esModule?function(){return a["default"]}:function(){return a};k.d(h,"a",h);return h};k.o=function(a,g){return Object.prototype.hasOwnProperty.call(a,g)};k.p="";return k(k.s=9)})([function(a,k,g){function h(c,
b,d){c[d]=l(c[d],b)}function l(c,d){var a=c.length+1;2==d?a=8:16==d&&(a=2);return b(c,a)}function f(c,d,b){2==d&&4>c[b].length&&(c[b]=Array(5-c[b].length).join("0")+c[b])}function e(c,d,b){(2==d||16==d)&&2>c[b].length&&(c[b]="0"+c[b])}function b(c,b){for(;c.length<b;)c="0"+c;return c}function c(c,b,d){d=void 0===d?h:d;if(10!=b)for(var a=0,e=c.length;a<e;)c[a]=c[a].toString(b),d(c,b,a),a++}var d=g(7),n=g(2);a.exports.makeBigEndian=function(c,b,a){b&&d(c,n.BitDepthOffsets[a])};a.exports.bytesToBase=
b,d){c[d]=l(c[d],b)}function l(c,d){var a=c.length+1;2==d?a=8:16==d&&(a=2);return b(c,a)}function f(c,d,b){2==d&&4>c[b].length&&(c[b]=Array(5-c[b].length).join("0")+c[b])}function e(c,b,d){(2==b||16==b)&&2>c[d].length&&(c[d]="0"+c[d])}function b(c,d){for(;c.length<d;)c="0"+c;return c}function c(c,d,b){b=void 0===b?h:b;if(10!=d)for(var a=0,e=c.length;a<e;)c[a]=c[a].toString(d),b(c,d,a),a++}var d=g(7),n=g(2);a.exports.makeBigEndian=function(c,b,a){b&&d(c,n.BitDepthOffsets[a])};a.exports.bytesToBase=
c;a.exports.outputToBase=function(b,d,a){4==d?c(b,a,f):2==d?c(b,a,e):1==d?c(b,a,function(){}):c(b,a)};a.exports.signed=function(c,b){c>parseInt(b/2,10)-1&&(c-=b);return c};a.exports.padding=h;a.exports.paddingNibble=f;a.exports.paddingCrumb=e;a.exports.bytePadding=l;a.exports.lPadZeros=b;a.exports.fixFloat16Endianness=function(c,b){b.float&&16==b.bits&&d(c,2)};a.exports.buildType=function(c,b){64==b&&(c.float=!0);c.float&&(c.signed=!0);c.bits=b}},function(a,k,g){function h(c,b,d){c[d]=l(c[d],b)}function l(c,

@@ -58,39 +58,39 @@ d){var a=c.length+1;2==d?a=8:16==d&&(a=2);return b(c,a)}function f(c,b,d){2==b&&4>c[d].length&&(c[d]=Array(5-c[d].length).join("0")+c[d])}function e(c,b,d){(2==b||16==b)&&2>c[d].length&&(c[d]="0"+c[d])}function b(c,b){for(;c.length<b;)c="0"+c;return c}function c(c,b,d){d=void 0===d?h:d;if(10!=b)for(var a=0,e=c.length;a<e;)c[a]=c[a].toString(b),d(c,b,a),a++}var d=g(7),n=g(4);a.exports.makeBigEndian=function(c,b,a){b&&d(c,n.BitDepthOffsets[a])};a.exports.bytesToBase=c;a.exports.outputToBase=function(b,

{oldNegative:h[e]/2,newNegative:h[b]/2,oldPositive:h[e]/2-1,newPositive:h[b]/2-1,original:e,target:b});f=n;g=a[n];"8"==b&&(g+=128);a[f]=g}};a.exports.BitDepthMaxValues=h},function(a,k,g){var h=g(12),l=g(5),f=h.uInt8,e=h.uInt16,b=h.uInt32,c=h.chr,d=g(18);k=function(){var c=d.call(this)||this;c.headerFormats_={4:17,8:1,16:1,24:1,32:1,"32f":3,64:3};c.samples_=[];return c};$jscomp.inherits(k,d);k.write=d.write;k.read=d.read;k.prototype.readRIFFChunk_=function(a){this.chunkId=h.unpackArray(a.slice(0,4),
c);if("RIFF"!=this.chunkId&&"RIFX"!=this.chunkId)throw Error(l.format);var b=this.LEorBE();this.chunkSize=h.fromBytes(a.slice(4,8),32,{be:b,single:!0});this.format=h.unpackArray(a.slice(8,12),c);if("WAVE"!=this.format)throw Error(l.wave);};k.prototype.LEorBE=function(){var c="RIFX"==this.chunkId;f.be=c;e.be=c;return b.be=c};k.prototype.readFmtChunk_=function(c){if(c=this.findChunk(c,"fmt "))this.fmtChunkId="fmt ",this.fmtChunkSize=c.chunkSize,this.audioFormat=h.unpack(c.chunkData.slice(0,2),e),this.numChannels=
h.unpack(c.chunkData.slice(2,4),e),this.sampleRate=h.unpack(c.chunkData.slice(4,8),b),this.byteRate=h.unpack(c.chunkData.slice(8,12),b),this.blockAlign=h.unpack(c.chunkData.slice(12,14),e),this.bitsPerSample=h.unpack(c.chunkData.slice(14,16),e),this.readFmtExtension(c);else throw Error(l["fmt "]);};k.prototype.readFmtExtension=function(c){16<this.fmtChunkSize&&(this.cbSize=h.unpack(c.chunkData.slice(16,18),e),18<this.fmtChunkSize&&(this.validBitsPerSample=h.unpack(c.chunkData.slice(18,20),e)))};k.prototype.readFactChunk_=
function(c){if(c=this.findChunk(c,"fact"))this.factChunkId="fact",this.factChunkSize=c.chunkSize,this.dwSampleLength=h.unpack(c.chunkData.slice(0,4),b);else if(this.enforceFact)throw Error(l.fact);};k.prototype.readBextChunk_=function(c){if(c=this.findChunk(c,"bext"))this.bextChunkId="bext",this.bextChunkSize=c.chunkSize,this.bextChunkData=c.chunkData};k.prototype.readCueChunk_=function(c){if(c=this.findChunk(c,"cue "))this.cueChunkId="cue ",this.cueChunkSize=c.chunkSize,this.cueChunkData=c.chunkData};
k.prototype.readDataChunk_=function(c,a){if(c=this.findChunk(c,"data"))this.dataChunkId="data",this.dataChunkSize=c.chunkSize,this.samplesFromBytes_(c.chunkData,a);else throw Error(l.data);};k.prototype.samplesFromBytes_=function(c,a){a.bits=4==this.bitsPerSample?8:this.bitsPerSample;a.signed=8==a.bits?!1:!0;a.float=3==this.audioFormat||64==this.bitsPerSample?!0:!1;a.single=!1;this.samples_=h.unpackArray(c,a)};k.prototype.findChunk=function(c,a){for(var b=0;b<c.length;b++)if(c[b].chunkId==a)return c[b];
return null};k.prototype.samplesToBytes_=function(c){c.bits=4==this.bitsPerSample?8:this.bitsPerSample;c.signed=8==c.bits?!1:!0;c.float=3==this.audioFormat||64==this.bitsPerSample?!0:!1;c=h.packArray(this.samples_,c);c.length%2&&c.push(0);return c};k.prototype.getBextBytes_=function(){return this.bextChunkId?[].concat(h.packArray(this.bextChunkId,c),h.pack(this.bextChunkSize,b),this.bextChunkData):[]};k.prototype.getCueBytes_=function(){return this.cueChunkId?[].concat(h.packArray(this.cueChunkId,
c),h.pack(this.cueChunkSize,b),this.cueChunkData):[]};k.prototype.getFactBytes_=function(){return this.factChunkId?[].concat(h.packArray(this.factChunkId,c),h.pack(this.factChunkSize,b),h.pack(this.dwSampleLength,b)):[]};k.prototype.getCbSizeBytes_=function(){return 16<this.fmtChunkSize?h.pack(this.cbSize,e):[]};k.prototype.getValidBitsPerSampleBytes_=function(){return 18<this.fmtChunkSize?h.pack(this.validBitsPerSample,e):[]};k.prototype.createWaveFile_=function(){var a={be:this.LEorBE()};return h.packArray(this.chunkId,
c).concat(h.pack(this.chunkSize,b),h.packArray(this.format,c),this.getBextBytes_(),h.packArray(this.fmtChunkId,c),h.pack(this.fmtChunkSize,b),h.pack(this.audioFormat,e),h.pack(this.numChannels,e),h.pack(this.sampleRate,b),h.pack(this.byteRate,b),h.pack(this.blockAlign,e),h.pack(this.bitsPerSample,e),this.getCbSizeBytes_(),this.getValidBitsPerSampleBytes_(),this.getFactBytes_(),h.packArray(this.dataChunkId,c),h.pack(this.dataChunkSize,b),this.samplesToBytes_(a),this.getCueBytes_())};a.exports=k},function(a,
k,g){function h(c,a){c=Object.assign({},c);c.base=a;c.single=!0;return c}function l(c,a){c=Object.assign({},c);c.base=a;c.single=!1;return c}function f(c){Array.isArray(c)||"string"==typeof c||(c=[c]);return c}var e=g(13),b=g(15);k=g(17);g=g(2);a.exports.pack=function(c,a,b){a=h(a,void 0===b?10:b);c=a.char?c[0]:c;return e.toBytes(f(c),a.bits,a)};a.exports.unpack=function(c,a,e){a=h(a,void 0===e?10:e);return b.fromBytes(c,a.bits,a)};a.exports.packArray=function(c,a,b){a=l(a,void 0===b?10:b);return e.toBytes(c,
a.bits,a)};a.exports.unpackArray=function(c,a,e){a=l(a,void 0===e?10:e);return b.fromBytes(c,a.bits,a)};a.exports.chr={bits:8,"char":!0,single:!0};a.exports.bool={bits:1,single:!0};a.exports.int2={bits:2,signed:!0,single:!0};a.exports.uInt2={bits:2,single:!0};a.exports.int4={bits:4,signed:!0,single:!0};a.exports.uInt4={bits:4,single:!0};a.exports.int8={bits:8,signed:!0,single:!0};a.exports.uInt8={bits:8,single:!0};a.exports.int16={bits:16,signed:!0,single:!0};a.exports.uInt16={bits:16,single:!0};
a.exports.float16={bits:16,"float":!0,single:!0};a.exports.int24={bits:24,signed:!0,single:!0};a.exports.uInt24={bits:24,single:!0};a.exports.int32={bits:32,signed:!0,single:!0};a.exports.uInt32={bits:32,single:!0};a.exports.float32={bits:32,"float":!0,single:!0};a.exports.int40={bits:40,signed:!0,single:!0};a.exports.uInt40={bits:40,single:!0};a.exports.int48={bits:48,signed:!0,single:!0};a.exports.uInt48={bits:48,single:!0};a.exports.float64={bits:64,"float":!0,single:!0};a.exports.findString=function(c,
a){for(var d,e=0;e<c.length;e++)if(d=b.fromBytes(c.slice(e,e+a.length),8,{"char":!0}),d==a)return e;return-1};a.exports.toBytes=e.toBytes;a.exports.fromBytes=b.fromBytes;a.exports.packBooleans=k.packBooleans;a.exports.unpackBooleans=k.unpackBooleans;a.exports.packCrumbs=k.packCrumbs;a.exports.unpackCrumbs=k.unpackCrumbs;a.exports.packNibbles=k.packNibbles;a.exports.unpackNibbles=k.unpackNibbles;a.exports.BitDepthOffsets=g.BitDepthOffsets;a.exports.BitDepthMaxValues=g.BitDepthMaxValues},function(a,
k,g){var h=g(14),l=g(0),f=g(2);a.exports.toBytes=function(a,b,c){c=void 0===c?{base:10,signed:!1}:c;l.buildType(c,b);var d=c;var e=d.char?h.writeString:h["write"+b+"Bit"+(d.float?"Float":"")];var g=0,k=0,u=a.length,t=[],m={};d.signed?(m.max=f.BitDepthMaxValues[b]/2-1,m.min=f.BitDepthMaxValues[b]/2*-1):(m.max=f.BitDepthMaxValues[b]-1,m.min=0);for(;g<u;){var p=a,q=g,r=m;d.float||(p[q]>r.max?p[q]=r.max:p[q]<r.min&&(p[q]=r.min));k=e(t,a,g,k,d.signed);g++}a=t;l.makeBigEndian(a,c.be,b);l.outputToBase(a,
b,c.base);l.fixFloat16Endianness(a,c);c.buffer&&(a=new Uint8Array(a));return a}},function(a,k,g){function h(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>>8&255;a[d++]=b[c]>>>16&255;a[d++]=b[c]>>>24&255;return d}var l=g(6),f=g(3);a.exports.write64BitFloat=function(a,b,c,d){b=l.toFloat64(b[c]);d=h(a,b,1,d);return h(a,b,0,d)};a.exports.write48Bit=function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>8&255;a[d++]=b[c]>>16&255;a[d++]=b[c]>>24&255;a[d++]=b[c]/4294967296&255;a[d++]=b[c]/1099511627776&255;return d};a.exports.write40Bit=
function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>8&255;a[d++]=b[c]>>16&255;a[d++]=b[c]>>24&255;a[d++]=b[c]/4294967296&255;return d};a.exports.write32BitFloat=function(a,b,c,d){b=f.unpack(b[c]);a[d++]=b&255;a[d++]=b>>>8&255;a[d++]=b>>>16&255;a[d++]=b>>>24&255;return d};a.exports.write32Bit=h;a.exports.write24Bit=function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>>8&255;a[d++]=b[c]>>>16&255;return d};a.exports.write16Bit=function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>>8&255;return d};a.exports.write16BitFloat=
function(a,b,c,d){b=l.toHalf(b[c]);a[d++]=b>>>8&255;a[d++]=b&255;return d};a.exports.write8Bit=function(a,b,c,d){a[d++]=b[c]&255;return d};a.exports.write4Bit=function(a,b,c,d){a[d++]=b[c]&15;return d};a.exports.write2Bit=function(a,b,c,d){a[d++]=0>b[c]?b[c]+4:b[c];return d};a.exports.write1Bit=function(a,b,c,d){a[d++]=b[c]?1:0;return d};a.exports.writeString=function(a,b,c,d){a[d++]=b.charCodeAt(c);return d}},function(a,k,g){function h(a,c,d){var b=[],h=0,g=0,k=f.BitDepthOffsets[c.bits],l=a.length-
(k-1),m=f.BitDepthMaxValues[c.bits];for(c=c.signed&&!c.float?e.signed:function(a,c){return a};h<l;)b[g]=c(d(a,h),m),h+=k,g++;return b}var l=g(16),f=g(2),e=g(0);a.exports.fromBytes=function(a,c,d){d=void 0===d?{base:10}:d;e.buildType(d,c);e.fixFloat16Endianness(a,d);e.makeBigEndian(a,d.be,c);var b=d.base;if(10!=b)for(var f=0,g=a.length;f<g;)a[f]=parseInt(a[f],b),f++;a=h(a,d,d.char?l.readChar:l["read"+(2==c||4==c?8:c)+"Bit"+(d.float?"Float":"")]);d.char&&(a=a.join(""));d.single&&(a=a[0]);return a}},
function(a,k,g){function h(a,b,e){--e;for(var c="";0<=e;)c+=f.bytePadding(a[e+b].toString(2),2),e--;return parseInt(c,2)}function l(a,b){return(a[3+b]<<24|a[2+b]<<16|a[1+b]<<8|a[b])>>>0}var f=g(0),e=g(6),b=g(3);a.exports.readChar=function(a,b){return String.fromCharCode(a[b])};a.exports.read1Bit=function(a,b){return parseInt(a[b],2)};a.exports.read8Bit=function(a,b){return a[b]};a.exports.read16Bit=function(a,b){return a[1+b]<<8|a[b]};a.exports.read16BitFloat=function(a,b){return e.decodeFloat16(a.slice(b,
b+2))};a.exports.read24Bit=function(a,b){return a[2+b]<<16|a[1+b]<<8|a[b]};a.exports.read32Bit=l;a.exports.read32BitFloat=function(a,d){return b.pack(l(a,d))};a.exports.read40Bit=function(a,b){return h(a,b,5)};a.exports.read48Bit=function(a,b){return h(a,b,6)};a.exports.read64BitFloat=function(a,b){return e.decodeFloat64(a.slice(b,b+8))}},function(a,k,g){function h(a,e){var b=0,c=a.length%e;if(c)for(c=-1*(c-e);b<c;)a.push(0),b++}var l=g(0);a.exports.packBooleans=function(a){var e=[],b=0,c=0;h(a,8);
for(var d=a.length-7;b<d;)e[c++]=parseInt(a[b].toString(2)+a[b+1].toString(2)+a[b+2].toString(2)+a[b+3].toString(2)+a[b+4].toString(2)+a[b+5].toString(2)+a[b+6].toString(2)+a[b+7].toString(2),2),b+=8;return e};a.exports.unpackBooleans=function(a){for(var e=[],b=0,c=0,d=a.length,f;b<d;)f=l.lPadZeros(a[b].toString(2),8),e[c++]=parseInt(f[0],2),e[c++]=parseInt(f[1],2),e[c++]=parseInt(f[2],2),e[c++]=parseInt(f[3],2),e[c++]=parseInt(f[4],2),e[c++]=parseInt(f[5],2),e[c++]=parseInt(f[6],2),e[c++]=parseInt(f[7],
2),b++;return e};a.exports.packCrumbs=function(a){var e=[],b=0,c=0;h(a,4);for(var d=a.length-3;b<d;)e[c++]=parseInt(l.lPadZeros(a[b].toString(2),2)+l.lPadZeros(a[b+1].toString(2),2)+l.lPadZeros(a[b+2].toString(2),2)+l.lPadZeros(a[b+3].toString(2),2),2),b+=4;return e};a.exports.unpackCrumbs=function(a){for(var e=[],b=0,c=0,d=a.length,f;b<d;)f=l.lPadZeros(a[b].toString(2),8),e[c++]=parseInt(f[0]+f[1],2),e[c++]=parseInt(f[2]+f[3],2),e[c++]=parseInt(f[4]+f[5],2),e[c++]=parseInt(f[6]+f[7],2),b++;return e};
a.exports.packNibbles=function(a){var e=[],b=0,c=0,d=a.length;for(d%2&&a.push(0);b<d;)e[c++]=parseInt(a[b].toString(16)+a[b+1].toString(16),16),b+=2;return e};a.exports.unpackNibbles=function(a){for(var e=[],b=0,c=0,d=a.length;b<d;)e[c++]=parseInt(a[b].toString(16)[0],16),e[c++]=parseInt(a[b].toString(16)[1],16),b++;return e}},function(a,k){a.exports=function(){this.chunkId="";this.chunkSize=0;this.fmtChunkId=this.format="";this.validBitsPerSample=this.cbSize=this.bitsPerSample=this.blockAlign=this.byteRate=
this.sampleRate=this.numChannels=this.audioFormat=this.fmtChunkSize=0;this.factChunkId="";this.factChunkSize=0;this.factChunkData=[];this.dwSampleLength=0;this.cueChunkId="";this.cueChunkSize=-1;this.cueChunkData=[];this.dataChunkId="";this.dataChunkSize=0;this.bextChunkId="";this.bextChunkSize=0;this.bextChunkData=[]}},function(a,k,g){function h(a,e){void 0!==e&&e||(c.be="RIFX"==a.chunkId);e=b.packArray(a.chunkId,d).concat(b.pack(a.chunkSize,c),b.packArray(a.format,d),l(a.subChunks,c.be));if("RIFF"==
a.chunkId||"RIFX"==a.chunkId)e=new Uint8Array(e);return e}function l(a,e){for(var f=[],g=0;g<a.length;)f="LIST"==a[g].chunkId?f.concat(h(a[g],e)):f.concat(b.packArray(a[g].chunkId,d),b.pack(a[g].chunkSize,c),a[g].chunkData),g++;return f}function f(a){for(var c=[],b=12;b<a.length;)c.push(e(a,b)),b+=8+c[c.length-1].chunkSize;return c}function e(a,e){var g={chunkId:b.unpackArray(a.slice(e,e+4),d),chunkSize:b.unpack(a.slice(e+4,e+8),c)};"LIST"==g.chunkId?(g.format=b.unpackArray(a.slice(8,12),d),g.subChunks=
f(a.slice(e,e+g.chunkSize))):g.chunkData=a.slice(e+8,e+8+g.chunkSize);return g}var b=g(20),c=b.uInt32,d=b.chr;a.exports.read=function(a){a=[].slice.call(a);var e=b.unpackArray(a.slice(0,4),d);c.be="RIFX"==e;var g=b.unpack(a.slice(4,8),c);return{chunkId:e,chunkSize:g,format:b.unpackArray(a.slice(8,12),d),subChunks:f(a)}};a.exports.write=h},function(a,k,g){function h(a,b){a=Object.assign({},a);a.base=b;a.single=!0;return a}function l(a,b){a=Object.assign({},a);a.base=b;a.single=!1;return a}function f(a){Array.isArray(a)||
"string"==typeof a||(a=[a]);return a}var e=g(21),b=g(23);k=g(25);g=g(4);a.exports.pack=function(a,b,g){b=h(b,void 0===g?10:g);a=b.char?a[0]:a;return e.toBytes(f(a),b.bits,b)};a.exports.unpack=function(a,d,e){d=h(d,void 0===e?10:e);return b.fromBytes(a,d.bits,d)};a.exports.packArray=function(a,b,f){b=l(b,void 0===f?10:f);return e.toBytes(a,b.bits,b)};a.exports.unpackArray=function(a,d,e){d=l(d,void 0===e?10:e);return b.fromBytes(a,d.bits,d)};a.exports.chr={bits:8,"char":!0,single:!0};a.exports.bool=
{bits:1,single:!0};a.exports.int2={bits:2,signed:!0,single:!0};a.exports.uInt2={bits:2,single:!0};a.exports.int4={bits:4,signed:!0,single:!0};a.exports.uInt4={bits:4,single:!0};a.exports.int8={bits:8,signed:!0,single:!0};a.exports.uInt8={bits:8,single:!0};a.exports.int16={bits:16,signed:!0,single:!0};a.exports.uInt16={bits:16,single:!0};a.exports.float16={bits:16,"float":!0,single:!0};a.exports.int24={bits:24,signed:!0,single:!0};a.exports.uInt24={bits:24,single:!0};a.exports.int32={bits:32,signed:!0,
single:!0};a.exports.uInt32={bits:32,single:!0};a.exports.float32={bits:32,"float":!0,single:!0};a.exports.int40={bits:40,signed:!0,single:!0};a.exports.uInt40={bits:40,single:!0};a.exports.int48={bits:48,signed:!0,single:!0};a.exports.uInt48={bits:48,single:!0};a.exports.float64={bits:64,"float":!0,single:!0};a.exports.findString=function(a,d){for(var c,e=0;e<a.length;e++)if(c=b.fromBytes(a.slice(e,e+d.length),8,{"char":!0}),c==d)return e;return-1};a.exports.toBytes=e.toBytes;a.exports.fromBytes=
b.fromBytes;a.exports.packBooleans=k.packBooleans;a.exports.unpackBooleans=k.unpackBooleans;a.exports.packCrumbs=k.packCrumbs;a.exports.unpackCrumbs=k.unpackCrumbs;a.exports.packNibbles=k.packNibbles;a.exports.unpackNibbles=k.unpackNibbles;a.exports.BitDepthOffsets=g.BitDepthOffsets;a.exports.BitDepthMaxValues=g.BitDepthMaxValues},function(a,k,g){var h=g(22),l=g(1),f=g(4);a.exports.toBytes=function(a,b,c){c=void 0===c?{base:10,signed:!1}:c;l.buildType(c,b);var d=c;var e=d.char?h.writeString:h["write"+
b+"Bit"+(d.float?"Float":"")];var g=0,k=0,u=a.length,t=[],m={};d.signed?(m.max=f.BitDepthMaxValues[b]/2-1,m.min=f.BitDepthMaxValues[b]/2*-1):(m.max=f.BitDepthMaxValues[b]-1,m.min=0);for(;g<u;){var p=a,q=g,r=m;d.float||(p[q]>r.max?p[q]=r.max:p[q]<r.min&&(p[q]=r.min));k=e(t,a,g,k,d.signed);g++}a=t;l.makeBigEndian(a,c.be,b);l.outputToBase(a,b,c.base);l.fixFloat16Endianness(a,c);c.buffer&&(a=new Uint8Array(a));return a}},function(a,k,g){function h(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>>8&255;a[d++]=b[c]>>>
16&255;a[d++]=b[c]>>>24&255;return d}var l=g(8),f=g(3);a.exports.write64BitFloat=function(a,b,c,d){b=l.toFloat64(b[c]);d=h(a,b,1,d);return h(a,b,0,d)};a.exports.write48Bit=function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>8&255;a[d++]=b[c]>>16&255;a[d++]=b[c]>>24&255;a[d++]=b[c]/4294967296&255;a[d++]=b[c]/1099511627776&255;return d};a.exports.write40Bit=function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>8&255;a[d++]=b[c]>>16&255;a[d++]=b[c]>>24&255;a[d++]=b[c]/4294967296&255;return d};a.exports.write32BitFloat=
function(a,b,c,d){b=f.unpack(b[c]);a[d++]=b&255;a[d++]=b>>>8&255;a[d++]=b>>>16&255;a[d++]=b>>>24&255;return d};a.exports.write32Bit=h;a.exports.write24Bit=function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>>8&255;a[d++]=b[c]>>>16&255;return d};a.exports.write16Bit=function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>>8&255;return d};a.exports.write16BitFloat=function(a,b,c,d){b=l.toHalf(b[c]);a[d++]=b>>>8&255;a[d++]=b&255;return d};a.exports.write8Bit=function(a,b,c,d){a[d++]=b[c]&255;return d};a.exports.write4Bit=
function(a,b,c,d){a[d++]=b[c]&15;return d};a.exports.write2Bit=function(a,b,c,d){a[d++]=0>b[c]?b[c]+4:b[c];return d};a.exports.write1Bit=function(a,b,c,d){a[d++]=b[c]?1:0;return d};a.exports.writeString=function(a,b,c,d){a[d++]=b.charCodeAt(c);return d}},function(a,k,g){function h(a,c,d){var b=[],g=0,h=0,k=f.BitDepthOffsets[c.bits],l=a.length-(k-1),m=f.BitDepthMaxValues[c.bits];for(c=c.signed&&!c.float?e.signed:function(a,c){return a};g<l;)b[h]=c(d(a,g),m),g+=k,h++;return b}var l=g(24),f=g(4),e=g(1);
a.exports.fromBytes=function(a,c,d){d=void 0===d?{base:10}:d;e.buildType(d,c);e.fixFloat16Endianness(a,d);e.makeBigEndian(a,d.be,c);var b=d.base;if(10!=b)for(var f=0,g=a.length;f<g;)a[f]=parseInt(a[f],b),f++;a=h(a,d,d.char?l.readChar:l["read"+(2==c||4==c?8:c)+"Bit"+(d.float?"Float":"")]);d.char&&(a=a.join(""));d.single&&(a=a[0]);return a}},function(a,k,g){function h(a,b,e){--e;for(var c="";0<=e;)c+=f.bytePadding(a[e+b].toString(2),2),e--;return parseInt(c,2)}function l(a,b){return(a[3+b]<<24|a[2+
b]<<16|a[1+b]<<8|a[b])>>>0}var f=g(1),e=g(8),b=g(3);a.exports.readChar=function(a,b){return String.fromCharCode(a[b])};a.exports.read1Bit=function(a,b){return parseInt(a[b],2)};a.exports.read8Bit=function(a,b){return a[b]};a.exports.read16Bit=function(a,b){return a[1+b]<<8|a[b]};a.exports.read16BitFloat=function(a,b){return e.decodeFloat16(a.slice(b,b+2))};a.exports.read24Bit=function(a,b){return a[2+b]<<16|a[1+b]<<8|a[b]};a.exports.read32Bit=l;a.exports.read32BitFloat=function(a,d){return b.pack(l(a,
d))};a.exports.read40Bit=function(a,b){return h(a,b,5)};a.exports.read48Bit=function(a,b){return h(a,b,6)};a.exports.read64BitFloat=function(a,b){return e.decodeFloat64(a.slice(b,b+8))}},function(a,k,g){function h(a,e){var b=0,c=a.length%e;if(c)for(c=-1*(c-e);b<c;)a.push(0),b++}var l=g(1);a.exports.packBooleans=function(a){var e=[],b=0,c=0;h(a,8);for(var d=a.length-7;b<d;)e[c++]=parseInt(a[b].toString(2)+a[b+1].toString(2)+a[b+2].toString(2)+a[b+3].toString(2)+a[b+4].toString(2)+a[b+5].toString(2)+
a[b+6].toString(2)+a[b+7].toString(2),2),b+=8;return e};a.exports.unpackBooleans=function(a){for(var e=[],b=0,c=0,d=a.length,f;b<d;)f=l.lPadZeros(a[b].toString(2),8),e[c++]=parseInt(f[0],2),e[c++]=parseInt(f[1],2),e[c++]=parseInt(f[2],2),e[c++]=parseInt(f[3],2),e[c++]=parseInt(f[4],2),e[c++]=parseInt(f[5],2),e[c++]=parseInt(f[6],2),e[c++]=parseInt(f[7],2),b++;return e};a.exports.packCrumbs=function(a){var e=[],b=0,c=0;h(a,4);for(var d=a.length-3;b<d;)e[c++]=parseInt(l.lPadZeros(a[b].toString(2),2)+
l.lPadZeros(a[b+1].toString(2),2)+l.lPadZeros(a[b+2].toString(2),2)+l.lPadZeros(a[b+3].toString(2),2),2),b+=4;return e};a.exports.unpackCrumbs=function(a){for(var e=[],b=0,c=0,d=a.length,f;b<d;)f=l.lPadZeros(a[b].toString(2),8),e[c++]=parseInt(f[0]+f[1],2),e[c++]=parseInt(f[2]+f[3],2),e[c++]=parseInt(f[4]+f[5],2),e[c++]=parseInt(f[6]+f[7],2),b++;return e};a.exports.packNibbles=function(a){var e=[],b=0,c=0,d=a.length;for(d%2&&a.push(0);b<d;)e[c++]=parseInt(a[b].toString(16)+a[b+1].toString(16),16),
b+=2;return e};a.exports.unpackNibbles=function(a){for(var e=[],b=0,c=0,d=a.length;b<d;)e[c++]=parseInt(a[b].toString(16)[0],16),e[c++]=parseInt(a[b].toString(16)[1],16),b++;return e}}]);
c);if("RIFF"!=this.chunkId&&"RIFX"!=this.chunkId)throw Error(l.format);this.LEorBE();this.chunkSize=h.unpack(a.slice(4,8),b);this.format=h.unpackArray(a.slice(8,12),c);if("WAVE"!=this.format)throw Error(l.wave);};k.prototype.LEorBE=function(){var c="RIFX"==this.chunkId;f.be=c;e.be=c;return b.be=c};k.prototype.readFmtChunk_=function(c){if(c=this.findChunk(c,"fmt "))this.fmtChunkId="fmt ",this.fmtChunkSize=c.chunkSize,this.audioFormat=h.unpack(c.chunkData.slice(0,2),e),this.numChannels=h.unpack(c.chunkData.slice(2,
4),e),this.sampleRate=h.unpack(c.chunkData.slice(4,8),b),this.byteRate=h.unpack(c.chunkData.slice(8,12),b),this.blockAlign=h.unpack(c.chunkData.slice(12,14),e),this.bitsPerSample=h.unpack(c.chunkData.slice(14,16),e),this.readFmtExtension(c);else throw Error(l["fmt "]);};k.prototype.readFmtExtension=function(c){16<this.fmtChunkSize&&(this.cbSize=h.unpack(c.chunkData.slice(16,18),e),18<this.fmtChunkSize&&(this.validBitsPerSample=h.unpack(c.chunkData.slice(18,20),e)))};k.prototype.readFactChunk_=function(c){if(c=
this.findChunk(c,"fact"))this.factChunkId="fact",this.factChunkSize=c.chunkSize,this.dwSampleLength=h.unpack(c.chunkData.slice(0,4),b);else if(this.enforceFact)throw Error(l.fact);};k.prototype.readBextChunk_=function(c){if(c=this.findChunk(c,"bext"))this.bextChunkId="bext",this.bextChunkSize=c.chunkSize,this.bextChunkData=c.chunkData};k.prototype.readCueChunk_=function(c){if(c=this.findChunk(c,"cue "))this.cueChunkId="cue ",this.cueChunkSize=c.chunkSize,this.cueChunkData=c.chunkData};k.prototype.readDataChunk_=
function(c,a){if(c=this.findChunk(c,"data"))this.dataChunkId="data",this.dataChunkSize=c.chunkSize,this.samplesFromBytes_(c.chunkData,a);else throw Error(l.data);};k.prototype.samplesFromBytes_=function(c,a){a.bits=4==this.bitsPerSample?8:this.bitsPerSample;a.signed=8==a.bits?!1:!0;a.float=3==this.audioFormat||64==this.bitsPerSample?!0:!1;a.single=!1;this.samples_=h.unpackArray(c,a)};k.prototype.findChunk=function(c,a){for(var b=0;b<c.length;b++)if(c[b].chunkId==a)return c[b];return null};k.prototype.samplesToBytes_=
function(c){c.bits=4==this.bitsPerSample?8:this.bitsPerSample;c.signed=8==c.bits?!1:!0;c.float=3==this.audioFormat||64==this.bitsPerSample?!0:!1;c=h.packArray(this.samples_,c);c.length%2&&c.push(0);return c};k.prototype.getBextBytes_=function(){return this.bextChunkId?[].concat(h.packArray(this.bextChunkId,c),h.pack(this.bextChunkSize,b),this.bextChunkData):[]};k.prototype.getCueBytes_=function(){return this.cueChunkId?[].concat(h.packArray(this.cueChunkId,c),h.pack(this.cueChunkSize,b),this.cueChunkData):
[]};k.prototype.getFactBytes_=function(){return this.factChunkId?[].concat(h.packArray(this.factChunkId,c),h.pack(this.factChunkSize,b),h.pack(this.dwSampleLength,b)):[]};k.prototype.getCbSizeBytes_=function(){return 16<this.fmtChunkSize?h.pack(this.cbSize,e):[]};k.prototype.getValidBitsPerSampleBytes_=function(){return 18<this.fmtChunkSize?h.pack(this.validBitsPerSample,e):[]};k.prototype.createWaveFile_=function(){var a={be:this.LEorBE()};return h.packArray(this.chunkId,c).concat(h.pack(this.chunkSize,
b),h.packArray(this.format,c),this.getBextBytes_(),h.packArray(this.fmtChunkId,c),h.pack(this.fmtChunkSize,b),h.pack(this.audioFormat,e),h.pack(this.numChannels,e),h.pack(this.sampleRate,b),h.pack(this.byteRate,b),h.pack(this.blockAlign,e),h.pack(this.bitsPerSample,e),this.getCbSizeBytes_(),this.getValidBitsPerSampleBytes_(),this.getFactBytes_(),h.packArray(this.dataChunkId,c),h.pack(this.dataChunkSize,b),this.samplesToBytes_(a),this.getCueBytes_())};a.exports=k},function(a,k,g){function h(c,a){c=
Object.assign({},c);c.base=a;c.single=!0;return c}function l(c,a){c=Object.assign({},c);c.base=a;c.single=!1;return c}function f(c){Array.isArray(c)||"string"==typeof c||(c=[c]);return c}var e=g(13),b=g(15);k=g(17);g=g(2);a.exports.pack=function(c,a,b){a=h(a,void 0===b?10:b);c=a.char?c[0]:c;return e.toBytes(f(c),a.bits,a)};a.exports.unpack=function(c,a,e){a=h(a,void 0===e?10:e);return b.fromBytes(c,a.bits,a)};a.exports.packArray=function(c,a,b){a=l(a,void 0===b?10:b);return e.toBytes(c,a.bits,a)};
a.exports.unpackArray=function(c,a,e){a=l(a,void 0===e?10:e);return b.fromBytes(c,a.bits,a)};a.exports.chr={bits:8,"char":!0,single:!0};a.exports.bool={bits:1,single:!0};a.exports.int2={bits:2,signed:!0,single:!0};a.exports.uInt2={bits:2,single:!0};a.exports.int4={bits:4,signed:!0,single:!0};a.exports.uInt4={bits:4,single:!0};a.exports.int8={bits:8,signed:!0,single:!0};a.exports.uInt8={bits:8,single:!0};a.exports.int16={bits:16,signed:!0,single:!0};a.exports.uInt16={bits:16,single:!0};a.exports.float16=
{bits:16,"float":!0,single:!0};a.exports.int24={bits:24,signed:!0,single:!0};a.exports.uInt24={bits:24,single:!0};a.exports.int32={bits:32,signed:!0,single:!0};a.exports.uInt32={bits:32,single:!0};a.exports.float32={bits:32,"float":!0,single:!0};a.exports.int40={bits:40,signed:!0,single:!0};a.exports.uInt40={bits:40,single:!0};a.exports.int48={bits:48,signed:!0,single:!0};a.exports.uInt48={bits:48,single:!0};a.exports.float64={bits:64,"float":!0,single:!0};a.exports.findString=function(c,a){for(var d,
e=0;e<c.length;e++)if(d=b.fromBytes(c.slice(e,e+a.length),8,{"char":!0}),d==a)return e;return-1};a.exports.toBytes=e.toBytes;a.exports.fromBytes=b.fromBytes;a.exports.packBooleans=k.packBooleans;a.exports.unpackBooleans=k.unpackBooleans;a.exports.packCrumbs=k.packCrumbs;a.exports.unpackCrumbs=k.unpackCrumbs;a.exports.packNibbles=k.packNibbles;a.exports.unpackNibbles=k.unpackNibbles;a.exports.BitDepthOffsets=g.BitDepthOffsets;a.exports.BitDepthMaxValues=g.BitDepthMaxValues},function(a,k,g){var h=g(14),
l=g(0),f=g(2);a.exports.toBytes=function(a,b,c){c=void 0===c?{base:10,signed:!1}:c;l.buildType(c,b);var d=c;var e=d.char?h.writeString:h["write"+b+"Bit"+(d.float?"Float":"")];var g=0,k=0,u=a.length,t=[],m={};d.signed?(m.max=f.BitDepthMaxValues[b]/2-1,m.min=f.BitDepthMaxValues[b]/2*-1):(m.max=f.BitDepthMaxValues[b]-1,m.min=0);for(;g<u;){var p=a,q=g,r=m;d.float||(p[q]>r.max?p[q]=r.max:p[q]<r.min&&(p[q]=r.min));k=e(t,a,g,k,d.signed);g++}a=t;l.makeBigEndian(a,c.be,b);l.outputToBase(a,b,c.base);l.fixFloat16Endianness(a,
c);c.buffer&&(a=new Uint8Array(a));return a}},function(a,k,g){function h(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>>8&255;a[d++]=b[c]>>>16&255;a[d++]=b[c]>>>24&255;return d}var l=g(6),f=g(3);a.exports.write64BitFloat=function(a,b,c,d){b=l.toFloat64(b[c]);d=h(a,b,1,d);return h(a,b,0,d)};a.exports.write48Bit=function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>8&255;a[d++]=b[c]>>16&255;a[d++]=b[c]>>24&255;a[d++]=b[c]/4294967296&255;a[d++]=b[c]/1099511627776&255;return d};a.exports.write40Bit=function(a,b,c,d){a[d++]=
b[c]&255;a[d++]=b[c]>>8&255;a[d++]=b[c]>>16&255;a[d++]=b[c]>>24&255;a[d++]=b[c]/4294967296&255;return d};a.exports.write32BitFloat=function(a,b,c,d){b=f.unpack(b[c]);a[d++]=b&255;a[d++]=b>>>8&255;a[d++]=b>>>16&255;a[d++]=b>>>24&255;return d};a.exports.write32Bit=h;a.exports.write24Bit=function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>>8&255;a[d++]=b[c]>>>16&255;return d};a.exports.write16Bit=function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>>8&255;return d};a.exports.write16BitFloat=function(a,b,c,d){b=
l.toHalf(b[c]);a[d++]=b>>>8&255;a[d++]=b&255;return d};a.exports.write8Bit=function(a,b,c,d){a[d++]=b[c]&255;return d};a.exports.write4Bit=function(a,b,c,d){a[d++]=b[c]&15;return d};a.exports.write2Bit=function(a,b,c,d){a[d++]=0>b[c]?b[c]+4:b[c];return d};a.exports.write1Bit=function(a,b,c,d){a[d++]=b[c]?1:0;return d};a.exports.writeString=function(a,b,c,d){a[d++]=b.charCodeAt(c);return d}},function(a,k,g){function h(a,c,d){var b=[],h=0,g=0,k=f.BitDepthOffsets[c.bits],l=a.length-(k-1),m=f.BitDepthMaxValues[c.bits];
for(c=c.signed&&!c.float?e.signed:function(a,c){return a};h<l;)b[g]=c(d(a,h),m),h+=k,g++;return b}var l=g(16),f=g(2),e=g(0);a.exports.fromBytes=function(a,c,d){d=void 0===d?{base:10}:d;e.buildType(d,c);e.fixFloat16Endianness(a,d);e.makeBigEndian(a,d.be,c);var b=d.base;if(10!=b)for(var f=0,g=a.length;f<g;)a[f]=parseInt(a[f],b),f++;a=h(a,d,d.char?l.readChar:l["read"+(2==c||4==c?8:c)+"Bit"+(d.float?"Float":"")]);d.char&&(a=a.join(""));d.single&&(a=a[0]);return a}},function(a,k,g){function h(a,b,e){--e;
for(var c="";0<=e;)c+=f.bytePadding(a[e+b].toString(2),2),e--;return parseInt(c,2)}function l(a,b){return(a[3+b]<<24|a[2+b]<<16|a[1+b]<<8|a[b])>>>0}var f=g(0),e=g(6),b=g(3);a.exports.readChar=function(a,b){return String.fromCharCode(a[b])};a.exports.read1Bit=function(a,b){return parseInt(a[b],2)};a.exports.read8Bit=function(a,b){return a[b]};a.exports.read16Bit=function(a,b){return a[1+b]<<8|a[b]};a.exports.read16BitFloat=function(a,b){return e.decodeFloat16(a.slice(b,b+2))};a.exports.read24Bit=function(a,
b){return a[2+b]<<16|a[1+b]<<8|a[b]};a.exports.read32Bit=l;a.exports.read32BitFloat=function(a,d){return b.pack(l(a,d))};a.exports.read40Bit=function(a,b){return h(a,b,5)};a.exports.read48Bit=function(a,b){return h(a,b,6)};a.exports.read64BitFloat=function(a,b){return e.decodeFloat64(a.slice(b,b+8))}},function(a,k,g){function h(a,e){var b=0,c=a.length%e;if(c)for(c=-1*(c-e);b<c;)a.push(0),b++}var l=g(0);a.exports.packBooleans=function(a){var e=[],b=0,c=0;h(a,8);for(var d=a.length-7;b<d;)e[c++]=parseInt(a[b].toString(2)+
a[b+1].toString(2)+a[b+2].toString(2)+a[b+3].toString(2)+a[b+4].toString(2)+a[b+5].toString(2)+a[b+6].toString(2)+a[b+7].toString(2),2),b+=8;return e};a.exports.unpackBooleans=function(a){for(var e=[],b=0,c=0,d=a.length,f;b<d;)f=l.lPadZeros(a[b].toString(2),8),e[c++]=parseInt(f[0],2),e[c++]=parseInt(f[1],2),e[c++]=parseInt(f[2],2),e[c++]=parseInt(f[3],2),e[c++]=parseInt(f[4],2),e[c++]=parseInt(f[5],2),e[c++]=parseInt(f[6],2),e[c++]=parseInt(f[7],2),b++;return e};a.exports.packCrumbs=function(a){var e=
[],b=0,c=0;h(a,4);for(var d=a.length-3;b<d;)e[c++]=parseInt(l.lPadZeros(a[b].toString(2),2)+l.lPadZeros(a[b+1].toString(2),2)+l.lPadZeros(a[b+2].toString(2),2)+l.lPadZeros(a[b+3].toString(2),2),2),b+=4;return e};a.exports.unpackCrumbs=function(a){for(var e=[],b=0,c=0,d=a.length,f;b<d;)f=l.lPadZeros(a[b].toString(2),8),e[c++]=parseInt(f[0]+f[1],2),e[c++]=parseInt(f[2]+f[3],2),e[c++]=parseInt(f[4]+f[5],2),e[c++]=parseInt(f[6]+f[7],2),b++;return e};a.exports.packNibbles=function(a){var e=[],b=0,c=0,
d=a.length;for(d%2&&a.push(0);b<d;)e[c++]=parseInt(a[b].toString(16)+a[b+1].toString(16),16),b+=2;return e};a.exports.unpackNibbles=function(a){for(var e=[],b=0,c=0,d=a.length;b<d;)e[c++]=parseInt(a[b].toString(16)[0],16),e[c++]=parseInt(a[b].toString(16)[1],16),b++;return e}},function(a,k){a.exports=function(){this.chunkId="";this.chunkSize=0;this.fmtChunkId=this.format="";this.validBitsPerSample=this.cbSize=this.bitsPerSample=this.blockAlign=this.byteRate=this.sampleRate=this.numChannels=this.audioFormat=
this.fmtChunkSize=0;this.factChunkId="";this.factChunkSize=0;this.factChunkData=[];this.dwSampleLength=0;this.cueChunkId="";this.cueChunkSize=-1;this.cueChunkData=[];this.dataChunkId="";this.dataChunkSize=0;this.bextChunkId="";this.bextChunkSize=0;this.bextChunkData=[]}},function(a,k,g){function h(a,e){void 0!==e&&e||(c.be="RIFX"==a.chunkId);e=b.packArray(a.chunkId,d).concat(b.pack(a.chunkSize,c),b.packArray(a.format,d),l(a.subChunks,c.be));if("RIFF"==a.chunkId||"RIFX"==a.chunkId)e=new Uint8Array(e);
return e}function l(a,e){for(var f=[],g=0;g<a.length;)f="LIST"==a[g].chunkId?f.concat(h(a[g],e)):f.concat(b.packArray(a[g].chunkId,d),b.pack(a[g].chunkSize,c),a[g].chunkData),g++;return f}function f(a){for(var c=[],b=12;b<a.length;)c.push(e(a,b)),b+=8+c[c.length-1].chunkSize;return c}function e(a,e){var g={chunkId:b.unpackArray(a.slice(e,e+4),d),chunkSize:b.unpack(a.slice(e+4,e+8),c)};"LIST"==g.chunkId?(g.format=b.unpackArray(a.slice(8,12),d),g.subChunks=f(a.slice(e,e+g.chunkSize))):g.chunkData=a.slice(e+
8,e+8+g.chunkSize);return g}var b=g(20),c=b.uInt32,d=b.chr;a.exports.read=function(a){a=[].slice.call(a);var e=b.unpackArray(a.slice(0,4),d);c.be="RIFX"==e;var g=b.unpack(a.slice(4,8),c);return{chunkId:e,chunkSize:g,format:b.unpackArray(a.slice(8,12),d),subChunks:f(a)}};a.exports.write=h},function(a,k,g){function h(a,b){a=Object.assign({},a);a.base=b;a.single=!0;return a}function l(a,b){a=Object.assign({},a);a.base=b;a.single=!1;return a}function f(a){Array.isArray(a)||"string"==typeof a||(a=[a]);
return a}var e=g(21),b=g(23);k=g(25);g=g(4);a.exports.pack=function(a,b,g){b=h(b,void 0===g?10:g);a=b.char?a[0]:a;return e.toBytes(f(a),b.bits,b)};a.exports.unpack=function(a,d,e){d=h(d,void 0===e?10:e);return b.fromBytes(a,d.bits,d)};a.exports.packArray=function(a,b,f){b=l(b,void 0===f?10:f);return e.toBytes(a,b.bits,b)};a.exports.unpackArray=function(a,d,e){d=l(d,void 0===e?10:e);return b.fromBytes(a,d.bits,d)};a.exports.chr={bits:8,"char":!0,single:!0};a.exports.bool={bits:1,single:!0};a.exports.int2=
{bits:2,signed:!0,single:!0};a.exports.uInt2={bits:2,single:!0};a.exports.int4={bits:4,signed:!0,single:!0};a.exports.uInt4={bits:4,single:!0};a.exports.int8={bits:8,signed:!0,single:!0};a.exports.uInt8={bits:8,single:!0};a.exports.int16={bits:16,signed:!0,single:!0};a.exports.uInt16={bits:16,single:!0};a.exports.float16={bits:16,"float":!0,single:!0};a.exports.int24={bits:24,signed:!0,single:!0};a.exports.uInt24={bits:24,single:!0};a.exports.int32={bits:32,signed:!0,single:!0};a.exports.uInt32={bits:32,
single:!0};a.exports.float32={bits:32,"float":!0,single:!0};a.exports.int40={bits:40,signed:!0,single:!0};a.exports.uInt40={bits:40,single:!0};a.exports.int48={bits:48,signed:!0,single:!0};a.exports.uInt48={bits:48,single:!0};a.exports.float64={bits:64,"float":!0,single:!0};a.exports.findString=function(a,d){for(var c,e=0;e<a.length;e++)if(c=b.fromBytes(a.slice(e,e+d.length),8,{"char":!0}),c==d)return e;return-1};a.exports.toBytes=e.toBytes;a.exports.fromBytes=b.fromBytes;a.exports.packBooleans=k.packBooleans;
a.exports.unpackBooleans=k.unpackBooleans;a.exports.packCrumbs=k.packCrumbs;a.exports.unpackCrumbs=k.unpackCrumbs;a.exports.packNibbles=k.packNibbles;a.exports.unpackNibbles=k.unpackNibbles;a.exports.BitDepthOffsets=g.BitDepthOffsets;a.exports.BitDepthMaxValues=g.BitDepthMaxValues},function(a,k,g){var h=g(22),l=g(1),f=g(4);a.exports.toBytes=function(a,b,c){c=void 0===c?{base:10,signed:!1}:c;l.buildType(c,b);var d=c;var e=d.char?h.writeString:h["write"+b+"Bit"+(d.float?"Float":"")];var g=0,k=0,u=a.length,
t=[],m={};d.signed?(m.max=f.BitDepthMaxValues[b]/2-1,m.min=f.BitDepthMaxValues[b]/2*-1):(m.max=f.BitDepthMaxValues[b]-1,m.min=0);for(;g<u;){var p=a,q=g,r=m;d.float||(p[q]>r.max?p[q]=r.max:p[q]<r.min&&(p[q]=r.min));k=e(t,a,g,k,d.signed);g++}a=t;l.makeBigEndian(a,c.be,b);l.outputToBase(a,b,c.base);l.fixFloat16Endianness(a,c);c.buffer&&(a=new Uint8Array(a));return a}},function(a,k,g){function h(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>>8&255;a[d++]=b[c]>>>16&255;a[d++]=b[c]>>>24&255;return d}var l=g(8),
f=g(3);a.exports.write64BitFloat=function(a,b,c,d){b=l.toFloat64(b[c]);d=h(a,b,1,d);return h(a,b,0,d)};a.exports.write48Bit=function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>8&255;a[d++]=b[c]>>16&255;a[d++]=b[c]>>24&255;a[d++]=b[c]/4294967296&255;a[d++]=b[c]/1099511627776&255;return d};a.exports.write40Bit=function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>8&255;a[d++]=b[c]>>16&255;a[d++]=b[c]>>24&255;a[d++]=b[c]/4294967296&255;return d};a.exports.write32BitFloat=function(a,b,c,d){b=f.unpack(b[c]);a[d++]=
b&255;a[d++]=b>>>8&255;a[d++]=b>>>16&255;a[d++]=b>>>24&255;return d};a.exports.write32Bit=h;a.exports.write24Bit=function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>>8&255;a[d++]=b[c]>>>16&255;return d};a.exports.write16Bit=function(a,b,c,d){a[d++]=b[c]&255;a[d++]=b[c]>>>8&255;return d};a.exports.write16BitFloat=function(a,b,c,d){b=l.toHalf(b[c]);a[d++]=b>>>8&255;a[d++]=b&255;return d};a.exports.write8Bit=function(a,b,c,d){a[d++]=b[c]&255;return d};a.exports.write4Bit=function(a,b,c,d){a[d++]=b[c]&15;
return d};a.exports.write2Bit=function(a,b,c,d){a[d++]=0>b[c]?b[c]+4:b[c];return d};a.exports.write1Bit=function(a,b,c,d){a[d++]=b[c]?1:0;return d};a.exports.writeString=function(a,b,c,d){a[d++]=b.charCodeAt(c);return d}},function(a,k,g){function h(a,c,d){var b=[],g=0,h=0,k=f.BitDepthOffsets[c.bits],l=a.length-(k-1),m=f.BitDepthMaxValues[c.bits];for(c=c.signed&&!c.float?e.signed:function(a,c){return a};g<l;)b[h]=c(d(a,g),m),g+=k,h++;return b}var l=g(24),f=g(4),e=g(1);a.exports.fromBytes=function(a,
c,d){d=void 0===d?{base:10}:d;e.buildType(d,c);e.fixFloat16Endianness(a,d);e.makeBigEndian(a,d.be,c);var b=d.base;if(10!=b)for(var f=0,g=a.length;f<g;)a[f]=parseInt(a[f],b),f++;a=h(a,d,d.char?l.readChar:l["read"+(2==c||4==c?8:c)+"Bit"+(d.float?"Float":"")]);d.char&&(a=a.join(""));d.single&&(a=a[0]);return a}},function(a,k,g){function h(a,b,e){--e;for(var c="";0<=e;)c+=f.bytePadding(a[e+b].toString(2),2),e--;return parseInt(c,2)}function l(a,b){return(a[3+b]<<24|a[2+b]<<16|a[1+b]<<8|a[b])>>>0}var f=
g(1),e=g(8),b=g(3);a.exports.readChar=function(a,b){return String.fromCharCode(a[b])};a.exports.read1Bit=function(a,b){return parseInt(a[b],2)};a.exports.read8Bit=function(a,b){return a[b]};a.exports.read16Bit=function(a,b){return a[1+b]<<8|a[b]};a.exports.read16BitFloat=function(a,b){return e.decodeFloat16(a.slice(b,b+2))};a.exports.read24Bit=function(a,b){return a[2+b]<<16|a[1+b]<<8|a[b]};a.exports.read32Bit=l;a.exports.read32BitFloat=function(a,d){return b.pack(l(a,d))};a.exports.read40Bit=function(a,
b){return h(a,b,5)};a.exports.read48Bit=function(a,b){return h(a,b,6)};a.exports.read64BitFloat=function(a,b){return e.decodeFloat64(a.slice(b,b+8))}},function(a,k,g){function h(a,e){var b=0,c=a.length%e;if(c)for(c=-1*(c-e);b<c;)a.push(0),b++}var l=g(1);a.exports.packBooleans=function(a){var e=[],b=0,c=0;h(a,8);for(var d=a.length-7;b<d;)e[c++]=parseInt(a[b].toString(2)+a[b+1].toString(2)+a[b+2].toString(2)+a[b+3].toString(2)+a[b+4].toString(2)+a[b+5].toString(2)+a[b+6].toString(2)+a[b+7].toString(2),
2),b+=8;return e};a.exports.unpackBooleans=function(a){for(var e=[],b=0,c=0,d=a.length,f;b<d;)f=l.lPadZeros(a[b].toString(2),8),e[c++]=parseInt(f[0],2),e[c++]=parseInt(f[1],2),e[c++]=parseInt(f[2],2),e[c++]=parseInt(f[3],2),e[c++]=parseInt(f[4],2),e[c++]=parseInt(f[5],2),e[c++]=parseInt(f[6],2),e[c++]=parseInt(f[7],2),b++;return e};a.exports.packCrumbs=function(a){var e=[],b=0,c=0;h(a,4);for(var d=a.length-3;b<d;)e[c++]=parseInt(l.lPadZeros(a[b].toString(2),2)+l.lPadZeros(a[b+1].toString(2),2)+l.lPadZeros(a[b+
2].toString(2),2)+l.lPadZeros(a[b+3].toString(2),2),2),b+=4;return e};a.exports.unpackCrumbs=function(a){for(var e=[],b=0,c=0,d=a.length,f;b<d;)f=l.lPadZeros(a[b].toString(2),8),e[c++]=parseInt(f[0]+f[1],2),e[c++]=parseInt(f[2]+f[3],2),e[c++]=parseInt(f[4]+f[5],2),e[c++]=parseInt(f[6]+f[7],2),b++;return e};a.exports.packNibbles=function(a){var e=[],b=0,c=0,d=a.length;for(d%2&&a.push(0);b<d;)e[c++]=parseInt(a[b].toString(16)+a[b+1].toString(16),16),b+=2;return e};a.exports.unpackNibbles=function(a){for(var e=
[],b=0,c=0,d=a.length;b<d;)e[c++]=parseInt(a[b].toString(16)[0],16),e[c++]=parseInt(a[b].toString(16)[1],16),b++;return e}}]);
{
"name": "wavefile",
"version": "1.0.3",
"version": "1.0.4",
"description": "Read & write wave files with 8, 16, 24, 32 & 64-bit data.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/rochars/wavefile",

@@ -50,7 +50,4 @@ /*

}
let bigEndian = this.LEorBE();
this.chunkSize = byteData.fromBytes(
bytes.slice(4, 8),
32,
{"be": bigEndian, "single": true});
this.LEorBE();
this.chunkSize = byteData.unpack(bytes.slice(4, 8), uInt32);
this.format = byteData.unpackArray(bytes.slice(8, 12), chr);

@@ -203,8 +200,6 @@ if (this.format != "WAVE") {

samplesToBytes_(options) {
let bytes = [];
options.bits = this.bitsPerSample == 4 ? 8 : this.bitsPerSample;
options.signed = options.bits == 8 ? false : true;
options.float = (this.audioFormat == 3 || this.bitsPerSample == 64) ? true : false;
bytes = byteData.packArray(this.samples_, options);
let bytes = byteData.packArray(this.samples_, options);
if (bytes.length % 2) {

@@ -211,0 +206,0 @@ bytes.push(0);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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