diff --git a/dist/wavefile.js b/dist/wavefile.js index a0ffcf5..67abbd8 100644 --- a/dist/wavefile.js +++ b/dist/wavefile.js @@ -1329,7 +1329,7 @@ class WaveFileReaderWriter extends WaveFileHeader { if (this.chunkId != "RIFF" && this.chunkId != "RIFX") { throw Error(WaveErrors.format); } - let bigEndian = this.LEorBE(); + this.LEorBE(); this.chunkSize = byteData.unpack(bytes.slice(4, 8), uInt32); this.format = byteData.unpackArray(bytes.slice(8, 12), chr); if (this.format != "WAVE") { diff --git a/docs/WaveFile.html b/docs/WaveFile.html index 9010ff0..710892e 100644 --- a/docs/WaveFile.html +++ b/docs/WaveFile.html @@ -1575,7 +1575,7 @@
Throws:

diff --git a/docs/index.html b/docs/index.html index 1d07d2d..ed20452 100644 --- a/docs/index.html +++ b/docs/index.html @@ -158,7 +158,7 @@

LICENSE

Copyright (c) 2017 Rafael da Silva Rocha.


diff --git a/docs/index.js.html b/docs/index.js.html index d676827..ec6b82f 100644 --- a/docs/index.js.html +++ b/docs/index.js.html @@ -261,7 +261,7 @@

index.js


diff --git a/docs/wavefile-min.js b/docs/wavefile-min.js deleted file mode 100644 index 4cd13de..0000000 --- a/docs/wavefile-min.js +++ /dev/null @@ -1,94 +0,0 @@ -/* - wavefile - Read & write wave files with 8, 16, 24, 32 & 64-bit data. - Copyright (c) 2017 Rafael da Silva Rocha. - https://github.com/rochars/wavefile - - endianness - Swap endianness in byte arrays. - Copyright (c) 2017 Rafael da Silva Rocha. - https://github.com/rochars/endianness - - bitdepth - Change the bit depth of samples to and from 8, 16, 24, 32 & 64-bit. - Copyright (c) 2017 Rafael da Silva Rocha. - https://github.com/rochars/bitdepth - - byte-data - Readable data to and from byte buffers. - Copyright (c) 2017 Rafael da Silva Rocha. - https://github.com/rochars/byte-data - - riff-chunks - Read and write the chunks of RIFF and RIFX files. - Copyright (c) 2017 Rafael da Silva Rocha. - https://github.com/rochars/riff-chunks - -*/ -var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var k=function(){};k.prototype=a;return new k};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},k={};try{return k.__proto__=a,k.a}catch(g){}return!1}; -$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,k){a.__proto__=k;if(a.__proto__!==k)throw new TypeError(a+" is not extensible");return a}:null; -$jscomp.inherits=function(a,k){a.prototype=$jscomp.objectCreate(k.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var g=$jscomp.setPrototypeOf;g(a,k)}else for(g in k)if("prototype"!=g)if(Object.defineProperties){var h=Object.getOwnPropertyDescriptor(k,g);h&&Object.defineProperty(a,g,h)}else a[g]=k[g];a.superClass_=k.prototype}; -$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,k,g){a!=Array.prototype&&a!=Object.prototype&&(a[k]=g.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this); -$jscomp.polyfill=function(a,k,g,h){if(k){g=$jscomp.global;a=a.split(".");for(h=0;hc[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.lengthparseInt(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, -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.lengthparseInt(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){a.exports.BitDepthOffsets={1:1,2:1,4:1,8:1,16:2,24:3,32:4,40:5,48:6,64:8}; -a.exports.BitDepthMaxValues={1:2,2:4,4:16,8:256,16:65536,24:16777216,32:4294967296,40:1099511627776,48:281474976710656,64:Infinity}},function(a,k){function g(a){h[0]=a;return l[0]}k=new Int8Array(4);var h=new Int32Array(k.buffer,0,1),l=new Float32Array(k.buffer,0,1);a.exports=g;a.exports.pack=g;a.exports.unpack=function(a){l[0]=a;return h[0]}},function(a,k){a.exports.BitDepthOffsets={1:1,2:1,4:1,8:1,16:2,24:3,32:4,40:5,48:6,64:8};a.exports.BitDepthMaxValues={1:2,2:4,4:16,8:256,16:65536,24:16777216, -32:4294967296,40:1099511627776,48:281474976710656,64:Infinity}},function(a,k){a.exports={format:"Not a supported format.",wave:"Could not find the 'WAVE' format identifier","fmt ":"Could not find the 'fmt ' chunk",data:"Could not find the 'data' chunk",fact:"Could not find the 'fact' chunk",bitDepth:"Invalid bit depth.",numChannels:"Invalid number of channels.",sampleRate:"Invalid sample rate."}},function(a,k,g){function h(b,c){c=void 0===c?!1:c;for(var d="",a=0,e=b.length;a>10,d=b&1023;return(c?Math.pow(2,c-15)*(1+d/1024):d/1024*.00006103515625)*(b>>15?-1:1)};a.exports.decodeFloat64=function(b){if("0,0,0,0,0,0,0,0"==b.toString())return 0;b=h(b);for(var c="1"+b.substr(12,52),d=1,a=0,e=0;e=b&&(c=2147483648,b=-b);var d=Math.floor(Math.log(b)/Math.log(2)),a=Math.floor(b/Math.pow(2,d)*Math.pow(2,52));b=a&4294967295;a/=Math.pow(2,32);return[c|d+1023<<20|a&1048575,b]};a.exports.toHalf=function(b){f[0]=b;var c=e[0];b=c>>16&32768;var d=c>>12&2047;c=c>>23&255;return 103>c?b:(b|c-112<<10|d>>1)+(d&1)}},function(a,k){a.exports=function(a,h){for(var g=a.length,f=0;f>10,d=b&1023;return(c?Math.pow(2,c-15)*(1+d/1024):d/1024*.00006103515625)*(b>>15?-1:1)};a.exports.decodeFloat64=function(b){if("0,0,0,0,0,0,0,0"==b.toString())return 0; -b=h(b);for(var c="1"+b.substr(12,52),d=1,a=0,e=0;e=b&&(c=2147483648,b=-b);var d=Math.floor(Math.log(b)/Math.log(2)),a=Math.floor(b/Math.pow(2,d)*Math.pow(2,52));b=a&4294967295;a/=Math.pow(2,32);return[c|d+1023<<20|a&1048575,b]};a.exports.toHalf=function(b){f[0]=b;var c=e[0];b=c>>16&32768;var d=c>>12&2047;c=c>>23& -255;return 103>c?b:(b|c-112<<10|d>>1)+(d&1)}},function(a,k,g){var h=g(10),l=g(5),f=g(11),e=g(19);a=function(b){var c=f.call(this)||this;b&&c.fromBuffer(b);return c};$jscomp.inherits(a,f);a.read64BitFloat=f.read64BitFloat;a.read48Bit=f.read48Bit;a.read40Bit=f.read40Bit;a.read32BitFloat=f.read32BitFloat;a.read32Bit=f.read32Bit;a.read24Bit=f.read24Bit;a.read16BitFloat=f.read16BitFloat;a.read16Bit=f.read16Bit;a.read8Bit=f.read8Bit;a.read1Bit=f.read1Bit;a.readChar=f.readChar;a.writeString=f.writeString; -a.write1Bit=f.write1Bit;a.write2Bit=f.write2Bit;a.write4Bit=f.write4Bit;a.write8Bit=f.write8Bit;a.write16BitFloat=f.write16BitFloat;a.write16Bit=f.write16Bit;a.write24Bit=f.write24Bit;a.write32Bit=f.write32Bit;a.write32BitFloat=f.write32BitFloat;a.write40Bit=f.write40Bit;a.write48Bit=f.write48Bit;a.write64BitFloat=f.write64BitFloat;a.BitDepthMaxValues=f.BitDepthMaxValues;a.BitDepthOffsets=f.BitDepthOffsets;a.unpackNibbles=f.unpackNibbles;a.packNibbles=f.packNibbles;a.unpackCrumbs=f.unpackCrumbs;a.packCrumbs= -f.packCrumbs;a.unpackBooleans=f.unpackBooleans;a.packBooleans=f.packBooleans;a.fromBytes=f.fromBytes;a.toBytes=f.toBytes;a.findString=f.findString;a.float64=f.float64;a.uInt48=f.uInt48;a.int48=f.int48;a.uInt40=f.uInt40;a.int40=f.int40;a.float32=f.float32;a.uInt32=f.uInt32;a.int32=f.int32;a.uInt24=f.uInt24;a.int24=f.int24;a.float16=f.float16;a.uInt16=f.uInt16;a.int16=f.int16;a.uInt8=f.uInt8;a.int8=f.int8;a.uInt4=f.uInt4;a.int4=f.int4;a.uInt2=f.uInt2;a.int2=f.int2;a.bool=f.bool;a.chr=f.chr;a.unpackArray= -f.unpackArray;a.packArray=f.packArray;a.unpack=f.unpack;a.pack=f.pack;a.prototype.fromScratch=function(b,c,d,a,e){e=void 0===e?{}:e;e.container||(e.container="RIFF");var f=parseInt(d,10)/8;this.chunkSize=36+a.length*f;this.fmtChunkSize=16;this.byteRate=b*f*c;this.blockAlign=b*f;this.chunkId=e.container;this.format="WAVE";this.fmtChunkId="fmt ";this.audioFormat=this.headerFormats_[d];this.numChannels=b;this.sampleRate=c;this.bitsPerSample=parseInt(d,10);this.dataChunkId="data";this.dataChunkSize=a.length* -f;this.samples_=a;this.bitDepth_=d};a.prototype.fromBuffer=function(b){this.readRIFFChunk_(b);var c="RIFX"==this.chunkId;b=e.read(b,c);this.readFmtChunk_(b.subChunks);this.readFactChunk_(b.subChunks);this.readBextChunk_(b.subChunks);this.readCueChunk_(b.subChunks);this.readDataChunk_(b.subChunks,{be:c,single:!0});this.bitDepth_=3==this.audioFormat&&32==this.bitsPerSample?"32f":this.bitsPerSample.toString()};a.prototype.toBuffer=function(){this.checkWriteInput_();return new Uint8Array(this.createWaveFile_())}; -a.prototype.toRIFF=function(){this.chunkId="RIFF";this.LEorBE()};a.prototype.toRIFX=function(){this.chunkId="RIFX";this.LEorBE()};a.prototype.toBitDepth=function(b){h.toBitDepth(this.samples_,this.bitDepth_,b);this.fromScratch(this.numChannels,this.sampleRate,b,this.samples_,{container:this.chunkId})};a.prototype.interleave=function(){var b=[],c,a,e=this.samples_[0].length;for(c=0;cthis.numChannels|| -65535this.sampleRate||4294967295r.max?p[q]=r.max:p[q]>>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>>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);br.max?p[q]=r.max:p[q]>>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>>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