Comparing version 0.4.4 to 0.4.5
@@ -22,34 +22,35 @@ /* | ||
*/ | ||
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 h=function(){};h.prototype=a;return new h};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},h={};try{return h.__proto__=a,h.a}catch(l){}return!1}; | ||
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,h){a.__proto__=h;if(a.__proto__!==h)throw new TypeError(a+" is not extensible");return a}:null; | ||
$jscomp.inherits=function(a,h){a.prototype=$jscomp.objectCreate(h.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var l=$jscomp.setPrototypeOf;l(a,h)}else for(l in h)if("prototype"!=l)if(Object.defineProperties){var g=Object.getOwnPropertyDescriptor(h,l);g&&Object.defineProperty(a,l,g)}else a[l]=h[l];a.superClass_=h.prototype}; | ||
(function(a){function h(g){if(l[g])return l[g].exports;var k=l[g]={i:g,l:!1,exports:{}};a[g].call(k.exports,k,k.exports,h);k.l=!0;return k.exports}var l={};h.m=a;h.c=l;h.d=function(a,k,e){h.o(a,k)||Object.defineProperty(a,k,{configurable:!1,enumerable:!0,get:e})};h.n=function(a){var k=a&&a.__esModule?function(){return a["default"]}:function(){return a};h.d(k,"a",k);return k};h.o=function(a,k){return Object.prototype.hasOwnProperty.call(a,k)};h.p="";return h(h.s=5)})([function(a,h){function l(a,e){var c= | ||
a.length+1;2==e?c=8:16==e&&(c=2);return g(a,c)}function g(a,e){for(;a.length<e;)a="0"+a;return a}a.exports.fixByteArraySize=function(a,e){var c=0,b=a.length%e;if(b)for(b=-1*(b-e);c<b;)a.push(0),c++};a.exports.padding=function(a,e,c){a[c]=l(a[c],e)};a.exports.paddingNibble=function(a,e,c){2==e&&4>a[c].length&&(a[c]=Array(5-a[c].length).join("0")+a[c])};a.exports.paddingCrumb=function(a,e,c){(2==e||16==e)&&2>a[c].length&&(a[c]="0"+a[c])};a.exports.bytePadding=l;a.exports.lPadZeros=g},function(a,h){function l(e){g[0]= | ||
e;return k[0]}h=new Int8Array(4);var g=new Int32Array(h.buffer,0,1),k=new Float32Array(h.buffer,0,1);a.exports=l;a.exports.pack=l;a.exports.unpack=function(e){k[0]=e;return g[0]}},function(a,h){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={2:4,4:16,8:256,16:65536,24:16777216,32:4294967296,40:1099511627776,48:281474976710656}},function(a,h){a.exports.endianness=function(a,g){for(var k=a.length,e=0;e<k;){for(var c,b=a,f=e,d=0,h=g-1,l=parseInt(g/ | ||
2,10);d<l;)c=b[f+d],b[f+d]=b[f+h],b[f+h]=c,d++,h--;e+=g}return a}},function(a,h,l){function g(c,f){f=void 0===f?!1:f;for(var d="",b=0,e=c.length;b<e;){var a=k.lPadZeros(c[b].toString(2),8);d=f?d+a:a+d;b++}return d}var k=l(0),e=new Float32Array(1),c=new Int32Array(e.buffer);a.exports.getBinary=g;a.exports.decodeFloat16=function(c){c=parseInt(g(c,!0),2);var b=(c&31744)>>10,d=c&1023;return(b?Math.pow(2,b-15)*(1+d/1024):d/1024*.00006103515625)*(c>>15?-1:1)};a.exports.decodeFloat64=function(c){if("0,0,0,0,0,0,0,0"== | ||
c.toString())return 0;c=g(c);for(var b="1"+c.substr(12,52),d=1,e=0,a=0;a<b.length;)e+=d*parseInt(b.charAt(a),10),d/=2,a++;return("1"==c.charAt(0)?-1:1)*e*Math.pow(2,parseInt(c.substr(1,11),2)-1023)};a.exports.toFloat64=function(c){if(0==c)return[0,0];var b=0;0>=c&&(b=2147483648,c=-c);var d=Math.floor(Math.log(c)/Math.log(2)),e=Math.floor(c/Math.pow(2,d)*Math.pow(2,52));c=e&4294967295;e/=Math.pow(2,32);return[b|d+1023<<20|e&1048575,c]};a.exports.toHalf=function(b){e[0]=b;var a=c[0];b=a>>16&32768;var d= | ||
a>>12&2047;a=a>>23&255;return 103>a?b:(b|a-112<<10|d>>1)+(d&1)}},function(a,h,l){var g=l(6),k=l(7);a=function(e,c,b){c=k.WaveFileReaderWriter.call(this,void 0===c?!1:c,void 0===b?!1:b)||this;e&&c.fromBuffer(e);return c};$jscomp.inherits(a,k.WaveFileReaderWriter);a.prototype.toRIFF=function(){this.chunkId="RIFF"};a.prototype.toRIFX=function(){this.chunkId="RIFX"};a.prototype.toBitDepth=function(e){g.toBitDepth(this.samples_,this.bitDepth_,e);this.fromScratch(this.numChannels,this.sampleRate,e,this.samples_, | ||
{container:this.chunkId})};a.prototype.interleave=function(){var e=[],c,b,a=this.samples_[0].length;for(c=0;c<a;c++)for(b=0;b<this.samples_.length;b++)e.push(this.samples_[b][c]);this.samples_=e};a.prototype.deInterleave=function(){var e=[],c;for(c=0;c<this.numChannels;c++)e[c]=[];c=0;for(var b;c<this.samples_.length;){for(b=0;b<this.numChannels;b++)e[b].push(this.samples_[c+b]);c+=b}this.samples_=e};window.WaveFile=a},function(a,h){var l={8:256,16:65536,24:16777216,32:4294967296};a.exports.toBitDepth= | ||
function(a,k,e){if(k!=e){var c="8 16 24 32 32f 64".split(" ");if(-1==c.indexOf(k)||-1==c.indexOf(e))throw Error("Invalid bit depth.");c=a.length;for(var b=0;b<c;b++){var f=a[b];"8"==k&&(f-=128);if("32f"==e||"64"==e){var d=k,g=parseInt(l[d]/2,10);"32f"!=d&&"64"!=d&&(f=0<f?f/(g-1):f/g)}else{d=f;g=k;f=e;var h=parseInt(l[g]/2,10),n=parseInt(l[f]/2,10);d="32f"==g||"64"==g?0<d?d*(n-1):d*n:0<d?parseInt(d/(h-1)*n-1,10):parseInt(d/h*n,10);"8"==f&&(d+=128);f=d}a[b]=f}}};a.exports.BitDepthMaxValues=l},function(a, | ||
h,l){var g=l(8),k=l(14);h=function(a,c){a=void 0===a?!1:a;c=void 0===c?!1:c;var b=k.WaveFileHeader.call(this)||this;b.isFromScratch_=!1;b.enforceFact=a;b.enforceBext=c;b.WaveErrors={format:"Not a supported format.",wave:"Could not find the 'WAVE' chunk","fmt ":"Could not find the 'fmt ' chunk",data:"Could not find the 'data' chunk",fact:"Could not find the 'fact' chunk",bext:"Could not find the 'bext' chunk",bitDepth:"Invalid bit depth.",numChannels:"Invalid number of channels.",sampleRate:"Invalid sample rate."}; | ||
b.headerFormats_={4:17,8:1,16:1,24:1,32:1,"32f":3,64:3};b.samples_=[];b.bytes_=[];return b};$jscomp.inherits(h,k.WaveFileHeader);h.prototype.fromScratch=function(a,c,b,f,d){d=void 0===d?{}:d;d.container||(d.container="RIFF");this.isFromScratch_=!0;var e=parseInt(b,10)/8;this.chunkSize=36+f.length*e;this.subChunk1Size=16;this.byteRate=a*e*c;this.blockAlign=a*e;this.chunkId=d.container;this.format="WAVE";this.subChunk1Id="fmt ";this.audioFormat=this.headerFormats_[b];this.numChannels=a;this.sampleRate= | ||
c;this.bitsPerSample=parseInt(b,10);this.subChunk2Id="data";this.subChunk2Size=f.length*e;this.samples_=f;this.bitDepth_=b};h.prototype.fromBuffer=function(a){this.isFromScratch_=!1;this.readRIFFChunk_(a);this.readWAVEChunk_(a);this.readFmtChunk_(a);this.readFactChunk_(a);this.readBextChunk_(a);this.readDataChunk_(a)};h.prototype.toBuffer=function(){this.checkWriteInput_(this.numChannels,this.sampleRate,this.bitDepth_);this.samplesToBytes_();return new Uint8Array(this.createWaveFile_())};h.prototype.readRIFFChunk_= | ||
function(a){this.chunkId=g.fromBytes(a.slice(0,4),8,{"char":!0});if("RIFF"!=this.chunkId&&"RIFX"!=this.chunkId)throw Error(this.WaveErrors.format);this.chunkSize=g.fromBytes(a.slice(4,8),32,{be:"RIFX"==this.chunkId})[0]};h.prototype.readWAVEChunk_=function(a){if(-1===g.findString(a,"WAVE"))throw Error(this.WaveErrors.wave);this.format="WAVE"};h.prototype.readFmtChunk_=function(a){var c=g.findString(a,"fmt ");if(-1===c)throw Error(this.WaveErrors["fmt "]);var b={be:"RIFX"==this.chunkId};this.subChunk1Id= | ||
"fmt ";this.subChunk1Size=g.fromBytes(a.slice(c+4,c+8),32,b)[0];this.audioFormat=g.fromBytes(a.slice(c+8,c+10),16,b)[0];this.numChannels=g.fromBytes(a.slice(c+10,c+12),16,b)[0];this.sampleRate=g.fromBytes(a.slice(c+12,c+16),32,b)[0];this.byteRate=g.fromBytes(a.slice(c+16,c+20),32,b)[0];this.blockAlign=g.fromBytes(a.slice(c+20,c+22),16,b)[0];this.bitsPerSample=g.fromBytes(a.slice(c+22,c+24),16,b)[0];this.bitDepth_=3==this.audioFormat&&32==this.bitsPerSample?"32f":this.bitsPerSample.toString()};h.prototype.readFactChunk_= | ||
function(a){a=g.findString(a,"fact");if(-1===a&&this.enforceFact)throw Error(this.WaveErrors.fact);-1<a&&(this.factChunkId="fact")};h.prototype.readBextChunk_=function(a){var c=g.findString(a,"bext");if(-1===c&&this.enforceBext)throw Error(this.WaveErrors.bext);-1<c&&(this.bextChunkId="bext",this.bextChunkSize=g.fromBytes(a.slice(c+4,c+8),32,{be:"RIFX"==this.chunkId})[0],this.bextChunkData=g.fromBytes(a.slice(c+8,c+8+this.bextChunkSize),8))};h.prototype.readDataChunk_=function(a){var c=g.findString(a, | ||
"data");if(-1===c)throw Error(this.WaveErrors.data);this.subChunk2Id="data";this.subChunk2Size=g.fromBytes(a.slice(c+4,c+8),32,{be:"RIFX"==this.chunkId})[0];this.samplesFromBytes_(a,c)};h.prototype.samplesFromBytes_=function(a,c){var b={signed:8==this.bitsPerSample?!1:!0,be:"RIFX"==this.chunkId};32==this.bitsPerSample&&3==this.audioFormat&&(b.float=!0);a=a.slice(c+8,c+8+this.subChunk2Size);this.samples_=4==this.bitsPerSample?g.fromBytes(a,8,b):g.fromBytes(a,this.bitsPerSample,b)};h.prototype.checkWriteInput_= | ||
function(){this.validateBitDepth_();this.validateNumChannels_();this.validateSampleRate_()};h.prototype.validateBitDepth_=function(){if(!this.headerFormats_[this.bitDepth_])throw Error(this.WaveErrors.bitDepth);return!0};h.prototype.validateNumChannels_=function(){var a=this.numChannels*this.bitsPerSample/8;if(1>this.numChannels||65535<a)throw Error(this.WaveErrors.numChannels);return!0};h.prototype.validateSampleRate_=function(){var a=this.bitsPerSample/8*this.numChannels*this.sampleRate;if(1>this.sampleRate|| | ||
4294967295<a)throw Error(this.WaveErrors.sampleRate);return!0};h.prototype.samplesToBytes_=function(){var a={be:"RIFX"==this.chunkId};32==this.bitsPerSample&&3==this.audioFormat&&(a.float=!0);this.bytes_=g.toBytes(this.samples_,4==this.bitsPerSample?8:this.bitsPerSample,a);this.bytes_.length%2&&this.bytes_.push(0)};h.prototype.createWaveFile_=function(){var a={be:"RIFX"==this.chunkId},c=[];this.factChunkId&&(c=g.toBytes(this.factChunkId,8,{"char":!0}));var b=[];this.bextChunkId&&(b=b.concat(g.toBytes(this.bextChunkId, | ||
8,{"char":!0}),g.toBytes([this.bextChunkSize],32,a),g.toBytes(this.bextChunkData,8)));return g.toBytes(this.chunkId,8,{"char":!0}).concat(g.toBytes([this.chunkSize],32,a),g.toBytes(this.format,8,{"char":!0}),g.toBytes(this.subChunk1Id,8,{"char":!0}),g.toBytes([this.subChunk1Size],32,a),g.toBytes([this.audioFormat],16,a),g.toBytes([this.numChannels],16,a),g.toBytes([this.sampleRate],32,a),g.toBytes([this.byteRate],32,a),g.toBytes([this.blockAlign],16,a),g.toBytes([this.bitsPerSample],16,a),b,c,g.toBytes(this.subChunk2Id, | ||
8,{"char":!0}),g.toBytes([this.subChunk2Size],32,a),this.bytes_)};a.exports.WaveFileReaderWriter=h},function(a,h,l){h=l(9);var g=l(11),k=l(13);l=l(2);a.exports.findString=function(a,c){for(var b,f=0;f<a.length;f++)if(b=g.fromBytes(a.slice(f,f+c.length),8,{"char":!0}),b==c)return f;return-1};a.exports.toBytes=h.toBytes;a.exports.fromBytes=g.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=l.BitDepthOffsets;a.exports.BitDepthMaxValues=l.BitDepthMaxValues},function(a,h,l){function g(a,c,b){4==c?k(a,b,e.paddingNibble):2==c?k(a,b,e.paddingCrumb):1==c?k(a,b,function(){}):k(a,b)}function k(a,c,b){b=void 0===b?e.padding:b;if(10!=c)for(var d=0,f=a.length;d<f;)a[d]=a[d].toString(c),b(a,c,d),d++}l(1);var e=l(0),c=l(3),b=l(10),f=l(2);a.exports.toBytes=function(a,e,k){k=void 0===k?{}:k;var d= | ||
10;"base"in k&&(d=k.base);var h=k.char?b.writeString:b["write"+e+"Bit"+(k.float?"Float":"")];for(var l=0,m=0,q=a.length,p=[];l<q;)m=h(p,a,l,m),l++;a=p;k.be&&c.endianness(a,f.BitDepthOffsets[e]);g(a,e,d);k.buffer&&(a=new Uint8Array(a));return a}},function(a,h,l){function g(a,b,f,d){a[d++]=b[f]&255;a[d++]=b[f]>>>8&255;a[d++]=b[f]>>>16&255;a[d++]=b[f]>>>24&255;return d}var k=l(4),e=l(1);a.exports.write64Bit=function(a,b,f,d){b=k.toFloat64(b[f]);d=g(a,b,1,d);return g(a,b,0,d)};a.exports.write48Bit=function(a, | ||
b,f,d){a[d++]=b[f]&255;a[d++]=b[f]>>8&255;a[d++]=b[f]>>16&255;a[d++]=b[f]>>24&255;a[d++]=b[f]/4294967296&255;a[d++]=b[f]/1099511627776&255;return d};a.exports.write40Bit=function(a,b,f,d){a[d++]=b[f]&255;a[d++]=b[f]>>8&255;a[d++]=b[f]>>16&255;a[d++]=b[f]>>24&255;a[d++]=b[f]/4294967296&255;return d};a.exports.write32BitFloat=function(a,b,f,d){b=e.unpack(b[f]);a[d++]=b&255;a[d++]=b>>>8&255;a[d++]=b>>>16&255;a[d++]=b>>>24&255;return d};a.exports.write32Bit=g;a.exports.write24Bit=function(a,b,f,d){a[d++]= | ||
b[f]&255;a[d++]=b[f]>>>8&255;a[d++]=b[f]>>>16&255;return d};a.exports.write16Bit=function(a,b,f,d){a[d++]=b[f]&255;a[d++]=b[f]>>>8&255;return d};a.exports.write16BitFloat=function(a,b,f,d){b=k.toHalf(b[f]);a[d++]=b>>>8&255;a[d++]=b&255;return d};a.exports.write8Bit=function(a,b,f,d){a[d++]=b[f]&255;return d};a.exports.write4Bit=function(a,b,f,d){a[d++]=b[f]&15;return d};a.exports.write2Bit=function(a,b,f,d){a[d++]=0>b[f]?b[f]+4:b[f];return d};a.exports.write1Bit=function(a,b,f,d){a[d++]=b[f]?1:0; | ||
return d};a.exports.writeString=function(a,b,f,d){a[d++]=b.charCodeAt(f);return d}},function(a,h,l){function g(a,d,c,e){var f=[],g=0,h=0,l=b.BitDepthOffsets[d],m=a.length-(l-1);d=b.BitDepthMaxValues[d];for(c=c?k:function(a,b){return a};g<m;)f[h]=c(e(a,g),d),g+=l,h++;return f}function k(a,b){a>parseInt(b/2,10)-1&&(a-=b);return a}var e=l(3),c=l(12),b=l(2);a.exports.fromBytes=function(a,b,k){k=void 0===k?{}:k;var d=10;"base"in k&&(d=k.base);k.be&&e.endianness(a,b/8);if(10!=d)for(var f=0,h=a.length;f< | ||
h;)a[f]=parseInt(a[f],d),f++;a=g(a,b,k.signed,k.char?c.readChar:c["read"+(2==b||4==b?8:b)+"Bit"+(k.float?"Float":"")]);k.char&&(a=a.join(""));return a}},function(a,h,l){function g(a,b,c){--c;for(var d="";0<=c;)d+=e.bytePadding(a[c+b].toString(2),2),c--;return parseInt(d,2)}function k(a,b){return(a[3+b]<<24|a[2+b]<<16|a[1+b]<<8|a[b])>>>0}var e=l(0),c=l(4),b=l(1);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 c.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=k;a.exports.read32BitFloat=function(a,c){return b.pack(k(a,c))};a.exports.read40Bit=function(a,b){return g(a,b,5)};a.exports.read48Bit=function(a,b){return g(a,b,6)};a.exports.read64Bit=function(a,b){return c.decodeFloat64(a.slice(b,b+8))}},function(a, | ||
h,l){var g=l(0);a.exports.packBooleans=function(a){var e=[],c=0,b=0;g.fixByteArraySize(a,8);for(var f=a.length-7;c<f;)e[b++]=parseInt(a[c].toString(2)+a[c+1].toString(2)+a[c+2].toString(2)+a[c+3].toString(2)+a[c+4].toString(2)+a[c+5].toString(2)+a[c+6].toString(2)+a[c+7].toString(2),2),c+=8;return e};a.exports.unpackBooleans=function(a){for(var e=[],c=0,b=0,f=a.length,d;c<f;)d=g.lPadZeros(a[c].toString(2),8),e[b++]=parseInt(d[0],2),e[b++]=parseInt(d[1],2),e[b++]=parseInt(d[2],2),e[b++]=parseInt(d[3], | ||
2),e[b++]=parseInt(d[4],2),e[b++]=parseInt(d[5],2),e[b++]=parseInt(d[6],2),e[b++]=parseInt(d[7],2),c++;return e};a.exports.packCrumbs=function(a){var e=[],c=0,b=0;g.fixByteArraySize(a,4);for(var f=a.length-3;c<f;)e[b++]=parseInt(g.lPadZeros(a[c].toString(2),2)+g.lPadZeros(a[c+1].toString(2),2)+g.lPadZeros(a[c+2].toString(2),2)+g.lPadZeros(a[c+3].toString(2),2),2),c+=4;return e};a.exports.unpackCrumbs=function(a){var e=[],c=0,b=0,f=a.length;for(console.log(f);c<f;){var d=g.lPadZeros(a[c].toString(2), | ||
8);e[b++]=parseInt(d[0]+d[1],2);e[b++]=parseInt(d[2]+d[3],2);e[b++]=parseInt(d[4]+d[5],2);e[b++]=parseInt(d[6]+d[7],2);c++}return e};a.exports.packNibbles=function(a){var e=[],c=0,b=0,f=a.length;for(f%2&&a.push(0);c<f;)e[b++]=parseInt(a[c].toString(16)+a[c+1].toString(16),16),c+=2;return e};a.exports.unpackNibbles=function(a){for(var e=[],c=0,b=0,f=a.length;c<f;)e[b++]=parseInt(a[c].toString(16)[0],16),e[b++]=parseInt(a[c].toString(16)[1],16),c++;return e}},function(a,h){a.exports.WaveFileHeader= | ||
function(){this.chunkId="";this.chunkSize=0;this.format=this.subChunk1Id="";this.cbSize=this.bitsPerSample=this.blockAlign=this.byteRate=this.sampleRate=this.numChannels=this.audioFormat=this.subChunk1Size=0;this.factChunkId="";this.factChunkSize=4;this.dwSampleLength=0;this.subChunk2Id="";this.subChunk2Size=0;this.bextChunkId="";this.bextChunkSize=0;this.bextChunkData=[]}}]); | ||
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(c){var k=function(){};k.prototype=c;return new k};$jscomp.underscoreProtoCanBeSet=function(){var c={a:!0},k={};try{return k.__proto__=c,k.a}catch(l){}return!1}; | ||
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(c,k){c.__proto__=k;if(c.__proto__!==k)throw new TypeError(c+" is not extensible");return c}:null; | ||
$jscomp.inherits=function(c,k){c.prototype=$jscomp.objectCreate(k.prototype);c.prototype.constructor=c;if($jscomp.setPrototypeOf){var l=$jscomp.setPrototypeOf;l(c,k)}else for(l in k)if("prototype"!=l)if(Object.defineProperties){var g=Object.getOwnPropertyDescriptor(k,l);g&&Object.defineProperty(c,l,g)}else c[l]=k[l];c.superClass_=k.prototype}; | ||
(function(c){function k(g){if(l[g])return l[g].exports;var h=l[g]={i:g,l:!1,exports:{}};c[g].call(h.exports,h,h.exports,k);h.l=!0;return h.exports}var l={};k.m=c;k.c=l;k.d=function(g,h,b){k.o(g,h)||Object.defineProperty(g,h,{configurable:!1,enumerable:!0,get:b})};k.n=function(g){var h=g&&g.__esModule?function(){return g["default"]}:function(){return g};k.d(h,"a",h);return h};k.o=function(g,h){return Object.prototype.hasOwnProperty.call(g,h)};k.p="";return k(k.s=5)})([function(c,k){function l(h,b){var a= | ||
h.length+1;2==b?a=8:16==b&&(a=2);return g(h,a)}function g(h,b){for(;h.length<b;)h="0"+h;return h}c.exports.fixByteArraySize=function(h,b){var a=0,e=h.length%b;if(e)for(e=-1*(e-b);a<e;)h.push(0),a++};c.exports.padding=function(h,b,a){h[a]=l(h[a],b)};c.exports.paddingNibble=function(h,b,a){2==b&&4>h[a].length&&(h[a]=Array(5-h[a].length).join("0")+h[a])};c.exports.paddingCrumb=function(h,b,a){(2==b||16==b)&&2>h[a].length&&(h[a]="0"+h[a])};c.exports.bytePadding=l;c.exports.lPadZeros=g},function(c,k){function l(b){g[0]= | ||
b;return h[0]}k=new Int8Array(4);var g=new Int32Array(k.buffer,0,1),h=new Float32Array(k.buffer,0,1);c.exports=l;c.exports.pack=l;c.exports.unpack=function(b){h[0]=b;return g[0]}},function(c,k){c.exports.BitDepthOffsets={1:1,2:1,4:1,8:1,16:2,24:3,32:4,40:5,48:6,64:8};c.exports.BitDepthMaxValues={2:4,4:16,8:256,16:65536,24:16777216,32:4294967296,40:1099511627776,48:281474976710656}},function(c,k){c.exports.endianness=function(c,g){for(var h=c.length,b=0;b<h;){for(var a,e=c,f=b,d=0,k=g-1,l=parseInt(g/ | ||
2,10);d<l;)a=e[f+d],e[f+d]=e[f+k],e[f+k]=a,d++,k--;b+=g}return c}},function(c,k,l){function g(a,b){b=void 0===b?!1:b;for(var d="",e=0,f=a.length;e<f;){var c=h.lPadZeros(a[e].toString(2),8);d=b?d+c:c+d;e++}return d}var h=l(0),b=new Float32Array(1),a=new Int32Array(b.buffer);c.exports.getBinary=g;c.exports.decodeFloat16=function(a){a=parseInt(g(a,!0),2);var e=(a&31744)>>10,d=a&1023;return(e?Math.pow(2,e-15)*(1+d/1024):d/1024*.00006103515625)*(a>>15?-1:1)};c.exports.decodeFloat64=function(a){if("0,0,0,0,0,0,0,0"== | ||
a.toString())return 0;a=g(a);for(var e="1"+a.substr(12,52),d=1,b=0,c=0;c<e.length;)b+=d*parseInt(e.charAt(c),10),d/=2,c++;return("1"==a.charAt(0)?-1:1)*b*Math.pow(2,parseInt(a.substr(1,11),2)-1023)};c.exports.toFloat64=function(a){if(0==a)return[0,0];var b=0;0>=a&&(b=2147483648,a=-a);var d=Math.floor(Math.log(a)/Math.log(2)),e=Math.floor(a/Math.pow(2,d)*Math.pow(2,52));a=e&4294967295;e/=Math.pow(2,32);return[b|d+1023<<20|e&1048575,a]};c.exports.toHalf=function(e){b[0]=e;var f=a[0];e=f>>16&32768;var d= | ||
f>>12&2047;f=f>>23&255;return 103>f?e:(e|f-112<<10|d>>1)+(d&1)}},function(c,k,l){var g=l(6),h=l(7);c=function(b,a,e){a=h.WaveFileReaderWriter.call(this,void 0===a?!1:a,void 0===e?!1:e)||this;b&&a.fromBuffer(b);return a};$jscomp.inherits(c,h.WaveFileReaderWriter);c.prototype.toRIFF=function(){this.chunkId="RIFF"};c.prototype.toRIFX=function(){this.chunkId="RIFX"};c.prototype.toBitDepth=function(b){g.toBitDepth(this.samples_,this.bitDepth_,b);this.fromScratch(this.numChannels,this.sampleRate,b,this.samples_, | ||
{container:this.chunkId})};c.prototype.interleave=function(){var b=[],a,e,f=this.samples_[0].length;for(a=0;a<f;a++)for(e=0;e<this.samples_.length;e++)b.push(this.samples_[e][a]);this.samples_=b};c.prototype.deInterleave=function(){var b=[],a;for(a=0;a<this.numChannels;a++)b[a]=[];a=0;for(var e;a<this.samples_.length;){for(e=0;e<this.numChannels;e++)b[e].push(this.samples_[a+e]);a+=e}this.samples_=b};window.WaveFile=c},function(c,k){var l={8:256,16:65536,24:16777216,32:4294967296};c.exports.toBitDepth= | ||
function(c,h,b){if(h!=b){var a="8 16 24 32 32f 64".split(" ");if(-1==a.indexOf(h)||-1==a.indexOf(b))throw Error("Invalid bit depth.");a=c.length;for(var e=0;e<a;e++){var f=c[e];"8"==h&&(f-=128);if("32f"==b||"64"==b){var d=h,g=parseInt(l[d]/2,10);"32f"!=d&&"64"!=d&&(f=0<f?f/(g-1):f/g)}else{d=f;g=h;f=b;var k=parseInt(l[g]/2,10),n=parseInt(l[f]/2,10);d="32f"==g||"64"==g?0<d?d*(n-1):d*n:0<d?parseInt(d/(k-1)*n-1,10):parseInt(d/k*n,10);"8"==f&&(d+=128);f=d}c[e]=f}}};c.exports.BitDepthMaxValues=l},function(c, | ||
k,l){var g=l(8),h=l(14);k=function(b,a){b=void 0===b?!1:b;a=void 0===a?!1:a;var e=h.WaveFileHeader.call(this)||this;e.isFromScratch_=!1;e.enforceFact=b;e.enforceBext=a;e.WaveErrors={format:"Not a supported format.",wave:"Could not find the 'WAVE' chunk","fmt ":"Could not find the 'fmt ' chunk",data:"Could not find the 'data' chunk",fact:"Could not find the 'fact' chunk",bext:"Could not find the 'bext' chunk",bitDepth:"Invalid bit depth.",numChannels:"Invalid number of channels.",sampleRate:"Invalid sample rate."}; | ||
e.headerFormats_={4:17,8:1,16:1,24:1,32:1,"32f":3,64:3};e.samples_=[];e.bytes_=[];return e};$jscomp.inherits(k,h.WaveFileHeader);k.prototype.fromScratch=function(b,a,e,f,d){d=void 0===d?{}:d;d.container||(d.container="RIFF");this.isFromScratch_=!0;var c=parseInt(e,10)/8;this.chunkSize=36+f.length*c;this.subChunk1Size=16;this.byteRate=b*c*a;this.blockAlign=b*c;this.chunkId=d.container;this.format="WAVE";this.subChunk1Id="fmt ";this.audioFormat=this.headerFormats_[e];this.numChannels=b;this.sampleRate= | ||
a;this.bitsPerSample=parseInt(e,10);this.subChunk2Id="data";this.subChunk2Size=f.length*c;this.samples_=f;this.bitDepth_=e};k.prototype.fromBuffer=function(b){this.isFromScratch_=!1;this.readRIFFChunk_(b);this.readWAVEChunk_(b);this.readFmtChunk_(b);this.readFactChunk_(b);this.readBextChunk_(b);this.readDataChunk_(b)};k.prototype.toBuffer=function(){this.checkWriteInput_(this.numChannels,this.sampleRate,this.bitDepth_);this.samplesToBytes_();return new Uint8Array(this.createWaveFile_())};k.prototype.readRIFFChunk_= | ||
function(b){this.chunkId=g.fromBytes(b.slice(0,4),8,{"char":!0});if("RIFF"!=this.chunkId&&"RIFX"!=this.chunkId)throw Error(this.WaveErrors.format);this.chunkSize=g.fromBytes(b.slice(4,8),32,{be:"RIFX"==this.chunkId})[0]};k.prototype.readWAVEChunk_=function(b){if(-1===g.findString(b,"WAVE"))throw Error(this.WaveErrors.wave);this.format="WAVE"};k.prototype.readFmtChunk_=function(b){var a=g.findString(b,"fmt ");if(-1===a)throw Error(this.WaveErrors["fmt "]);var e={be:"RIFX"==this.chunkId};this.subChunk1Id= | ||
"fmt ";this.subChunk1Size=g.fromBytes(b.slice(a+4,a+8),32,e)[0];this.audioFormat=g.fromBytes(b.slice(a+8,a+10),16,e)[0];this.numChannels=g.fromBytes(b.slice(a+10,a+12),16,e)[0];this.sampleRate=g.fromBytes(b.slice(a+12,a+16),32,e)[0];this.byteRate=g.fromBytes(b.slice(a+16,a+20),32,e)[0];this.blockAlign=g.fromBytes(b.slice(a+20,a+22),16,e)[0];this.bitsPerSample=g.fromBytes(b.slice(a+22,a+24),16,e)[0];this.bitDepth_=3==this.audioFormat&&32==this.bitsPerSample?"32f":this.bitsPerSample.toString();16<this.subChunk1Size&& | ||
(this.cbSize=g.fromBytes(b.slice(a+24,a+26),16)[0],18<this.subChunk1Size&&(this.validBitsPerSample=g.fromBytes(b.slice(a+26,a+28),16)[0]))};k.prototype.readFactChunk_=function(b){var a=g.findString(b,"fact");if(-1===a&&this.enforceFact)throw Error(this.WaveErrors.fact);-1<a&&(this.factChunkId="fact",this.factChunkSize=g.fromBytes(b.slice(a+4,a+8),32)[0],this.dwSampleLength=g.fromBytes(b.slice(a+8,a+12),32)[0])};k.prototype.readBextChunk_=function(b){var a=g.findString(b,"bext");if(-1===a&&this.enforceBext)throw Error(this.WaveErrors.bext); | ||
-1<a&&(this.bextChunkId="bext",this.bextChunkSize=g.fromBytes(b.slice(a+4,a+8),32,{be:"RIFX"==this.chunkId})[0],this.bextChunkData=g.fromBytes(b.slice(a+8,a+8+this.bextChunkSize),8))};k.prototype.readDataChunk_=function(b){var a=g.findString(b,"data");if(-1===a)throw Error(this.WaveErrors.data);this.subChunk2Id="data";this.subChunk2Size=g.fromBytes(b.slice(a+4,a+8),32,{be:"RIFX"==this.chunkId})[0];this.samplesFromBytes_(b,a)};k.prototype.samplesFromBytes_=function(b,a){var e={signed:8==this.bitsPerSample? | ||
!1:!0,be:"RIFX"==this.chunkId};32==this.bitsPerSample&&3==this.audioFormat&&(e.float=!0);b=b.slice(a+8,a+8+this.subChunk2Size);this.samples_=4==this.bitsPerSample?g.fromBytes(b,8,e):g.fromBytes(b,this.bitsPerSample,e)};k.prototype.checkWriteInput_=function(){this.validateBitDepth_();this.validateNumChannels_();this.validateSampleRate_()};k.prototype.validateBitDepth_=function(){if(!this.headerFormats_[this.bitDepth_])throw Error(this.WaveErrors.bitDepth);return!0};k.prototype.validateNumChannels_= | ||
function(){var b=this.numChannels*this.bitsPerSample/8;if(1>this.numChannels||65535<b)throw Error(this.WaveErrors.numChannels);return!0};k.prototype.validateSampleRate_=function(){var b=this.bitsPerSample/8*this.numChannels*this.sampleRate;if(1>this.sampleRate||4294967295<b)throw Error(this.WaveErrors.sampleRate);return!0};k.prototype.samplesToBytes_=function(){var b={be:"RIFX"==this.chunkId};32==this.bitsPerSample&&3==this.audioFormat&&(b.float=!0);this.bytes_=g.toBytes(this.samples_,4==this.bitsPerSample? | ||
8:this.bitsPerSample,b);this.bytes_.length%2&&this.bytes_.push(0)};k.prototype.createWaveFile_=function(){var b={be:"RIFX"==this.chunkId},a=[],e=[];16<this.subChunk1Size&&(a=g.toBytes([this.cbSize],16,b),e=g.toBytes([this.validBitsPerSample],16,b));var f=[];this.factChunkId&&(f=f.concat(g.toBytes(this.factChunkId,8,{"char":!0}),g.toBytes([this.factChunkSize],32,b),g.toBytes([this.dwSampleLength],32,b)));var d=[];this.bextChunkId&&(d=d.concat(g.toBytes(this.bextChunkId,8,{"char":!0}),g.toBytes([this.bextChunkSize], | ||
32,b),g.toBytes(this.bextChunkData,8)));return g.toBytes(this.chunkId,8,{"char":!0}).concat(g.toBytes([this.chunkSize],32,b),g.toBytes(this.format,8,{"char":!0}),d,g.toBytes(this.subChunk1Id,8,{"char":!0}),g.toBytes([this.subChunk1Size],32,b),g.toBytes([this.audioFormat],16,b),g.toBytes([this.numChannels],16,b),g.toBytes([this.sampleRate],32,b),g.toBytes([this.byteRate],32,b),g.toBytes([this.blockAlign],16,b),g.toBytes([this.bitsPerSample],16,b),a,e,f,g.toBytes(this.subChunk2Id,8,{"char":!0}),g.toBytes([this.subChunk2Size], | ||
32,b),this.bytes_)};c.exports.WaveFileReaderWriter=k},function(c,k,l){k=l(9);var g=l(11),h=l(13);l=l(2);c.exports.findString=function(b,a){for(var e,f=0;f<b.length;f++)if(e=g.fromBytes(b.slice(f,f+a.length),8,{"char":!0}),e==a)return f;return-1};c.exports.toBytes=k.toBytes;c.exports.fromBytes=g.fromBytes;c.exports.packBooleans=h.packBooleans;c.exports.unpackBooleans=h.unpackBooleans;c.exports.packCrumbs=h.packCrumbs;c.exports.unpackCrumbs=h.unpackCrumbs;c.exports.packNibbles=h.packNibbles;c.exports.unpackNibbles= | ||
h.unpackNibbles;c.exports.BitDepthOffsets=l.BitDepthOffsets;c.exports.BitDepthMaxValues=l.BitDepthMaxValues},function(c,k,l){function g(a,e,f){4==e?h(a,f,b.paddingNibble):2==e?h(a,f,b.paddingCrumb):1==e?h(a,f,function(){}):h(a,f)}function h(a,e,f){f=void 0===f?b.padding:f;if(10!=e)for(var d=0,c=a.length;d<c;)a[d]=a[d].toString(e),f(a,e,d),d++}l(1);var b=l(0),a=l(3),e=l(10),f=l(2);c.exports.toBytes=function(d,b,c){c=void 0===c?{}:c;var h=10;"base"in c&&(h=c.base);var k=c.char?e.writeString:e["write"+ | ||
b+"Bit"+(c.float?"Float":"")];for(var l=0,m=0,q=d.length,p=[];l<q;)m=k(p,d,l,m),l++;d=p;c.be&&a.endianness(d,f.BitDepthOffsets[b]);g(d,b,h);c.buffer&&(d=new Uint8Array(d));return d}},function(c,k,l){function g(a,b,f,d){a[d++]=b[f]&255;a[d++]=b[f]>>>8&255;a[d++]=b[f]>>>16&255;a[d++]=b[f]>>>24&255;return d}var h=l(4),b=l(1);c.exports.write64Bit=function(a,b,f,d){b=h.toFloat64(b[f]);d=g(a,b,1,d);return g(a,b,0,d)};c.exports.write48Bit=function(a,b,f,d){a[d++]=b[f]&255;a[d++]=b[f]>>8&255;a[d++]=b[f]>> | ||
16&255;a[d++]=b[f]>>24&255;a[d++]=b[f]/4294967296&255;a[d++]=b[f]/1099511627776&255;return d};c.exports.write40Bit=function(a,b,f,d){a[d++]=b[f]&255;a[d++]=b[f]>>8&255;a[d++]=b[f]>>16&255;a[d++]=b[f]>>24&255;a[d++]=b[f]/4294967296&255;return d};c.exports.write32BitFloat=function(a,e,f,d){e=b.unpack(e[f]);a[d++]=e&255;a[d++]=e>>>8&255;a[d++]=e>>>16&255;a[d++]=e>>>24&255;return d};c.exports.write32Bit=g;c.exports.write24Bit=function(a,b,f,d){a[d++]=b[f]&255;a[d++]=b[f]>>>8&255;a[d++]=b[f]>>>16&255; | ||
return d};c.exports.write16Bit=function(a,b,f,d){a[d++]=b[f]&255;a[d++]=b[f]>>>8&255;return d};c.exports.write16BitFloat=function(a,b,f,d){b=h.toHalf(b[f]);a[d++]=b>>>8&255;a[d++]=b&255;return d};c.exports.write8Bit=function(a,b,f,d){a[d++]=b[f]&255;return d};c.exports.write4Bit=function(a,b,f,d){a[d++]=b[f]&15;return d};c.exports.write2Bit=function(a,b,f,d){a[d++]=0>b[f]?b[f]+4:b[f];return d};c.exports.write1Bit=function(a,b,f,d){a[d++]=b[f]?1:0;return d};c.exports.writeString=function(a,b,f,d){a[d++]= | ||
b.charCodeAt(f);return d}},function(c,k,l){function g(a,b,c,g){var d=[],f=0,k=0,l=e.BitDepthOffsets[b],m=a.length-(l-1);b=e.BitDepthMaxValues[b];for(c=c?h:function(a,b){return a};f<m;)d[k]=c(g(a,f),b),f+=l,k++;return d}function h(a,b){a>parseInt(b/2,10)-1&&(a-=b);return a}var b=l(3),a=l(12),e=l(2);c.exports.fromBytes=function(f,d,c){c=void 0===c?{}:c;var e=10;"base"in c&&(e=c.base);c.be&&b.endianness(f,d/8);if(10!=e)for(var h=0,k=f.length;h<k;)f[h]=parseInt(f[h],e),h++;f=g(f,d,c.signed,c.char?a.readChar: | ||
a["read"+(2==d||4==d?8:d)+"Bit"+(c.float?"Float":"")]);c.char&&(f=f.join(""));return f}},function(c,k,l){function g(a,d,c){--c;for(var f="";0<=c;)f+=b.bytePadding(a[c+d].toString(2),2),c--;return parseInt(f,2)}function h(a,b){return(a[3+b]<<24|a[2+b]<<16|a[1+b]<<8|a[b])>>>0}var b=l(0),a=l(4),e=l(1);c.exports.readChar=function(a,b){return String.fromCharCode(a[b])};c.exports.read1Bit=function(a,b){return parseInt(a[b],2)};c.exports.read8Bit=function(a,b){return a[b]};c.exports.read16Bit=function(a, | ||
b){return a[1+b]<<8|a[b]};c.exports.read16BitFloat=function(b,d){return a.decodeFloat16(b.slice(d,d+2))};c.exports.read24Bit=function(a,b){return a[2+b]<<16|a[1+b]<<8|a[b]};c.exports.read32Bit=h;c.exports.read32BitFloat=function(a,b){return e.pack(h(a,b))};c.exports.read40Bit=function(a,b){return g(a,b,5)};c.exports.read48Bit=function(a,b){return g(a,b,6)};c.exports.read64Bit=function(b,c){return a.decodeFloat64(b.slice(c,c+8))}},function(c,k,l){var g=l(0);c.exports.packBooleans=function(c){var b= | ||
[],a=0,e=0;g.fixByteArraySize(c,8);for(var f=c.length-7;a<f;)b[e++]=parseInt(c[a].toString(2)+c[a+1].toString(2)+c[a+2].toString(2)+c[a+3].toString(2)+c[a+4].toString(2)+c[a+5].toString(2)+c[a+6].toString(2)+c[a+7].toString(2),2),a+=8;return b};c.exports.unpackBooleans=function(c){for(var b=[],a=0,e=0,f=c.length,d;a<f;)d=g.lPadZeros(c[a].toString(2),8),b[e++]=parseInt(d[0],2),b[e++]=parseInt(d[1],2),b[e++]=parseInt(d[2],2),b[e++]=parseInt(d[3],2),b[e++]=parseInt(d[4],2),b[e++]=parseInt(d[5],2),b[e++]= | ||
parseInt(d[6],2),b[e++]=parseInt(d[7],2),a++;return b};c.exports.packCrumbs=function(c){var b=[],a=0,e=0;g.fixByteArraySize(c,4);for(var f=c.length-3;a<f;)b[e++]=parseInt(g.lPadZeros(c[a].toString(2),2)+g.lPadZeros(c[a+1].toString(2),2)+g.lPadZeros(c[a+2].toString(2),2)+g.lPadZeros(c[a+3].toString(2),2),2),a+=4;return b};c.exports.unpackCrumbs=function(c){var b=[],a=0,e=0,f=c.length;for(console.log(f);a<f;){var d=g.lPadZeros(c[a].toString(2),8);b[e++]=parseInt(d[0]+d[1],2);b[e++]=parseInt(d[2]+d[3], | ||
2);b[e++]=parseInt(d[4]+d[5],2);b[e++]=parseInt(d[6]+d[7],2);a++}return b};c.exports.packNibbles=function(c){var b=[],a=0,e=0,f=c.length;for(f%2&&c.push(0);a<f;)b[e++]=parseInt(c[a].toString(16)+c[a+1].toString(16),16),a+=2;return b};c.exports.unpackNibbles=function(c){for(var b=[],a=0,e=0,f=c.length;a<f;)b[e++]=parseInt(c[a].toString(16)[0],16),b[e++]=parseInt(c[a].toString(16)[1],16),a++;return b}},function(c,k){c.exports.WaveFileHeader=function(){this.chunkId="";this.chunkSize=0;this.format=this.subChunk1Id= | ||
"";this.validBitsPerSample=this.cbSize=this.bitsPerSample=this.blockAlign=this.byteRate=this.sampleRate=this.numChannels=this.audioFormat=this.subChunk1Size=0;this.factChunkId="";this.factChunkSize=0;this.factChunkData=[];this.dwSampleLength=0;this.subChunk2Id="";this.subChunk2Size=0;this.bextChunkId="";this.bextChunkSize=0;this.bextChunkData=[]}}]); |
@@ -879,2 +879,10 @@ /******/ (function(modules) { // webpackBootstrap | ||
} | ||
if (this.subChunk1Size > 16) { | ||
this.cbSize = byteData.fromBytes( | ||
bytes.slice(start + 24, start + 26), 16)[0]; | ||
if (this.subChunk1Size > 18) { | ||
this.validBitsPerSample = byteData.fromBytes( | ||
bytes.slice(start + 26, start + 28), 16)[0]; | ||
} | ||
} | ||
} | ||
@@ -891,8 +899,10 @@ | ||
throw Error(this.WaveErrors.fact); | ||
}else if (start > -1) { | ||
} else if (start > -1) { | ||
this.factChunkId = "fact"; | ||
//this.factChunkSize = byteData.uIntFrom4Bytes( | ||
// bytes.slice(start + 4, start + 8)); | ||
//this.dwSampleLength = byteData.uIntFrom4Bytes( | ||
// bytes.slice(start + 8, start + 12)); | ||
this.factChunkSize = byteData.fromBytes( | ||
bytes.slice(start + 4, start + 8), | ||
32)[0]; | ||
this.dwSampleLength = byteData.fromBytes( | ||
bytes.slice(start + 8, start + 12), | ||
32)[0]; | ||
} | ||
@@ -1050,5 +1060,17 @@ } | ||
let options = {"be": this.chunkId == "RIFX"}; | ||
let cbSize = []; | ||
let validBitsPerSample = [] | ||
if (this.subChunk1Size > 16) { | ||
cbSize = byteData.toBytes([this.cbSize], 16, options); | ||
validBitsPerSample = byteData.toBytes([this.validBitsPerSample], 16, options); | ||
} | ||
let factVal = []; | ||
if (this.factChunkId) { | ||
factVal = byteData.toBytes(this.factChunkId, 8, {"char": true}); | ||
factVal = factVal.concat( | ||
byteData.toBytes(this.factChunkId, 8, {"char": true}), | ||
byteData.toBytes([this.factChunkSize], 32, options), | ||
byteData.toBytes([this.dwSampleLength], 32, options) | ||
); | ||
} | ||
@@ -1063,7 +1085,6 @@ let bextVal = []; | ||
} | ||
return byteData.toBytes(this.chunkId, 8, {"char": true}).concat( | ||
byteData.toBytes([this.chunkSize], 32, options), | ||
byteData.toBytes(this.format, 8, {"char": true}), | ||
bextVal, | ||
byteData.toBytes(this.subChunk1Id, 8, {"char": true}), | ||
@@ -1077,3 +1098,4 @@ byteData.toBytes([this.subChunk1Size], 32, options), | ||
byteData.toBytes([this.bitsPerSample], 16, options), | ||
bextVal, | ||
cbSize, | ||
validBitsPerSample, | ||
factVal, | ||
@@ -1882,2 +1904,5 @@ byteData.toBytes(this.subChunk2Id, 8, {"char": true}), | ||
/** @type {number} */ | ||
this.validBitsPerSample = 0; | ||
/** @type {string} */ | ||
@@ -1889,3 +1914,4 @@ this.factChunkId = ""; | ||
*/ | ||
this.factChunkSize = 4; | ||
this.factChunkSize = 0; | ||
this.factChunkData = []; | ||
/** @type {number} */ | ||
@@ -1892,0 +1918,0 @@ this.dwSampleLength = 0; |
{ | ||
"name": "wavefile", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"description": "Read & write wave files with 8, 16, 24, 32 PCM, 32 IEEE & 64-bit data.", | ||
@@ -37,4 +37,3 @@ "homepage": "https://github.com/rochars/wavefile", | ||
"test": "nyc ./node_modules/mocha/bin/_mocha test --recursive --timeout=8000", | ||
"test_a": "nyc ./node_modules/mocha/bin/_mocha test/read test/write", | ||
"test_b": "nyc ./node_modules/mocha/bin/_mocha test/read/read-bext.js", | ||
"test_a": "nyc ./node_modules/mocha/bin/_mocha test/write", | ||
"coverage": "nyc report --reporter=lcov > coverage.lcov && codecov", | ||
@@ -41,0 +40,0 @@ "bundle": "webpack", |
@@ -50,2 +50,5 @@ /* | ||
/** @type {number} */ | ||
this.validBitsPerSample = 0; | ||
/** @type {string} */ | ||
@@ -57,3 +60,4 @@ this.factChunkId = ""; | ||
*/ | ||
this.factChunkSize = 4; | ||
this.factChunkSize = 0; | ||
this.factChunkData = []; | ||
/** @type {number} */ | ||
@@ -60,0 +64,0 @@ this.dwSampleLength = 0; |
@@ -181,2 +181,10 @@ /* | ||
} | ||
if (this.subChunk1Size > 16) { | ||
this.cbSize = byteData.fromBytes( | ||
bytes.slice(start + 24, start + 26), 16)[0]; | ||
if (this.subChunk1Size > 18) { | ||
this.validBitsPerSample = byteData.fromBytes( | ||
bytes.slice(start + 26, start + 28), 16)[0]; | ||
} | ||
} | ||
} | ||
@@ -193,8 +201,10 @@ | ||
throw Error(this.WaveErrors.fact); | ||
}else if (start > -1) { | ||
} else if (start > -1) { | ||
this.factChunkId = "fact"; | ||
//this.factChunkSize = byteData.uIntFrom4Bytes( | ||
// bytes.slice(start + 4, start + 8)); | ||
//this.dwSampleLength = byteData.uIntFrom4Bytes( | ||
// bytes.slice(start + 8, start + 12)); | ||
this.factChunkSize = byteData.fromBytes( | ||
bytes.slice(start + 4, start + 8), | ||
32)[0]; | ||
this.dwSampleLength = byteData.fromBytes( | ||
bytes.slice(start + 8, start + 12), | ||
32)[0]; | ||
} | ||
@@ -352,5 +362,17 @@ } | ||
let options = {"be": this.chunkId == "RIFX"}; | ||
let cbSize = []; | ||
let validBitsPerSample = [] | ||
if (this.subChunk1Size > 16) { | ||
cbSize = byteData.toBytes([this.cbSize], 16, options); | ||
validBitsPerSample = byteData.toBytes([this.validBitsPerSample], 16, options); | ||
} | ||
let factVal = []; | ||
if (this.factChunkId) { | ||
factVal = byteData.toBytes(this.factChunkId, 8, {"char": true}); | ||
factVal = factVal.concat( | ||
byteData.toBytes(this.factChunkId, 8, {"char": true}), | ||
byteData.toBytes([this.factChunkSize], 32, options), | ||
byteData.toBytes([this.dwSampleLength], 32, options) | ||
); | ||
} | ||
@@ -365,7 +387,6 @@ let bextVal = []; | ||
} | ||
return byteData.toBytes(this.chunkId, 8, {"char": true}).concat( | ||
byteData.toBytes([this.chunkSize], 32, options), | ||
byteData.toBytes(this.format, 8, {"char": true}), | ||
bextVal, | ||
byteData.toBytes(this.subChunk1Id, 8, {"char": true}), | ||
@@ -379,3 +400,4 @@ byteData.toBytes([this.subChunk1Size], 32, options), | ||
byteData.toBytes([this.bitsPerSample], 16, options), | ||
bextVal, | ||
cbSize, | ||
validBitsPerSample, | ||
factVal, | ||
@@ -382,0 +404,0 @@ byteData.toBytes(this.subChunk2Id, 8, {"char": true}), |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1130192
2984