@vkontakte/calls-audio-effects 1.2.9 → 1.2.10-dev.12fb226c.0
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/AudioEffects.d.ts +2 -0
- package/audio-effects.cjs.js +5307 -6
- package/audio-effects.esm.js +5297 -6
- package/controllers/VadController.d.ts +38 -0
- package/effects/EffectVadAi.d.ts +13 -0
- package/package.json +3 -2
- package/workers/VadAiWorker.d.ts +7 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface VadControllerOptions {
|
|
2
|
+
/** Порог вероятности речи для включения трека. Default: 0.66 */
|
|
3
|
+
threshold?: number;
|
|
4
|
+
/** Сколько ms после последнего "речь" держим enabled=true. Default: 300 */
|
|
5
|
+
hangoverMs?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface VadLib {
|
|
8
|
+
VadController: typeof VadController;
|
|
9
|
+
}
|
|
10
|
+
export declare class VadController {
|
|
11
|
+
private _effect;
|
|
12
|
+
private _sendTrack;
|
|
13
|
+
private _vadInputTrack;
|
|
14
|
+
private _threshold;
|
|
15
|
+
private _hangoverMs;
|
|
16
|
+
private _isSpeaking;
|
|
17
|
+
private _lastSpeechAt;
|
|
18
|
+
private _hangoverTimer;
|
|
19
|
+
private _watchdogTimer;
|
|
20
|
+
private _destroyed;
|
|
21
|
+
private _loggerFn;
|
|
22
|
+
private _logger;
|
|
23
|
+
constructor(sendTrack?: MediaStreamTrack | null, options?: VadControllerOptions);
|
|
24
|
+
setOptions(options: VadControllerOptions): void;
|
|
25
|
+
setLogger(loggerFunction: (type: string, ...args: unknown[]) => void, loggerName?: string): void;
|
|
26
|
+
init(): Promise<void>;
|
|
27
|
+
setSendTrack(track: MediaStreamTrack | null): void;
|
|
28
|
+
pause(): void;
|
|
29
|
+
resume(): void;
|
|
30
|
+
get isSpeaking(): boolean;
|
|
31
|
+
destroy(): void;
|
|
32
|
+
private _applySendTrack;
|
|
33
|
+
private _onProbs;
|
|
34
|
+
private _armHangover;
|
|
35
|
+
private _setSpeaking;
|
|
36
|
+
private _scheduleWatchdog;
|
|
37
|
+
private _replaceVadInputTrack;
|
|
38
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DataProcessing } from '../processor/AudioProcessor';
|
|
2
|
+
import { WorkerAudioProcessor } from '../processor/WorkerAudioProcessor';
|
|
3
|
+
export interface VadProbs {
|
|
4
|
+
speechProb: number;
|
|
5
|
+
silenceProb: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class EffectVadAi extends WorkerAudioProcessor implements DataProcessing {
|
|
8
|
+
onData: (probs: VadProbs) => void;
|
|
9
|
+
init(): Promise<void>;
|
|
10
|
+
protected onWorkletData(data: ArrayBuffer): void;
|
|
11
|
+
protected onWorkerData(probs: VadProbs): void;
|
|
12
|
+
static isSupported(): boolean;
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/calls-audio-effects",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10-dev.12fb226c.0",
|
|
4
4
|
"author": "vk.com",
|
|
5
5
|
"description": "Audio effects library for video calls based on the vk.com platform",
|
|
6
6
|
"homepage": "https://vk.com",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"**/*.d.ts"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@vkontakte/audio-processing": "0.0.8"
|
|
17
|
+
"@vkontakte/audio-processing": "0.0.8",
|
|
18
|
+
"onnxruntime-web": "^1.26.0"
|
|
18
19
|
}
|
|
19
20
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Tensor } from 'onnxruntime-web';
|
|
2
|
+
export type StateTensors = Record<string, Tensor>;
|
|
3
|
+
export interface VadWorkerRequest {
|
|
4
|
+
data: ArrayBuffer;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: (modelUrl: string, modelDataUrl: string, ortWasmUrl: string, ortMjsUrl: string) => void;
|
|
7
|
+
export default _default;
|