@tensamin/audio 0.1.2 → 0.1.4
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/README.md +218 -30
- package/dist/chunk-AHBRT4RD.mjs +307 -0
- package/dist/chunk-ERJVV5JR.mjs +91 -0
- package/dist/chunk-N553RHTI.mjs +93 -0
- package/dist/chunk-NMHKX64G.mjs +118 -0
- package/dist/chunk-XO6B3D4A.mjs +67 -0
- package/dist/{chunk-FS635GMR.mjs → chunk-YOSTLLCS.mjs} +2 -2
- package/dist/extensibility/plugins.js +110 -32
- package/dist/extensibility/plugins.mjs +3 -3
- package/dist/index.js +463 -97
- package/dist/index.mjs +6 -6
- package/dist/livekit/integration.js +463 -97
- package/dist/livekit/integration.mjs +6 -6
- package/dist/noise-suppression/rnnoise-node.js +42 -14
- package/dist/noise-suppression/rnnoise-node.mjs +1 -1
- package/dist/pipeline/audio-pipeline.js +396 -83
- package/dist/pipeline/audio-pipeline.mjs +5 -5
- package/dist/types.d.mts +118 -10
- package/dist/types.d.ts +118 -10
- package/dist/vad/vad-node.js +68 -18
- package/dist/vad/vad-node.mjs +1 -1
- package/dist/vad/vad-state.d.mts +1 -0
- package/dist/vad/vad-state.d.ts +1 -0
- package/dist/vad/vad-state.js +42 -8
- package/dist/vad/vad-state.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-HFSKQ33X.mjs +0 -38
- package/dist/chunk-JJASCVEW.mjs +0 -59
- package/dist/chunk-QU7E5HBA.mjs +0 -106
- package/dist/chunk-SDTOKWM2.mjs +0 -39
- package/dist/chunk-UMU2KIB6.mjs +0 -68
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
attachProcessingToTrack
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-ERJVV5JR.mjs";
|
|
4
|
+
import "../chunk-AHBRT4RD.mjs";
|
|
5
|
+
import "../chunk-N553RHTI.mjs";
|
|
6
6
|
import "../chunk-OZ7KMC4S.mjs";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-YOSTLLCS.mjs";
|
|
8
|
+
import "../chunk-XO6B3D4A.mjs";
|
|
9
|
+
import "../chunk-NMHKX64G.mjs";
|
|
10
10
|
export {
|
|
11
11
|
attachProcessingToTrack
|
|
12
12
|
};
|
|
@@ -39,32 +39,60 @@ var RNNoisePlugin = class {
|
|
|
39
39
|
async createNode(context, config) {
|
|
40
40
|
const { loadRnnoise, RnnoiseWorkletNode } = await import("@sapphi-red/web-noise-suppressor");
|
|
41
41
|
if (!config?.enabled) {
|
|
42
|
+
console.log("Noise suppression disabled, using passthrough node");
|
|
42
43
|
const pass = context.createGain();
|
|
43
44
|
return pass;
|
|
44
45
|
}
|
|
45
46
|
if (!config?.wasmUrl || !config?.simdUrl || !config?.workletUrl) {
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
const error = new Error(
|
|
48
|
+
`RNNoisePlugin requires 'wasmUrl', 'simdUrl', and 'workletUrl' to be configured. Please download the assets from @sapphi-red/web-noise-suppressor and provide the URLs in the config. Current config: wasmUrl=${config?.wasmUrl}, simdUrl=${config?.simdUrl}, workletUrl=${config?.workletUrl}
|
|
49
|
+
To disable noise suppression, set noiseSuppression.enabled to false.`
|
|
48
50
|
);
|
|
51
|
+
console.error(error.message);
|
|
52
|
+
throw error;
|
|
49
53
|
}
|
|
50
|
-
|
|
51
|
-
this.wasmBuffer
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
try {
|
|
55
|
+
if (!this.wasmBuffer) {
|
|
56
|
+
console.log("Loading RNNoise WASM binary...");
|
|
57
|
+
this.wasmBuffer = await loadRnnoise({
|
|
58
|
+
url: config.wasmUrl,
|
|
59
|
+
simdUrl: config.simdUrl
|
|
60
|
+
});
|
|
61
|
+
console.log("RNNoise WASM loaded successfully");
|
|
62
|
+
}
|
|
63
|
+
} catch (error) {
|
|
64
|
+
const err = new Error(
|
|
65
|
+
`Failed to load RNNoise WASM binary: ${error instanceof Error ? error.message : String(error)}`
|
|
66
|
+
);
|
|
67
|
+
console.error(err);
|
|
68
|
+
throw err;
|
|
55
69
|
}
|
|
56
70
|
const workletUrl = config.workletUrl;
|
|
57
71
|
try {
|
|
58
72
|
await context.audioWorklet.addModule(workletUrl);
|
|
73
|
+
console.log("RNNoise worklet loaded successfully");
|
|
59
74
|
} catch (e) {
|
|
60
|
-
|
|
75
|
+
const error = new Error(
|
|
76
|
+
`Failed to load RNNoise worklet from ${workletUrl}: ${e instanceof Error ? e.message : String(e)}. Ensure the workletUrl points to a valid RNNoise worklet script.`
|
|
77
|
+
);
|
|
78
|
+
console.error(error.message);
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
const node = new RnnoiseWorkletNode(context, {
|
|
83
|
+
wasmBinary: this.wasmBuffer,
|
|
84
|
+
maxChannels: 1
|
|
85
|
+
// Mono for now
|
|
86
|
+
});
|
|
87
|
+
console.log("RNNoise worklet node created successfully");
|
|
88
|
+
return node;
|
|
89
|
+
} catch (error) {
|
|
90
|
+
const err = new Error(
|
|
91
|
+
`Failed to create RNNoise worklet node: ${error instanceof Error ? error.message : String(error)}`
|
|
92
|
+
);
|
|
93
|
+
console.error(err);
|
|
94
|
+
throw err;
|
|
61
95
|
}
|
|
62
|
-
const node = new RnnoiseWorkletNode(context, {
|
|
63
|
-
wasmBinary: this.wasmBuffer,
|
|
64
|
-
maxChannels: 1
|
|
65
|
-
// Mono for now
|
|
66
|
-
});
|
|
67
|
-
return node;
|
|
68
96
|
}
|
|
69
97
|
};
|
|
70
98
|
// Annotate the CommonJS export names for ESM import in node:
|