@pexip/media-processor 20.3.3 → 20.3.5
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/CHANGELOG.md +15 -0
- package/api-docs/README.mdx +411 -0
- package/api-docs/enumerations/AbortReason.mdx +5 -0
- package/api-docs/functions/avg.mdx +15 -0
- package/api-docs/functions/calculateDistance.mdx +18 -0
- package/api-docs/functions/closedCurve.mdx +27 -0
- package/api-docs/functions/copyByteBufferToFloatBuffer.mdx +16 -0
- package/api-docs/functions/createAnalyzerGraphNode.mdx +19 -0
- package/api-docs/functions/createAnalyzerSubscribableGraphNode.mdx +15 -0
- package/api-docs/functions/createAsyncCallbackLoop.mdx +35 -0
- package/api-docs/functions/createAudioContext.mdx +22 -0
- package/api-docs/functions/createAudioDestinationGraphNode.mdx +9 -0
- package/api-docs/functions/createAudioGraph.mdx +28 -0
- package/api-docs/functions/createAudioGraphProxy.mdx +14 -0
- package/api-docs/functions/createAudioSignalDetector.mdx +51 -0
- package/api-docs/functions/createAudioStats.mdx +19 -0
- package/api-docs/functions/createBenchmark.mdx +14 -0
- package/api-docs/functions/createCanvas.mdx +16 -0
- package/api-docs/functions/createCanvasTransform.mdx +14 -0
- package/api-docs/functions/createChannelMergerGraphNode.mdx +19 -0
- package/api-docs/functions/createChannelSplitterGraphNode.mdx +19 -0
- package/api-docs/functions/createDelayGraphNode.mdx +19 -0
- package/api-docs/functions/createDenoiseWorkletGraphNode.mdx +16 -0
- package/api-docs/functions/createFrameCallbackRequest.mdx +29 -0
- package/api-docs/functions/createGainGraphNode.mdx +15 -0
- package/api-docs/functions/createMediaElementSourceGraphNode.mdx +15 -0
- package/api-docs/functions/createSegmenter.mdx +14 -0
- package/api-docs/functions/createStreamDestinationGraphNode.mdx +15 -0
- package/api-docs/functions/createStreamSourceGraphNode.mdx +16 -0
- package/api-docs/functions/createVADetector.mdx +54 -0
- package/api-docs/functions/createVideoProcessor.mdx +14 -0
- package/api-docs/functions/createVideoTrackProcessor.mdx +9 -0
- package/api-docs/functions/createVideoTrackProcessorWithFallback.mdx +15 -0
- package/api-docs/functions/createVoiceDetectorFromProbability.mdx +15 -0
- package/api-docs/functions/createVoiceDetectorFromTimeData.mdx +19 -0
- package/api-docs/functions/curve.mdx +15 -0
- package/api-docs/functions/fromByteToFloat.mdx +27 -0
- package/api-docs/functions/fromFloatToByte.mdx +27 -0
- package/api-docs/functions/getAudioStats.mdx +19 -0
- package/api-docs/functions/getBezierCurveControlPoints.mdx +26 -0
- package/api-docs/functions/isAnalyzerNodeInit.mdx +13 -0
- package/api-docs/functions/isAudioNode.mdx +13 -0
- package/api-docs/functions/isAudioNodeInit.mdx +13 -0
- package/api-docs/functions/isAudioParam.mdx +13 -0
- package/api-docs/functions/isClipping.mdx +18 -0
- package/api-docs/functions/isEqualSize.mdx +22 -0
- package/api-docs/functions/isLowVolume.mdx +19 -0
- package/api-docs/functions/isMono.mdx +22 -0
- package/api-docs/functions/isRenderEffects.mdx +13 -0
- package/api-docs/functions/isSilent.mdx +22 -0
- package/api-docs/functions/isVoiceActivity.mdx +29 -0
- package/api-docs/functions/line.mdx +15 -0
- package/api-docs/functions/loadScript.mdx +14 -0
- package/api-docs/functions/loadWasms.mdx +13 -0
- package/api-docs/functions/pow.mdx +29 -0
- package/api-docs/functions/processAverageVolume.mdx +15 -0
- package/api-docs/functions/resumeAudioOnInterruption.mdx +23 -0
- package/api-docs/functions/resumeAudioOnUnmute.mdx +27 -0
- package/api-docs/functions/rms.mdx +15 -0
- package/api-docs/functions/round.mdx +23 -0
- package/api-docs/functions/subscribeTimeoutAnalyzerNode.mdx +22 -0
- package/api-docs/functions/subscribeWorkletNode.mdx +28 -0
- package/api-docs/functions/sum.mdx +15 -0
- package/api-docs/functions/toDecibel.mdx +18 -0
- package/api-docs/interfaces/Analyzer.mdx +368 -0
- package/api-docs/interfaces/AnalyzerSubscribableOptions.mdx +11 -0
- package/api-docs/interfaces/AsyncAssets.mdx +7 -0
- package/api-docs/interfaces/AudioGraph.mdx +92 -0
- package/api-docs/interfaces/AudioGraphOptions.mdx +6 -0
- package/api-docs/interfaces/AudioNodeInit.mdx +127 -0
- package/api-docs/interfaces/AudioNodeProps.mdx +15 -0
- package/api-docs/interfaces/AudioStats.mdx +16 -0
- package/api-docs/interfaces/BackgroundImage.mdx +6 -0
- package/api-docs/interfaces/Benchmark.mdx +35 -0
- package/api-docs/interfaces/Clock.mdx +11 -0
- package/api-docs/interfaces/Denoise.mdx +50 -0
- package/api-docs/interfaces/Detector.mdx +81 -0
- package/api-docs/interfaces/Frame.mdx +11 -0
- package/api-docs/interfaces/Gain.mdx +227 -0
- package/api-docs/interfaces/ImageRecord.mdx +6 -0
- package/api-docs/interfaces/ImageSegmenterOptions.mdx +8 -0
- package/api-docs/interfaces/MPMask.mdx +145 -0
- package/api-docs/interfaces/Point.mdx +10 -0
- package/api-docs/interfaces/Process.mdx +46 -0
- package/api-docs/interfaces/ProcessEventClose.mdx +7 -0
- package/api-docs/interfaces/ProcessEventDebug.mdx +14 -0
- package/api-docs/interfaces/ProcessEventDestroy.mdx +7 -0
- package/api-docs/interfaces/ProcessEventOpen.mdx +14 -0
- package/api-docs/interfaces/ProcessEventProcess.mdx +14 -0
- package/api-docs/interfaces/ProcessEventUpdate.mdx +14 -0
- package/api-docs/interfaces/ProcessWorkerDebugMessage.mdx +6 -0
- package/api-docs/interfaces/ProcessWorkerEvent.mdx +12 -0
- package/api-docs/interfaces/ProcessWorkerEventDebug.mdx +12 -0
- package/api-docs/interfaces/ProcessWorkerEventOpened.mdx +5 -0
- package/api-docs/interfaces/ProcessWorkerEventProcessed.mdx +12 -0
- package/api-docs/interfaces/ProcessWorkerEventUpdated.mdx +5 -0
- package/api-docs/interfaces/ProcessorEvent.mdx +7 -0
- package/api-docs/interfaces/ProcessorOptions.mdx +16 -0
- package/api-docs/interfaces/ProcessorProcessOptions.mdx +6 -0
- package/api-docs/interfaces/Rect.mdx +8 -0
- package/api-docs/interfaces/RenderEventHandlers.mdx +7 -0
- package/api-docs/interfaces/Renderer.mdx +64 -0
- package/api-docs/interfaces/RendererOptions.mdx +15 -0
- package/api-docs/interfaces/Runner.mdx +41 -0
- package/api-docs/interfaces/Segmentation.mdx +5 -0
- package/api-docs/interfaces/SegmentationModelAsset.mdx +8 -0
- package/api-docs/interfaces/SegmentationParams.mdx +18 -0
- package/api-docs/interfaces/SegmentationSmoothingConfig.mdx +5 -0
- package/api-docs/interfaces/Segmenter.mdx +121 -0
- package/api-docs/interfaces/SegmenterOptions.mdx +13 -0
- package/api-docs/interfaces/Size.mdx +10 -0
- package/api-docs/interfaces/StatsOptions.mdx +10 -0
- package/api-docs/interfaces/SubscribableOptions.mdx +9 -0
- package/api-docs/interfaces/ThrottleOptions.mdx +8 -0
- package/api-docs/interfaces/Transform.mdx +62 -0
- package/api-docs/interfaces/VideoFrameLike.mdx +8 -0
- package/api-docs/interfaces/VideoProcessor.mdx +38 -0
- package/api-docs/interfaces/WorkletMessagePortOptions.mdx +16 -0
- package/api-docs/interfaces/WorkletModule.mdx +6 -0
- package/api-docs/type-aliases/AnalyzerNodeInit.mdx +3 -0
- package/api-docs/type-aliases/AsyncCallback.mdx +7 -0
- package/api-docs/type-aliases/AudioBufferBytes.mdx +5 -0
- package/api-docs/type-aliases/AudioBufferFloats.mdx +6 -0
- package/api-docs/type-aliases/AudioDestinationNodeInit.mdx +3 -0
- package/api-docs/type-aliases/AudioNodeConnectParam.mdx +3 -0
- package/api-docs/type-aliases/AudioNodeInitConnectParam.mdx +3 -0
- package/api-docs/type-aliases/AudioNodeInitConnection.mdx +3 -0
- package/api-docs/type-aliases/AudioNodeInitConnections.mdx +3 -0
- package/api-docs/type-aliases/AudioNodeParam.mdx +3 -0
- package/api-docs/type-aliases/AudioSamples.mdx +17 -0
- package/api-docs/type-aliases/BaseAudioNode.mdx +3 -0
- package/api-docs/type-aliases/Callback.mdx +20 -0
- package/api-docs/type-aliases/Canvas.mdx +3 -0
- package/api-docs/type-aliases/CanvasContext.mdx +3 -0
- package/api-docs/type-aliases/ChannelSplitterNodeInit.mdx +3 -0
- package/api-docs/type-aliases/Color.mdx +12 -0
- package/api-docs/type-aliases/ConnectInitParamBaseType.mdx +3 -0
- package/api-docs/type-aliases/ConnectInitParamType.mdx +3 -0
- package/api-docs/type-aliases/ConnectParamBase.mdx +11 -0
- package/api-docs/type-aliases/ConnectParamBaseType.mdx +3 -0
- package/api-docs/type-aliases/ConnectParamType.mdx +3 -0
- package/api-docs/type-aliases/DelayNodeInit.mdx +3 -0
- package/api-docs/type-aliases/Delegate.mdx +3 -0
- package/api-docs/type-aliases/DenoiseWorkletNodeInit.mdx +3 -0
- package/api-docs/type-aliases/ExtractMessageEventType.mdx +9 -0
- package/api-docs/type-aliases/GainNodeInit.mdx +3 -0
- package/api-docs/type-aliases/ImageMapIterable.mdx +3 -0
- package/api-docs/type-aliases/ImageType.mdx +6 -0
- package/api-docs/type-aliases/IncludeMessageEventDataType.mdx +10 -0
- package/api-docs/type-aliases/InputFrame.mdx +3 -0
- package/api-docs/type-aliases/IsVoice.mdx +19 -0
- package/api-docs/type-aliases/MediaElementAudioSourceNodeInit.mdx +3 -0
- package/api-docs/type-aliases/MediaStreamAudioDestinationNodeInit.mdx +3 -0
- package/api-docs/type-aliases/MediaStreamAudioSourceNodeInit.mdx +3 -0
- package/api-docs/type-aliases/Node.mdx +3 -0
- package/api-docs/type-aliases/NodeConnectionAction.mdx +3 -0
- package/api-docs/type-aliases/Nodes.mdx +3 -0
- package/api-docs/type-aliases/ProcessEvents.mdx +17 -0
- package/api-docs/type-aliases/ProcessInputType.mdx +3 -0
- package/api-docs/type-aliases/ProcessStatus.mdx +3 -0
- package/api-docs/type-aliases/ProcessVideoTrack.mdx +15 -0
- package/api-docs/type-aliases/ProcessWorkerEvents.mdx +18 -0
- package/api-docs/type-aliases/ProcessorEvents.mdx +3 -0
- package/api-docs/type-aliases/ProcessorWorkerEvents.mdx +3 -0
- package/api-docs/type-aliases/RenderBackend.mdx +3 -0
- package/api-docs/type-aliases/RenderEffects.mdx +3 -0
- package/api-docs/type-aliases/RenderingEvents.mdx +3 -0
- package/api-docs/type-aliases/RunnerCreator.mdx +21 -0
- package/api-docs/type-aliases/SegmentationModel.mdx +3 -0
- package/api-docs/type-aliases/SegmentationTransform.mdx +3 -0
- package/api-docs/type-aliases/TupleOf.mdx +12 -0
- package/api-docs/type-aliases/UniversalAudioContextState.mdx +6 -0
- package/api-docs/type-aliases/Unsubscribe.mdx +9 -0
- package/api-docs/type-aliases/WasmPaths.mdx +3 -0
- package/api-docs/variables/BACKGROUND_BLUR_AMOUNT.mdx +3 -0
- package/api-docs/variables/CLIP_COUNT_THRESHOLD.mdx +6 -0
- package/api-docs/variables/CLIP_THRESHOLD.mdx +5 -0
- package/api-docs/variables/EDGE_BLUR_AMOUNT.mdx +3 -0
- package/api-docs/variables/FOREGROUND_THRESHOLD.mdx +3 -0
- package/api-docs/variables/FRAME_RATE.mdx +3 -0
- package/api-docs/variables/LOW_VOLUME_THRESHOLD.mdx +5 -0
- package/api-docs/variables/MASK_COMBINE_RATIO.mdx +3 -0
- package/api-docs/variables/MONO_THRESHOLD.mdx +6 -0
- package/api-docs/variables/PLAY_VIDEO_TIMEOUT.mdx +3 -0
- package/api-docs/variables/PROCESSING_HEIGHT.mdx +3 -0
- package/api-docs/variables/PROCESSING_WIDTH.mdx +3 -0
- package/api-docs/variables/PROCESS_STATUS.mdx +22 -0
- package/api-docs/variables/RENDERING_EVENTS.mdx +14 -0
- package/api-docs/variables/RENDER_BACKEND.mdx +10 -0
- package/api-docs/variables/RENDER_EFFECT.mdx +11 -0
- package/api-docs/variables/SEGMENTATION_MODELS.mdx +10 -0
- package/api-docs/variables/SILENT_THRESHOLD.mdx +6 -0
- package/api-docs/variables/VOICE_PROBABILITY_THRESHOLD.mdx +5 -0
- package/api-docs/variables/calculateMaxBlurPass.mdx +13 -0
- package/api-docs/variables/clamping.mdx +26 -0
- package/api-docs/variables/createLazyProps.mdx +19 -0
- package/api-docs/variables/createObjectUpdater.mdx +31 -0
- package/api-docs/variables/createRemoteImageBitmap.mdx +21 -0
- package/api-docs/variables/getErrorMessage.mdx +13 -0
- package/api-docs/variables/handleWebGLContextLoss.mdx +21 -0
- package/api-docs/variables/isRenderingEvents.mdx +13 -0
- package/api-docs/variables/isSegmentationModel.mdx +13 -0
- package/api-docs/variables/resize.mdx +30 -0
- package/api-docs/variables/toRenderingEvents.mdx +13 -0
- package/api-docs/variables/urls.mdx +10 -0
- package/package.json +14 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 20.3.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 13e3722: Generate the package documentation in a folder called doc-dist
|
|
8
|
+
- Updated dependencies [13e3722]
|
|
9
|
+
- @pexip/utils@17.1.3
|
|
10
|
+
|
|
11
|
+
## 20.3.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [0e1a7b7]
|
|
16
|
+
- @pexip/utils@17.1.2
|
|
17
|
+
|
|
3
18
|
## 20.3.3
|
|
4
19
|
|
|
5
20
|
## 20.3.2
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
# `@pexip/media-processor`
|
|
2
|
+
|
|
3
|
+
An package for media data processing using Web API.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
`npm install @pexip/media-processor`
|
|
8
|
+
|
|
9
|
+
## Usages
|
|
10
|
+
|
|
11
|
+
### Use Analyzer to get the MediaStream data
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
const stream = await navigator.mediaDevices.getUserMedia({audio:true});
|
|
15
|
+
|
|
16
|
+
const fftSize = 64;
|
|
17
|
+
// Setup an Audio Graph with `source` -> `analyzer`
|
|
18
|
+
const source = createStreamSourceGraphNode(stream);
|
|
19
|
+
const analyzer = createAnalyzerGraphNode({fftSize});
|
|
20
|
+
const audioGraph = createAudioGraph([[source, analyzer]]);
|
|
21
|
+
|
|
22
|
+
// Grab the current time domain data in floating point representation
|
|
23
|
+
const buffer = new Float32Array(fftSize);
|
|
24
|
+
analyzer.node?.getFloatTimeDomainData(buffer);
|
|
25
|
+
// Do some work with the buffer
|
|
26
|
+
buffer.forEach(...);
|
|
27
|
+
|
|
28
|
+
// Get the current volume, [0, 1]
|
|
29
|
+
const volume = analyzer.getAverageVolume(buffer);
|
|
30
|
+
|
|
31
|
+
// Release the resources when you have done with the analyzer
|
|
32
|
+
await audioGraph.release();
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Use AudioGraph to control the audio gain to mute/unmute
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
const stream = await navigator.mediaDevices.getUserMedia({
|
|
39
|
+
audio: true,
|
|
40
|
+
video: true,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const mute = !stream.getAudioTracks()[0]?.enabled;
|
|
44
|
+
|
|
45
|
+
// Setup an Audio Graph with `source` -> `gain`
|
|
46
|
+
const source = createStreamSourceGraphNode(stream);
|
|
47
|
+
const gain = createGainGraphNode(mute);
|
|
48
|
+
const destination = createStreamDestinationGraphNode();
|
|
49
|
+
|
|
50
|
+
const audioGraph = createAudioGraph([[source, gain, destination]]);
|
|
51
|
+
|
|
52
|
+
// Use the output MediaStream to for the altered AudioTrack
|
|
53
|
+
const alteredStream = new MediaStream([
|
|
54
|
+
...stream.getVideoTracks(),
|
|
55
|
+
...destination.stream.getAudioTracks(),
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
// Mute the audio
|
|
59
|
+
if (gain.node) {
|
|
60
|
+
gain.node.mute = true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Check if the audio is muted
|
|
64
|
+
gain.node.mute; // returns `true`, since we have just set the gain to 0
|
|
65
|
+
|
|
66
|
+
// Release the resources when you have done with the analyzer
|
|
67
|
+
await audioGraph.release();
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Use noise suppression
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
const stream = await navigator.mediaDevices.getUserMedia({
|
|
74
|
+
audio: true,
|
|
75
|
+
video: true,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Fetch denoise WebAssembly
|
|
79
|
+
const response = await fetch(
|
|
80
|
+
new URL('@pexip/denoise/denoise_bg.wasm', import.meta.url).href,
|
|
81
|
+
);
|
|
82
|
+
const wasmBuffer = await response.arrayBuffer();
|
|
83
|
+
|
|
84
|
+
// Setup an Audio Graph with `source` -> `gain`
|
|
85
|
+
const source = createStreamSourceGraphNode(stream);
|
|
86
|
+
const destination = createStreamDestinationGraphNode();
|
|
87
|
+
|
|
88
|
+
const audioGraph = createAudioGraph([[source, destination]]);
|
|
89
|
+
// Add worklet module
|
|
90
|
+
await audioGraph.addWorklet(
|
|
91
|
+
new URL(
|
|
92
|
+
'@pexip/media-processor/dist/worklets/denoise.worklet',
|
|
93
|
+
import.meta.url,
|
|
94
|
+
).href
|
|
95
|
+
);
|
|
96
|
+
const denoise = createDenoiseWorkletGraphNode(wasmBuffer);
|
|
97
|
+
// Route the source through the denoise node
|
|
98
|
+
const audioGraph.connect([source, denoise, destination]);
|
|
99
|
+
const audioGraph.disconnect([source, destination]);
|
|
100
|
+
|
|
101
|
+
// Release the resources when you have done with the analyzer
|
|
102
|
+
await audioGraph.release();
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Use background blur
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import {
|
|
109
|
+
createSegmenter,
|
|
110
|
+
createCanvasTransform,
|
|
111
|
+
createVideoTrackProcessor,
|
|
112
|
+
createVideoTrackProcessorWithFallback,
|
|
113
|
+
} from '@pexip/media-processor';
|
|
114
|
+
|
|
115
|
+
// Grab the user's camera stream
|
|
116
|
+
const stream = await navigator.mediaDevices.getUserMedia({video: true});
|
|
117
|
+
|
|
118
|
+
// Setting the path to that `@mediapipe/tasks-vision` assets
|
|
119
|
+
// It will be passed direct to
|
|
120
|
+
// [FilesetResolver.forVisionTasks()](https://ai.google.dev/edge/api/mediapipe/js/tasks-vision.filesetresolver#filesetresolverforvisiontasks)
|
|
121
|
+
const tasksVisionBasePath =
|
|
122
|
+
'A base path to specify the directory the Wasm files should be loaded from';
|
|
123
|
+
|
|
124
|
+
const modelAsset = {
|
|
125
|
+
/**
|
|
126
|
+
* Path to mediapipe selfie segmentation model asset
|
|
127
|
+
*/
|
|
128
|
+
path: 'A path to selfie segmentation model',
|
|
129
|
+
modelName: 'selfie' as const,
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const segmenter = createSegmenter(tasksVisionBasePath, {modelAssets});
|
|
133
|
+
// Create a processing transformer and set the effects to `blur`
|
|
134
|
+
const transformer = createCanvasTransform(segmenter, {effects: 'blur'});
|
|
135
|
+
const processor = createVideoProcessor([transformer]);
|
|
136
|
+
|
|
137
|
+
// Start the processor
|
|
138
|
+
await videoProcessor.open();
|
|
139
|
+
|
|
140
|
+
// Passing the raw MediaStream to apply the effects
|
|
141
|
+
// Then, use the output stream for whatever purpose
|
|
142
|
+
const processedStream = await videoProcessor.process(stream);
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Profiling Web Audio
|
|
146
|
+
|
|
147
|
+
You can do it with chrome, [See here][profiling web audio].
|
|
148
|
+
|
|
149
|
+
## How AudioWorkletNode and the AudioWorkletProcessor work together
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
┌─────────────────────────┐ ┌──────────────────────────┐
|
|
153
|
+
│ │ │ │
|
|
154
|
+
│ Main Global Scope │ │ AudioWorkletGlobalScope │
|
|
155
|
+
│ │ │ │
|
|
156
|
+
│ ┌───────────────────┐ │ │ ┌────────────────────┐ │
|
|
157
|
+
│ │ │ │ MessagePort │ │ │ │
|
|
158
|
+
│ │ AudioWorklet │◄─┼─────────────┼─►│ AudioWorklet │ │
|
|
159
|
+
│ │ Node │ │ │ │ Processor │ │
|
|
160
|
+
│ │ │ │ │ │ │ │
|
|
161
|
+
│ └───────────────────┘ │ │ └────────────────────┘ │
|
|
162
|
+
│ │ │ │
|
|
163
|
+
└─────────────────────────┘ └──────────────────────────┘
|
|
164
|
+
Main Thread WebAudio Render Thread
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Constraints when using the AudioWorklet
|
|
168
|
+
|
|
169
|
+
- Each `BaseAudioContext` possesses exactly one `AudioWorklet`
|
|
170
|
+
- 128 samples-frames
|
|
171
|
+
- No `fetch` API in the `AudioWorkletGlobalScope`
|
|
172
|
+
- No `TextEncoder/Decoder` APIs in the `AudioWorkletGlobalScope`
|
|
173
|
+
|
|
174
|
+
## References
|
|
175
|
+
|
|
176
|
+
- [MDN - Web Audio API][web audio api]
|
|
177
|
+
- [Web Audio Spec][web audio spec]
|
|
178
|
+
|
|
179
|
+
[web audio api]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API
|
|
180
|
+
[web audio spec]: https://webaudio.github.io/web-audio-api
|
|
181
|
+
[profiling web audio]: https://web.dev/profiling-web-audio-apps-in-chrome
|
|
182
|
+
|
|
183
|
+
A library for media analysis using Web APIs.
|
|
184
|
+
|
|
185
|
+
## Enumerations
|
|
186
|
+
|
|
187
|
+
| Enumeration | Description |
|
|
188
|
+
| ------ | ------ |
|
|
189
|
+
| [AbortReason](enumerations/AbortReason.mdx) | - |
|
|
190
|
+
|
|
191
|
+
## Interfaces
|
|
192
|
+
|
|
193
|
+
| Interface | Description |
|
|
194
|
+
| ------ | ------ |
|
|
195
|
+
| [Segmentation](interfaces/Segmentation.mdx) | - |
|
|
196
|
+
| [VideoFrameLike](interfaces/VideoFrameLike.mdx) | - |
|
|
197
|
+
| [ImageRecord](interfaces/ImageRecord.mdx) | - |
|
|
198
|
+
| [Rect](interfaces/Rect.mdx) | - |
|
|
199
|
+
| [ProcessEventOpen](interfaces/ProcessEventOpen.mdx) | Message event to initializing the Processor |
|
|
200
|
+
| [ProcessEventProcess](interfaces/ProcessEventProcess.mdx) | Message event to process the video frame |
|
|
201
|
+
| [ProcessEventUpdate](interfaces/ProcessEventUpdate.mdx) | Message event to update processor options |
|
|
202
|
+
| [ProcessEventClose](interfaces/ProcessEventClose.mdx) | Message event to stop the processing |
|
|
203
|
+
| [ProcessEventDestroy](interfaces/ProcessEventDestroy.mdx) | Message event to release all the resources |
|
|
204
|
+
| [ProcessEventDebug](interfaces/ProcessEventDebug.mdx) | Message event for debugging |
|
|
205
|
+
| [ProcessWorkerEventProcessed](interfaces/ProcessWorkerEventProcessed.mdx) | - |
|
|
206
|
+
| [ProcessWorkerEventOpened](interfaces/ProcessWorkerEventOpened.mdx) | - |
|
|
207
|
+
| [ProcessWorkerEventUpdated](interfaces/ProcessWorkerEventUpdated.mdx) | - |
|
|
208
|
+
| [ProcessWorkerEvent](interfaces/ProcessWorkerEvent.mdx) | - |
|
|
209
|
+
| [ProcessWorkerEventDebug](interfaces/ProcessWorkerEventDebug.mdx) | - |
|
|
210
|
+
| [ProcessorOptions](interfaces/ProcessorOptions.mdx) | - |
|
|
211
|
+
| [ProcessorProcessOptions](interfaces/ProcessorProcessOptions.mdx) | - |
|
|
212
|
+
| [ProcessWorkerDebugMessage](interfaces/ProcessWorkerDebugMessage.mdx) | - |
|
|
213
|
+
| [ProcessorEvent](interfaces/ProcessorEvent.mdx) | - |
|
|
214
|
+
| [RendererOptions](interfaces/RendererOptions.mdx) | - |
|
|
215
|
+
| [Renderer](interfaces/Renderer.mdx) | - |
|
|
216
|
+
| [RenderEventHandlers](interfaces/RenderEventHandlers.mdx) | - |
|
|
217
|
+
| [SegmentationModelAsset](interfaces/SegmentationModelAsset.mdx) | Segmentation model asset that can be used to load a segmentation model. |
|
|
218
|
+
| [ImageSegmenterOptions](interfaces/ImageSegmenterOptions.mdx) | - |
|
|
219
|
+
| [SegmenterOptions](interfaces/SegmenterOptions.mdx) | - |
|
|
220
|
+
| [SegmentationSmoothingConfig](interfaces/SegmentationSmoothingConfig.mdx) | - |
|
|
221
|
+
| [MPMask](interfaces/MPMask.mdx) | Wrapper for a mask produced by a Segmentation Task. |
|
|
222
|
+
| [Benchmark](interfaces/Benchmark.mdx) | - |
|
|
223
|
+
| [Point](interfaces/Point.mdx) | Interface for Point consist of coordinates x and y |
|
|
224
|
+
| [Size](interfaces/Size.mdx) | - |
|
|
225
|
+
| [Frame](interfaces/Frame.mdx) | - |
|
|
226
|
+
| [AudioStats](interfaces/AudioStats.mdx) | Data structure for the audio statistics while processing |
|
|
227
|
+
| [StatsOptions](interfaces/StatsOptions.mdx) | Stats options for calculating the audio stats |
|
|
228
|
+
| [SubscribableOptions](interfaces/SubscribableOptions.mdx) | - |
|
|
229
|
+
| [WorkletMessagePortOptions](interfaces/WorkletMessagePortOptions.mdx) | - |
|
|
230
|
+
| [AnalyzerSubscribableOptions](interfaces/AnalyzerSubscribableOptions.mdx) | - |
|
|
231
|
+
| [Denoise](interfaces/Denoise.mdx) | A wrapper for the Denoise wasm module |
|
|
232
|
+
| [Gain](interfaces/Gain.mdx) | - |
|
|
233
|
+
| [Analyzer](interfaces/Analyzer.mdx) | - |
|
|
234
|
+
| [AudioNodeProps](interfaces/AudioNodeProps.mdx) | - |
|
|
235
|
+
| [AudioNodeInit](interfaces/AudioNodeInit.mdx) | - |
|
|
236
|
+
| [WorkletModule](interfaces/WorkletModule.mdx) | - |
|
|
237
|
+
| [AudioGraphOptions](interfaces/AudioGraphOptions.mdx) | - |
|
|
238
|
+
| [AudioGraph](interfaces/AudioGraph.mdx) | - |
|
|
239
|
+
| [Clock](interfaces/Clock.mdx) | Clock interface to get the current time with now method, |
|
|
240
|
+
| [ThrottleOptions](interfaces/ThrottleOptions.mdx) | Limit the rate of flow in terms of millisecond, and provided Clock |
|
|
241
|
+
| [Runner](interfaces/Runner.mdx) | - |
|
|
242
|
+
| [Transform](interfaces/Transform.mdx) | - |
|
|
243
|
+
| [AsyncAssets](interfaces/AsyncAssets.mdx) | - |
|
|
244
|
+
| [Process](interfaces/Process.mdx) | - |
|
|
245
|
+
| [BackgroundImage](interfaces/BackgroundImage.mdx) | - |
|
|
246
|
+
| [Segmenter](interfaces/Segmenter.mdx) | - |
|
|
247
|
+
| [Detector](interfaces/Detector.mdx) | - |
|
|
248
|
+
| [SegmentationParams](interfaces/SegmentationParams.mdx) | - |
|
|
249
|
+
| [VideoProcessor](interfaces/VideoProcessor.mdx) | - |
|
|
250
|
+
|
|
251
|
+
## Type Aliases
|
|
252
|
+
|
|
253
|
+
| Type Alias | Description |
|
|
254
|
+
| ------ | ------ |
|
|
255
|
+
| [ProcessStatus](type-aliases/ProcessStatus.mdx) | - |
|
|
256
|
+
| [RenderBackend](type-aliases/RenderBackend.mdx) | - |
|
|
257
|
+
| [RenderEffects](type-aliases/RenderEffects.mdx) | - |
|
|
258
|
+
| [RenderingEvents](type-aliases/RenderingEvents.mdx) | - |
|
|
259
|
+
| [ProcessInputType](type-aliases/ProcessInputType.mdx) | - |
|
|
260
|
+
| [ImageType](type-aliases/ImageType.mdx) | - |
|
|
261
|
+
| [ImageMapIterable](type-aliases/ImageMapIterable.mdx) | - |
|
|
262
|
+
| [ProcessEvents](type-aliases/ProcessEvents.mdx) | Message events to be sent to the Processor |
|
|
263
|
+
| [ProcessWorkerEvents](type-aliases/ProcessWorkerEvents.mdx) | Message events returned from the processor |
|
|
264
|
+
| [ProcessorEvents](type-aliases/ProcessorEvents.mdx) | - |
|
|
265
|
+
| [ProcessorWorkerEvents](type-aliases/ProcessorWorkerEvents.mdx) | - |
|
|
266
|
+
| [SegmentationModel](type-aliases/SegmentationModel.mdx) | - |
|
|
267
|
+
| [Delegate](type-aliases/Delegate.mdx) | - |
|
|
268
|
+
| [ExtractMessageEventType](type-aliases/ExtractMessageEventType.mdx) | - |
|
|
269
|
+
| [IncludeMessageEventDataType](type-aliases/IncludeMessageEventDataType.mdx) | - |
|
|
270
|
+
| [TupleOf](type-aliases/TupleOf.mdx) | From https://github.com/Microsoft/TypeScript/issues/26223#issuecomment-674500430 |
|
|
271
|
+
| [Canvas](type-aliases/Canvas.mdx) | - |
|
|
272
|
+
| [Unsubscribe](type-aliases/Unsubscribe.mdx) | Unsubscribe the subscription |
|
|
273
|
+
| [AudioBufferFloats](type-aliases/AudioBufferFloats.mdx) | Same as [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) Or the return from [AnalyserNode.getFloatFrequencyData()](https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getFloatFrequencyData) |
|
|
274
|
+
| [AudioBufferBytes](type-aliases/AudioBufferBytes.mdx) | Same as the return from [AnalyserNode.getByteFrequencyData()](https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteFrequencyData) |
|
|
275
|
+
| [AudioSamples](type-aliases/AudioSamples.mdx) | Audio samples from each channel, either in float or bytes form |
|
|
276
|
+
| [NodeConnectionAction](type-aliases/NodeConnectionAction.mdx) | - |
|
|
277
|
+
| [BaseAudioNode](type-aliases/BaseAudioNode.mdx) | - |
|
|
278
|
+
| [AudioNodeParam](type-aliases/AudioNodeParam.mdx) | - |
|
|
279
|
+
| [Node](type-aliases/Node.mdx) | - |
|
|
280
|
+
| [Nodes](type-aliases/Nodes.mdx) | - |
|
|
281
|
+
| [ConnectParamBaseType](type-aliases/ConnectParamBaseType.mdx) | - |
|
|
282
|
+
| [ConnectInitParamBaseType](type-aliases/ConnectInitParamBaseType.mdx) | - |
|
|
283
|
+
| [ConnectParamType](type-aliases/ConnectParamType.mdx) | - |
|
|
284
|
+
| [ConnectInitParamType](type-aliases/ConnectInitParamType.mdx) | - |
|
|
285
|
+
| [ConnectParamBase](type-aliases/ConnectParamBase.mdx) | - |
|
|
286
|
+
| [AudioNodeConnectParam](type-aliases/AudioNodeConnectParam.mdx) | - |
|
|
287
|
+
| [AudioNodeInitConnectParam](type-aliases/AudioNodeInitConnectParam.mdx) | - |
|
|
288
|
+
| [AudioNodeInitConnection](type-aliases/AudioNodeInitConnection.mdx) | - |
|
|
289
|
+
| [AudioNodeInitConnections](type-aliases/AudioNodeInitConnections.mdx) | - |
|
|
290
|
+
| [MediaStreamAudioSourceNodeInit](type-aliases/MediaStreamAudioSourceNodeInit.mdx) | - |
|
|
291
|
+
| [MediaElementAudioSourceNodeInit](type-aliases/MediaElementAudioSourceNodeInit.mdx) | - |
|
|
292
|
+
| [AnalyzerNodeInit](type-aliases/AnalyzerNodeInit.mdx) | - |
|
|
293
|
+
| [DenoiseWorkletNodeInit](type-aliases/DenoiseWorkletNodeInit.mdx) | - |
|
|
294
|
+
| [GainNodeInit](type-aliases/GainNodeInit.mdx) | - |
|
|
295
|
+
| [MediaStreamAudioDestinationNodeInit](type-aliases/MediaStreamAudioDestinationNodeInit.mdx) | - |
|
|
296
|
+
| [AudioDestinationNodeInit](type-aliases/AudioDestinationNodeInit.mdx) | - |
|
|
297
|
+
| [DelayNodeInit](type-aliases/DelayNodeInit.mdx) | - |
|
|
298
|
+
| [ChannelSplitterNodeInit](type-aliases/ChannelSplitterNodeInit.mdx) | - |
|
|
299
|
+
| [UniversalAudioContextState](type-aliases/UniversalAudioContextState.mdx) | We need to add the missing type def to work with AudioContextState in Safari See https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/state#resuming_interrupted_play_states_in_ios_safari |
|
|
300
|
+
| [CanvasContext](type-aliases/CanvasContext.mdx) | - |
|
|
301
|
+
| [IsVoice](type-aliases/IsVoice.mdx) | - |
|
|
302
|
+
| [AsyncCallback](type-aliases/AsyncCallback.mdx) | - |
|
|
303
|
+
| [Callback](type-aliases/Callback.mdx) | - |
|
|
304
|
+
| [RunnerCreator](type-aliases/RunnerCreator.mdx) | - |
|
|
305
|
+
| [WasmPaths](type-aliases/WasmPaths.mdx) | - |
|
|
306
|
+
| [Color](type-aliases/Color.mdx) | - |
|
|
307
|
+
| [InputFrame](type-aliases/InputFrame.mdx) | - |
|
|
308
|
+
| [SegmentationTransform](type-aliases/SegmentationTransform.mdx) | - |
|
|
309
|
+
| [ProcessVideoTrack](type-aliases/ProcessVideoTrack.mdx) | - |
|
|
310
|
+
|
|
311
|
+
## Variables
|
|
312
|
+
|
|
313
|
+
| Variable | Description |
|
|
314
|
+
| ------ | ------ |
|
|
315
|
+
| [PROCESSING\_WIDTH](variables/PROCESSING_WIDTH.mdx) | - |
|
|
316
|
+
| [PROCESSING\_HEIGHT](variables/PROCESSING_HEIGHT.mdx) | - |
|
|
317
|
+
| [FOREGROUND\_THRESHOLD](variables/FOREGROUND_THRESHOLD.mdx) | - |
|
|
318
|
+
| [BACKGROUND\_BLUR\_AMOUNT](variables/BACKGROUND_BLUR_AMOUNT.mdx) | - |
|
|
319
|
+
| [EDGE\_BLUR\_AMOUNT](variables/EDGE_BLUR_AMOUNT.mdx) | - |
|
|
320
|
+
| [MASK\_COMBINE\_RATIO](variables/MASK_COMBINE_RATIO.mdx) | - |
|
|
321
|
+
| [PROCESS\_STATUS](variables/PROCESS_STATUS.mdx) | Process status |
|
|
322
|
+
| [RENDER\_EFFECT](variables/RENDER_EFFECT.mdx) | - |
|
|
323
|
+
| [RENDER\_BACKEND](variables/RENDER_BACKEND.mdx) | - |
|
|
324
|
+
| [RENDERING\_EVENTS](variables/RENDERING_EVENTS.mdx) | - |
|
|
325
|
+
| [SEGMENTATION\_MODELS](variables/SEGMENTATION_MODELS.mdx) | - |
|
|
326
|
+
| [isSegmentationModel](variables/isSegmentationModel.mdx) | - |
|
|
327
|
+
| [isRenderingEvents](variables/isRenderingEvents.mdx) | - |
|
|
328
|
+
| [toRenderingEvents](variables/toRenderingEvents.mdx) | - |
|
|
329
|
+
| [getErrorMessage](variables/getErrorMessage.mdx) | - |
|
|
330
|
+
| [createObjectUpdater](variables/createObjectUpdater.mdx) | - |
|
|
331
|
+
| [createRemoteImageBitmap](variables/createRemoteImageBitmap.mdx) | - |
|
|
332
|
+
| [clamping](variables/clamping.mdx) | - |
|
|
333
|
+
| [calculateMaxBlurPass](variables/calculateMaxBlurPass.mdx) | - |
|
|
334
|
+
| [resize](variables/resize.mdx) | Calculate the coordinates and size of the source and destination to fit the target aspect ratio. |
|
|
335
|
+
| [createLazyProps](variables/createLazyProps.mdx) | - |
|
|
336
|
+
| [handleWebGLContextLoss](variables/handleWebGLContextLoss.mdx) | - |
|
|
337
|
+
| [urls](variables/urls.mdx) | - |
|
|
338
|
+
| [SILENT\_THRESHOLD](variables/SILENT_THRESHOLD.mdx) | Default silent threshold At least one LSB 16-bit data (compare is on absolute value). |
|
|
339
|
+
| [MONO\_THRESHOLD](variables/MONO_THRESHOLD.mdx) | Default mono detection threshold Data must be identical within one LSB 16-bit to be identified as mono. |
|
|
340
|
+
| [LOW\_VOLUME\_THRESHOLD](variables/LOW_VOLUME_THRESHOLD.mdx) | Default low volume detection threshold |
|
|
341
|
+
| [CLIP\_THRESHOLD](variables/CLIP_THRESHOLD.mdx) | Default clipping detection threshold |
|
|
342
|
+
| [VOICE\_PROBABILITY\_THRESHOLD](variables/VOICE_PROBABILITY_THRESHOLD.mdx) | Default Voice probability threshold |
|
|
343
|
+
| [CLIP\_COUNT\_THRESHOLD](variables/CLIP_COUNT_THRESHOLD.mdx) | Default clipping count threshold Number of consecutive clipThreshold level samples that indicate clipping. |
|
|
344
|
+
| [FRAME\_RATE](variables/FRAME_RATE.mdx) | - |
|
|
345
|
+
| [PLAY\_VIDEO\_TIMEOUT](variables/PLAY_VIDEO_TIMEOUT.mdx) | - |
|
|
346
|
+
|
|
347
|
+
## Functions
|
|
348
|
+
|
|
349
|
+
| Function | Description |
|
|
350
|
+
| ------ | ------ |
|
|
351
|
+
| [createAudioContext](functions/createAudioContext.mdx) | A function to create `AudioContext` using constructor or factory function depends on the browser supports |
|
|
352
|
+
| [resumeAudioOnInterruption](functions/resumeAudioOnInterruption.mdx) | Resume the stream whenever interrupted |
|
|
353
|
+
| [resumeAudioOnUnmute](functions/resumeAudioOnUnmute.mdx) | Resume the AudioContext whenever the source track is unmuted |
|
|
354
|
+
| [subscribeWorkletNode](functions/subscribeWorkletNode.mdx) | Subscribe MessagePort message from an AudioWorkletNode |
|
|
355
|
+
| [subscribeTimeoutAnalyzerNode](functions/subscribeTimeoutAnalyzerNode.mdx) | Subscribe to a timeout loop to get the data from Analyzer |
|
|
356
|
+
| [createStreamSourceGraphNode](functions/createStreamSourceGraphNode.mdx) | Create a MediaStreamAudioSourceNodeInit |
|
|
357
|
+
| [createMediaElementSourceGraphNode](functions/createMediaElementSourceGraphNode.mdx) | Create a MediaStreamAudioSourceNodeInit |
|
|
358
|
+
| [createAnalyzerSubscribableGraphNode](functions/createAnalyzerSubscribableGraphNode.mdx) | Create an analyzer node with push-based subscription |
|
|
359
|
+
| [createDenoiseWorkletGraphNode](functions/createDenoiseWorkletGraphNode.mdx) | Create a noise suppression node |
|
|
360
|
+
| [createGainGraphNode](functions/createGainGraphNode.mdx) | Create a GainNodeInit |
|
|
361
|
+
| [createAnalyzerGraphNode](functions/createAnalyzerGraphNode.mdx) | Create an AnalyzerNodeInit |
|
|
362
|
+
| [createStreamDestinationGraphNode](functions/createStreamDestinationGraphNode.mdx) | Create a MediaStreamAudioDestinationNodeInit |
|
|
363
|
+
| [createAudioDestinationGraphNode](functions/createAudioDestinationGraphNode.mdx) | Create an `AudioDestinationNode` |
|
|
364
|
+
| [createDelayGraphNode](functions/createDelayGraphNode.mdx) | Create a `DelayNode` |
|
|
365
|
+
| [createChannelSplitterGraphNode](functions/createChannelSplitterGraphNode.mdx) | Create a ChannelSplitterNode |
|
|
366
|
+
| [createChannelMergerGraphNode](functions/createChannelMergerGraphNode.mdx) | Create a ChannelMergerNode |
|
|
367
|
+
| [createAudioGraph](functions/createAudioGraph.mdx) | Accepts AudioNodeInitConnections to build the audio graph within a signal audio context |
|
|
368
|
+
| [createAudioGraphProxy](functions/createAudioGraphProxy.mdx) | - |
|
|
369
|
+
| [createBenchmark](functions/createBenchmark.mdx) | - |
|
|
370
|
+
| [sum](functions/sum.mdx) | Sum an array of numbers |
|
|
371
|
+
| [avg](functions/avg.mdx) | Average an array of numbers |
|
|
372
|
+
| [pow](functions/pow.mdx) | pow function from Math in functional form `number -> number -> number` |
|
|
373
|
+
| [rms](functions/rms.mdx) | Calculate the Root Mean Square from provided numbers |
|
|
374
|
+
| [round](functions/round.mdx) | Round the floating point number away from zero, which is different from `Math.round` |
|
|
375
|
+
| [createAudioStats](functions/createAudioStats.mdx) | AudioStats builder |
|
|
376
|
+
| [fromByteToFloat](functions/fromByteToFloat.mdx) | Convert a byte to float, according to web audio spec |
|
|
377
|
+
| [fromFloatToByte](functions/fromFloatToByte.mdx) | Convert a float to byte, according to web audio spec |
|
|
378
|
+
| [copyByteBufferToFloatBuffer](functions/copyByteBufferToFloatBuffer.mdx) | Copy data from Uint8Array buffer to Float32Array buffer with byte to float conversion |
|
|
379
|
+
| [toDecibel](functions/toDecibel.mdx) | Convert a floating point gain value into a dB representation without any reference, dBFS, https://en.wikipedia.org/wiki/DBFS |
|
|
380
|
+
| [processAverageVolume](functions/processAverageVolume.mdx) | Calculate the averaged volume using Root Mean Square, assuming the data is in float form |
|
|
381
|
+
| [isSilent](functions/isSilent.mdx) | Simple silent detection to only check the first and last bit from the sample |
|
|
382
|
+
| [isLowVolume](functions/isLowVolume.mdx) | Check if the provided gain above the low volume threshold, which is considered as low volume. |
|
|
383
|
+
| [isClipping](functions/isClipping.mdx) | Check if there is clipping |
|
|
384
|
+
| [isMono](functions/isMono.mdx) | Check if provided channels are mono or stereo |
|
|
385
|
+
| [getAudioStats](functions/getAudioStats.mdx) | Calculate the audio stats, expected the samples are in float form |
|
|
386
|
+
| [isVoiceActivity](functions/isVoiceActivity.mdx) | A Naive Voice activity detection |
|
|
387
|
+
| [isEqualSize](functions/isEqualSize.mdx) | Compare the provided width and height to see if they are the same |
|
|
388
|
+
| [createVoiceDetectorFromTimeData](functions/createVoiceDetectorFromTimeData.mdx) | A function to check provided time series data is considered as voice activity |
|
|
389
|
+
| [createVoiceDetectorFromProbability](functions/createVoiceDetectorFromProbability.mdx) | A function to check the provided probability is considered as voice activity |
|
|
390
|
+
| [createVADetector](functions/createVADetector.mdx) | Create a voice detector based on provided params |
|
|
391
|
+
| [createAudioSignalDetector](functions/createAudioSignalDetector.mdx) | Create a function to process the AudioStats and check if silent `onSignalDetected` callback is called under 2 situations: |
|
|
392
|
+
| [isAudioNode](functions/isAudioNode.mdx) | - |
|
|
393
|
+
| [isAudioParam](functions/isAudioParam.mdx) | - |
|
|
394
|
+
| [isAudioNodeInit](functions/isAudioNodeInit.mdx) | - |
|
|
395
|
+
| [isAnalyzerNodeInit](functions/isAnalyzerNodeInit.mdx) | - |
|
|
396
|
+
| [createAsyncCallbackLoop](functions/createAsyncCallbackLoop.mdx) | Create an async callback loop to be called recursively with delay based on the `frameRate` |
|
|
397
|
+
| [createCanvasTransform](functions/createCanvasTransform.mdx) | - |
|
|
398
|
+
| [loadScript](functions/loadScript.mdx) | - |
|
|
399
|
+
| [loadWasms](functions/loadWasms.mdx) | - |
|
|
400
|
+
| [createSegmenter](functions/createSegmenter.mdx) | - |
|
|
401
|
+
| [isRenderEffects](functions/isRenderEffects.mdx) | - |
|
|
402
|
+
| [createCanvas](functions/createCanvas.mdx) | Create a Canvas element with provided width and height |
|
|
403
|
+
| [createFrameCallbackRequest](functions/createFrameCallbackRequest.mdx) | Create a callback loop for video frame processing using `requestVideoFrameCallback` under-the-hood when available otherwise our fallback implementation based on `setTimeout`. |
|
|
404
|
+
| [createVideoProcessor](functions/createVideoProcessor.mdx) | - |
|
|
405
|
+
| [createVideoTrackProcessor](functions/createVideoTrackProcessor.mdx) | Video track processor using MediaStreamTrackProcessor API |
|
|
406
|
+
| [createVideoTrackProcessorWithFallback](functions/createVideoTrackProcessorWithFallback.mdx) | Video track processor using Canvas[captureStream] API |
|
|
407
|
+
| [calculateDistance](functions/calculateDistance.mdx) | Calculate the distance between two Points |
|
|
408
|
+
| [getBezierCurveControlPoints](functions/getBezierCurveControlPoints.mdx) | Spline Interpolation for Bezier Curve |
|
|
409
|
+
| [line](functions/line.mdx) | Create a straight line path command |
|
|
410
|
+
| [curve](functions/curve.mdx) | Create a cubic Bezier curve path command |
|
|
411
|
+
| [closedCurve](functions/closedCurve.mdx) | Create a cubic Bezier curve path then turning back to the starting point with provided point of reference |
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
```ts
|
|
2
|
+
function calculateDistance(p1, p2): number;
|
|
3
|
+
```
|
|
4
|
+
|
|
5
|
+
**`Internal`**
|
|
6
|
+
|
|
7
|
+
Calculate the distance between two Points
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
| Parameter | Type | Description |
|
|
12
|
+
| ------ | ------ | ------ |
|
|
13
|
+
| `p1` | [`Point`](../interfaces/Point.mdx) | Point 1 |
|
|
14
|
+
| `p2` | [`Point`](../interfaces/Point.mdx) | Point 2 |
|
|
15
|
+
|
|
16
|
+
## Returns
|
|
17
|
+
|
|
18
|
+
`number`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
```ts
|
|
2
|
+
function closedCurve(__namedParameters): (data) => string;
|
|
3
|
+
```
|
|
4
|
+
|
|
5
|
+
**`Alpha`**
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
| Parameter | Type |
|
|
10
|
+
| ------ | ------ |
|
|
11
|
+
| `__namedParameters` | [`Point`](../interfaces/Point.mdx) |
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
(data): string;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Parameters
|
|
20
|
+
|
|
21
|
+
| Parameter | Type |
|
|
22
|
+
| ------ | ------ |
|
|
23
|
+
| `data` | [`Point`](../interfaces/Point.mdx)[] |
|
|
24
|
+
|
|
25
|
+
### Returns
|
|
26
|
+
|
|
27
|
+
`string`
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
```ts
|
|
2
|
+
function copyByteBufferToFloatBuffer(bytes, floats): void;
|
|
3
|
+
```
|
|
4
|
+
|
|
5
|
+
Copy data from Uint8Array buffer to Float32Array buffer with byte to float conversion
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
| Parameter | Type | Description |
|
|
10
|
+
| ------ | ------ | ------ |
|
|
11
|
+
| `bytes` | `Uint8Array` | The source Byte buffer |
|
|
12
|
+
| `floats` | `Float32Array` | The destination buffer |
|
|
13
|
+
|
|
14
|
+
## Returns
|
|
15
|
+
|
|
16
|
+
`void`
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
```ts
|
|
2
|
+
function createAnalyzerGraphNode(options?): AudioNodeInit<AnalyserNode, Analyzer>;
|
|
3
|
+
```
|
|
4
|
+
|
|
5
|
+
Create an AnalyzerNodeInit
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
| Parameter | Type | Description |
|
|
10
|
+
| ------ | ------ | ------ |
|
|
11
|
+
| `options?` | `AnalyserOptions` | |
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
[`AudioNodeInit`](../interfaces/AudioNodeInit.mdx)\<`AnalyserNode`, [`Analyzer`](../interfaces/Analyzer.mdx)\>
|
|
16
|
+
|
|
17
|
+
## See
|
|
18
|
+
|
|
19
|
+
AnalyserOptions
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
```ts
|
|
2
|
+
function createAnalyzerSubscribableGraphNode(__namedParameters): AudioNodeInit<AnalyserNode, Analyzer>;
|
|
3
|
+
```
|
|
4
|
+
|
|
5
|
+
Create an analyzer node with push-based subscription
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
| Parameter | Type |
|
|
10
|
+
| ------ | ------ |
|
|
11
|
+
| `__namedParameters` | [`AnalyzerSubscribableOptions`](../interfaces/AnalyzerSubscribableOptions.mdx) & `AnalyserOptions` |
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
[`AudioNodeInit`](../interfaces/AudioNodeInit.mdx)\<`AnalyserNode`, [`Analyzer`](../interfaces/Analyzer.mdx)\>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
```ts
|
|
2
|
+
function createAsyncCallbackLoop<P, R>(
|
|
3
|
+
callback,
|
|
4
|
+
frameRate,
|
|
5
|
+
__namedParameters): object;
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Create an async callback loop to be called recursively with delay based on
|
|
9
|
+
the `frameRate`
|
|
10
|
+
|
|
11
|
+
## Type Parameters
|
|
12
|
+
|
|
13
|
+
| Type Parameter |
|
|
14
|
+
| ------ |
|
|
15
|
+
| `P` *extends* `unknown`[] |
|
|
16
|
+
| `R` *extends* `Promise`\<`unknown`\> |
|
|
17
|
+
|
|
18
|
+
## Parameters
|
|
19
|
+
|
|
20
|
+
| Parameter | Type | Description |
|
|
21
|
+
| ------ | ------ | ------ |
|
|
22
|
+
| `callback` | [`Callback`](../type-aliases/Callback.mdx)\<`R`, `P`\> | The callback to be invoked |
|
|
23
|
+
| `frameRate` | `number` | The rate to be expected to invoke the `callback` |
|
|
24
|
+
| `__namedParameters` | `Partial`\<`AsyncCallbackLoopOptions`\> | - |
|
|
25
|
+
|
|
26
|
+
## Returns
|
|
27
|
+
|
|
28
|
+
`object`
|
|
29
|
+
|
|
30
|
+
| Name | Type |
|
|
31
|
+
| ------ | ------ |
|
|
32
|
+
| `start()` | (...`params`) => `Promise`\<`void`\> |
|
|
33
|
+
| `stop()` | () => `void` |
|
|
34
|
+
| `get frameRate` | `number` |
|
|
35
|
+
| `set frameRate` | `void` |
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
```ts
|
|
2
|
+
function createAudioContext(options?): AudioContext;
|
|
3
|
+
```
|
|
4
|
+
|
|
5
|
+
**`Internal`**
|
|
6
|
+
|
|
7
|
+
A function to create `AudioContext` using constructor or factory function
|
|
8
|
+
depends on the browser supports
|
|
9
|
+
|
|
10
|
+
## Parameters
|
|
11
|
+
|
|
12
|
+
| Parameter | Type | Description |
|
|
13
|
+
| ------ | ------ | ------ |
|
|
14
|
+
| `options?` | `AudioContextOptions` | |
|
|
15
|
+
|
|
16
|
+
## Returns
|
|
17
|
+
|
|
18
|
+
`AudioContext`
|
|
19
|
+
|
|
20
|
+
## See
|
|
21
|
+
|
|
22
|
+
AudioContextOptions
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
```ts
|
|
2
|
+
function createAudioDestinationGraphNode(): AudioNodeInit<AudioDestinationNode, AudioDestinationNode>;
|
|
3
|
+
```
|
|
4
|
+
|
|
5
|
+
Create an `AudioDestinationNode`
|
|
6
|
+
|
|
7
|
+
## Returns
|
|
8
|
+
|
|
9
|
+
[`AudioNodeInit`](../interfaces/AudioNodeInit.mdx)\<`AudioDestinationNode`, `AudioDestinationNode`\>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
```ts
|
|
2
|
+
function createAudioGraph(initialConnections, options): AudioGraph;
|
|
3
|
+
```
|
|
4
|
+
|
|
5
|
+
Accepts AudioNodeInitConnections to build the audio graph within a signal audio context
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
| Parameter | Type | Description |
|
|
10
|
+
| ------ | ------ | ------ |
|
|
11
|
+
| `initialConnections` | [`AudioNodeInitConnections`](../type-aliases/AudioNodeInitConnections.mdx) | A list of AudioNodeInit to build the graph in a linear fashion |
|
|
12
|
+
| `options` | [`AudioGraphOptions`](../interfaces/AudioGraphOptions.mdx) | |
|
|
13
|
+
|
|
14
|
+
## Returns
|
|
15
|
+
|
|
16
|
+
[`AudioGraph`](../interfaces/AudioGraph.mdx)
|
|
17
|
+
|
|
18
|
+
## See
|
|
19
|
+
|
|
20
|
+
[AudioGraphOptions](../interfaces/AudioGraphOptions.mdx)
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
const source = createStreamSourceGraphNode(stream);
|
|
26
|
+
const analyzer = createAnalyzerGraphNode({fftSize});
|
|
27
|
+
const audioGraph = createAudioGraph([[source, analyzer]]);
|
|
28
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
```ts
|
|
2
|
+
function createAudioGraphProxy(audioGraph, handlers): AudioGraph;
|
|
3
|
+
```
|
|
4
|
+
|
|
5
|
+
## Parameters
|
|
6
|
+
|
|
7
|
+
| Parameter | Type |
|
|
8
|
+
| ------ | ------ |
|
|
9
|
+
| `audioGraph` | [`AudioGraph`](../interfaces/AudioGraph.mdx) |
|
|
10
|
+
| `handlers` | `AudioGraphProxyHandlers` |
|
|
11
|
+
|
|
12
|
+
## Returns
|
|
13
|
+
|
|
14
|
+
[`AudioGraph`](../interfaces/AudioGraph.mdx)
|