瀏覽代碼

feat(ns) update Krisp to latest version

* feat(noise-suppression): Add support for BVC model

* feat(noise-suppression): Add support for extended BVC devices list

This commit adds support for extending the list of allowed BVC devices in the noise suppression feature. It introduces a new file, `bvc-allowed-ext.txt`, which can be used to include additional BVC supported devices.

* fix(noise-suppression): reuse the existing audioStream for Krisp initialization

* update krisp configuration

* refactor(krisp): Update Krisp JS SDK version and noise suppression configuration

* refactor(config): update config default values, add the enabled flad in INoiseSuppressionConfig
factor2
Ashot Hovhannisyan 11 月之前
父節點
當前提交
49cf63213d
No account linked to committer's email address

+ 34
- 3
config.js 查看文件

@@ -209,14 +209,45 @@ var config = {
209 209
     // installation. Specifically, these files are needed:
210 210
     //   - https://meet.example.com/libs/krisp/krisp.mjs
211 211
     //   - https://meet.example.com/libs/krisp/models/model_8.kw
212
-    //   - https://meet.example.com/libs/krisp/models/model_16.kw
213
-    //   - https://meet.example.com/libs/krisp/models/model_32.kw
214
-    // NOTE: Krisp JS SDK v1.0.9 was tested.
212
+    //   - https://meet.example.com/libs/krisp/models/model_nc.kw
213
+    //   - https://meet.example.com/libs/krisp/models/model_bvc.kw
214
+    //   - https://meet.example.com/libs/krisp/assets/bvc-allowed.txt
215
+    //     In case when you have known BVC supported devices and you want to extend allowed devices list
216
+    //   - https://meet.example.com/libs/krisp/assets/bvc-allowed-ext.txt
217
+    //     In case when you have known BVC supported devices and you want to extend allowed devices list
218
+    //   - https://meet.example.com/libs/krisp/models/model_inbound_8.kw
219
+    //   - https://meet.example.com/libs/krisp/models/model_inbound_16.kw
220
+    //     In case when you want to use inbound noise suppression models
221
+    // NOTE: Krisp JS SDK v2.0.0 was tested.
215 222
     // noiseSuppression: {
216 223
     //     krisp: {
217 224
     //         enabled: false,
218 225
     //         logProcessStats: false,
219 226
     //         debugLogs: false,
227
+    //         useBVC: false,
228
+    //         bufferOverflowMS: 1000,
229
+    //         inboundModels: {
230
+    //             modelInbound8: 'model_inbound_8.kef',
231
+    //             modelInbound16: 'model_inbound_16.kef',
232
+    //         },
233
+    //         preloadInboundModels: {
234
+    //             modelInbound8: 'model_inbound_8.kef',
235
+    //             modelInbound16: 'model_inbound_16.kef',
236
+    //         },
237
+    //         preloadModels: {
238
+    //             modelBVC: 'model_bvc.kef',
239
+    //             model8: 'model_8.kef',
240
+    //             modelNC: 'model_nc_mq.kef',
241
+    //         },
242
+    //         models: {
243
+    //             modelBVC: 'model_bvc.kef',
244
+    //             model8: 'model_8.kef',
245
+    //             modelNV: 'model_nc_mq.kef',
246
+    //         },
247
+    //         bvc: {
248
+    //             allowedDevices: 'bvc-allowed.txt',
249
+    //             allowedDevicesExt: 'bvc-allowed-ext.txt',
250
+    //         }
220 251
     //     },
221 252
     // },
222 253
 

+ 18
- 2
react/features/base/config/configType.ts 查看文件

@@ -124,11 +124,27 @@ export interface IDeeplinkingConfig {
124 124
     ios?: IDeeplinkingMobileConfig;
125 125
 }
126 126
 
127
+export type PartialRecord<K extends keyof any, T> = {
128
+    [P in K]?: T;
129
+};
130
+
127 131
 export interface INoiseSuppressionConfig {
128 132
     krisp?: {
129
-        debugLogs?: boolean;
130
-        enabled?: boolean;
133
+        bufferOverflowMS?: number;
134
+        bvc?: {
135
+            allowedDevices?: string;
136
+            allowedDevicesExt?: string;
137
+        };
138
+        debugLogs: boolean;
139
+        enableSessionStats?: boolean;
140
+        enabled: boolean;
141
+        inboundModels?: PartialRecord<string, string>;
131 142
         logProcessStats?: boolean;
143
+        models?: PartialRecord<string, string>;
144
+        preloadInboundModels?: PartialRecord<string, string>;
145
+        preloadModels?: PartialRecord<string, string>;
146
+        useBVC?: boolean;
147
+        useSharedArrayBuffer?: boolean;
132 148
     };
133 149
 }
134 150
 

+ 49
- 17
react/features/stream-effects/noise-suppression/NoiseSuppressionEffect.ts 查看文件

@@ -90,7 +90,7 @@ export class NoiseSuppressionEffect {
90 90
         let init;
91 91
 
92 92
         if (this._options?.krisp?.enabled) {
93
-            init = _initializeKrisp(this._options).then(filterNode => {
93
+            init = _initializeKrisp(this._options, audioStream).then(filterNode => {
94 94
                 this._noiseSuppressorNode = filterNode;
95 95
 
96 96
                 if (krispState.filterNodeReady) {
@@ -167,26 +167,52 @@ export class NoiseSuppressionEffect {
167 167
  * Initializes the Krisp SDK and creates the filter node.
168 168
  *
169 169
  * @param {INoiseSuppressionConfig} options - Krisp options.
170
+ * @param {MediaStream} stream - Audio stream which will be mixed with _mixAudio.
170 171
  *
171 172
  * @returns {Promise<AudioWorkletNode | undefined>}
172 173
  */
173
-async function _initializeKrisp(options: INoiseSuppressionConfig): Promise<AudioWorkletNode | undefined> {
174
+async function _initializeKrisp(
175
+        options: INoiseSuppressionConfig,
176
+        stream: MediaStream
177
+): Promise<AudioWorkletNode | undefined> {
174 178
     await audioContext.resume();
175 179
 
176 180
     if (!krispState.sdk) {
177 181
         const baseUrl = `${getBaseUrl()}libs/krisp`;
178 182
         const { default: KrispSDK } = await import(/* webpackIgnore: true */ `${baseUrl}/krispsdk.mjs`);
179 183
 
180
-        krispState.sdk = new KrispSDK({
181
-            params: {
184
+        const ncParams = {
185
+            krisp: {
182 186
                 models: {
183
-                    model8: `${baseUrl}/models/model_8.kw`,
184
-                    model16: `${baseUrl}/models/model_16.kw`,
185
-                    model32: `${baseUrl}/models/model_32.kw`
187
+                    modelBVC: `${baseUrl}/models/${options?.krisp?.models?.modelBVC}`,
188
+                    model8: `${baseUrl}/models/${options?.krisp?.models?.model8}`,
189
+                    modelNC: `${baseUrl}/models/${options?.krisp?.models?.modelNC}`
190
+                },
191
+                logProcessStats: !options?.krisp?.logProcessStats,
192
+                debugLogs: !options?.krisp?.debugLogs,
193
+                useBVC: !options?.krisp?.useBVC,
194
+                bvc: {
195
+                    allowedDevices: `${baseUrl}/assets/${options?.krisp?.bvc?.allowedDevices}`,
196
+                    allowedDevicesExt: `${baseUrl}/assets/${options?.krisp?.bvc?.allowedDevicesExt}`
197
+                },
198
+                inboundModels: {
199
+                    modelInbound8: `${baseUrl}/models/${options?.krisp?.inboundModels?.modelInbound8}`,
200
+                    modelInbound16: `${baseUrl}/models/${options?.krisp?.inboundModels?.modelInbound16}`
201
+                },
202
+                preloadModels: {
203
+                    modelBVC: `${baseUrl}/models/${options?.krisp?.preloadModels?.modelBVC}`,
204
+                    model8: `${baseUrl}/models/${options?.krisp?.preloadModels?.model8}`,
205
+                    modelNC: `${baseUrl}/models/${options?.krisp?.preloadModels?.modelNC}`
186 206
                 },
187
-                logProcessStats: options?.krisp?.logProcessStats,
188
-                debugLogs: options?.krisp?.debugLogs
189
-            },
207
+                preloadInboundModels: {
208
+                    modelInbound8: `${baseUrl}/models/${options?.krisp?.preloadInboundModels?.modelInbound8}`,
209
+                    modelInbound16: `${baseUrl}/models/${options?.krisp?.preloadInboundModels?.modelInbound16}`
210
+                }
211
+            }
212
+        };
213
+
214
+        krispState.sdk = new KrispSDK({
215
+            params: ncParams.krisp,
190 216
             callbacks: {}
191 217
         });
192 218
     }
@@ -201,14 +227,20 @@ async function _initializeKrisp(options: INoiseSuppressionConfig): Promise<Audio
201 227
     if (!krispState.filterNode) {
202 228
         try {
203 229
             // @ts-ignore
204
-            krispState.filterNode = await krispState.sdk?.createNoiseFilter(audioContext, () => {
205
-                logger.info('Krisp audio filter ready');
230
+            krispState.filterNode = await krispState.sdk?.createNoiseFilter(
231
+                {
232
+                    audioContext,
233
+                    stream
234
+                },
235
+                () => {
236
+                    logger.info('Krisp audio filter ready');
206 237
 
207
-                // Enable audio filtering.
208
-                // @ts-ignore
209
-                krispState.filterNode?.enable();
210
-                krispState.filterNodeReady = true;
211
-            });
238
+                    // Enable audio filtering.
239
+                    // @ts-ignore
240
+                    krispState.filterNode?.enable();
241
+                    krispState.filterNodeReady = true;
242
+                }
243
+            );
212 244
         } catch (e) {
213 245
             logger.error('Failed to create Krisp noise filter', e);
214 246
 

Loading…
取消
儲存