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 0.4.2 to 0.4.3

src/wavefile.js

81

dist/wavefile-min.js

@@ -14,6 +14,6 @@ /*

byte-data
Readable data to and from bytes.
Copyright (c) 2017 Rafael da Silva Rocha.
https://github.com/rochars/byte-data
WaveFileInterface
Copyright (c) 2017 Rafael da Silva Rocha. MIT License.
https://github.com/rochars/wavefile
bitdepth

@@ -24,34 +24,43 @@ Change the bit depth of audio samples to and from 8, 16, 24, 32, 32 IEEE & 64-bit.

WaveFile
Copyright (c) 2017 Rafael da Silva Rocha. MIT License.
https://github.com/rochars/wavefile
byte-data
Readable data to and from bytes.
Copyright (c) 2017 Rafael da Silva Rocha.
https://github.com/rochars/byte-data
*/
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(h){}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 h=$jscomp.setPrototypeOf;h(a,k)}else for(h in k)if("prototype"!=h)if(Object.defineProperties){var f=Object.getOwnPropertyDescriptor(k,h);f&&Object.defineProperty(a,h,f)}else a[h]=k[h];a.superClass_=k.prototype};
(function(a){function k(f){if(h[f])return h[f].exports;var g=h[f]={i:f,l:!1,exports:{}};a[f].call(g.exports,g,g.exports,k);g.l=!0;return g.exports}var h={};k.m=a;k.c=h;k.d=function(a,g,l){k.o(a,g)||Object.defineProperty(a,g,{configurable:!1,enumerable:!0,get:l})};k.n=function(a){var g=a&&a.__esModule?function(){return a["default"]}:function(){return a};k.d(g,"a",g);return g};k.o=function(a,g){return Object.prototype.hasOwnProperty.call(a,g)};k.p="";return k(k.s=5)})([function(a,k){function h(a,l){var c=
a.length+1;2==l?c=8:16==l&&(c=2);return f(a,c)}function f(a,f){for(;a.length<f;)a="0"+a;return a}a.exports.fixByteArraySize=function(a,f){var c=0,d=a.length%f;if(d)for(d=-1*(d-f);c<d;)a.push(0),c++};a.exports.padding=function(a,f,c){a[c]=h(a[c],f)};a.exports.paddingNibble=function(a,f,c){2==f&&4>a[c].length&&(a[c]=Array(5-a[c].length).join("0")+a[c])};a.exports.paddingCrumb=function(a,f,c){(2==f||16==f)&&2>a[c].length&&(a[c]="0"+a[c])};a.exports.bytePadding=h;a.exports.lPadZeros=f},function(a,k){function h(a){f[0]=
a;return g[0]}k=new Int8Array(4);var f=new Int32Array(k.buffer,0,1),g=new Float32Array(k.buffer,0,1);a.exports=h;a.exports.pack=h;a.exports.unpack=function(a){g[0]=a;return f[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={2:4,4:16,8:256,16:65536,24:16777216,32:4294967296,40:1099511627776,48:281474976710656}},function(a,k){a.exports.endianness=function(a,f){for(var g=a.length,l=0;l<g;){for(var c,d=a,e=l,b=0,h=f-1,k=parseInt(f/
2,10);b<k;)c=d[e+b],d[e+b]=d[e+h],d[e+h]=c,b++,h--;l+=f}return a}},function(a,k,h){function f(c,e){e=void 0===e?!1:e;for(var b="",d=0,a=c.length;d<a;){var f=g.lPadZeros(c[d].toString(2),8);b=e?b+f:f+b;d++}return b}var g=h(0),l=new Float32Array(1),c=new Int32Array(l.buffer);a.exports.getBinary=f;a.exports.decodeFloat16=function(c){c=parseInt(f(c,!0),2);var d=(c&31744)>>10,b=c&1023;return(d?Math.pow(2,d-15)*(1+b/1024):b/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=f(c);for(var d="1"+c.substr(12,52),b=1,a=0,g=0;g<d.length;)a+=b*parseInt(d.charAt(g),10),b/=2,g++;return("1"==c.charAt(0)?-1:1)*a*Math.pow(2,parseInt(c.substr(1,11),2)-1023)};a.exports.toFloat64=function(c){if(0==c)return[0,0];var d=0;0>=c&&(d=2147483648,c=-c);var b=Math.floor(Math.log(c)/Math.log(2)),a=Math.floor(c/Math.pow(2,b)*Math.pow(2,52));c=a&4294967295;a/=Math.pow(2,32);return[d|b+1023<<20|a&1048575,c]};a.exports.toHalf=function(d){l[0]=d;var a=c[0];d=a>>16&32768;var b=
a>>12&2047;a=a>>23&255;return 103>a?d:(d|a-112<<10|b>>1)+(b&1)}},function(a,k,h){var f=h(6),g=h(12),l=h(13);a=function(c,a,e){a=void 0===a?!1:a;e=void 0===e?!1:e;var b=l.WaveFileHeader.call(this)||this;b.isFromScratch_=!1;b.enforceFact=a;b.enforceBext=e;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.samples_=[];b.bytes_=[];c&&b.fromBuffer(c);return b};$jscomp.inherits(a,l.WaveFileHeader);a.prototype.fromScratch=function(c,a,e,b,f){f=void 0===f?{}:f;f.container||(f.container="RIFF");this.isFromScratch_=!0;var d=parseInt(e,10)/8;this.chunkSize=36+b.length*d;this.subChunk1Size=16;this.byteRate=c*d*a;this.blockAlign=c*d;this.chunkId=f.container;this.format="WAVE";this.subChunk1Id="fmt ";this.audioFormat=this.headerFormats_[e];
this.numChannels=c;this.sampleRate=a;this.bitsPerSample=parseInt(e,10);this.subChunk2Id="data";this.subChunk2Size=b.length*d;this.samples_=b;this.bitDepth_=e};a.prototype.fromBuffer=function(c){this.isFromScratch_=!1;this.readRIFFChunk_(c);this.readWAVEChunk_(c);this.readFmtChunk_(c);this.readFactChunk_(c);this.readBextChunk_(c);this.readDataChunk_(c)};a.prototype.toBuffer=function(){this.checkWriteInput_(this.numChannels,this.sampleRate,this.bitDepth_);this.samplesToBytes_();return new Uint8Array(this.createWaveFile_())};
a.prototype.toRIFF=function(){this.chunkId="RIFF"};a.prototype.toRIFX=function(){this.chunkId="RIFX"};a.prototype.toBitDepth=function(c){g.toBitDepth(this.samples_,this.bitDepth_,c);this.fromScratch(this.numChannels,this.sampleRate,c,this.samples_,{container:this.chunkId})};a.prototype.interleave=function(){var c=[],a,e,b=this.samples_[0].length;for(a=0;a<b;a++)for(e=0;e<this.samples_.length;e++)c.push(this.samples_[e][a]);this.samples_=c};a.prototype.deInterleave=function(){var c=[],a;for(a=0;a<
this.numChannels;a++)c[a]=[];a=0;for(var e;a<this.samples_.length;){for(e=0;e<this.numChannels;e++)c[e].push(this.samples_[a+e]);a+=e}this.samples_=c};a.prototype.readRIFFChunk_=function(c){this.chunkId=f.fromBytes(c.slice(0,4),8,{"char":!0});if("RIFF"!=this.chunkId&&"RIFX"!=this.chunkId)throw Error(this.WaveErrors.format);this.chunkSize=f.fromBytes(c.slice(4,8),32,{be:"RIFX"==this.chunkId})[0]};a.prototype.readWAVEChunk_=function(c){if(-1===f.findString(c,"WAVE"))throw Error(this.WaveErrors.wave);
this.format="WAVE"};a.prototype.readFmtChunk_=function(c){var a=f.findString(c,"fmt ");if(-1===a)throw Error(this.WaveErrors["fmt "]);var e={be:"RIFX"==this.chunkId};this.subChunk1Id="fmt ";this.subChunk1Size=f.fromBytes(c.slice(a+4,a+8),32,e)[0];this.audioFormat=f.fromBytes(c.slice(a+8,a+10),16,e)[0];this.numChannels=f.fromBytes(c.slice(a+10,a+12),16,e)[0];this.sampleRate=f.fromBytes(c.slice(a+12,a+16),32,e)[0];this.byteRate=f.fromBytes(c.slice(a+16,a+20),32,e)[0];this.blockAlign=f.fromBytes(c.slice(a+
20,a+22),16,e)[0];this.bitsPerSample=f.fromBytes(c.slice(a+22,a+24),16,e)[0];this.bitDepth_=3==this.audioFormat&&32==this.bitsPerSample?"32f":this.bitsPerSample.toString()};a.prototype.readFactChunk_=function(a){a=f.findString(a,"fact");if(-1===a&&this.enforceFact)throw Error(this.WaveErrors.fact);-1<a&&(this.factChunkId="fact")};a.prototype.readBextChunk_=function(a){a=f.findString(a,"bext");if(-1===a&&this.enforceBext)throw Error(this.WaveErrors.bext);-1<a&&(this.bextChunkId="bext")};a.prototype.readDataChunk_=
function(a){var c=f.findString(a,"data");if(-1===c)throw Error(this.WaveErrors.data);this.subChunk2Id="data";this.subChunk2Size=f.fromBytes(a.slice(c+4,c+8),32,{be:"RIFX"==this.chunkId})[0];this.samplesFromBytes_(a,c)};a.prototype.samplesFromBytes_=function(a,d){var c={signed:8==this.bitsPerSample?!1:!0,be:"RIFX"==this.chunkId};32==this.bitsPerSample&&3==this.audioFormat&&(c.float=!0);a=a.slice(d+8,d+8+this.subChunk2Size);this.samples_=4==this.bitsPerSample?f.fromBytes(a,8,c):f.fromBytes(a,this.bitsPerSample,
c)};a.prototype.checkWriteInput_=function(){this.validateBitDepth_();this.validateNumChannels_();this.validateSampleRate_()};a.prototype.validateBitDepth_=function(){if(!this.headerFormats_[this.bitDepth_])throw Error(this.WaveErrors.bitDepth);return!0};a.prototype.validateNumChannels_=function(){var a=this.numChannels*this.bitsPerSample/8;if(1>this.numChannels||65535<a)throw Error(this.WaveErrors.numChannels);return!0};a.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};a.prototype.samplesToBytes_=function(){var a={be:"RIFX"==this.chunkId};32==this.bitsPerSample&&3==this.audioFormat&&(a.float=!0);this.bytes_=f.toBytes(this.samples_,4==this.bitsPerSample?8:this.bitsPerSample,a);this.bytes_.length%2&&this.bytes_.push(0)};a.prototype.createWaveFile_=function(){var a=[];this.factChunkId&&(a=f.toBytes(this.factChunkId,8,{"char":!0}));var d={be:"RIFX"==this.chunkId};return f.toBytes(this.chunkId,
8,{"char":!0}).concat(f.toBytes([this.chunkSize],32,d),f.toBytes(this.format,8,{"char":!0}),f.toBytes(this.subChunk1Id,8,{"char":!0}),f.toBytes([this.subChunk1Size],32,d),f.toBytes([this.audioFormat],16,d),f.toBytes([this.numChannels],16,d),f.toBytes([this.sampleRate],32,d),f.toBytes([this.byteRate],32,d),f.toBytes([this.blockAlign],16,d),f.toBytes([this.bitsPerSample],16,d),a,f.toBytes(this.subChunk2Id,8,{"char":!0}),f.toBytes([this.subChunk2Size],32,d),this.bytes_)};window.WaveFile=a},function(a,
k,h){k=h(7);var f=h(9),g=h(11);h=h(2);a.exports.findString=function(a,c){for(var d,e=0;e<a.length;e++)if(d=f.fromBytes(a.slice(e,e+c.length),8,{"char":!0}),d==c)return e;return-1};a.exports.toBytes=k.toBytes;a.exports.fromBytes=f.fromBytes;a.exports.packBooleans=g.packBooleans;a.exports.unpackBooleans=g.unpackBooleans;a.exports.packCrumbs=g.packCrumbs;a.exports.unpackCrumbs=g.unpackCrumbs;a.exports.packNibbles=g.packNibbles;a.exports.unpackNibbles=g.unpackNibbles;a.exports.BitDepthOffsets=h.BitDepthOffsets;
a.exports.BitDepthMaxValues=h.BitDepthMaxValues},function(a,k,h){function f(a,c,e){4==c?g(a,e,l.paddingNibble):2==c?g(a,e,l.paddingCrumb):1==c?g(a,e,function(){}):g(a,e)}function g(a,c,e){e=void 0===e?l.padding:e;if(10!=c)for(var b=0,d=a.length;b<d;)a[b]=a[b].toString(c),e(a,c,b),b++}h(1);var l=h(0),c=h(3),d=h(8),e=h(2);a.exports.toBytes=function(a,g,h){h=void 0===h?{}:h;var b=10;"base"in h&&(b=h.base);var l=h.char?d.writeString:d["write"+g+"Bit"+(h.float?"Float":"")];for(var k=0,m=0,p=a.length,n=
[];k<p;)m=l(n,a,k,m),k++;a=n;h.be&&c.endianness(a,e.BitDepthOffsets[g]);f(a,g,b);h.buffer&&(a=new Uint8Array(a));return a}},function(a,k,h){function f(a,d,e,b){a[b++]=d[e]&255;a[b++]=d[e]>>>8&255;a[b++]=d[e]>>>16&255;a[b++]=d[e]>>>24&255;return b}var g=h(4),l=h(1);a.exports.write64Bit=function(a,d,e,b){d=g.toFloat64(d[e]);b=f(a,d,1,b);return f(a,d,0,b)};a.exports.write48Bit=function(a,d,e,b){a[b++]=d[e]&255;a[b++]=d[e]>>8&255;a[b++]=d[e]>>16&255;a[b++]=d[e]>>24&255;a[b++]=d[e]/4294967296&255;a[b++]=
d[e]/1099511627776&255;return b};a.exports.write40Bit=function(a,d,e,b){a[b++]=d[e]&255;a[b++]=d[e]>>8&255;a[b++]=d[e]>>16&255;a[b++]=d[e]>>24&255;a[b++]=d[e]/4294967296&255;return b};a.exports.write32BitFloat=function(a,d,e,b){d=l.unpack(d[e]);a[b++]=d&255;a[b++]=d>>>8&255;a[b++]=d>>>16&255;a[b++]=d>>>24&255;return b};a.exports.write32Bit=f;a.exports.write24Bit=function(a,d,e,b){a[b++]=d[e]&255;a[b++]=d[e]>>>8&255;a[b++]=d[e]>>>16&255;return b};a.exports.write16Bit=function(a,d,e,b){a[b++]=d[e]&
255;a[b++]=d[e]>>>8&255;return b};a.exports.write16BitFloat=function(a,d,e,b){d=g.toHalf(d[e]);a[b++]=d>>>8&255;a[b++]=d&255;return b};a.exports.write8Bit=function(a,d,e,b){a[b++]=d[e]&255;return b};a.exports.write4Bit=function(a,d,e,b){a[b++]=d[e]&15;return b};a.exports.write2Bit=function(a,d,e,b){a[b++]=0>d[e]?d[e]+4:d[e];return b};a.exports.write1Bit=function(a,d,e,b){a[b++]=d[e]?1:0;return b};a.exports.writeString=function(a,d,e,b){a[b++]=d.charCodeAt(e);return b}},function(a,k,h){function f(a,
b,c,f){var e=[],h=0,l=0,k=d.BitDepthOffsets[b],m=a.length-(k-1);b=d.BitDepthMaxValues[b];for(c=c?g:function(a,b){return a};h<m;)e[l]=c(f(a,h),b),h+=k,l++;return e}function g(a,b){a>parseInt(b/2,10)-1&&(a-=b);return a}var l=h(3),c=h(10),d=h(2);a.exports.fromBytes=function(a,b,d){d=void 0===d?{}:d;var e=10;"base"in d&&(e=d.base);d.be&&l.endianness(a,b/8);if(10!=e)for(var g=0,h=a.length;g<h;)a[g]=parseInt(a[g],e),g++;a=f(a,b,d.signed,d.char?c.readChar:c["read"+(2==b||4==b?8:b)+"Bit"+(d.float?"Float":
"")]);d.char&&(a=a.join(""));return a}},function(a,k,h){function f(a,b,c){--c;for(var e="";0<=c;)e+=l.bytePadding(a[c+b].toString(2),2),c--;return parseInt(e,2)}function g(a,b){return(a[3+b]<<24|a[2+b]<<16|a[1+b]<<8|a[b])>>>0}var l=h(0),c=h(4),d=h(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=g;a.exports.read32BitFloat=function(a,b){return d.pack(g(a,b))};a.exports.read40Bit=function(a,b){return f(a,b,5)};a.exports.read48Bit=function(a,b){return f(a,b,6)};a.exports.read64Bit=function(a,b){return c.decodeFloat64(a.slice(b,b+8))}},function(a,k,h){var f=h(0);a.exports.packBooleans=function(a){var g=[],c=0,d=0;f.fixByteArraySize(a,8);for(var e=a.length-
7;c<e;)g[d++]=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 g};a.exports.unpackBooleans=function(a){for(var g=[],c=0,d=0,e=a.length,b;c<e;)b=f.lPadZeros(a[c].toString(2),8),g[d++]=parseInt(b[0],2),g[d++]=parseInt(b[1],2),g[d++]=parseInt(b[2],2),g[d++]=parseInt(b[3],2),g[d++]=parseInt(b[4],2),g[d++]=parseInt(b[5],2),g[d++]=parseInt(b[6],2),g[d++]=parseInt(b[7],2),c++;return g};
a.exports.packCrumbs=function(a){var g=[],c=0,d=0;f.fixByteArraySize(a,4);for(var e=a.length-3;c<e;)g[d++]=parseInt(f.lPadZeros(a[c].toString(2),2)+f.lPadZeros(a[c+1].toString(2),2)+f.lPadZeros(a[c+2].toString(2),2)+f.lPadZeros(a[c+3].toString(2),2),2),c+=4;return g};a.exports.unpackCrumbs=function(a){var g=[],c=0,d=0,e=a.length;for(console.log(e);c<e;){var b=f.lPadZeros(a[c].toString(2),8);g[d++]=parseInt(b[0]+b[1],2);g[d++]=parseInt(b[2]+b[3],2);g[d++]=parseInt(b[4]+b[5],2);g[d++]=parseInt(b[6]+
b[7],2);c++}return g};a.exports.packNibbles=function(a){var f=[],c=0,d=0,e=a.length;for(e%2&&a.push(0);c<e;)f[d++]=parseInt(a[c].toString(16)+a[c+1].toString(16),16),c+=2;return f};a.exports.unpackNibbles=function(a){for(var f=[],c=0,d=0,e=a.length;c<e;)f[d++]=parseInt(a[c].toString(16)[0],16),f[d++]=parseInt(a[c].toString(16)[1],16),c++;return f}},function(a,k){var h={2:4,4:16,8:256,16:65536,24:16777216,32:4294967296,40:1099511627776,48:281474976710656};a.exports.toBitDepth=function(a,g,k){if(g!=
k){var c="8 16 24 32 32f 64".split(" ");if(-1==c.indexOf(g)||-1==c.indexOf(k))throw Error("Invalid bit depth.");c=a.length;for(var d=parseInt(h[parseInt(g,10)]/2,10),e=parseInt(h[parseInt(k,10)]/2,10),b=0;b<c;b++)"8"==g&&(a[b]-=128),"32f"==k||"64"==k?"32f"!=g&&"64"!=g&&(a[b]=0<a[b]?a[b]/(d-1):a[b]/d):(a[b]="32f"==g||"64"==g?0<a[b]?a[b]*(e-1):a[b]*e:0<a[b]?parseInt(a[b]/(d-1)*e-1,10):parseInt(a[b]/d*e,10),"8"==k&&(a[b]+=128))}};a.exports.BitDepthMaxValues=h},function(a,k){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.headerFormats_={4:17,8:1,16:1,24:1,32:1,"32f":3,64:3}}}]);
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(k){}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 k=$jscomp.setPrototypeOf;k(a,h)}else for(k in h)if("prototype"!=k)if(Object.defineProperties){var g=Object.getOwnPropertyDescriptor(h,k);g&&Object.defineProperty(a,k,g)}else a[k]=h[k];a.superClass_=h.prototype};
(function(a){function h(g){if(k[g])return k[g].exports;var l=k[g]={i:g,l:!1,exports:{}};a[g].call(l.exports,l,l.exports,h);l.l=!0;return l.exports}var k={};h.m=a;h.c=k;h.d=function(a,l,e){h.o(a,l)||Object.defineProperty(a,l,{configurable:!1,enumerable:!0,get:e})};h.n=function(a){var l=a&&a.__esModule?function(){return a["default"]}:function(){return a};h.d(l,"a",l);return l};h.o=function(a,l){return Object.prototype.hasOwnProperty.call(a,l)};h.p="";return h(h.s=5)})([function(a,h){function k(a,e){var b=
a.length+1;2==e?b=8:16==e&&(b=2);return g(a,b)}function g(a,e){for(;a.length<e;)a="0"+a;return a}a.exports.fixByteArraySize=function(a,e){var b=0,c=a.length%e;if(c)for(c=-1*(c-e);b<c;)a.push(0),b++};a.exports.padding=function(a,e,b){a[b]=k(a[b],e)};a.exports.paddingNibble=function(a,e,b){2==e&&4>a[b].length&&(a[b]=Array(5-a[b].length).join("0")+a[b])};a.exports.paddingCrumb=function(a,e,b){(2==e||16==e)&&2>a[b].length&&(a[b]="0"+a[b])};a.exports.bytePadding=k;a.exports.lPadZeros=g},function(a,h){function k(e){g[0]=
e;return l[0]}h=new Int8Array(4);var g=new Int32Array(h.buffer,0,1),l=new Float32Array(h.buffer,0,1);a.exports=k;a.exports.pack=k;a.exports.unpack=function(e){l[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 l=a.length,e=0;e<l;){for(var b,c=a,f=e,d=0,h=g-1,k=parseInt(g/
2,10);d<k;)b=c[f+d],c[f+d]=c[f+h],c[f+h]=b,d++,h--;e+=g}return a}},function(a,h,k){function g(b,f){f=void 0===f?!1:f;for(var d="",c=0,e=b.length;c<e;){var a=l.lPadZeros(b[c].toString(2),8);d=f?d+a:a+d;c++}return d}var l=k(0),e=new Float32Array(1),b=new Int32Array(e.buffer);a.exports.getBinary=g;a.exports.decodeFloat16=function(b){b=parseInt(g(b,!0),2);var c=(b&31744)>>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=g(b);for(var c="1"+b.substr(12,52),d=1,e=0,a=0;a<c.length;)e+=d*parseInt(c.charAt(a),10),d/=2,a++;return("1"==b.charAt(0)?-1:1)*e*Math.pow(2,parseInt(b.substr(1,11),2)-1023)};a.exports.toFloat64=function(b){if(0==b)return[0,0];var e=0;0>=b&&(e=2147483648,b=-b);var d=Math.floor(Math.log(b)/Math.log(2)),c=Math.floor(b/Math.pow(2,d)*Math.pow(2,52));b=c&4294967295;c/=Math.pow(2,32);return[e|d+1023<<20|c&1048575,b]};a.exports.toHalf=function(c){e[0]=c;var a=b[0];c=a>>16&32768;var d=
a>>12&2047;a=a>>23&255;return 103>a?c:(c|a-112<<10|d>>1)+(d&1)}},function(a,h,k){a=k(6);window.WaveFile=a.WaveFile},function(a,h,k){var g=k(7),l=k(8);h=function(e,b,c){b=l.WaveFile.call(this,void 0===b?!1:b,void 0===c?!1:c)||this;e&&b.fromBuffer(e);return b};$jscomp.inherits(h,l.WaveFile);h.prototype.fromScratch=function(e,b,c,a,d){d=void 0===d?{}:d;d.container||(d.container="RIFF");this.isFromScratch_=!0;var f=parseInt(c,10)/8;this.chunkSize=36+a.length*f;this.subChunk1Size=16;this.byteRate=e*f*
b;this.blockAlign=e*f;this.chunkId=d.container;this.format="WAVE";this.subChunk1Id="fmt ";this.audioFormat=this.headerFormats_[c];this.numChannels=e;this.sampleRate=b;this.bitsPerSample=parseInt(c,10);this.subChunk2Id="data";this.subChunk2Size=a.length*f;this.samples_=a;this.bitDepth_=c};h.prototype.fromBuffer=function(e){this.isFromScratch_=!1;this.readRIFFChunk_(e);this.readWAVEChunk_(e);this.readFmtChunk_(e);this.readFactChunk_(e);this.readBextChunk_(e);this.readDataChunk_(e)};h.prototype.toBuffer=
function(){this.checkWriteInput_(this.numChannels,this.sampleRate,this.bitDepth_);this.samplesToBytes_();return new Uint8Array(this.createWaveFile_())};h.prototype.toRIFF=function(){this.chunkId="RIFF"};h.prototype.toRIFX=function(){this.chunkId="RIFX"};h.prototype.toBitDepth=function(e){g.toBitDepth(this.samples_,this.bitDepth_,e);this.fromScratch(this.numChannels,this.sampleRate,e,this.samples_,{container:this.chunkId})};h.prototype.interleave=function(){var e=[],b,c,a=this.samples_[0].length;for(b=
0;b<a;b++)for(c=0;c<this.samples_.length;c++)e.push(this.samples_[c][b]);this.samples_=e};h.prototype.deInterleave=function(){var e=[],b;for(b=0;b<this.numChannels;b++)e[b]=[];b=0;for(var a;b<this.samples_.length;){for(a=0;a<this.numChannels;a++)e[a].push(this.samples_[b+a]);b+=a}this.samples_=e};a.exports.WaveFile=h},function(a,h){var k={8:256,16:65536,24:16777216,32:4294967296};a.exports.toBitDepth=function(a,l,e){if(l!=e){var b="8 16 24 32 32f 64".split(" ");if(-1==b.indexOf(l)||-1==b.indexOf(e))throw Error("Invalid bit depth.");
b=a.length;for(var c=0;c<b;c++){var f=a[c];"8"==l&&(f-=128);if("32f"==e||"64"==e){var d=l,g=parseInt(k[d]/2,10);"32f"!=d&&"64"!=d&&(f=0<f?f/(g-1):f/g)}else{d=f;g=l;f=e;var h=parseInt(k[g]/2,10),n=parseInt(k[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[c]=f}}};a.exports.BitDepthMaxValues=k},function(a,h,k){var g=k(9),l=k(15);h=function(a,b,c){b=void 0===b?!1:b;c=void 0===c?!1:c;a=l.WaveFileHeader.call(this)||this;a.isFromScratch_=
!1;a.enforceFact=b;a.enforceBext=c;a.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."};a.headerFormats_={4:17,8:1,16:1,24:1,32:1,"32f":3,64:3};a.samples_=[];a.bytes_=[];return a};$jscomp.inherits(h,l.WaveFileHeader);
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 b=g.findString(a,"fmt ");if(-1===b)throw Error(this.WaveErrors["fmt "]);var c={be:"RIFX"==
this.chunkId};this.subChunk1Id="fmt ";this.subChunk1Size=g.fromBytes(a.slice(b+4,b+8),32,c)[0];this.audioFormat=g.fromBytes(a.slice(b+8,b+10),16,c)[0];this.numChannels=g.fromBytes(a.slice(b+10,b+12),16,c)[0];this.sampleRate=g.fromBytes(a.slice(b+12,b+16),32,c)[0];this.byteRate=g.fromBytes(a.slice(b+16,b+20),32,c)[0];this.blockAlign=g.fromBytes(a.slice(b+20,b+22),16,c)[0];this.bitsPerSample=g.fromBytes(a.slice(b+22,b+24),16,c)[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){a=g.findString(a,"bext");if(-1===a&&this.enforceBext)throw Error(this.WaveErrors.bext);-1<a&&(this.bextChunkId="bext")};h.prototype.readDataChunk_=function(a){var b=g.findString(a,"data");if(-1===b)throw Error(this.WaveErrors.data);this.subChunk2Id="data";this.subChunk2Size=g.fromBytes(a.slice(b+4,b+8),
32,{be:"RIFX"==this.chunkId})[0];this.samplesFromBytes_(a,b)};h.prototype.samplesFromBytes_=function(a,b){var c={signed:8==this.bitsPerSample?!1:!0,be:"RIFX"==this.chunkId};32==this.bitsPerSample&&3==this.audioFormat&&(c.float=!0);a=a.slice(b+8,b+8+this.subChunk2Size);this.samples_=4==this.bitsPerSample?g.fromBytes(a,8,c):g.fromBytes(a,this.bitsPerSample,c)};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=[];this.factChunkId&&(a=g.toBytes(this.factChunkId,8,{"char":!0}));var b={be:"RIFX"==this.chunkId};return g.toBytes(this.chunkId,8,{"char":!0}).concat(g.toBytes([this.chunkSize],32,b),g.toBytes(this.format,8,{"char":!0}),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,g.toBytes(this.subChunk2Id,8,{"char":!0}),g.toBytes([this.subChunk2Size],32,b),this.bytes_)};a.exports.WaveFile=h},function(a,h,k){h=k(10);var g=k(12),l=k(14);k=k(2);a.exports.findString=function(a,b){for(var c,f=0;f<a.length;f++)if(c=g.fromBytes(a.slice(f,
f+b.length),8,{"char":!0}),c==b)return f;return-1};a.exports.toBytes=h.toBytes;a.exports.fromBytes=g.fromBytes;a.exports.packBooleans=l.packBooleans;a.exports.unpackBooleans=l.unpackBooleans;a.exports.packCrumbs=l.packCrumbs;a.exports.unpackCrumbs=l.unpackCrumbs;a.exports.packNibbles=l.packNibbles;a.exports.unpackNibbles=l.unpackNibbles;a.exports.BitDepthOffsets=k.BitDepthOffsets;a.exports.BitDepthMaxValues=k.BitDepthMaxValues},function(a,h,k){function g(a,b,c){4==b?l(a,c,e.paddingNibble):2==b?l(a,
c,e.paddingCrumb):1==b?l(a,c,function(){}):l(a,c)}function l(a,b,c){c=void 0===c?e.padding:c;if(10!=b)for(var d=0,f=a.length;d<f;)a[d]=a[d].toString(b),c(a,b,d),d++}k(1);var e=k(0),b=k(3),c=k(11),f=k(2);a.exports.toBytes=function(a,e,l){l=void 0===l?{}:l;var d=10;"base"in l&&(d=l.base);var h=l.char?c.writeString:c["write"+e+"Bit"+(l.float?"Float":"")];for(var k=0,m=0,q=a.length,p=[];k<q;)m=h(p,a,k,m),k++;a=p;l.be&&b.endianness(a,f.BitDepthOffsets[e]);g(a,e,d);l.buffer&&(a=new Uint8Array(a));return a}},
function(a,h,k){function g(a,c,f,d){a[d++]=c[f]&255;a[d++]=c[f]>>>8&255;a[d++]=c[f]>>>16&255;a[d++]=c[f]>>>24&255;return d}var l=k(4),e=k(1);a.exports.write64Bit=function(a,c,f,d){c=l.toFloat64(c[f]);d=g(a,c,1,d);return g(a,c,0,d)};a.exports.write48Bit=function(a,c,f,d){a[d++]=c[f]&255;a[d++]=c[f]>>8&255;a[d++]=c[f]>>16&255;a[d++]=c[f]>>24&255;a[d++]=c[f]/4294967296&255;a[d++]=c[f]/1099511627776&255;return d};a.exports.write40Bit=function(a,c,f,d){a[d++]=c[f]&255;a[d++]=c[f]>>8&255;a[d++]=c[f]>>16&
255;a[d++]=c[f]>>24&255;a[d++]=c[f]/4294967296&255;return d};a.exports.write32BitFloat=function(a,c,f,d){c=e.unpack(c[f]);a[d++]=c&255;a[d++]=c>>>8&255;a[d++]=c>>>16&255;a[d++]=c>>>24&255;return d};a.exports.write32Bit=g;a.exports.write24Bit=function(a,c,f,d){a[d++]=c[f]&255;a[d++]=c[f]>>>8&255;a[d++]=c[f]>>>16&255;return d};a.exports.write16Bit=function(a,c,f,d){a[d++]=c[f]&255;a[d++]=c[f]>>>8&255;return d};a.exports.write16BitFloat=function(a,c,f,d){c=l.toHalf(c[f]);a[d++]=c>>>8&255;a[d++]=c&255;
return d};a.exports.write8Bit=function(a,c,f,d){a[d++]=c[f]&255;return d};a.exports.write4Bit=function(a,c,f,d){a[d++]=c[f]&15;return d};a.exports.write2Bit=function(a,c,f,d){a[d++]=0>c[f]?c[f]+4:c[f];return d};a.exports.write1Bit=function(a,c,f,d){a[d++]=c[f]?1:0;return d};a.exports.writeString=function(a,c,f,d){a[d++]=c.charCodeAt(f);return d}},function(a,h,k){function g(a,d,b,e){var f=[],g=0,h=0,k=c.BitDepthOffsets[d],m=a.length-(k-1);d=c.BitDepthMaxValues[d];for(b=b?l:function(a,d){return a};g<
m;)f[h]=b(e(a,g),d),g+=k,h++;return f}function l(a,d){a>parseInt(d/2,10)-1&&(a-=d);return a}var e=k(3),b=k(13),c=k(2);a.exports.fromBytes=function(a,d,c){c=void 0===c?{}:c;var f=10;"base"in c&&(f=c.base);c.be&&e.endianness(a,d/8);if(10!=f)for(var l=0,h=a.length;l<h;)a[l]=parseInt(a[l],f),l++;a=g(a,d,c.signed,c.char?b.readChar:b["read"+(2==d||4==d?8:d)+"Bit"+(c.float?"Float":"")]);c.char&&(a=a.join(""));return a}},function(a,h,k){function g(a,d,b){--b;for(var c="";0<=b;)c+=e.bytePadding(a[b+d].toString(2),
2),b--;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 e=k(0),b=k(4),c=k(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,c){return b.decodeFloat16(a.slice(c,c+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,b){return c.pack(l(a,b))};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,c){return b.decodeFloat64(a.slice(c,c+8))}},function(a,h,k){var g=k(0);a.exports.packBooleans=function(a){var e=[],b=0,c=0;g.fixByteArraySize(a,8);for(var f=a.length-7;b<f;)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,f=a.length,d;b<f;)d=g.lPadZeros(a[b].toString(2),8),e[c++]=parseInt(d[0],2),e[c++]=parseInt(d[1],2),e[c++]=parseInt(d[2],2),e[c++]=parseInt(d[3],2),e[c++]=parseInt(d[4],2),e[c++]=parseInt(d[5],2),e[c++]=parseInt(d[6],2),e[c++]=parseInt(d[7],2),b++;return e};a.exports.packCrumbs=function(a){var e=[],b=0,c=0;g.fixByteArraySize(a,4);for(var f=a.length-3;b<f;)e[c++]=parseInt(g.lPadZeros(a[b].toString(2),
2)+g.lPadZeros(a[b+1].toString(2),2)+g.lPadZeros(a[b+2].toString(2),2)+g.lPadZeros(a[b+3].toString(2),2),2),b+=4;return e};a.exports.unpackCrumbs=function(a){var e=[],b=0,c=0,f=a.length;for(console.log(f);b<f;){var d=g.lPadZeros(a[b].toString(2),8);e[c++]=parseInt(d[0]+d[1],2);e[c++]=parseInt(d[2]+d[3],2);e[c++]=parseInt(d[4]+d[5],2);e[c++]=parseInt(d[6]+d[7],2);b++}return e};a.exports.packNibbles=function(a){var e=[],b=0,c=0,f=a.length;for(f%2&&a.push(0);b<f;)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,f=a.length;b<f;)e[c++]=parseInt(a[b].toString(16)[0],16),e[c++]=parseInt(a[b].toString(16)[1],16),b++;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=""}}]);

@@ -432,10 +432,26 @@ /******/ (function(modules) { // webpackBootstrap

const byteData = __webpack_require__(6);
const bitDepthLib = __webpack_require__(12);
const wavefileheader = __webpack_require__(13);
const wavefile = __webpack_require__(6);
window['WaveFile'] = wavefile.WaveFile;
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
/*!
* WaveFileInterface
* Copyright (c) 2017 Rafael da Silva Rocha. MIT License.
* https://github.com/rochars/wavefile
*
*/
const bitDepthLib = __webpack_require__(7);
const wavefile = __webpack_require__(8);
/**
* A wave file.
*/
class WaveFile extends wavefileheader.WaveFileHeader {
class WaveFileInterface extends wavefile.WaveFile {

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

constructor(bytes, enforceFact=false, enforceBext=false) {
super();
/** @type {boolean} */
this.isFromScratch_ = false;
/** @type {boolean} */
this.enforceFact = enforceFact;
/** @type {boolean} */
this.enforceBext = enforceBext;
/**
* Error messages.
* @enum {string}
*/
this.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."
};
this.samples_ = [];
this.bytes_ = [];
super(enforceFact, enforceBext);
if(bytes) {

@@ -606,4 +599,239 @@ this.fromBuffer(bytes);

}
}
module.exports.WaveFile = WaveFileInterface;
/***/ }),
/* 7 */
/***/ (function(module, exports) {
/*!
* bitdepth
* Change the bit depth of audio samples to and from 8, 16, 24, 32, 32 IEEE & 64-bit.
* Copyright (c) 2017 Rafael da Silva Rocha. MIT License.
* https://github.com/rochars/bitdepth
*
*/
/**
* Max number of different values for each bit depth.
* @enum {number}
*/
const BitDepthMaxValues = {
8: 256,
16: 65536,
24: 16777216,
32: 4294967296
};
/**
* Change the bit depth of the data.
* The input array is modified in-place.
* @param {!Array<number>} samples The samples.
* @param {string} originalBitDepth The original bit depth of the data.
* One of "8", "16", "24", "32", "32f", "64"
* @param {string} targetBitDepth The new bit depth of the data.
* One of "8", "16", "24", "32", "32f", "64"
*/
function toBitDepth(samples, originalBitDepth, targetBitDepth) {
if (originalBitDepth == targetBitDepth) {
return;
}
validateBitDepths(originalBitDepth, targetBitDepth);
let len = samples.length;
for (let i=0; i<len; i++) {
let sample = samples[i];
// 8-bit samples are unsigned;
// They are signed here before conversion
// (other bit depths are all signed)
sample = sign8Bit(sample, originalBitDepth);
// If it is a float-to-float or int-to-float conversion then
// the samples in the target bit depth will be normalized in the
// -1.0 to 1.0 range; there is no need to multiply
if (targetBitDepth == "32f" || targetBitDepth == "64") {
sample = toFloat(sample, originalBitDepth);
// If it is a float-to-int or int-to-int conversion then the
// samples will be de-normalized according to the bit depth
}else {
sample = toInt(sample, originalBitDepth, targetBitDepth);
}
samples[i] = sample;
}
}
/**
* Sign unsigned 8-bit data.
* @param {number} sample The sample.
* @param {string} originalBitDepth The original bit depth of the data.
* One of "8", "16", "24", "32", "32f", "64"
*/
function sign8Bit(sample, originalBitDepth) {
if (originalBitDepth == "8") {
sample -= 128;
}
return sample;
}
/**
* Unsign signed 8-bit data.
* @param {number} sample The sample.
* @param {string} targetBitDepth The target bit depth of the data.
* One of "8", "16", "24", "32", "32f", "64"
*/
function unsign8Bit(sample, targetBitDepth) {
if (targetBitDepth == "8") {
sample += 128;
}
return sample;
}
/**
* Change the bit depth from int to float.
* The input array is modified in-place.
* @param {number} sample The sample.
* @param {string} originalBitDepth The original bit depth of the data.
* One of "8", "16", "24", "32", "32f", "64"
*/
function toFloat(sample, originalBitDepth) {
let oldMaxValue = parseInt((BitDepthMaxValues[originalBitDepth]) / 2, 10);
if (originalBitDepth != "32f" && originalBitDepth != "64") {
if (sample > 0) {
sample = sample / (oldMaxValue - 1);
} else {
sample = sample / oldMaxValue;
}
}
return sample;
}
/**
* Change the bit depth of the data.
* The input array is modified in-place.
* @param {number} sample The sample.
* @param {string} originalBitDepth The original bit depth of the data.
* One of "8", "16", "24", "32", "32f", "64"
* @param {string} targetBitDepth The new bit depth of the data.
* One of "8", "16", "24", "32", "32f", "64"
*/
function toInt(sample, originalBitDepth, targetBitDepth) {
// If the original samples are float, then they are already
// normalized between -1.0 and 1.0; All that is need is to
// multiply the sample values by the new bit depth max value
let oldMaxValue = parseInt((BitDepthMaxValues[originalBitDepth]) / 2, 10);
let newMaxValue = parseInt((BitDepthMaxValues[targetBitDepth]) / 2, 10);
if (originalBitDepth == "32f" || originalBitDepth == "64" ) {
if (sample > 0) {
sample = sample * (newMaxValue - 1);
} else {
sample = sample * newMaxValue;
}
// If the original samples are integers, then they need to be
// divided by the maximum values of its original bit depth
// (to normalize them between -1.0 and .10) and then multiply
// them by the new bit depth max value
} else {
if (sample > 0) {
sample =
parseInt((sample / (oldMaxValue - 1)) * newMaxValue - 1, 10);
} else {
sample = parseInt((sample / oldMaxValue) * newMaxValue, 10);
}
}
// Make the samples unsigned if the target bit depth is "8"
return unsign8Bit(sample, targetBitDepth);
}
/**
* Validate the bit depth.
* @param {string} originalBitDepth The original bit depth.
* Should be one of "8", "16", "24", "32", "32f", "64".
* @param {string} targetBitDepth The target bit depth.
* Should be one of "8", "16", "24", "32", "32f", "64".
* @throws {Error} If any argument does not meet the criteria.
*/
function validateBitDepths(originalBitDepth, targetBitDepth) {
let validBitDepths = ["8", "16", "24", "32", "32f", "64"];
if (validBitDepths.indexOf(originalBitDepth) == -1 ||
validBitDepths.indexOf(targetBitDepth) == -1) {
throw new Error("Invalid bit depth.");
}
return true;
}
module.exports.toBitDepth = toBitDepth;
module.exports.BitDepthMaxValues = BitDepthMaxValues;
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
/*!
* WaveFile
* Copyright (c) 2017 Rafael da Silva Rocha. MIT License.
* https://github.com/rochars/wavefile
*
*/
const byteData = __webpack_require__(9);
const wavefileheader = __webpack_require__(15);
/**
* A wave file.
*/
class WaveFile extends wavefileheader.WaveFileHeader {
/**
* @param {Uint8Array} bytes The file bytes.
* @param {boolean} enforceFact True if it should throw a error
* if no "fact" chunk is found.
* @param {boolean} enforceBext True if it should throw a error
* if no "bext" chunk is found.
*/
constructor(bytes, enforceFact=false, enforceBext=false) {
super();
/** @type {boolean} */
this.isFromScratch_ = false;
/** @type {boolean} */
this.enforceFact = enforceFact;
/** @type {boolean} */
this.enforceBext = enforceBext;
/**
* Error messages.
* @enum {string}
*/
this.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."
};
/**
* Header formats.
* @enum {number}
*/
this.headerFormats_ = {
"4": 17,
"8": 1,
"16": 1,
"24": 1,
"32": 1,
"32f": 3,
"64": 3
};
this.samples_ = [];
this.bytes_ = [];
}
/**
* Read the RIFF chunk a wave file.

@@ -849,7 +1077,7 @@ * @param {Uint8Array} bytes an array representing the wave file.

window['WaveFile'] = WaveFile;
module.exports.WaveFile = WaveFile;
/***/ }),
/* 6 */
/* 9 */
/***/ (function(module, exports, __webpack_require__) {

@@ -864,5 +1092,5 @@

let toBytes = __webpack_require__(7);
let fromBytes = __webpack_require__(9);
let bitPacker = __webpack_require__(11);
let toBytes = __webpack_require__(10);
let fromBytes = __webpack_require__(12);
let bitPacker = __webpack_require__(14);
let bitDepth = __webpack_require__(2);

@@ -906,3 +1134,3 @@

/***/ }),
/* 7 */
/* 10 */
/***/ (function(module, exports, __webpack_require__) {

@@ -919,3 +1147,3 @@

const endianness = __webpack_require__(3);
const writer = __webpack_require__(8);
const writer = __webpack_require__(11);
const bitDepths = __webpack_require__(2);

@@ -1030,3 +1258,3 @@

/***/ }),
/* 8 */
/* 11 */
/***/ (function(module, exports, __webpack_require__) {

@@ -1148,3 +1376,3 @@

/***/ }),
/* 9 */
/* 12 */
/***/ (function(module, exports, __webpack_require__) {

@@ -1159,3 +1387,3 @@

const endianness = __webpack_require__(3);
const reader = __webpack_require__(10);
const reader = __webpack_require__(13);
const bitDepths = __webpack_require__(2);

@@ -1280,3 +1508,3 @@

/***/ }),
/* 10 */
/* 13 */
/***/ (function(module, exports, __webpack_require__) {

@@ -1444,3 +1672,3 @@

/***/ }),
/* 11 */
/* 14 */
/***/ (function(module, exports, __webpack_require__) {

@@ -1601,138 +1829,8 @@

/***/ }),
/* 12 */
/* 15 */
/***/ (function(module, exports) {
/*!
* bitdepth
* Change the bit depth of audio samples to and from 8, 16, 24, 32, 32 IEEE & 64-bit.
* Copyright (c) 2017 Rafael da Silva Rocha. MIT License.
* https://github.com/rochars/bitdepth
*
*/
/**
* Max number of values for each bit depth.
* @enum {number}
*/
const BitDepthMaxValues = {
2: 4,
4: 16,
8: 256,
16: 65536,
24: 16777216,
32: 4294967296,
40: 1099511627776,
48: 281474976710656
};
/**
* Change the bit depth of the data.
* The input array is modified in-place.
* @param {!Array<number>} data The data.
* @param {string} originalBitDepth The original bit depth of the data.
* One of "8", "16", "24", "32", "32f", "64"
* @param {string} targetBitDepth The new bit depth of the data.
* One of "8", "16", "24", "32", "32f", "64"
*/
function toBitDepth(data, originalBitDepth, targetBitDepth) {
if (originalBitDepth == targetBitDepth) {
return;
}
validateBitDepths(originalBitDepth, targetBitDepth);
let len = data.length;
// Get the max values for both original and target bit depth
let oldMaxValue =
parseInt((BitDepthMaxValues[parseInt(originalBitDepth, 10)]) / 2, 10);
let newMaxValue =
parseInt((BitDepthMaxValues[parseInt(targetBitDepth, 10)]) / 2, 10);
// needs dithering if the target bit depth
// is lower than the original bit depth
//if (parseInt(targetBitDepth, 10) < parseInt(originalBitDepth, 10)) {
// TODO: dithering
//}
for (let i=0; i<len; i++) {
// 8-bit samples are unsigned;
// They are signed here before conversion
// (other bit depths are all signed)
if (originalBitDepth == "8") {
data[i] -= 128;
}
// If it is a float-to-float or int-to-float conversion then
// the samples in the target bit depth will be normalized in the
// -1.0 to 1.0 range; there is no need to multiply
if (targetBitDepth == "32f" || targetBitDepth == "64") {
if (originalBitDepth != "32f" && originalBitDepth != "64") {
if (data[i] > 0) {
data[i] = data[i] / (oldMaxValue - 1);
} else {
data[i] = data[i] / oldMaxValue;
}
}
// If it is a float-to-int or int-to-int conversion then the
// samples will be de-normalized according to the bit depth
}else {
// If the original samples are float, then they are already
// normalized between -1.0 and 1.0; All that is need is to
// multiply the sample values by the new bit depth max value
if (originalBitDepth == "32f" || originalBitDepth == "64" ) {
if (data[i] > 0) {
data[i] = data[i] * (newMaxValue - 1);
} else {
data[i] = data[i] * newMaxValue;
}
// If the original samples are integers, then they need to be
// divided by the maximum values of its original bit depth
// (to normalize them between -1.0 and .10) and then multiply
// them by the new bit depth max value
} else {
if (data[i] > 0) {
data[i] = parseInt((data[i] / (oldMaxValue - 1)) * newMaxValue - 1, 10);
} else {
data[i] = parseInt((data[i] / oldMaxValue) * newMaxValue, 10);
}
}
// Make the samples unsigned if the target bit depth is "8"
if (targetBitDepth == "8") {
data[i] += 128;
}
}
}
}
/**
* Validate the bit depth.
* @param {string} originalBitDepth The original bit depth.
* Should be one of "8", "16", "24", "32", "32f", "64".
* @param {string} targetBitDepth The target bit depth.
* Should be one of "8", "16", "24", "32", "32f", "64".
* @throws {Error} If any argument does not meet the criteria.
*/
function validateBitDepths(originalBitDepth, targetBitDepth) {
let validBitDepths = ["8", "16", "24", "32", "32f", "64"];
if (validBitDepths.indexOf(originalBitDepth) == -1 ||
validBitDepths.indexOf(targetBitDepth) == -1) {
throw new Error("Invalid bit depth.");
}
return true;
}
module.exports.toBitDepth = toBitDepth;
module.exports.BitDepthMaxValues = BitDepthMaxValues;
/***/ }),
/* 13 */
/***/ (function(module, exports) {
/*
* wavefileheader.js: WaveFileHeader class
* WaveFileHeader class
* A structure representing a WAVE file header.
* Copyright (c) 2017 Rafael da Silva Rocha. MIT License.

@@ -1806,15 +1904,2 @@ * https://github.com/rochars/wavefile

// TODO bext data
/**
* Header formats.
* @enum {number}
*/
this.headerFormats_ = {
"4": 17,
"8": 1,
"16": 1,
"24": 1,
"32": 1,
"32f": 3,
"64": 3
};
}

@@ -1821,0 +1906,0 @@ }

@@ -9,416 +9,5 @@ /*!

const byteData = require("byte-data");
const bitDepthLib = require("bitdepth");
const wavefileheader = require("./src/wavefileheader");
const wavefile = require("./src/wavefileinterface");
/**
* A wave file.
*/
class WaveFile extends wavefileheader.WaveFileHeader {
module.exports.WaveFile = wavefile.WaveFile;
/**
* @param {Uint8Array} bytes The file bytes.
* @param {boolean} enforceFact True if it should throw a error
* if no "fact" chunk is found.
* @param {boolean} enforceBext True if it should throw a error
* if no "bext" chunk is found.
*/
constructor(bytes, enforceFact=false, enforceBext=false) {
super();
/** @type {boolean} */
this.isFromScratch_ = false;
/** @type {boolean} */
this.enforceFact = enforceFact;
/** @type {boolean} */
this.enforceBext = enforceBext;
/**
* Error messages.
* @enum {string}
*/
this.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."
};
this.samples_ = [];
this.bytes_ = [];
if(bytes) {
this.fromBuffer(bytes);
}
}
/**
* Create a WaveFile object based on the arguments passed.
* @param {number} numChannels The number of channels
* (Ints like 1 for mono, 2 stereo and so on).
* @param {number} sampleRate The sample rate.
* Integer numbers like 8000, 44100, 48000, 96000, 192000.
* @param {string} bitDepth The audio bit depth.
* One of "8", "16", "24", "32", "32f", "64".
* @param {!Array<number>} samples Array of samples to be written.
* Samples must be in the correct range according to the bit depth.
* Samples of multi-channel data .
*/
fromScratch(numChannels, sampleRate, bitDepth, samples, options={}) {
if (!options.container) {
options.container = "RIFF";
}
this.isFromScratch_ = true;
let bytes = parseInt(bitDepth, 10) / 8;
this.chunkSize = 36 + samples.length * bytes;
this.subChunk1Size = 16;
this.byteRate = (numChannels * bytes) * sampleRate;
this.blockAlign = numChannels * bytes;
this.chunkId = options.container;
this.format = "WAVE";
this.subChunk1Id = "fmt ";
this.audioFormat = this.headerFormats_[bitDepth];
this.numChannels = numChannels;
this.sampleRate = sampleRate;
this.bitsPerSample = parseInt(bitDepth, 10);
this.subChunk2Id = "data";
this.subChunk2Size = samples.length * bytes;
this.samples_ = samples;
this.bitDepth_ = bitDepth;
}
/**
* Read a wave file from a byte buffer.
* @param {Uint8Array} bytes The buffer.
*/
fromBuffer(bytes) {
this.isFromScratch_ = false;
this.readRIFFChunk_(bytes);
this.readWAVEChunk_(bytes);
this.readFmtChunk_(bytes);
this.readFactChunk_(bytes);
this.readBextChunk_(bytes);
this.readDataChunk_(bytes);
}
/**
* Turn the WaveFile object into a byte buffer.
* @return {Uint8Array}
*/
toBuffer() {
this.checkWriteInput_(this.numChannels, this.sampleRate, this.bitDepth_);
this.samplesToBytes_();
return new Uint8Array(this.createWaveFile_());
}
/**
* Turn the file to RIFF.
* All values will be little-endian when writing.
*/
toRIFF() {
this.chunkId = "RIFF";
}
/**
* Turn the file to RIFX.
* All values but FourCCs will be big-endian when writing.
*/
toRIFX() {
this.chunkId = "RIFX";
}
/**
* Change the bit depth of the data.
* @param {string} bitDepth The new bit depth of the data.
* One of "8", "16", "24", "32", "32f", "64"
*/
toBitDepth(bitDepth) {
bitDepthLib.toBitDepth(this.samples_, this.bitDepth_, bitDepth);
this.fromScratch(
this.numChannels,
this.sampleRate,
bitDepth,
this.samples_,
{"container": this.chunkId}
);
}
/**
* Interleave multi-channel samples.
*/
interleave() {
let finalSamples = [];
let i;
let j;
let numChannels = this.samples_[0].length;
for (i = 0; i < numChannels; i++) {
for (j = 0; j < this.samples_.length; j++) {
finalSamples.push(this.samples_[j][i]);
}
}
this.samples_ = finalSamples;
}
/**
* De-interleave samples into multiple channels.
*/
deInterleave() {
let finalSamples = [];
let i;
for (i = 0; i < this.numChannels; i++) {
finalSamples[i] = [];
}
i = 0;
let j;
while (i < this.samples_.length) {
for (j = 0; j < this.numChannels; j++) {
finalSamples[j].push(this.samples_[i+j]);
}
i += j;
}
this.samples_ = finalSamples;
}
/**
* Read the RIFF chunk a wave file.
* @param {Uint8Array} bytes an array representing the wave file.
* @throws {Error} If no "RIFF" chunk is found.
*/
readRIFFChunk_(bytes) {
this.chunkId = byteData.fromBytes(bytes.slice(0, 4),
8, {"char": true});
if (this.chunkId != "RIFF" && this.chunkId != "RIFX") {
throw Error(this.WaveErrors.format);
}
this.chunkSize = byteData.fromBytes(
bytes.slice(4, 8), 32, {"be": this.chunkId == "RIFX"})[0];
}
/**
* Read the WAVE chunk of a wave file.
* @param {Uint8Array} bytes an array representing the wave file.
* @throws {Error} If no "WAVE" chunk is found.
*/
readWAVEChunk_(bytes) {
let start = byteData.findString(bytes, "WAVE");
if (start === -1) {
throw Error(this.WaveErrors.wave);
}
this.format = "WAVE";
}
/**
* Read the "fmt " chunk of a wave file.
* @param {Uint8Array} bytes an array representing the wave file.
* @throws {Error} If no "fmt " chunk is found.
*/
readFmtChunk_(bytes) {
let start = byteData.findString(bytes, "fmt ");
if (start === -1) {
throw Error(this.WaveErrors["fmt "]);
}
let options = {"be": this.chunkId == "RIFX"};
this.subChunk1Id = "fmt ";
this.subChunk1Size = byteData.fromBytes(
bytes.slice(start + 4, start + 8), 32, options)[0];
this.audioFormat = byteData.fromBytes(
bytes.slice(start + 8, start + 10), 16, options)[0];
this.numChannels = byteData.fromBytes(
bytes.slice(start + 10, start + 12), 16, options)[0];
this.sampleRate = byteData.fromBytes(
bytes.slice(start + 12, start + 16), 32, options)[0];
this.byteRate = byteData.fromBytes(
bytes.slice(start + 16, start + 20), 32, options)[0];
this.blockAlign = byteData.fromBytes(
bytes.slice(start + 20, start + 22), 16, options)[0];
this.bitsPerSample = byteData.fromBytes(
bytes.slice(start + 22, start + 24), 16, options)[0];
if (this.audioFormat == 3 && this.bitsPerSample == 32) {
this.bitDepth_ = "32f";
}else {
this.bitDepth_ = this.bitsPerSample.toString();
}
}
/**
* Read the "fact" chunk of a wave file.
* @param {Uint8Array} bytes an array representing the wave file.
* @throws {Error} If no "fact" chunk is found.
*/
readFactChunk_(bytes) {
let start = byteData.findString(bytes, "fact");
if (start === -1 && this.enforceFact) {
throw Error(this.WaveErrors.fact);
}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));
}
}
/**
* Read the "bext" chunk of a wave file.
* @param {Uint8Array} bytes an array representing the wave file.
* @throws {Error} If no "bext" chunk is found.
*/
readBextChunk_(bytes) {
let start = byteData.findString(bytes, "bext");
if (start === -1 && this.enforceBext) {
throw Error(this.WaveErrors.bext);
}else if (start > -1){
this.bextChunkId = "bext";
}
}
/**
* Read the "data" chunk of a wave file.
* @param {Uint8Array} bytes an array representing the wave file.
* @throws {Error} If no "data" chunk is found.
*/
readDataChunk_(bytes) {
let start = byteData.findString(bytes, "data");
if (start === -1) {
throw Error(this.WaveErrors.data);
}
this.subChunk2Id = "data";
this.subChunk2Size = byteData.fromBytes(
bytes.slice(start + 4, start + 8),
32,
{"be": this.chunkId == "RIFX"})[0];
this.samplesFromBytes_(bytes, start);
}
/**
* Find and return the start offset of the data chunk on a wave file.
* @param {Uint8Array} bytes Array of bytes representing the wave file.
* @param {number} start The offset to start reading.
*/
samplesFromBytes_(bytes, start) {
let params = {
"signed": this.bitsPerSample == 8 ? false : true,
"be": this.chunkId == "RIFX"
};
if (this.bitsPerSample == 32 && this.audioFormat == 3) {
params.float = true;
}
let samples = bytes.slice(start + 8, start + 8 + this.subChunk2Size);
if (this.bitsPerSample == 4) {
this.samples_ = byteData.fromBytes(samples, 8, params);
} else {
this.samples_ = byteData.fromBytes(samples, this.bitsPerSample, params);
}
}
/**
* Validate the input for wav writing.
* @param {number} numChannels The number of channels
* Should be a int greater than zero smaller than the
* channel limit according to the bit depth.
* @param {number} sampleRate The sample rate.
* Should be a int greater than zero smaller than the
* channel limit according to the bit depth and number of channels.
* @param {string} bitDepth The audio bit depth.
* Should be one of "8", "16", "24", "32", "32f", "64".
* @throws {Error} If any argument does not meet the criteria.
*/
checkWriteInput_() {
this.validateBitDepth_();
this.validateNumChannels_();
this.validateSampleRate_();
}
/**
* Validate the bit depth.
* @param {number} numChannels The number of channels
* @param {string} bitDepth The audio bit depth.
* Should be one of "8", "16", "24", "32", "32f", "64".
* @throws {Error} If any argument does not meet the criteria.
*/
validateBitDepth_() {
if (!this.headerFormats_[this.bitDepth_]) {
throw new Error(this.WaveErrors.bitDepth);
}
return true;
}
/**
* Validate the sample rate value.
* @param {number} numChannels The number of channels
* @param {string} bitDepth The audio bit depth.
* Should be one of "8", "16", "24", "32", "32f", "64".
* @throws {Error} If any argument does not meet the criteria.
*/
validateNumChannels_() {
let blockAlign = this.numChannels * this.bitsPerSample / 8;
if (this.numChannels < 1 || blockAlign > 65535) {
throw new Error(this.WaveErrors.numChannels);
}
return true;
}
/**
* Validate the sample rate value.
* @param {number} numChannels The number of channels
* Should be a int greater than zero smaller than the
* channel limit according to the bit depth.
* @param {number} sampleRate The sample rate.
* @param {string} bitDepth The audio bit depth.
* Should be one of "8", "16", "24", "32", "32f", "64".
* @throws {Error} If any argument does not meet the criteria.
*/
validateSampleRate_() {
let byteRate = this.numChannels *
(this.bitsPerSample / 8) * this.sampleRate;
if (this.sampleRate < 1 || byteRate > 4294967295) {
throw new Error(this.WaveErrors.sampleRate);
}
return true;
}
/**
* Split each sample into bytes.
*/
samplesToBytes_() {
let params = {"be": this.chunkId == "RIFX"};
if (this.bitsPerSample == 32 && this.audioFormat == 3) {
params.float = true;
}
let bitDepth = this.bitsPerSample == 4 ? 8 : this.bitsPerSample;
this.bytes_ = byteData.toBytes(this.samples_, bitDepth, params);
if (this.bytes_.length % 2) {
this.bytes_.push(0);
}
}
/**
* Turn a WaveFile object into a file.
* @return {Uint8Array} The wav file bytes.
*/
createWaveFile_() {
let factVal = [];
if (this.factChunkId) {
factVal = byteData.toBytes(this.factChunkId, 8, {"char": true});
}
let options = {"be": this.chunkId == "RIFX"};
return byteData.toBytes(this.chunkId, 8, {"char": true}).concat(
byteData.toBytes([this.chunkSize], 32, options),
byteData.toBytes(this.format, 8, {"char": true}),
byteData.toBytes(this.subChunk1Id, 8, {"char": true}),
byteData.toBytes([this.subChunk1Size], 32, options),
byteData.toBytes([this.audioFormat], 16, options),
byteData.toBytes([this.numChannels], 16, options),
byteData.toBytes([this.sampleRate], 32, options),
byteData.toBytes([this.byteRate], 32, options),
byteData.toBytes([this.blockAlign], 16, options),
byteData.toBytes([this.bitsPerSample], 16, options),
factVal,
byteData.toBytes(this.subChunk2Id, 8, {"char": true}),
byteData.toBytes([this.subChunk2Size], 32, options),
this.bytes_);
}
}
module.exports.WaveFile = WaveFile;
{
"name": "wavefile",
"version": "0.4.2",
"version": "0.4.3",
"description": "Read & write wave files with 8, 16, 24, 32 PCM, 32 IEEE & 64-bit data.",

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

"dependencies": {
"bitdepth": "^1.0.0",
"bitdepth": "^1.0.1",
"byte-data": "^0.4.2"

@@ -60,0 +60,0 @@ },

/*
* wavefileheader.js: WaveFileHeader class
* WaveFileHeader class
* A structure representing a WAVE file header.
* Copyright (c) 2017 Rafael da Silva Rocha. MIT License.

@@ -71,16 +72,3 @@ * https://github.com/rochars/wavefile

// TODO bext data
/**
* Header formats.
* @enum {number}
*/
this.headerFormats_ = {
"4": 17,
"8": 1,
"16": 1,
"24": 1,
"32": 1,
"32f": 3,
"64": 3
};
}
}

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