New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@100mslive/hms-noise-suppression

Package Overview
Dependencies
Maintainers
16
Versions
242
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@100mslive/hms-noise-suppression - npm Package Compare versions

Comparing version

to
0.1.4-5

src/public/worklet/bypass-processor.js

4

dist/hms-noise-suppression.cjs.development.js

@@ -807,4 +807,4 @@ 'use strict';

var BASE_URL = "https://unpkg.com/" + pkg.name + "/public";
var PROCESSOR_FILE = 'worklet/bypass-processor.js';
var BASE_URL = "https://unpkg.com/" + pkg.name + "/src/";
var PROCESSOR_FILE = 'public/worklet/bypass-processor.js';
var path = BASE_URL + "/" + PROCESSOR_FILE; //The buffer size in units of sample-frames, it will be in power of 2.

@@ -811,0 +811,0 @@ //If specified, the bufferSize must be one of the following values: 256, 512, 1024, 2048, 4096, 8192, 16384

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@100mslive/hms-video");function e(t,e,r,n,o,i,s){try{var a=t[i](s),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function r(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var s=t.apply(r,n);function a(t){e(s,o,i,a,c,"next",t)}function c(t){e(s,o,i,a,c,"throw",t)}a(void 0)}))}}var n,o=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",s=n.toStringTag||"@@toStringTag";function a(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=Object.create((e&&e.prototype instanceof f?e:f).prototype),i=new E(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var a=N(s,r);if(a){if(a===h)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,i),o}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h={};function f(){}function p(){}function l(){}var d={};a(d,o,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(L([])));g&&g!==e&&r.call(g,o)&&(d=g);var y=l.prototype=f.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(o,i){function s(){return new e((function(n,s){!function n(o,i,s,a){var c=u(t[o],t,i);if("throw"!==c.type){var h=c.arg,f=h.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(f).then((function(t){h.value=t,s(h)}),(function(t){return n("throw",t,s,a)}))}a(c.arg)}(o,i,n,s)}))}return n=n?n.then(s,s):s()}}function N(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,N(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function b(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function L(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:_}}function _(){return{value:void 0,done:!0}}return p.prototype=l,a(y,"constructor",l),a(l,"constructor",p),p.displayName=a(l,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,a(t,s,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},m(w.prototype),a(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var s=new w(c(e,r,n,o),i);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},m(y),a(y,s,"Generator"),a(y,o,(function(){return this})),a(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=L,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return s.type="throw",s.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var a=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),b(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;b(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(n={exports:{}}),n.exports),i="NoiseSuppressionProcessor",s=require("../package.json"),a="https://unpkg.com/"+s.name+"/public/worklet/bypass-processor.js";exports.HMSNoiseSuppressionPlugin=function(){function e(){var t=this;this.demoCode=function(){var e=r(o.mark((function e(r){return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.log(i,"adding processor"),e.next=3,r.audioWorklet.addModule(a);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.suppressNoise=!0,this.nodesConnected=!1,this.nodesCreated=!1,this.module=null}var n=e.prototype;return n.init=function(){var t=r(o.mark((function t(){return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:console.time("init"),this.addRandomNoise(!1),console.timeEnd("init");case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),n.isSupported=function(){return-1!=navigator.userAgent.indexOf("Chrome")||-1!=navigator.userAgent.indexOf("Firefox")||-1!=navigator.userAgent.indexOf("Edg")},n.getName=function(){return s.name},n.getPluginType=function(){return t.HMSAudioPluginType.TRANSFORM},n.stop=function(){this.setNoiseSuppression(!1),this.processingNode&&this.processingNode.disconnect()},n.setNoiseSuppression=function(t){this.suppressNoise=t},n.removeNoise=function(t,e){for(var r=e.ptr,n=e.st,o=0;o<480;o++)e.HEAPF32[(r>>2)+o]=32768*t[o];e._rnnoise_process_frame(n,r,r);for(var i=0;i<480;i++)t[i]=e.HEAPF32[(r>>2)+i]/32768},n.processAudioTrack=function(){var t=r(o.mark((function t(e,r){var n,s,a,c=this;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}throw new Error("Audio context is not created");case 2:if(r){t.next=4;break}throw new Error("source node is not defined");case 4:return t.next=6,this.demoCode(e);case 6:return this.module&&(this.nodesCreated||(this.log(i,"nodes created"),this.createNodes(e),this.nodesCreated=!0),this.nodesConnected||(this.log(i,"nodes connected"),this.connectAudioNodes(e,r),this.nodesConnected=!0),this.addNoise&&this.processNoiseNode(),n=[],s=[],a=[],this.log(i,this.suppressNoise),this.processingNode.onaudioprocess=function(t){console.time("process");for(var e=t.inputBuffer.getChannelData(0),r=t.outputBuffer.getChannelData(0),o=0;o<512;o++)s.push(e[o]);for(;s.length>=480;){for(var i=0;i<480;i++)n[i]=s.shift();c.suppressNoise&&c.removeNoise(n,c.module);for(var u=0;u<480;u++)a.push(n[u])}if(!(a.length<512)){for(var h=0;h<512;h++)r[h]=a.shift();console.timeEnd("process")}}),t.abrupt("return",this.processingNode);case 8:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.log=function(t){for(var e,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];(e=console).info.apply(e,[t].concat(n))},n.connectAudioNodes=function(t,e){this.addNoise&&t?(e.connect(this.noiseNode),this.noiseNode.connect(this.processingNode)):e.connect(this.processingNode)},n.createNodes=function(t){t?(this.processingNode=t.createScriptProcessor(512,1,1),this.addNoise&&(this.noiseNode=t.createScriptProcessor(512,1,1))):this.log(i,"audio context is null")},n.addRandomNoise=function(t){this.addNoise=t},n.processNoiseNode=function(){var t=this.addNoise;this.noiseNode.onaudioprocess=function(e){this.input=e.inputBuffer.getChannelData(0),this.output=e.outputBuffer.getChannelData(0);for(var r=0;r<this.input.length;r++)this.output[r]=t?this.input[r]+Math.random()/100:this.input[r]}},e}();
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@100mslive/hms-video");function e(t,e,r,n,o,i,s){try{var a=t[i](s),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function r(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var s=t.apply(r,n);function a(t){e(s,o,i,a,c,"next",t)}function c(t){e(s,o,i,a,c,"throw",t)}a(void 0)}))}}var n,o=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",s=n.toStringTag||"@@toStringTag";function a(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=Object.create((e&&e.prototype instanceof f?e:f).prototype),i=new E(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var a=N(s,r);if(a){if(a===h)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,i),o}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h={};function f(){}function p(){}function l(){}var d={};a(d,o,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(L([])));g&&g!==e&&r.call(g,o)&&(d=g);var y=l.prototype=f.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(o,i){function s(){return new e((function(n,s){!function n(o,i,s,a){var c=u(t[o],t,i);if("throw"!==c.type){var h=c.arg,f=h.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(f).then((function(t){h.value=t,s(h)}),(function(t){return n("throw",t,s,a)}))}a(c.arg)}(o,i,n,s)}))}return n=n?n.then(s,s):s()}}function N(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,N(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function b(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function L(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:_}}function _(){return{value:void 0,done:!0}}return p.prototype=l,a(y,"constructor",l),a(l,"constructor",p),p.displayName=a(l,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,a(t,s,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},m(w.prototype),a(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var s=new w(c(e,r,n,o),i);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},m(y),a(y,s,"Generator"),a(y,o,(function(){return this})),a(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=L,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return s.type="throw",s.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var a=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),b(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;b(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(n={exports:{}}),n.exports),i="NoiseSuppressionProcessor",s=require("../package.json"),a="https://unpkg.com/"+s.name+"/src//public/worklet/bypass-processor.js";exports.HMSNoiseSuppressionPlugin=function(){function e(){var t=this;this.demoCode=function(){var e=r(o.mark((function e(r){return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.log(i,"adding processor"),e.next=3,r.audioWorklet.addModule(a);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.suppressNoise=!0,this.nodesConnected=!1,this.nodesCreated=!1,this.module=null}var n=e.prototype;return n.init=function(){var t=r(o.mark((function t(){return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:console.time("init"),this.addRandomNoise(!1),console.timeEnd("init");case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),n.isSupported=function(){return-1!=navigator.userAgent.indexOf("Chrome")||-1!=navigator.userAgent.indexOf("Firefox")||-1!=navigator.userAgent.indexOf("Edg")},n.getName=function(){return s.name},n.getPluginType=function(){return t.HMSAudioPluginType.TRANSFORM},n.stop=function(){this.setNoiseSuppression(!1),this.processingNode&&this.processingNode.disconnect()},n.setNoiseSuppression=function(t){this.suppressNoise=t},n.removeNoise=function(t,e){for(var r=e.ptr,n=e.st,o=0;o<480;o++)e.HEAPF32[(r>>2)+o]=32768*t[o];e._rnnoise_process_frame(n,r,r);for(var i=0;i<480;i++)t[i]=e.HEAPF32[(r>>2)+i]/32768},n.processAudioTrack=function(){var t=r(o.mark((function t(e,r){var n,s,a,c=this;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}throw new Error("Audio context is not created");case 2:if(r){t.next=4;break}throw new Error("source node is not defined");case 4:return t.next=6,this.demoCode(e);case 6:return this.module&&(this.nodesCreated||(this.log(i,"nodes created"),this.createNodes(e),this.nodesCreated=!0),this.nodesConnected||(this.log(i,"nodes connected"),this.connectAudioNodes(e,r),this.nodesConnected=!0),this.addNoise&&this.processNoiseNode(),n=[],s=[],a=[],this.log(i,this.suppressNoise),this.processingNode.onaudioprocess=function(t){console.time("process");for(var e=t.inputBuffer.getChannelData(0),r=t.outputBuffer.getChannelData(0),o=0;o<512;o++)s.push(e[o]);for(;s.length>=480;){for(var i=0;i<480;i++)n[i]=s.shift();c.suppressNoise&&c.removeNoise(n,c.module);for(var u=0;u<480;u++)a.push(n[u])}if(!(a.length<512)){for(var h=0;h<512;h++)r[h]=a.shift();console.timeEnd("process")}}),t.abrupt("return",this.processingNode);case 8:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.log=function(t){for(var e,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];(e=console).info.apply(e,[t].concat(n))},n.connectAudioNodes=function(t,e){this.addNoise&&t?(e.connect(this.noiseNode),this.noiseNode.connect(this.processingNode)):e.connect(this.processingNode)},n.createNodes=function(t){t?(this.processingNode=t.createScriptProcessor(512,1,1),this.addNoise&&(this.noiseNode=t.createScriptProcessor(512,1,1))):this.log(i,"audio context is null")},n.addRandomNoise=function(t){this.addNoise=t},n.processNoiseNode=function(){var t=this.addNoise;this.noiseNode.onaudioprocess=function(e){this.input=e.inputBuffer.getChannelData(0),this.output=e.outputBuffer.getChannelData(0);for(var r=0;r<this.input.length;r++)this.output[r]=t?this.input[r]+Math.random()/100:this.input[r]}},e}();

@@ -803,4 +803,4 @@ import { HMSAudioPluginType } from '@100mslive/hms-video';

var BASE_URL = "https://unpkg.com/" + pkg.name + "/public";
var PROCESSOR_FILE = 'worklet/bypass-processor.js';
var BASE_URL = "https://unpkg.com/" + pkg.name + "/src/";
var PROCESSOR_FILE = 'public/worklet/bypass-processor.js';
var path = BASE_URL + "/" + PROCESSOR_FILE; //The buffer size in units of sample-frames, it will be in power of 2.

@@ -807,0 +807,0 @@ //If specified, the bufferSize must be one of the following values: 256, 512, 1024, 2048, 4096, 8192, 16384

{
"version": "0.1.4-4",
"version": "0.1.4-5",
"license": "MIT",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

@@ -8,4 +8,4 @@ // @ts-ignore

const pkg = require('../package.json');
const BASE_URL = `https://unpkg.com/${pkg.name}/public`;
const PROCESSOR_FILE = 'worklet/bypass-processor.js';
const BASE_URL = `https://unpkg.com/${pkg.name}/src/`;
const PROCESSOR_FILE = 'public/worklet/bypass-processor.js';
const path = BASE_URL + "/" + PROCESSOR_FILE;

@@ -12,0 +12,0 @@