@pexip/media-processor 16.7.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.
@@ -0,0 +1,1129 @@
1
+ import * as _tensorflow_tfjs_backend_webgl_dist_webgl_util from '@tensorflow/tfjs-backend-webgl/dist/webgl_util';
2
+ import * as _tensorflow_tfjs_backend_webgl_dist_gpgpu_util from '@tensorflow/tfjs-backend-webgl/dist/gpgpu_util';
3
+ import * as _tensorflow_tfjs_backend_webgl from '@tensorflow/tfjs-backend-webgl';
4
+ import { Tensor3D } from '@tensorflow/tfjs-core';
5
+ import { Options as Options$3 } from '@pexip/bg-blur/selfie_segmentation';
6
+ import { Queue } from '@pexip/utils';
7
+
8
+ /**
9
+ * Interface for Point consist of coordinates x and y
10
+ *
11
+ * @alpha
12
+ */
13
+ interface Point {
14
+ x: number;
15
+ y: number;
16
+ }
17
+ interface Size {
18
+ width: number;
19
+ height: number;
20
+ }
21
+ type Rect = Point & Size;
22
+ interface Frame extends Size {
23
+ source: Canvas | HTMLVideoElement | HTMLImageElement;
24
+ }
25
+ /**
26
+ * Unsubscribe the subscription
27
+ */
28
+ type Unsubscribe$1 = () => void;
29
+ /**
30
+ * Same as {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer | AudioBuffer}
31
+ * Or the return from {@link https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getFloatFrequencyData | AnalyserNode.getFloatFrequencyData()}
32
+ */
33
+ type AudioBufferFloats = Float32Array;
34
+ /**
35
+ * Same as the return from {@link https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteFrequencyData | AnalyserNode.getByteFrequencyData()}
36
+ */
37
+ type AudioBufferBytes = Uint8Array;
38
+ /**
39
+ * Audio samples from each channel, either in float or bytes form
40
+ *
41
+ * @example
42
+ *
43
+ * ```
44
+ * | | | Sample Frame 1 | Sample Frame 2 | Sample Frame 3 |
45
+ * | Input | Channel L: | sample 1 | sample 2 | sample 3 |
46
+ * | | Channel R: | sample 1 | sample 2 | sample 3 |
47
+ * ```
48
+ * We can get 2 `AudioSamples` from "Channel L" and "Channel R" from "Input"
49
+ */
50
+ type AudioSamples = number[] | AudioBufferFloats | AudioBufferBytes;
51
+ /**
52
+ * Data structure for the audio statistics while processing
53
+ */
54
+ interface AudioStats {
55
+ /**
56
+ * Indicating the audio is silent when it is set to `true`
57
+ */
58
+ silent: boolean;
59
+ /**
60
+ * Indicating the audio is mono when it is set to `true`
61
+ *
62
+ * `undefined` means cannot-not-tell.
63
+ */
64
+ mono?: boolean;
65
+ /**
66
+ * Indicating the audio is low volume when it is set to `true`
67
+ */
68
+ lowVolume: boolean;
69
+ /**
70
+ * Indicating the audio is clipping when it is set to `true`
71
+ */
72
+ clipping: boolean;
73
+ /**
74
+ * Peak gain value
75
+ */
76
+ peak: number;
77
+ /**
78
+ * Global rms
79
+ */
80
+ rms: number;
81
+ /**
82
+ * Maximum running RMS value
83
+ */
84
+ maxRms: number;
85
+ /**
86
+ * Maximum Clip count
87
+ */
88
+ maxClipCount: number;
89
+ /**
90
+ * Value of sum squared sample used for RMS calculation
91
+ */
92
+ sumSquare: number;
93
+ /**
94
+ * Value of sum number of sample used for RMS calculation
95
+ */
96
+ sumLength: number;
97
+ }
98
+ /**
99
+ * Stats options for calculating the audio stats
100
+ */
101
+ interface StatsOptions {
102
+ /**
103
+ * Used for the analysis
104
+ */
105
+ samples: AudioSamples;
106
+ /**
107
+ * this will be used for accumulation
108
+ */
109
+ baseStats?: AudioStats;
110
+ /**
111
+ * Threshold for clipping
112
+ *
113
+ * @defaultValue
114
+ * `1.0` as assuming it is float value
115
+ */
116
+ clipThreshold?: number;
117
+ /**
118
+ * Threshold for silent
119
+ *
120
+ * @defaultValue
121
+ * 1.0 / 32767
122
+ */
123
+ silentThreshold?: number;
124
+ }
125
+ /**
126
+ * Audio Processor Message to post to AudioWorkletProcessor
127
+ */
128
+ type AudioProcessorRelease = {
129
+ type: 'release';
130
+ };
131
+ type AudioProcessorEnable = {
132
+ type: 'enable';
133
+ value: boolean;
134
+ };
135
+ type AudioProcessorMessageEvent = MessageEvent<AudioProcessorRelease | AudioProcessorEnable>;
136
+ interface SubscribableOptions {
137
+ updateFrequency?: number;
138
+ }
139
+ interface WorkletMessagePortOptions<T> {
140
+ messageHandler: (message: T) => void;
141
+ errorHandler?: (event: Event) => void;
142
+ }
143
+ interface AnalyzerSubscribableOptions extends SubscribableOptions, WorkletMessagePortOptions<Analyzer> {
144
+ }
145
+ /**
146
+ * Pass the wasm module from `AudioWorkletNode` to `AudioWorkletProcessor` via
147
+ * `AudioWorkletNodeOptions`
148
+ *
149
+ * - data: The wasm module data
150
+ * - sampleRate: The sample rate for the context
151
+ * - shouldSendVAD: Should post VADs to main
152
+ */
153
+ interface WasmProcessorOptions {
154
+ data: BufferSource;
155
+ sampleRate: number;
156
+ shouldSendVAD?: boolean;
157
+ }
158
+ interface WasmWorkletNodeOptions extends AudioWorkletNodeOptions {
159
+ processorOptions?: WasmProcessorOptions;
160
+ }
161
+ /**
162
+ * A wrapper for the Denoise wasm module
163
+ */
164
+ interface Denoise {
165
+ vad(channel: number): number;
166
+ free(): void;
167
+ pipe(inputs: Float32Array[][], outputs: Float32Array[][]): void;
168
+ }
169
+ type NodeConnectionAction = 'connect' | 'disconnect';
170
+ type BaseAudioNode = Pick<AudioNode, NodeConnectionAction>;
171
+ interface Gain extends BaseAudioNode {
172
+ readonly node: GainNode;
173
+ mute: boolean;
174
+ }
175
+ interface Analyzer extends BaseAudioNode {
176
+ readonly node: AnalyserNode;
177
+ readonly frequencyBinCount: AnalyserNode['frequencyBinCount'];
178
+ fftSize: AnalyserNode['fftSize'];
179
+ minDecibels: AnalyserNode['minDecibels'];
180
+ maxDecibels: AnalyserNode['maxDecibels'];
181
+ smoothingTimeConstant: AnalyserNode['smoothingTimeConstant'];
182
+ /**
183
+ * Copies the current waveform, or time-domain, data into a Uint8Array
184
+ * (unsigned byte array) passed into it.
185
+ *
186
+ * If the array has fewer elements than the `AnalyserNode.fftSize`, excess
187
+ * elements are dropped.
188
+ * If it has more elements than needed, excess elements are ignored.
189
+ *
190
+ * @param buffer - Use provided buffer instead of creating a new one
191
+ *
192
+ * @remarks
193
+ * The bytes versions are not cheaper than the float version but provided
194
+ * for convenient: the byte version are computed from the float version,
195
+ * using simple quantization to 2^8 values
196
+ * ref. https://padenot.github.io/web-audio-perf/#analysernode
197
+ */
198
+ getByteTimeDomainData(buffer: Uint8Array): void;
199
+ /**
200
+ * Copies the current frequency data into a Uint8Array (unsigned byte array)
201
+ * passed into it.
202
+ *
203
+ * The frequency data is composed of integers on a scale from 0 to 255.
204
+ *
205
+ * @param buffer - Use provided buffer instead of creating a new one
206
+ *
207
+ * @remarks
208
+ * The bytes versions are not cheaper than the float version but provided
209
+ * for convenient: the byte version are computed from the float version,
210
+ * using simple quantization to 2^8 values
211
+ * ref. https://padenot.github.io/web-audio-perf/#analysernode
212
+ */
213
+ getByteFrequencyData(buffer: Uint8Array): void;
214
+ /**
215
+ * Copies the current waveform, or time-domain, data into Float32Array
216
+ * passed into it
217
+ *
218
+ * @param buffer - Use provided buffer instead of creating a new one
219
+ *
220
+ * @remarks
221
+ * The buffer size should be the same as `AnalyserNode.fftSize`
222
+ */
223
+ getFloatTimeDomainData(buffer: Float32Array): void;
224
+ /**
225
+ * Copies the current waveform, or time-domain, data into Float32Array
226
+ * passed into it
227
+ *
228
+ * @param buffer - Use provided buffer instead of creating a new one
229
+ *
230
+ * @remarks
231
+ * The buffer size should be the same as `AnalyserNode.frequencyBinCount`
232
+ */
233
+ getFloatFrequencyData(buffer: Float32Array): void;
234
+ /**
235
+ * Utility function to get the average volume from `getByteFrequencyData`
236
+ *
237
+ * @param options - `buffer`, use provided buffer instead of creating a new
238
+ * one, and `beforeAlter`, will analyze the raw data before any changes to
239
+ * the audio signal when it is set to `true`
240
+ *
241
+ * @remarks
242
+ * This is a better option when you only need to get the volume in terms of
243
+ * performance and complexity.
244
+ */
245
+ getAverageVolume(buffer: Float32Array): number;
246
+ }
247
+ interface AudioNodeProps<T extends AudioNode, R extends BaseAudioNode> {
248
+ name: string;
249
+ node: R | undefined;
250
+ audioNode: T | undefined;
251
+ outputs: WeakSet<AudioNodeInit | AudioParam>;
252
+ }
253
+ type AudioNodeParam = BaseAudioNode | AudioParam;
254
+ type Node = AudioNode | AudioParam;
255
+ type Nodes = Node[];
256
+ type ConnectParamBaseType = AudioParam | BaseAudioNode;
257
+ type ConnectInitParamBaseType = AudioParam | AudioNodeInit;
258
+ type ConnectParamType = ConnectParamBaseType | undefined;
259
+ type ConnectInitParamType = ConnectInitParamBaseType | undefined;
260
+ type AudioNodeInputIndex = number | undefined;
261
+ type AudioNodeOutputIndex = number | undefined;
262
+ type ConnectParamBase<T extends ConnectParamType | ConnectInitParamType> = [
263
+ T,
264
+ T extends undefined ? undefined : AudioNodeOutputIndex,
265
+ T extends undefined ? undefined : AudioNodeInputIndex
266
+ ] | T;
267
+ type AudioNodeConnectParam = ConnectParamBase<ConnectParamType>;
268
+ type AudioNodeInitConnectParam = ConnectParamBase<ConnectInitParamType>;
269
+ type AudioNodeInitConnection = AudioNodeInitConnectParam[];
270
+ type AudioNodeInitConnections = AudioNodeInitConnection[];
271
+ interface AudioNodeInit<T extends AudioNode = AudioNode, R extends BaseAudioNode = BaseAudioNode> extends Readonly<AudioNodeProps<T, R>> {
272
+ /**
273
+ * Internal function to create the actual AudioNode.
274
+ * Should ONLY be CALLED inside an AudioGraph
275
+ *
276
+ * @param context - Audio Context to use
277
+ * @param prevNode - The input AudioNode for connection
278
+ *
279
+ * @internal
280
+ */
281
+ create(context: AudioContext, prevNode?: AudioNode): [T, R];
282
+ /**
283
+ * Internal function to connect a signal output
284
+ * Should ONLY be CALLED inside an AudioGraph
285
+ *
286
+ * @param param - The init to connect
287
+ *
288
+ * @internal
289
+ */
290
+ connect(param: AudioNodeInitConnectParam | undefined): void;
291
+ /**
292
+ * Internal function to disconnect a signal output
293
+ * Should ONLY be CALLED inside an AudioGraph
294
+ *
295
+ * @param param - The init to disconnect
296
+ *
297
+ * @internal
298
+ */
299
+ disconnect(param: AudioNodeInitConnectParam | undefined): void;
300
+ /**
301
+ * Check if there is a connection to the provided init
302
+ * @param init - AudioNodeInit
303
+ */
304
+ hasConnectedTo(init: AudioNodeInit | AudioParam): boolean;
305
+ /**
306
+ * Internal function to release the node init resources
307
+ * Should ONLY be CALLED inside an AudioGraph
308
+ *
309
+ * @internal
310
+ */
311
+ release(): void;
312
+ toJSON?: () => unknown;
313
+ }
314
+ type MediaStreamAudioSourceNodeInit = AudioNodeInit<MediaStreamAudioSourceNode, MediaStreamAudioSourceNode>;
315
+ type MediaElementAudioSourceNodeInit = AudioNodeInit<MediaElementAudioSourceNode, MediaElementAudioSourceNode>;
316
+ type AnalyzerNodeInit = AudioNodeInit<AnalyserNode, Analyzer>;
317
+ type DenoiseWorkletNodeInit = AudioNodeInit<AudioWorkletNode>;
318
+ type GainNodeInit = AudioNodeInit<GainNode, Gain>;
319
+ type MediaStreamAudioDestinationNodeInit = AudioNodeInit<MediaStreamAudioDestinationNode, MediaStreamAudioDestinationNode>;
320
+ type AudioDestinationNodeInit = AudioNodeInit<AudioDestinationNode, AudioDestinationNode>;
321
+ type DelayNodeInit = AudioNodeInit<DelayNode, DelayNode>;
322
+ type ChannelSplitterNodeInit = AudioNodeInit<ChannelSplitterNode, ChannelSplitterNode>;
323
+ interface WorkletModule {
324
+ moduleURL: string;
325
+ options?: WorkletOptions;
326
+ }
327
+ interface AudioGraphOptions {
328
+ context?: AudioContext;
329
+ contextOptions?: AudioContextOptions;
330
+ }
331
+ type AudioGraphState = AudioContext['state'] | 'closing';
332
+ interface AudioGraph {
333
+ readonly context: AudioContext;
334
+ readonly inits: AudioNodeInit[];
335
+ readonly state: AudioGraphState;
336
+ connect(sequence: AudioNodeInitConnection): void;
337
+ disconnect(sequence: AudioNodeInitConnection): void;
338
+ addWorklet(moduleURL: string, options?: WorkletOptions): Promise<void>;
339
+ releaseInit(init: AudioNodeInit): void;
340
+ release(): Promise<void>;
341
+ }
342
+ /**
343
+ * We need to add the missing type def to work with AudioContextState in Safari
344
+ * See https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/state#resuming_interrupted_play_states_in_ios_safari
345
+ *
346
+ */
347
+ type UniversalAudioContextState = AudioContextState | 'interrupted';
348
+ type Canvas = HTMLCanvasElement | OffscreenCanvas;
349
+ type CanvasContext = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
350
+ /**
351
+ * Clock interface to get the current time with now method, @see Performance['now']
352
+ */
353
+ interface Clock {
354
+ now: Performance['now'];
355
+ }
356
+ /**
357
+ * Limit the rate of flow in terms of millisecond, and provided Clock
358
+ */
359
+ interface ThrottleOptions {
360
+ throttleMs?: number;
361
+ clock?: Clock;
362
+ }
363
+ type IsVoice<T> = (data: T) => boolean;
364
+ type AsyncCallback = () => Promise<void>;
365
+ type Callback<R, T extends unknown[]> = (...params: T) => R;
366
+ interface Runner<P extends unknown[]> {
367
+ start(...params: P): Promise<void>;
368
+ stop(): void;
369
+ frameRate: number;
370
+ }
371
+ type RunnerCreator<P extends unknown[], R> = (callback: Callback<R, P>, frameRate: number) => Runner<P>;
372
+ interface Transform<I, O> extends Transformer<I, O> {
373
+ init(): Promise<void>;
374
+ destroy(): Promise<void>;
375
+ }
376
+
377
+ /**
378
+ * A function to create `AudioContext` using constructor or factory function
379
+ * depends on the browser supports
380
+ *
381
+ * @param options - @see {@link AudioContextOptions}
382
+ *
383
+ * @internal
384
+ */
385
+ declare const createAudioContext: (options?: AudioContextOptions) => AudioContext;
386
+ /**
387
+ * Resume the stream whenever interrupted
388
+ *
389
+ * @param audioContext - AudioContext
390
+ *
391
+ * @alpha
392
+ */
393
+ declare function resumeAudioOnInterruption(audioContext: AudioContext): () => void;
394
+ /**
395
+ * Resume the AudioContext whenever the source track is unmuted
396
+ *
397
+ * @param audioContext - The `AudioContext` to resume
398
+ *
399
+ * @alpha
400
+ */
401
+ declare const resumeAudioOnUnmute: (context: AudioContext) => (track: MediaStreamTrack) => Unsubscribe$1;
402
+ /**
403
+ * Subscribe MessagePort message from an AudioWorkletNode
404
+ *
405
+ * @param workletNode - the node to subscribe
406
+ * @param options - can pass a message handler here to handle the message
407
+ */
408
+ declare const subscribeWorkletNode: <T>(workletNode: AudioWorkletNode, { messageHandler, errorHandler }?: Partial<WorkletMessagePortOptions<T>>) => () => void;
409
+ /**
410
+ * Subscribe to a timeout loop to get the data from Analyzer
411
+ *
412
+ * @param analyzer - the analyzer to subscribe
413
+ * @param options - message handler, etc.
414
+ */
415
+ declare const subscribeTimeoutAnalyzerNode: (analyzer: Analyzer, { messageHandler, updateFrequency }: AnalyzerSubscribableOptions) => () => void;
416
+ /**
417
+ * Create a MediaStreamAudioSourceNodeInit
418
+ *
419
+ * @param mediaStream - Source MediaStream
420
+ * @param shouldResetEnabled - Whether or not to enable the cloned track
421
+ */
422
+ declare const createStreamSourceGraphNode: (mediaStream: MediaStream, shouldResetEnabled?: boolean) => AudioNodeInit<MediaStreamAudioSourceNode, MediaStreamAudioSourceNode>;
423
+ /**
424
+ * Create a MediaStreamAudioSourceNodeInit
425
+ *
426
+ * @param mediaStream - Source MediaStream
427
+ */
428
+ declare const createMediaElementSourceGraphNode: (mediaElement: HTMLMediaElement) => AudioNodeInit<MediaElementAudioSourceNode, MediaElementAudioSourceNode>;
429
+ /**
430
+ * Create an analyzer node with push-based subscription
431
+ */
432
+ declare const createAnalyzerSubscribableGraphNode: ({ messageHandler, updateFrequency, ...analyserOptions }: AnalyzerSubscribableOptions & AnalyserOptions) => AudioNodeInit<AnalyserNode, Analyzer>;
433
+ /**
434
+ * Create a noise suppression node
435
+ *
436
+ * @param data - WebAssembly source
437
+ */
438
+ declare const createDenoiseWorkletGraphNode: (data: BufferSource, messageHandler?: ((vads: number[]) => void) | undefined) => AudioNodeInit<AudioWorkletNode, AudioWorkletNode>;
439
+ /**
440
+ * Create a GainNodeInit
441
+ *
442
+ * @param mute - initial mute state
443
+ */
444
+ declare const createGainGraphNode: (mute: boolean) => AudioNodeInit<GainNode, Gain>;
445
+ /**
446
+ * Create an AnalyzerNodeInit
447
+ *
448
+ * @param options - @see {@link AnalyserOptions}
449
+ */
450
+ declare const createAnalyzerGraphNode: (options?: AnalyserOptions) => AudioNodeInit<AnalyserNode, Analyzer>;
451
+ /**
452
+ * Create a MediaStreamAudioDestinationNodeInit
453
+ */
454
+ declare const createStreamDestinationGraphNode: (options?: AudioNodeOptions) => AudioNodeInit<MediaStreamAudioDestinationNode, MediaStreamAudioDestinationNode>;
455
+ /**
456
+ * Create an `AudioDestinationNode`
457
+ */
458
+ declare const createAudioDestinationGraphNode: () => AudioNodeInit<AudioDestinationNode, AudioDestinationNode>;
459
+ /**
460
+ * Create a `DelayNode`
461
+ *
462
+ * @param options - @see DelayOptions
463
+ */
464
+ declare const createDelayGraphNode: (options?: DelayOptions) => AudioNodeInit<DelayNode, DelayNode>;
465
+ /**
466
+ * Create a ChannelSplitterNode
467
+ *
468
+ * @param options - @see ChannelSplitterOptions
469
+ */
470
+ declare const createChannelSplitterGraphNode: (options?: ChannelSplitterOptions) => AudioNodeInit<ChannelSplitterNode, ChannelSplitterNode>;
471
+ /**
472
+ * Create a ChannelMergerNode
473
+ *
474
+ * @param options - @see ChannelMergerOptions
475
+ */
476
+ declare const createChannelMergerGraphNode: (options?: ChannelMergerOptions) => AudioNodeInit<ChannelMergerNode, ChannelMergerNode>;
477
+ /**
478
+ * Accepts AudioNodeInitConnections to build the audio graph within a signal audio context
479
+ *
480
+ * @param initialConnections - A list of AudioNodeInit to build the graph in a linear fashion
481
+ * @param options - @see {@link AudioGraphOptions}
482
+ *
483
+ * @example
484
+ *
485
+ * ```typescript
486
+ * const source = createStreamSourceGraphNode(stream);
487
+ * const analyzer = createAnalyzerGraphNode({fftSize});
488
+ * const audioGraph = createAudioGraph([[source, analyzer]]);
489
+ * ```
490
+ */
491
+ declare const createAudioGraph: (initialConnections: AudioNodeInitConnections, options?: AudioGraphOptions) => AudioGraph;
492
+ type AudioGraphProxyHandler = (target: AudioGraph, args: Parameters<AudioGraph['connect']>) => void;
493
+ interface AudioGraphProxyHandlers {
494
+ connect?: AudioGraphProxyHandler;
495
+ disconnect?: AudioGraphProxyHandler;
496
+ }
497
+ declare const createAudioGraphProxy: (audioGraph: AudioGraph, handlers: AudioGraphProxyHandlers) => AudioGraph;
498
+
499
+ declare const loadScript: (path: string, id: string) => Promise<void>;
500
+ type WasmPaths = [string, string | undefined];
501
+ declare const loadWasms: (paths: WasmPaths[]) => Promise<void>;
502
+ declare const loadTfjsCore: (prodMode: boolean) => Promise<unknown>;
503
+ declare const loadTfjsBackendWebGl: () => Promise<{
504
+ default: typeof _tensorflow_tfjs_backend_webgl;
505
+ version_webgl: "4.2.0";
506
+ webgl: {
507
+ forceHalfFloat: typeof _tensorflow_tfjs_backend_webgl.forceHalfFloat;
508
+ };
509
+ forceHalfFloat(): void;
510
+ MathBackendWebGL: typeof _tensorflow_tfjs_backend_webgl.MathBackendWebGL;
511
+ setWebGLContext: typeof _tensorflow_tfjs_backend_webgl.setWebGLContext;
512
+ GPGPUContext: typeof _tensorflow_tfjs_backend_webgl.GPGPUContext;
513
+ gpgpu_util: typeof _tensorflow_tfjs_backend_webgl_dist_gpgpu_util;
514
+ webgl_util: typeof _tensorflow_tfjs_backend_webgl_dist_webgl_util;
515
+ }>;
516
+
517
+ declare const RENDER_EFFECTS: readonly ["none", "blur", "overlay"];
518
+ declare const SEG_MODELS: readonly ["mediapipeSelfie"];
519
+ /**
520
+ * Interfaces from "tensorflow-models/body-segmentation" interfaces
521
+ */
522
+ type MaskUnderlyingType = 'canvasimagesource' | 'imagedata' | 'tensor';
523
+ interface Mask {
524
+ toCanvasImageSource(): Promise<CanvasImageSource>;
525
+ toImageData(): Promise<ImageData>;
526
+ toTensor(): Promise<Tensor3D>;
527
+ getUnderlyingType(): MaskUnderlyingType;
528
+ }
529
+ /**
530
+ * Interfaces from "tensorflow-models/body-segmentation" interfaces
531
+ */
532
+ interface Segmentation {
533
+ maskValueToLabel: (maskValue: number) => string;
534
+ mask: Mask;
535
+ }
536
+ type Color = {
537
+ r: number;
538
+ g: number;
539
+ b: number;
540
+ a: number;
541
+ };
542
+ type SegmentationModel = (typeof SEG_MODELS)[number];
543
+ type RenderEffects = (typeof RENDER_EFFECTS)[number];
544
+ type ProcessInputType = ImageData | HTMLVideoElement | HTMLImageElement | OffscreenCanvas | HTMLCanvasElement | ImageBitmap;
545
+ type InputFrame = CanvasImageSource | VideoFrame;
546
+ type ImageType = CanvasImageSource | ProcessInputType | VideoFrame;
547
+ /**
548
+ * A keypoint that contains coordinate information.
549
+ */
550
+ interface Keypoint {
551
+ x: number;
552
+ y: number;
553
+ z?: number;
554
+ score?: number;
555
+ name?: string;
556
+ }
557
+ interface BoundingBox {
558
+ xMin: number;
559
+ yMin: number;
560
+ xMax: number;
561
+ yMax: number;
562
+ width: number;
563
+ height: number;
564
+ }
565
+ interface Face {
566
+ keypoints: Keypoint[];
567
+ box: BoundingBox;
568
+ }
569
+ interface ProcessingSize {
570
+ /**
571
+ * Processing Width size
572
+ */
573
+ width: number;
574
+ /**
575
+ * Processing height size
576
+ */
577
+ height: number;
578
+ }
579
+ interface RenderParams extends ProcessingSize {
580
+ /**
581
+ * Range in between 0 and 1
582
+ * @defaultValue `0.5`
583
+ */
584
+ foregroundThreshold: number;
585
+ /**
586
+ * Range in between 0 and 20
587
+ * @defaultValue `3`
588
+ */
589
+ backgroundBlurAmount: number;
590
+ /**
591
+ * Range in between 0 and 20
592
+ * @defaultValue `3`
593
+ */
594
+ edgeBlurAmount: number;
595
+ /**
596
+ * @defaultValue `false`
597
+ */
598
+ flipHorizontal: boolean;
599
+ /**
600
+ * @defaultValue `none`
601
+ */
602
+ effects: RenderEffects;
603
+ /**
604
+ * Background image used for background replacement
605
+ */
606
+ backgroundImage: Canvas | undefined;
607
+ }
608
+ interface AsyncAssets {
609
+ tfjsCoreLoaded: boolean;
610
+ tfjsBackendLoaded: boolean;
611
+ glueLoaded: boolean;
612
+ }
613
+ type ProcessStatus = 'created' | 'opened' | 'opening' | 'processing' | 'idle' | 'closed' | 'destroying' | 'destroyed';
614
+ interface Process {
615
+ status: ProcessStatus;
616
+ open(): Promise<void>;
617
+ close(): void;
618
+ destroy(): Promise<void>;
619
+ }
620
+ interface Segmenter extends Process, ProcessingSize {
621
+ model: SegmentationModel;
622
+ process(input: ProcessInputType): Promise<Segmentation[]>;
623
+ }
624
+ interface Detector<T> extends Process {
625
+ detect(input: ProcessInputType): Promise<T>;
626
+ }
627
+ interface SegmentationParams extends RenderParams {
628
+ segmenter: Segmenter;
629
+ loadBackgroundImage(url: string): Promise<void>;
630
+ backgroundImageUrl?: string;
631
+ }
632
+ type SegmentationTransform = Transform<InputFrame, InputFrame> & SegmentationParams & Omit<Process, 'open'>;
633
+
634
+ type Track = MediaStreamVideoTrack | MediaStreamVideoTrackGenerator;
635
+ interface Options$2 {
636
+ signal?: AbortSignal;
637
+ }
638
+ type ProcessVideoTrack = (track: MediaStreamVideoTrack, transformers: Array<Transformer<InputFrame, InputFrame>>, options?: Options$2) => Promise<Track>;
639
+ declare const createVideoTrackProcessor: () => ProcessVideoTrack;
640
+ interface FallbackOptions {
641
+ width?: number;
642
+ height?: number;
643
+ frameRate?: number;
644
+ }
645
+ declare const createVideoTrackProcessorWithFallback: ({ width, height, frameRate, }?: FallbackOptions) => ProcessVideoTrack;
646
+
647
+ interface VideoProcessor {
648
+ open(): Promise<void>;
649
+ /**
650
+ * Process the video and return a MediaStream
651
+ */
652
+ process: (source: MediaStream) => Promise<MediaStream>;
653
+ /**
654
+ * Stop the process of video segmentation
655
+ */
656
+ close(): void;
657
+ /**
658
+ * Destroy the segmentation wasm instance
659
+ */
660
+ destroy: () => Promise<void>;
661
+ }
662
+ declare const createVideoProcessor: (transformers: Array<Transform<InputFrame, InputFrame>>, processTrack: ProcessVideoTrack) => VideoProcessor;
663
+
664
+ type Params = Omit<RenderParams, 'frameRate'>;
665
+ interface Options$1 extends Omit<Params, 'backgroundImage'> {
666
+ selfManageSegmenter?: boolean;
667
+ bgImageUrl?: string;
668
+ }
669
+ declare const createTransform: (segmenter: Segmenter, { width, height, foregroundThreshold, backgroundBlurAmount, edgeBlurAmount, flipHorizontal, effects, selfManageSegmenter, bgImageUrl, }?: Partial<Options$1>) => SegmentationTransform;
670
+
671
+ type Timeouts = Pick<WindowOrWorkerGlobalScope, 'setTimeout' | 'clearTimeout'>;
672
+ type AsyncCallbackLoopOptions = Timeouts & Pick<Performance, 'now'> & {
673
+ frameRate: number;
674
+ };
675
+ /**
676
+ * Create an async callback loop to be called recursively with delay based on
677
+ * the `frameRate`
678
+ *
679
+ * @param callback - The callback to be invoked
680
+ * @param frameRate - The rate to be expected to invoke the `callback`
681
+ */
682
+ declare const createAsyncCallbackLoop: <P extends unknown[], R extends Promise<unknown>>(callback: Callback<R, P>, frameRate: number, { setTimeout, clearTimeout, now, }?: Partial<AsyncCallbackLoopOptions>) => {
683
+ start: (...params: P) => Promise<void>;
684
+ stop: () => void;
685
+ frameRate: number;
686
+ };
687
+ type Unsubscribe = () => void;
688
+ /**
689
+ * Subscribe visibilitychange event
690
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilitychange_event}
691
+ *
692
+ * @param callback - A callback to be called with `document.hidden` when the event is trigger
693
+ */
694
+ declare const subscribeVisibilityChangeEvent: (callback: (hidden: boolean) => Promise<void>) => Unsubscribe;
695
+
696
+ interface FrameCallbackRequestOptions {
697
+ /**
698
+ * Subscribe `visibilitychange` event from the DOM
699
+ * @see {@link subscribeVisibilityChangeEvent}
700
+ */
701
+ subscribeVisibilityChange?: typeof subscribeVisibilityChangeEvent;
702
+ }
703
+ /**
704
+ * Create a callback loop for video frame processing using
705
+ * `requestVideoFrameCallback` under-the-hood when available otherwise our
706
+ * fallback implementation based on `setTimeout`.
707
+ *
708
+ * @param callback - To be called by the loop
709
+ * @param frameRate - A fallback frame rate when we are not able to get the rate
710
+ * from API
711
+ */
712
+ declare const createFrameCallbackRequest: (callback: Callback<Promise<void>, [ProcessInputType]>, frameRate: number, { subscribeVisibilityChange, }?: FrameCallbackRequestOptions) => {
713
+ start: (input: ProcessInputType) => Promise<void>;
714
+ stop: () => void;
715
+ frameRate: number;
716
+ };
717
+
718
+ declare const SelfieSegmentationModelTypes: ['general', 'landscape'];
719
+ type SelfieSegmentationModelType = (typeof SelfieSegmentationModelTypes)[number];
720
+ interface Options extends AsyncAssets, Omit<Options$3, 'modelSelection'> {
721
+ modelType: SelfieSegmentationModelType;
722
+ processingWidth: number;
723
+ processingHeight: number;
724
+ gluePath: string;
725
+ selfieMode: boolean;
726
+ prodMode: boolean;
727
+ }
728
+ declare const createSegmenter: (basePath?: string, { modelType, tfjsCoreLoaded, tfjsBackendLoaded, glueLoaded, processingWidth, processingHeight, gluePath, selfieMode, prodMode, }?: Partial<Options>) => Segmenter;
729
+
730
+ declare const isRenderEffects: (t: unknown) => t is "blur" | "none" | "overlay";
731
+ declare const isSegmentationModel: (t: unknown) => t is "mediapipeSelfie";
732
+
733
+ declare const PROCESSING_WIDTH = 768;
734
+ declare const PROCESSING_HEIGHT = 432;
735
+ declare const FOREGROUND_THRESHOLD = 0.5;
736
+ declare const BACKGROUND_BLUR_AMOUNT = 3;
737
+ declare const EDGE_BLUR_AMOUNT = 3;
738
+ declare const FLIP_HORIZONTAL = false;
739
+ declare const FRAME_RATE = 20;
740
+ declare enum AbortReason {
741
+ Close = "close"
742
+ }
743
+
744
+ /**
745
+ * Calculate the distance between two Points
746
+ *
747
+ * @param p1 - Point 1
748
+ * @param p2 - Point 2
749
+ *
750
+ * @internal
751
+ */
752
+ declare function calculateDistance(p1: Point, p2: Point): number;
753
+ /**
754
+ * Spline Interpolation for Bezier Curve
755
+ *
756
+ * @param p1 - Starting point
757
+ * @param p2 - Point between p1 and p3
758
+ * @param p3 - Ending point
759
+ * @param t - tension constant
760
+ *
761
+ * @remarks
762
+ * Ref. http://scaledinnovation.com/analytics/splines/aboutSplines.html
763
+ * Alt. https://www.particleincell.com/2012/bezier-splines/
764
+ *
765
+ * @internal
766
+ */
767
+ declare function getBezierCurveControlPoints({ p1, p2, p3, t, }: {
768
+ p1: Point;
769
+ p2: Point;
770
+ p3: Point;
771
+ t: number;
772
+ }): [Point, Point];
773
+ /**
774
+ * Create a straight line path command
775
+ *
776
+ * @param data - An array of Points
777
+ *
778
+ * @example
779
+ *
780
+ * ```typescript
781
+ * line([{x:0, y:0}, {x:2, y:2}]);
782
+ * // Output:
783
+ * // M 0,0 L 2,2
784
+ * ```
785
+ *
786
+ * @alpha
787
+ */
788
+ declare const line: (data: Point[]) => string;
789
+ /**
790
+ * Create a cubic Bezier curve path command
791
+ *
792
+ * @param data - An array of Points
793
+ *
794
+ * @example
795
+ *
796
+ * ```typescript
797
+ * curve([{x:0, y:0}, {x:3, y:4}, {x:9, y:16}]);
798
+ * // Output:
799
+ * // M 0,0 C 0,0 1.778263374435667,1.8280237767745193 3,4 C 6.278263374435667,9.828023776774518 9,16 9,16
800
+ * ```
801
+ *
802
+ * @alpha
803
+ */
804
+ declare const curve: (data: Point[]) => string;
805
+ /**
806
+ * Create a cubic Bezier curve path then turning back to the starting point with
807
+ * provided point of reference
808
+ *
809
+ * @param reference - reference coordinates, straight to y then x then the starting point
810
+ * @param data - An array of Points
811
+ *
812
+ * @example
813
+ *
814
+ * ```typescript
815
+ * closedCurve({x:0, y:20})([{x:0, y:0}, {x:3, y:4}, {x:9, y:16}]);
816
+ * // Output:
817
+ * // M 0,0 C 0,0 1.778263374435667,1.8280237767745193 3,4 C 6.278263374435667,9.828023776774518 9,16 9,16 V 20 H 0 Z
818
+ * ```
819
+ *
820
+ * @alpha
821
+ */
822
+ declare const closedCurve: ({ x, y }: Point) => (data: Point[]) => string;
823
+
824
+ /**
825
+ * Sum an array of numbers
826
+ *
827
+ * @param nums - An array of numbers
828
+ */
829
+ declare const sum: (nums: number[]) => number;
830
+ /**
831
+ * Average an array of numbers
832
+ *
833
+ * @param nums - An array of numbers
834
+ */
835
+ declare const avg: (nums: number[]) => number;
836
+ /**
837
+ * pow function from Math in functional form `number -> number -> number`
838
+ *
839
+ * @param exponent - The exponent used for the expression
840
+ * @param base - The base value to be powered
841
+ *
842
+ * @returns Math.pow(base, exponent)
843
+ */
844
+ declare const pow: (exponent: number) => (base: number) => number;
845
+ /**
846
+ * Calculate the Root Mean Square from provided numbers
847
+ *
848
+ * @param nums - An array of numbers
849
+ */
850
+ declare const rms: (nums: number[]) => number;
851
+ /**
852
+ * Round the floating point number away from zero, which is different from
853
+ * `Math.round`
854
+ *
855
+ * @param num - The number to round
856
+ *
857
+ * @example
858
+ *
859
+ * ```typescript
860
+ * round(0.5) // 1
861
+ * round(-0.5) // -1
862
+ * ```
863
+ */
864
+ declare const round: (num: number) => number;
865
+
866
+ /**
867
+ * Default silent threshold
868
+ * At least one LSB 16-bit data (compare is on absolute value).
869
+ */
870
+ declare const SILENT_THRESHOLD: number;
871
+ /**
872
+ * Default mono detection threshold
873
+ * Data must be identical within one LSB 16-bit to be identified as mono.
874
+ */
875
+ declare const MONO_THRESHOLD: number;
876
+ /**
877
+ * Default low volume detection threshold
878
+ */
879
+ declare const LOW_VOLUME_THRESHOLD = -60;
880
+ /**
881
+ * Default clipping detection threshold
882
+ */
883
+ declare const CLIP_THRESHOLD = 0.98;
884
+ /**
885
+ * Default Voice probability threshold
886
+ */
887
+ declare const VOICE_PROBABILITY_THRESHOLD = 0.3;
888
+ /**
889
+ * Default clipping count threshold
890
+ * Number of consecutive clipThreshold level samples that indicate clipping.
891
+ */
892
+ declare const CLIP_COUNT_THRESHOLD = 6;
893
+ /**
894
+ * AudioStats builder
895
+ *
896
+ * @param stats - overwrite the default attributes
897
+ * @param options - `silentThreshold`, `lowVolumeThreshold` and
898
+ * `clipCountThreshold`
899
+ */
900
+ declare const createAudioStats: (stats?: Partial<AudioStats>, { silentThreshold, lowVolumeThreshold, clipCountThreshold, }?: {
901
+ silentThreshold?: number | undefined;
902
+ lowVolumeThreshold?: number | undefined;
903
+ clipCountThreshold?: number | undefined;
904
+ }) => AudioStats;
905
+ /**
906
+ * Convert a byte to float, according to web audio spec
907
+ *
908
+ * Floating point audio sample number is defined as: non-interleaved IEEE754
909
+ * 32-bit linear PCM with a nominal range between -1 and +1, that is, 32bits
910
+ * floating point buffer, with each samples between -1.0 and 1.0
911
+ * https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer
912
+ *
913
+ * Byte samples are represented as follows:
914
+ * 128 is silence, 0 is negative max, 256 is positive max
915
+ *
916
+ * @param value - The byte value to convert to float
917
+ *
918
+ * @remarks
919
+ * Ref. https://www.w3.org/TR/webaudio/#dom-analysernode-getbytetimedomaindata
920
+ */
921
+ declare const fromByteToFloat: (value: number) => number;
922
+ /**
923
+ * Convert a float to byte, according to web audio spec
924
+ *
925
+ * Floating point audio sample number is defined as: non-interleaved IEEE754
926
+ * 32-bit linear PCM with a nominal range between -1 and +1, that is, 32bits
927
+ * floating point buffer, with each samples between -1.0 and 1.0
928
+ * https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer
929
+ *
930
+ * Byte samples are represented as follows:
931
+ * 128 is silence, 0 is negative max, 256 is positive max
932
+ *
933
+ * @param value - The float value to convert to byte
934
+ *
935
+ * @remarks
936
+ * Ref. https://www.w3.org/TR/webaudio/#dom-analysernode-getbytetimedomaindata
937
+ */
938
+ declare const fromFloatToByte: (value: number) => number;
939
+ /**
940
+ * Copy data from Uint8Array buffer to Float32Array buffer with byte to float conversion
941
+ *
942
+ * @param bytes - The source Byte buffer
943
+ * @param floats - The destination buffer
944
+ */
945
+ declare const copyByteBufferToFloatBuffer: (bytes: Uint8Array, floats: Float32Array) => void;
946
+ /**
947
+ * Convert a floating point gain value into a dB representation without any
948
+ * reference, dBFS, https://en.wikipedia.org/wiki/DBFS
949
+ *
950
+ * See https://www.w3.org/TR/webaudio#conversion-to-db
951
+ *
952
+ * @param amplitude - Expected a value in (0, 1]
953
+ */
954
+ declare const toDecibel: (gain: number) => number;
955
+ /**
956
+ * Calculate the averaged volume using Root Mean Square, assuming the data is in
957
+ * float form
958
+ *
959
+ * @param data - Audio Frequency data
960
+ *
961
+ * @alpha
962
+ */
963
+ declare const processAverageVolume: (data: number[]) => number;
964
+ /**
965
+ * Simple silent detection to only check the first and last bit from the sample
966
+ *
967
+ * @param samples - Audio sample data, this could be in a form of floating number
968
+ * of a byte number as long as the `threshold` value is given accordingly.
969
+ * @param threshold - Silent threshold
970
+ *
971
+ * @defaultValue
972
+ * `1.0 / 32767` assuming the sample is float value
973
+ *
974
+ * @returns
975
+ * `true` when it is silent
976
+ */
977
+ declare const isSilent: (samples: AudioSamples, threshold?: number) => boolean;
978
+ /**
979
+ * Check if the provided gain above the low volume threshold, which is
980
+ * considered as low volume.
981
+ *
982
+ * @param gain - Floating point representation of the gain number
983
+ *
984
+ * @returns
985
+ * `true` if the `gain` is lower than the threshold
986
+ */
987
+ declare const isLowVolume: (gain: number, threshold?: number) => boolean;
988
+ /**
989
+ * Check if there is clipping
990
+ *
991
+ * @param clipCount - Number of consecutive clip
992
+ *
993
+ * @returns
994
+ * `true` if the `clipCount` is above the threshold, aka clipping
995
+ */
996
+ declare const isClipping: (clipCount: number, threshold?: number) => boolean;
997
+ /**
998
+ * Check if provided channels are mono or stereo
999
+ *
1000
+ * @param channels - Audio channels and assuming the inputs are in floating
1001
+ * point form
1002
+ * @param threshold - Mono detection threshold, default to floating point form
1003
+ *
1004
+ * @defaultValue
1005
+ * `1.0 / 32767`
1006
+ *
1007
+ * @returns
1008
+ * `true` if they are mono, otherwise stereo
1009
+ */
1010
+ declare const isMono: (channels: AudioSamples[], threshold?: number) => boolean;
1011
+ /**
1012
+ * Calculate the audio stats, expected the samples are in float form
1013
+ *
1014
+ * @param options - See StatsOptions
1015
+ *
1016
+ * @remarks
1017
+ * http://www.rossbencina.com/code/real-time-audio-programming-101-time-waits-for-nothing
1018
+ */
1019
+ declare const getAudioStats: ({ samples, baseStats, clipThreshold, }: StatsOptions) => AudioStats;
1020
+ /**
1021
+ * VAD options
1022
+ */
1023
+ interface VAOptions {
1024
+ /**
1025
+ * the RMS threshold used to compare with the input RMS
1026
+ */
1027
+ volumeThreshold?: number;
1028
+ /**
1029
+ * The threshold for a voice pulse in terms of time, in millisecond
1030
+ */
1031
+ VADTimeThreshold?: number;
1032
+ /**
1033
+ * The clock, can be used for testing
1034
+ *
1035
+ * @defaultValue
1036
+ * `performance`
1037
+ */
1038
+ clock?: Clock;
1039
+ }
1040
+ /**
1041
+ * A Naive Voice activity detection
1042
+ *
1043
+ * @param options - See `VAOptions`
1044
+ *
1045
+ * @returns `(volume: number) => boolean`, `true` if there is voice
1046
+ */
1047
+ declare const isVoiceActivity: ({ volumeThreshold, VADTimeThreshold, clock, }?: VAOptions) => (volume: number) => boolean;
1048
+ /**
1049
+ * Compare the provided width and height to see if they are the same
1050
+ *
1051
+ * @param widthA - The width of A
1052
+ * @param heightA - The height of A
1053
+ * @param widthB - The width of B
1054
+ * @param heightB - The height of B
1055
+ */
1056
+ declare const isEqualSize: (widthA: number, heightA: number, widthB: number, heightB: number) => boolean;
1057
+ /**
1058
+ * Convert the source size to destination size when necessary based on the
1059
+ * height
1060
+ *
1061
+ * @param sw - Source width
1062
+ * @param sh - Source height
1063
+ * @param dw - destination width
1064
+ * @param dh - destination height
1065
+ */
1066
+ declare const fitDestinationSize: (sw: number, sh: number, dw: number, dh: number) => Rect;
1067
+ /**
1068
+ * A function to check provided time series data is considered as voice activity
1069
+ *
1070
+ * @param options - @see VAOptions
1071
+ */
1072
+ declare const createVoiceDetectorFromTimeData: (options?: VAOptions) => IsVoice<number[]>;
1073
+ /**
1074
+ * A function to check the provided probability is considered as voice activity
1075
+ *
1076
+ * @param voiceThreshold - A threshold of the probability to be considered as
1077
+ * voice activity
1078
+ */
1079
+ declare const createVoiceDetectorFromProbability: (voiceThreshold?: number) => IsVoice<number>;
1080
+ /**
1081
+ * Create a voice detector based on provided params
1082
+ *
1083
+ * @param onDetected - When there is voice activity, this callback will be called
1084
+ * @param shouldDetect - When return `true`, voice activity will function, otherwise, not function
1085
+ * @param options - @see ThrottleOptions
1086
+ */
1087
+ declare const createVADetector: (onDetected: () => void, shouldDetect: () => boolean, options?: ThrottleOptions) => <T>(isVoice: IsVoice<T>) => (data: T) => void;
1088
+ /**
1089
+ * Create a function to process the AudioStats and check if silent
1090
+ * `onSignalDetected` callback is called under 2 situations:
1091
+ *
1092
+ * ```
1093
+ * Logic
1094
+ * lastCheck | silent | should call onSignalDetected
1095
+ * 0 | 0 | 0
1096
+ * 0 | 1 | 1
1097
+ * 1 | 0 | 1
1098
+ * 1 | 1 | 0
1099
+ * ```
1100
+ */
1101
+ declare const createAudioSignalDetector: (shouldDetect: () => boolean, onDetected: (silent: boolean) => void) => (buffer: Queue<number[]>, threshold?: number) => (samples: number[]) => void;
1102
+
1103
+ declare const isAudioNode: (t: unknown) => t is AudioNode;
1104
+ declare const isAudioParam: (t: unknown) => t is AudioParam;
1105
+ declare const isAudioNodeInit: (t: unknown) => t is AudioNodeInit<AudioNode, BaseAudioNode>;
1106
+ declare const isAnalyzerNodeInit: (t: unknown) => t is AnalyzerNodeInit;
1107
+
1108
+ interface Benchmark {
1109
+ begin(): void;
1110
+ end(): void;
1111
+ calculateFps(): number;
1112
+ }
1113
+ interface BenchmarkOptions {
1114
+ calculationThresholdMS?: number;
1115
+ }
1116
+ declare const createBenchmark: (clock?: Clock, { calculationThresholdMS }?: BenchmarkOptions) => Benchmark;
1117
+ declare const calculateFps: (time: number) => number;
1118
+
1119
+ /**
1120
+ * A library for media analysis using Web APIs.
1121
+ *
1122
+ * @packageDocumentation
1123
+ */
1124
+
1125
+ declare const urls: {
1126
+ denoise: () => URL;
1127
+ };
1128
+
1129
+ export { AbortReason, Analyzer, AnalyzerNodeInit, AnalyzerSubscribableOptions, AsyncAssets, AsyncCallback, AudioBufferBytes, AudioBufferFloats, AudioDestinationNodeInit, AudioGraph, AudioGraphOptions, AudioNodeConnectParam, AudioNodeInit, AudioNodeInitConnectParam, AudioNodeInitConnection, AudioNodeInitConnections, AudioNodeParam, AudioNodeProps, AudioProcessorEnable, AudioProcessorMessageEvent, AudioProcessorRelease, AudioSamples, AudioStats, BACKGROUND_BLUR_AMOUNT, BaseAudioNode, Benchmark, BoundingBox, CLIP_COUNT_THRESHOLD, CLIP_THRESHOLD, Callback, Canvas, CanvasContext, ChannelSplitterNodeInit, Clock, Color, ConnectInitParamBaseType, ConnectInitParamType, ConnectParamBase, ConnectParamBaseType, ConnectParamType, DelayNodeInit, Denoise, DenoiseWorkletNodeInit, Detector, EDGE_BLUR_AMOUNT, FLIP_HORIZONTAL, FOREGROUND_THRESHOLD, FRAME_RATE, Face, Frame, Gain, GainNodeInit, ImageType, InputFrame, IsVoice, Keypoint, LOW_VOLUME_THRESHOLD, MONO_THRESHOLD, Mask, MaskUnderlyingType, MediaElementAudioSourceNodeInit, MediaStreamAudioDestinationNodeInit, MediaStreamAudioSourceNodeInit, Node, NodeConnectionAction, Nodes, PROCESSING_HEIGHT, PROCESSING_WIDTH, Point, Process, ProcessInputType, ProcessStatus, ProcessVideoTrack, RENDER_EFFECTS, Rect, RenderEffects, RenderParams, Runner, RunnerCreator, SEG_MODELS, SILENT_THRESHOLD, Segmentation, SegmentationModel, SegmentationParams, SegmentationTransform, Segmenter, Size, StatsOptions, SubscribableOptions, ThrottleOptions, Transform, UniversalAudioContextState, Unsubscribe$1 as Unsubscribe, VOICE_PROBABILITY_THRESHOLD, VideoProcessor, WasmPaths, WasmProcessorOptions, WasmWorkletNodeOptions, WorkletMessagePortOptions, WorkletModule, avg, calculateDistance, calculateFps, closedCurve, copyByteBufferToFloatBuffer, createAnalyzerGraphNode, createAnalyzerSubscribableGraphNode, createAsyncCallbackLoop, createAudioContext, createAudioDestinationGraphNode, createAudioGraph, createAudioGraphProxy, createAudioSignalDetector, createAudioStats, createBenchmark, createTransform as createCanvasTransform, createChannelMergerGraphNode, createChannelSplitterGraphNode, createDelayGraphNode, createDenoiseWorkletGraphNode, createFrameCallbackRequest, createGainGraphNode, createMediaElementSourceGraphNode, createSegmenter as createMediapipeSegmenter, createStreamDestinationGraphNode, createStreamSourceGraphNode, createVADetector, createVideoProcessor, createVideoTrackProcessor, createVideoTrackProcessorWithFallback, createVoiceDetectorFromProbability, createVoiceDetectorFromTimeData, curve, fitDestinationSize, fromByteToFloat, fromFloatToByte, getAudioStats, getBezierCurveControlPoints, isAnalyzerNodeInit, isAudioNode, isAudioNodeInit, isAudioParam, isClipping, isEqualSize, isLowVolume, isMono, isRenderEffects, isSegmentationModel, isSilent, isVoiceActivity, line, loadScript, loadTfjsBackendWebGl, loadTfjsCore, loadWasms, pow, processAverageVolume, resumeAudioOnInterruption, resumeAudioOnUnmute, rms, round, subscribeTimeoutAnalyzerNode, subscribeWorkletNode, sum, toDecibel, urls };