Module 207898

964 characters · in cc72bd823dbd35d2.js
Dependencies
Required by (1)
Lazily required by (0)none
Requires (0)none
Lazily requires (0)none
Source Raw
function(r){r.exports=function(r,e){e=e||{};var t,a,o,f,i,u,l,s,c,v=r.numberOfChannels,h=r.sampleRate,d=e.float32?3:1;return t=2===v?function(r,n){for(var e=r.length+n.length,t=new Float32Array(e),a=0,o=0;a<e;)t[a++]=r[o],t[a++]=n[o],o++;return t}(r.getChannelData(0),r.getChannelData(1)):r.getChannelData(0),a=d,o=h,l=(f=v)*(u=(i=3===d?32:16)/8),n(c=new DataView(s=new ArrayBuffer(44+t.length*u)),0,"RIFF"),c.setUint32(4,36+t.length*u,!0),n(c,8,"WAVE"),n(c,12,"fmt "),c.setUint32(16,16,!0),c.setUint16(20,a,!0),c.setUint16(22,f,!0),c.setUint32(24,o,!0),c.setUint32(28,o*l,!0),c.setUint16(32,l,!0),c.setUint16(34,i,!0),n(c,36,"data"),c.setUint32(40,t.length*u,!0),1===a?function(r,n,e){for(var t=0;t<e.length;t++,n+=2){var a=Math.max(-1,Math.min(1,e[t]));r.setInt16(n,a<0?32768*a:32767*a,!0)}}(c,44,t):function(r,n,e){for(var t=0;t<e.length;t++,n+=4)r.setFloat32(n,e[t],!0)}(c,44,t),s};function n(r,n,e){for(var t=0;t<e.length;t++)r.setUint8(n+t,e.charCodeAt(t))}}