-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrnnoise-processor.min.js
More file actions
2 lines (2 loc) · 15.1 KB
/
rnnoise-processor.min.js
File metadata and controls
2 lines (2 loc) · 15.1 KB
1
2
window.JitsiMeetJS=window.JitsiMeetJS||{},window.JitsiMeetJS.app=window.JitsiMeetJS.app||{},window.JitsiMeetJS.app.effects=window.JitsiMeetJS.app.effects||{},window.JitsiMeetJS.app.effects.rnnoise=function(n){var t={};function e(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return n[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=n,e.c=t,e.d=function(n,t,r){e.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:r})},e.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},e.t=function(n,t){if(1&t&&(n=e(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var i in n)e.d(r,i,function(t){return n[t]}.bind(null,i));return r},e.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,"a",t),t},e.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},e.p="/libs/",e(e.s=4)}([function(n,t){var e,r,i=n.exports={};function o(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function a(n){if(e===setTimeout)return setTimeout(n,0);if((e===o||!e)&&setTimeout)return e=setTimeout,setTimeout(n,0);try{return e(n,0)}catch(t){try{return e.call(null,n,0)}catch(t){return e.call(this,n,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:o}catch(n){e=o}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(n){r=u}}();var s,c=[],f=!1,l=-1;function p(){f&&s&&(f=!1,s.length?c=s.concat(c):l=-1,c.length&&m())}function m(){if(!f){var n=a(p);f=!0;for(var t=c.length;t;){for(s=c,c=[];++l<t;)s&&s[l].run();l=-1,t=c.length}s=null,f=!1,function(n){if(r===clearTimeout)return clearTimeout(n);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(n);try{r(n)}catch(t){try{return r.call(null,n)}catch(t){return r.call(this,n)}}}(n)}}function d(n,t){this.fun=n,this.array=t}function h(){}i.nextTick=function(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];c.push(new d(n,t)),1!==c.length||f||a(m)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=h,i.addListener=h,i.once=h,i.off=h,i.removeListener=h,i.removeAllListeners=h,i.emit=h,i.prependListener=h,i.prependOnceListener=h,i.listeners=function(n){return[]},i.binding=function(n){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(n){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(n,t,e){"use strict";(function(n,r){var i,o=(i="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t){t=void 0!==(t=t||{})?t:{};var o,u={};for(o in t)t.hasOwnProperty(o)&&(u[o]=t[o]);t.arguments=[],t.thisProgram="./this.program",t.quit=function(n,t){throw t},t.preRun=[],t.postRun=[];var a=!1,s=!1,c=!1,f=!1;a="object"==typeof window,s="function"==typeof importScripts,c="object"==typeof n&&!a&&!s,f=!a&&!c&&!s;var l,p,m="";function d(n){return t.locateFile?t.locateFile(n,m):m+n}c?(m=r+"/",t.read=function(n,t){var r;return l||(l=e(2)),p||(p=e(3)),n=p.normalize(n),r=l.readFileSync(n),t?r:r.toString()},t.readBinary=function(n){var e=t.read(n,!0);return e.buffer||(e=new Uint8Array(e)),g(e.buffer),e},n.argv.length>1&&(t.thisProgram=n.argv[1].replace(/\\/g,"/")),t.arguments=n.argv.slice(2),n.on("uncaughtException",(function(n){if(!(n instanceof bn))throw n})),n.on("unhandledRejection",gn),t.quit=function(t){n.exit(t)},t.inspect=function(){return"[Emscripten Module object]"}):f?("undefined"!=typeof read&&(t.read=function(n){return read(n)}),t.readBinary=function(n){var t;return"function"==typeof readbuffer?new Uint8Array(readbuffer(n)):(g("object"==typeof(t=read(n,"binary"))),t)},"undefined"!=typeof scriptArgs?t.arguments=scriptArgs:void 0!==arguments&&(t.arguments=arguments),"function"==typeof quit&&(t.quit=function(n){quit(n)})):(a||s)&&(s?m=self.location.href:document.currentScript&&(m=document.currentScript.src),i&&(m=i),m=0!==m.indexOf("blob:")?m.substr(0,m.lastIndexOf("/")+1):"",t.read=function(n){var t=new XMLHttpRequest;return t.open("GET",n,!1),t.send(null),t.responseText},s&&(t.readBinary=function(n){var t=new XMLHttpRequest;return t.open("GET",n,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),t.readAsync=function(n,t,e){var r=new XMLHttpRequest;r.open("GET",n,!0),r.responseType="arraybuffer",r.onload=function(){200==r.status||0==r.status&&r.response?t(r.response):e()},r.onerror=e,r.send(null)},t.setWindowTitle=function(n){document.title=n});var h=t.print||("undefined"!=typeof console?console.log.bind(console):"undefined"!=typeof print?print:null),y=t.printErr||("undefined"!=typeof printErr?printErr:"undefined"!=typeof console&&console.warn.bind(console)||h);for(o in u)u.hasOwnProperty(o)&&(t[o]=u[o]);u=void 0;var w,b={"f64-rem":function(n,t){return n%t},debugger:function(){}};new Array(0),"object"!=typeof WebAssembly&&y("no native wasm support detected");var _=!1;function g(n,t){n||gn("Assertion failed: "+t)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf8"),"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var v,A,T,S,P=65536;function R(n,t){return n%t>0&&(n+=t-n%t),n}function M(){t.HEAP8=A=new Int8Array(v),t.HEAP16=new Int16Array(v),t.HEAP32=S=new Int32Array(v),t.HEAPU8=T=new Uint8Array(v),t.HEAPU16=new Uint16Array(v),t.HEAPU32=new Uint32Array(v),t.HEAPF32=new Float32Array(v),t.HEAPF64=new Float64Array(v)}var E=5338208,I=95072,O=5242880,x=t.TOTAL_MEMORY||16777216;function L(n){for(;n.length>0;){var e=n.shift();if("function"!=typeof e){var r=e.func;"number"==typeof r?void 0===e.arg?t.dynCall_v(r):t.dynCall_vi(r,e.arg):r(void 0===e.arg?null:e.arg)}else e()}}x<O&&y("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+x+"! (TOTAL_STACK="+O+")"),t.buffer?v=t.buffer:"object"==typeof WebAssembly&&"function"==typeof WebAssembly.Memory?(w=new WebAssembly.Memory({initial:x/P}),v=w.buffer):v=new ArrayBuffer(x),M(),S[I>>2]=E;var j=[],C=[],W=[],B=[],D=!1;function J(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)k(t.preRun.shift());L(j)}function F(){D||(D=!0,L(C))}function H(){L(W)}function V(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)q(t.postRun.shift());L(B)}function k(n){j.unshift(n)}function q(n){B.unshift(n)}var N=0,U=null,z=null;function K(n){N++,t.monitorRunDependencies&&t.monitorRunDependencies(N)}function G(n){if(N--,t.monitorRunDependencies&&t.monitorRunDependencies(N),0==N&&(null!==U&&(clearInterval(U),U=null),z)){var e=z;z=null,e()}}t.preloadedImages={},t.preloadedAudios={};var X="data:application/octet-stream;base64,";function Y(n){return String.prototype.startsWith?n.startsWith(X):0===n.indexOf(X)}var $="rnnoise.wasm";function Q(){try{if(t.wasmBinary)return new Uint8Array(t.wasmBinary);if(t.readBinary)return t.readBinary($);throw"both async and sync fetching of the wasm failed"}catch(n){gn(n)}}function Z(){return t.wasmBinary||!a&&!s||"function"!=typeof fetch?new Promise((function(n,t){n(Q())})):fetch($,{credentials:"same-origin"}).then((function(n){if(!n.ok)throw"failed to load wasm binary file at '"+$+"'";return n.arrayBuffer()})).catch((function(){return Q()}))}function nn(n){var e={env:n,global:{NaN:NaN,Infinity:1/0},"global.Math":Math,asm2wasm:b};function r(n,e){var r=n.exports;t.asm=r,G()}if(K(),t.instantiateWasm)try{return t.instantiateWasm(e,r)}catch(n){return y("Module.instantiateWasm callback failed with error: "+n),!1}function i(n){r(n.instance)}function o(n){Z().then((function(n){return WebAssembly.instantiate(n,e)})).then(n,(function(n){y("failed to asynchronously prepare wasm: "+n),gn(n)}))}return t.wasmBinary||"function"!=typeof WebAssembly.instantiateStreaming||Y($)||"function"!=typeof fetch?o(i):WebAssembly.instantiateStreaming(fetch($,{credentials:"same-origin"}),e).then(i,(function(n){y("wasm streaming compile failed: "+n),y("falling back to ArrayBuffer instantiation"),o(i)})),{}}function tn(){return A.length}function en(n){gn("OOM")}function rn(n){n=R(n,65536);var t=v.byteLength;try{return-1!==w.grow((n-t)/65536)?v=w.buffer:null}catch(n){return null}}function on(n){var t=tn();if(n>2147418112)return!1;for(var e=Math.max(t,16777216);e<n;)e=e<=536870912?R(2*e,65536):Math.min(R((3*e+2147483648)/4,65536),2147418112);var r=rn(e);return!(!r||r.byteLength!=e||(M(),0))}function un(n){return Math.log(n)/Math.LN10}function an(n){return un(n)}function sn(n){var t=cn,e=t.LLVM_SAVEDSTACKS[n];t.LLVM_SAVEDSTACKS.splice(n,1),yn(e)}function cn(){var n=cn;return n.LLVM_SAVEDSTACKS||(n.LLVM_SAVEDSTACKS=[]),n.LLVM_SAVEDSTACKS.push(wn()),n.LLVM_SAVEDSTACKS.length-1}function fn(){gn("trap!")}function ln(n,t,e){T.set(T.subarray(t,t+e),n)}function pn(n){return t.___errno_location&&(S[t.___errno_location()>>2]=n),n}Y($)||($=d($)),t.asm=function(n,t,e){return t.memory=w,t.table=new WebAssembly.Table({initial:0,maximum:0,element:"anyfunc"}),t.__memory_base=1024,t.__table_base=0,nn(t)};var mn={},dn={e:pn,j:tn,i:ln,h:on,g:an,d:sn,c:cn,b:fn,f:en,a:I},hn=t.asm(mn,dn,v);t.asm=hn,t.___errno_location=function(){return t.asm.k.apply(null,arguments)},t._free=function(){return t.asm.l.apply(null,arguments)},t._malloc=function(){return t.asm.m.apply(null,arguments)},t._rnnoise_create=function(){return t.asm.n.apply(null,arguments)},t._rnnoise_destroy=function(){return t.asm.o.apply(null,arguments)},t._rnnoise_init=function(){return t.asm.p.apply(null,arguments)},t._rnnoise_process_frame=function(){return t.asm.q.apply(null,arguments)};var yn=t.stackRestore=function(){return t.asm.r.apply(null,arguments)},wn=t.stackSave=function(){return t.asm.s.apply(null,arguments)};function bn(n){this.name="ExitStatus",this.message="Program terminated with exit("+n+")",this.status=n}function _n(n){function e(){t.calledRun||(t.calledRun=!0,_||(F(),H(),t.onRuntimeInitialized&&t.onRuntimeInitialized(),V()))}n=n||t.arguments,N>0||(J(),N>0||t.calledRun||(t.setStatus?(t.setStatus("Running..."),setTimeout((function(){setTimeout((function(){t.setStatus("")}),1),e()}),1)):e()))}function gn(n){throw t.onAbort&&t.onAbort(n),void 0!==n?(h(n),y(n),n=JSON.stringify(n)):n="",_=!0,"abort("+n+"). Build with -s ASSERTIONS=1 for more info."}if(t.asm=hn,t.then=function(n){if(t.calledRun)n(t);else{var e=t.onRuntimeInitialized;t.onRuntimeInitialized=function(){e&&e(),n(t)}}return t},bn.prototype=new Error,bn.prototype.constructor=bn,z=function n(){t.calledRun||_n(),t.calledRun||(z=n)},t.run=_n,t.abort=gn,t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return t.noExitRuntime=!0,_n(),t});t.a=o}).call(this,e(0),"/")},function(n,t){},function(n,t,e){(function(n){function e(n,t){for(var e=0,r=n.length-1;r>=0;r--){var i=n[r];"."===i?n.splice(r,1):".."===i?(n.splice(r,1),e++):e&&(n.splice(r,1),e--)}if(t)for(;e--;e)n.unshift("..");return n}function r(n,t){if(n.filter)return n.filter(t);for(var e=[],r=0;r<n.length;r++)t(n[r],r,n)&&e.push(n[r]);return e}t.resolve=function(){for(var t="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var u=o>=0?arguments[o]:n.cwd();if("string"!=typeof u)throw new TypeError("Arguments to path.resolve must be strings");u&&(t=u+"/"+t,i="/"===u.charAt(0))}return(i?"/":"")+(t=e(r(t.split("/"),(function(n){return!!n})),!i).join("/"))||"."},t.normalize=function(n){var o=t.isAbsolute(n),u="/"===i(n,-1);return(n=e(r(n.split("/"),(function(n){return!!n})),!o).join("/"))||o||(n="."),n&&u&&(n+="/"),(o?"/":"")+n},t.isAbsolute=function(n){return"/"===n.charAt(0)},t.join=function(){var n=Array.prototype.slice.call(arguments,0);return t.normalize(r(n,(function(n,t){if("string"!=typeof n)throw new TypeError("Arguments to path.join must be strings");return n})).join("/"))},t.relative=function(n,e){function r(n){for(var t=0;t<n.length&&""===n[t];t++);for(var e=n.length-1;e>=0&&""===n[e];e--);return t>e?[]:n.slice(t,e-t+1)}n=t.resolve(n).substr(1),e=t.resolve(e).substr(1);for(var i=r(n.split("/")),o=r(e.split("/")),u=Math.min(i.length,o.length),a=u,s=0;s<u;s++)if(i[s]!==o[s]){a=s;break}var c=[];for(s=a;s<i.length;s++)c.push("..");return(c=c.concat(o.slice(a))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(n){if("string"!=typeof n&&(n+=""),0===n.length)return".";for(var t=n.charCodeAt(0),e=47===t,r=-1,i=!0,o=n.length-1;o>=1;--o)if(47===(t=n.charCodeAt(o))){if(!i){r=o;break}}else i=!1;return-1===r?e?"/":".":e&&1===r?"/":n.slice(0,r)},t.basename=function(n,t){var e=function(n){"string"!=typeof n&&(n+="");var t,e=0,r=-1,i=!0;for(t=n.length-1;t>=0;--t)if(47===n.charCodeAt(t)){if(!i){e=t+1;break}}else-1===r&&(i=!1,r=t+1);return-1===r?"":n.slice(e,r)}(n);return t&&e.substr(-1*t.length)===t&&(e=e.substr(0,e.length-t.length)),e},t.extname=function(n){"string"!=typeof n&&(n+="");for(var t=-1,e=0,r=-1,i=!0,o=0,u=n.length-1;u>=0;--u){var a=n.charCodeAt(u);if(47!==a)-1===r&&(i=!1,r=u+1),46===a?-1===t?t=u:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){e=u+1;break}}return-1===t||-1===r||0===o||1===o&&t===r-1&&t===e+1?"":n.slice(t,r)};var i="b"==="ab".substr(-1)?function(n,t,e){return n.substr(t,e)}:function(n,t,e){return t<0&&(t=n.length+t),n.substr(t,e)}}).call(this,e(0))},function(n,t,e){"use strict";e.r(t);var r=e(1);const i=480,o=4*i,u=44100;class a{constructor(n){var t,e,r;r=!1,(e="_destroyed")in(t=this)?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r;try{if(this._wasmInterface=n,this._wasmPcmInput=this._wasmInterface._malloc(o),!this._wasmPcmInput)throw Error("Failed to create wasm input memory buffer!");if(this._wasmPcmOutput=this._wasmInterface._malloc(o),!this._wasmPcmOutput)throw n._free(this._wasmPcmInput),Error("Failed to create wasm output memory buffer!");this._wasmPcmInputF32Index=this._wasmPcmInput/4,this._context=this._wasmInterface._rnnoise_create()}catch(n){throw this._releaseWasmResources(),n}}_copyPCMSampleToWasmBuffer(n){this._wasmInterface.HEAPF32.set(n,this._wasmPcmInputF32Index)}_convertTo16BitPCM(n){for(const[t,e]of n.entries())n[t]=32767*e}_releaseWasmResources(){this._wasmPcmInput&&(this._wasmInterface._free(this._wasmPcmInput),this._wasmPcmInput=null),this._wasmPcmOutput&&(this._wasmInterface._free(this._wasmPcmOutput),this._wasmPcmOutput=null),this._context&&(this._wasmInterface._rnnoise_destroy(this._context),this._context=null)}getSampleLength(){return i}getRequiredPCMFrequency(){return u}destroy(){this._destroyed||(this._releaseWasmResources(),this._destroyed=!0)}calculateAudioFrameVAD(n){if(this._destroyed)throw new Error("RnnoiseProcessor instance is destroyed, please create another one!");const t=n.length;if(t!==i)throw new Error(`Rnnoise can only process PCM frames of 480 samples! Input sample was:${t}`);return this._convertTo16BitPCM(n),this._copyPCMSampleToWasmBuffer(n),this._wasmInterface._rnnoise_process_frame(this._context,this._wasmPcmOutput,this._wasmPcmInput)}}let s,c;function f(){return c||(c=new Promise((n,t)=>{s=Object(r.a)({onRuntimeInitialized(){n()},onAbort(n){t(n)}})})),c.then(()=>new a(s))}e.d(t,"createRnnoiseProcessor",(function(){return f})),e.d(t,"RNNOISE_SAMPLE_LENGTH",(function(){return i}))}]);
//# sourceMappingURL=rnnoise-processor.min.map