@whereby.com/audio-denoiser 1.0.36 → 1.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -34,7 +34,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
34
34
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
35
35
  };
36
36
 
37
- const CDN_BASE_URL = "https://cdn.srv.whereby.com/audio-denoiser/v1-0-36";
37
+ const CDN_BASE_URL = "https://cdn.srv.whereby.com/audio-denoiser/v1-0-38";
38
38
  const getAssetUrl = (path) => {
39
39
  {
40
40
  return `${CDN_BASE_URL}/${path}`;
package/dist/index.mjs CHANGED
@@ -32,7 +32,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
32
32
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
33
33
  };
34
34
 
35
- const CDN_BASE_URL = "https://cdn.srv.whereby.com/audio-denoiser/v1-0-36";
35
+ const CDN_BASE_URL = "https://cdn.srv.whereby.com/audio-denoiser/v1-0-38";
36
36
  const getAssetUrl = (path) => {
37
37
  {
38
38
  return `${CDN_BASE_URL}/${path}`;
@@ -32,7 +32,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
32
32
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
33
33
  };
34
34
 
35
- const CDN_BASE_URL = "https://cdn.srv.whereby.com/audio-denoiser/v1-0-36";
35
+ const CDN_BASE_URL = "https://cdn.srv.whereby.com/audio-denoiser/v1-0-38";
36
36
  const getAssetUrl = (path) => {
37
37
  {
38
38
  return `${CDN_BASE_URL}/${path}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whereby.com/audio-denoiser",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "description": "Audio denoiser (noise suppression) for microphone streams",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,16 +28,16 @@
28
28
  ],
29
29
  "devDependencies": {
30
30
  "@rollup/plugin-url": "^8.0.2",
31
- "rimraf": "^5.0.5",
32
- "rollup": "^4.22.4",
33
31
  "@whereby.com/eslint-config": "0.1.0",
34
32
  "@whereby.com/jest-config": "0.1.0",
35
33
  "@whereby.com/prettier-config": "0.1.0",
36
34
  "@whereby.com/rollup-config": "0.1.1",
37
- "@whereby.com/tsconfig": "0.1.0"
35
+ "@whereby.com/tsconfig": "0.1.0",
36
+ "rimraf": "^5.0.5",
37
+ "rollup": "^4.22.4"
38
38
  },
39
39
  "dependencies": {
40
- "@whereby.com/media": "11.4.2"
40
+ "@whereby.com/media": "11.5.0"
41
41
  },
42
42
  "prettier": "@whereby.com/prettier-config",
43
43
  "scripts": {
@@ -1,70 +0,0 @@
1
- let instance;
2
- let heapFloat32;
3
-
4
- class DenoiserProcessor extends AudioWorkletProcessor {
5
- constructor(options) {
6
- super({
7
- ...options,
8
- numberOfInputs: 1,
9
- numberOfOutputs: 1,
10
- outputChannelCount: [1],
11
- });
12
-
13
- this.alive = true;
14
-
15
- (async () => {
16
- try {
17
- if (!instance) {
18
- const wasmModule = (await WebAssembly.instantiate(options.processorOptions.wasmBuffer)).module;
19
- instance = new WebAssembly.Instance(wasmModule).exports;
20
- heapFloat32 = new Float32Array(instance.memory.buffer);
21
- }
22
- this.state = instance.newState();
23
- this.active = true;
24
- this.port.onmessage = ({ data: keepalive }) => {
25
- if (this.alive) {
26
- if (!keepalive) {
27
- this.active = false;
28
- this.alive = false;
29
- instance.deleteState(this.state);
30
- this.state = undefined;
31
- }
32
- }
33
- };
34
- } catch (ex) {
35
- this.port.postMessage({ error: ex.toString() });
36
- }
37
- })();
38
- }
39
-
40
- process([input], [output]) {
41
- if (this.active) {
42
- if (!input.length) {
43
- return true;
44
- }
45
- // ensure the state is truthy before proceeding, otherwise just passthrough audio
46
- if (!this.state) {
47
- try {
48
- output[0].set(input[0]);
49
- } catch (_) {}
50
- return true;
51
- }
52
-
53
- heapFloat32.set(input[0], instance.getInput(this.state) / 4);
54
- const o = output[0];
55
- const ptr4 = instance.pipe(this.state, o.length) / 4;
56
- if (ptr4) o.set(heapFloat32.subarray(ptr4, ptr4 + o.length));
57
- return true;
58
- }
59
- if (this.alive) {
60
- // not yet loaded, or error initalizing wasm, so try to passthrough audio
61
- try {
62
- output[0].set(input[0]);
63
- } catch (_) {}
64
- return true;
65
- }
66
- return false; // we signal it is ok to destroy the processor
67
- }
68
- }
69
-
70
- registerProcessor("denoiser", DenoiserProcessor);