@picovoice/eagle-web 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +4 -4
- package/.eslintrc.js +469 -469
- package/.prettierignore +1 -1
- package/.prettierrc +8 -8
- package/README.md +234 -236
- package/dist/esm/index.js +3656 -11290
- package/dist/esm/index.min.js +1 -1
- package/dist/iife/index.js +3655 -11289
- package/dist/iife/index.min.js +1 -1
- package/dist/types/eagle.d.ts +237 -245
- package/dist/types/eagle.d.ts.map +1 -1
- package/dist/types/eagle_errors.d.ts +47 -47
- package/dist/types/eagle_profiler_worker.d.ts +112 -113
- package/dist/types/eagle_profiler_worker.d.ts.map +1 -1
- package/dist/types/eagle_profiler_worker_handler.d.ts +3 -3
- package/dist/types/eagle_worker.d.ts +88 -93
- package/dist/types/eagle_worker.d.ts.map +1 -1
- package/dist/types/eagle_worker_handler.d.ts +3 -3
- package/dist/types/index.d.ts +6 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +142 -140
- package/dist/types/types.d.ts.map +1 -1
- package/module.d.ts +16 -16
- package/package.json +73 -73
- package/rollup.config.js +75 -75
- package/src/eagle.ts +1546 -1508
- package/src/eagle_errors.ts +252 -252
- package/src/eagle_profiler_worker.ts +443 -405
- package/src/eagle_profiler_worker_handler.ts +246 -208
- package/src/eagle_worker.ts +307 -346
- package/src/eagle_worker_handler.ts +138 -170
- package/src/index.ts +94 -98
- package/src/types.ts +224 -218
- package/tsconfig.json +22 -22
package/dist/types/eagle.d.ts
CHANGED
|
@@ -1,246 +1,238 @@
|
|
|
1
|
-
/// <reference types="emscripten" />
|
|
2
|
-
import { Mutex } from 'async-mutex';
|
|
3
|
-
import { EagleModel, EagleOptions, EagleProfile,
|
|
4
|
-
type
|
|
5
|
-
type pv_eagle_profiler_export_type = (object: number, speakerProfile: number) => number;
|
|
6
|
-
type pv_eagle_profiler_export_size_type = (object: number, speakerProfileSizeBytes: number) => number;
|
|
7
|
-
type
|
|
8
|
-
type pv_eagle_version_type = () => number;
|
|
9
|
-
type pv_eagle_list_hardware_devices_type = (hardwareDevices: number, numHardwareDevices: number) => number;
|
|
10
|
-
type pv_eagle_free_hardware_devices_type = (hardwareDevices: number, numHardwareDevices: number) => number;
|
|
11
|
-
type pv_sample_rate_type = () => number;
|
|
12
|
-
type pv_set_sdk_type = (sdk: number) => void;
|
|
13
|
-
type pv_get_error_stack_type = (messageStack: number, messageStackDepth: number) => number;
|
|
14
|
-
type pv_free_error_stack_type = (messageStack: number) => void;
|
|
15
|
-
type EagleModule = EmscriptenModule & {
|
|
16
|
-
_pv_free: (address: number) => void;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
_pv_eagle_version: pv_eagle_version_type;
|
|
22
|
-
_pv_eagle_list_hardware_devices: pv_eagle_list_hardware_devices_type;
|
|
23
|
-
_pv_eagle_free_hardware_devices: pv_eagle_free_hardware_devices_type;
|
|
24
|
-
_pv_sample_rate: pv_sample_rate_type;
|
|
25
|
-
_pv_set_sdk: pv_set_sdk_type;
|
|
26
|
-
_pv_get_error_stack: pv_get_error_stack_type;
|
|
27
|
-
_pv_free_error_stack: pv_free_error_stack_type;
|
|
28
|
-
addFunction: typeof addFunction;
|
|
29
|
-
ccall: typeof ccall;
|
|
30
|
-
cwrap: typeof cwrap;
|
|
31
|
-
};
|
|
32
|
-
type EagleBaseWasmOutput = {
|
|
33
|
-
module: EagleModule;
|
|
34
|
-
sampleRate: number;
|
|
35
|
-
version: string;
|
|
36
|
-
messageStackAddressAddressAddress: number;
|
|
37
|
-
messageStackDepthAddress: number;
|
|
38
|
-
};
|
|
39
|
-
declare class EagleBase {
|
|
40
|
-
protected _module?: EagleModule;
|
|
41
|
-
protected readonly _functionMutex: Mutex;
|
|
42
|
-
protected readonly _messageStackAddressAddressAddress: number;
|
|
43
|
-
protected readonly _messageStackDepthAddress: number;
|
|
44
|
-
protected readonly _sampleRate: number;
|
|
45
|
-
protected readonly _version: string;
|
|
46
|
-
protected static _wasmSimd: string;
|
|
47
|
-
protected static _wasmSimdLib: string;
|
|
48
|
-
protected static _wasmPThread: string;
|
|
49
|
-
protected static _wasmPThreadLib: string;
|
|
50
|
-
protected static _sdk: string;
|
|
51
|
-
protected static _eagleMutex: Mutex;
|
|
52
|
-
protected constructor(handleWasm: EagleBaseWasmOutput);
|
|
53
|
-
/**
|
|
54
|
-
* Audio sample rate required by Eagle.
|
|
55
|
-
*/
|
|
56
|
-
get sampleRate(): number;
|
|
57
|
-
/**
|
|
58
|
-
* Version of Eagle.
|
|
59
|
-
*/
|
|
60
|
-
get version(): string;
|
|
61
|
-
/**
|
|
62
|
-
* Set base64 wasm file with SIMD feature.
|
|
63
|
-
* @param wasmSimd Base64'd wasm file to use to initialize wasm.
|
|
64
|
-
*/
|
|
65
|
-
static setWasmSimd(wasmSimd: string): void;
|
|
66
|
-
/**
|
|
67
|
-
* Set base64 SIMD wasm file in text format.
|
|
68
|
-
* @param wasmSimdLib Base64'd wasm file in text format.
|
|
69
|
-
*/
|
|
70
|
-
static setWasmSimdLib(wasmSimdLib: string): void;
|
|
71
|
-
/**
|
|
72
|
-
* Set base64 wasm file with SIMD and pthread feature.
|
|
73
|
-
* @param wasmPThread Base64'd wasm file to use to initialize wasm.
|
|
74
|
-
*/
|
|
75
|
-
static setWasmPThread(wasmPThread: string): void;
|
|
76
|
-
/**
|
|
77
|
-
* Set base64 SIMD and thread wasm file in text format.
|
|
78
|
-
* @param wasmPThreadLib Base64'd wasm file in text format.
|
|
79
|
-
*/
|
|
80
|
-
static setWasmPThreadLib(wasmPThreadLib: string): void;
|
|
81
|
-
static setSdk(sdk: string): void;
|
|
82
|
-
protected static _initBaseWasm(wasmBase64: string, wasmLibBase64: string, createModuleFunc: any): Promise<EagleBaseWasmOutput>;
|
|
83
|
-
/**
|
|
84
|
-
* Releases resources acquired by Eagle
|
|
85
|
-
*/
|
|
86
|
-
release(): Promise<void>;
|
|
87
|
-
protected static getMessageStack(pv_get_error_stack: pv_get_error_stack_type, pv_free_error_stack: pv_free_error_stack_type, messageStackAddressAddressAddress: number, messageStackDepthAddress: number, memoryBufferInt32: Int32Array, memoryBufferUint8: Uint8Array): Promise<string[]>;
|
|
88
|
-
protected static wrapAsyncFunction(module: EagleModule, functionName: string, numArgs: number): (...args: any[]) => any;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* JavaScript/WebAssembly binding for the profiler of the Eagle Speaker Recognition engine.
|
|
92
|
-
* It enrolls a speaker given a set of utterances and then constructs a profile for the enrolled speaker.
|
|
93
|
-
*/
|
|
94
|
-
export declare class EagleProfiler extends EagleBase {
|
|
95
|
-
private readonly _pv_eagle_profiler_enroll;
|
|
96
|
-
private readonly
|
|
97
|
-
private readonly
|
|
98
|
-
private readonly
|
|
99
|
-
private readonly
|
|
100
|
-
private readonly _percentageAddress;
|
|
101
|
-
private readonly
|
|
102
|
-
private readonly
|
|
103
|
-
private
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* @param
|
|
113
|
-
* @param model
|
|
114
|
-
* @param model.
|
|
115
|
-
* @param model.
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* @param model.
|
|
119
|
-
* @param
|
|
120
|
-
* @param options
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* `cpu`,
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
static
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* -
|
|
139
|
-
* - the
|
|
140
|
-
* -
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
private readonly
|
|
181
|
-
private readonly
|
|
182
|
-
private readonly
|
|
183
|
-
private readonly
|
|
184
|
-
private
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* @param
|
|
196
|
-
* @param model
|
|
197
|
-
*
|
|
198
|
-
* @param model.
|
|
199
|
-
* @param model.
|
|
200
|
-
*
|
|
201
|
-
* @param
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* @param
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
*
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
* Each entry in the list can be the used as the `device` argument for the `.create` method.
|
|
239
|
-
*
|
|
240
|
-
* @returns List of all available devices that Eagle can use for inference.
|
|
241
|
-
*/
|
|
242
|
-
static listAvailableDevices(): Promise<string[]>;
|
|
243
|
-
private static _initWasm;
|
|
244
|
-
}
|
|
245
|
-
export {};
|
|
1
|
+
/// <reference types="emscripten" />
|
|
2
|
+
import { Mutex } from 'async-mutex';
|
|
3
|
+
import { EagleModel, EagleOptions, EagleProfile, EagleProfilerOptions } from './types';
|
|
4
|
+
type pv_eagle_profiler_frame_length_type = () => number;
|
|
5
|
+
type pv_eagle_profiler_export_type = (object: number, speakerProfile: number) => number;
|
|
6
|
+
type pv_eagle_profiler_export_size_type = (object: number, speakerProfileSizeBytes: number) => number;
|
|
7
|
+
type pv_eagle_process_min_audio_length_samples_type = (object: number, numSamples: number) => number;
|
|
8
|
+
type pv_eagle_version_type = () => number;
|
|
9
|
+
type pv_eagle_list_hardware_devices_type = (hardwareDevices: number, numHardwareDevices: number) => number;
|
|
10
|
+
type pv_eagle_free_hardware_devices_type = (hardwareDevices: number, numHardwareDevices: number) => number;
|
|
11
|
+
type pv_sample_rate_type = () => number;
|
|
12
|
+
type pv_set_sdk_type = (sdk: number) => void;
|
|
13
|
+
type pv_get_error_stack_type = (messageStack: number, messageStackDepth: number) => number;
|
|
14
|
+
type pv_free_error_stack_type = (messageStack: number) => void;
|
|
15
|
+
type EagleModule = EmscriptenModule & {
|
|
16
|
+
_pv_free: (address: number) => void;
|
|
17
|
+
_pv_eagle_profiler_export: pv_eagle_profiler_export_type;
|
|
18
|
+
_pv_eagle_profiler_export_size: pv_eagle_profiler_export_size_type;
|
|
19
|
+
_pv_eagle_profiler_frame_length: pv_eagle_profiler_frame_length_type;
|
|
20
|
+
_pv_eagle_process_min_audio_length_samples: pv_eagle_process_min_audio_length_samples_type;
|
|
21
|
+
_pv_eagle_version: pv_eagle_version_type;
|
|
22
|
+
_pv_eagle_list_hardware_devices: pv_eagle_list_hardware_devices_type;
|
|
23
|
+
_pv_eagle_free_hardware_devices: pv_eagle_free_hardware_devices_type;
|
|
24
|
+
_pv_sample_rate: pv_sample_rate_type;
|
|
25
|
+
_pv_set_sdk: pv_set_sdk_type;
|
|
26
|
+
_pv_get_error_stack: pv_get_error_stack_type;
|
|
27
|
+
_pv_free_error_stack: pv_free_error_stack_type;
|
|
28
|
+
addFunction: typeof addFunction;
|
|
29
|
+
ccall: typeof ccall;
|
|
30
|
+
cwrap: typeof cwrap;
|
|
31
|
+
};
|
|
32
|
+
type EagleBaseWasmOutput = {
|
|
33
|
+
module: EagleModule;
|
|
34
|
+
sampleRate: number;
|
|
35
|
+
version: string;
|
|
36
|
+
messageStackAddressAddressAddress: number;
|
|
37
|
+
messageStackDepthAddress: number;
|
|
38
|
+
};
|
|
39
|
+
declare class EagleBase {
|
|
40
|
+
protected _module?: EagleModule;
|
|
41
|
+
protected readonly _functionMutex: Mutex;
|
|
42
|
+
protected readonly _messageStackAddressAddressAddress: number;
|
|
43
|
+
protected readonly _messageStackDepthAddress: number;
|
|
44
|
+
protected readonly _sampleRate: number;
|
|
45
|
+
protected readonly _version: string;
|
|
46
|
+
protected static _wasmSimd: string;
|
|
47
|
+
protected static _wasmSimdLib: string;
|
|
48
|
+
protected static _wasmPThread: string;
|
|
49
|
+
protected static _wasmPThreadLib: string;
|
|
50
|
+
protected static _sdk: string;
|
|
51
|
+
protected static _eagleMutex: Mutex;
|
|
52
|
+
protected constructor(handleWasm: EagleBaseWasmOutput);
|
|
53
|
+
/**
|
|
54
|
+
* Audio sample rate required by Eagle.
|
|
55
|
+
*/
|
|
56
|
+
get sampleRate(): number;
|
|
57
|
+
/**
|
|
58
|
+
* Version of Eagle.
|
|
59
|
+
*/
|
|
60
|
+
get version(): string;
|
|
61
|
+
/**
|
|
62
|
+
* Set base64 wasm file with SIMD feature.
|
|
63
|
+
* @param wasmSimd Base64'd wasm file to use to initialize wasm.
|
|
64
|
+
*/
|
|
65
|
+
static setWasmSimd(wasmSimd: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* Set base64 SIMD wasm file in text format.
|
|
68
|
+
* @param wasmSimdLib Base64'd wasm file in text format.
|
|
69
|
+
*/
|
|
70
|
+
static setWasmSimdLib(wasmSimdLib: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Set base64 wasm file with SIMD and pthread feature.
|
|
73
|
+
* @param wasmPThread Base64'd wasm file to use to initialize wasm.
|
|
74
|
+
*/
|
|
75
|
+
static setWasmPThread(wasmPThread: string): void;
|
|
76
|
+
/**
|
|
77
|
+
* Set base64 SIMD and thread wasm file in text format.
|
|
78
|
+
* @param wasmPThreadLib Base64'd wasm file in text format.
|
|
79
|
+
*/
|
|
80
|
+
static setWasmPThreadLib(wasmPThreadLib: string): void;
|
|
81
|
+
static setSdk(sdk: string): void;
|
|
82
|
+
protected static _initBaseWasm(wasmBase64: string, wasmLibBase64: string, createModuleFunc: any): Promise<EagleBaseWasmOutput>;
|
|
83
|
+
/**
|
|
84
|
+
* Releases resources acquired by Eagle
|
|
85
|
+
*/
|
|
86
|
+
release(): Promise<void>;
|
|
87
|
+
protected static getMessageStack(pv_get_error_stack: pv_get_error_stack_type, pv_free_error_stack: pv_free_error_stack_type, messageStackAddressAddressAddress: number, messageStackDepthAddress: number, memoryBufferInt32: Int32Array, memoryBufferUint8: Uint8Array): Promise<string[]>;
|
|
88
|
+
protected static wrapAsyncFunction(module: EagleModule, functionName: string, numArgs: number): (...args: any[]) => any;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* JavaScript/WebAssembly binding for the profiler of the Eagle Speaker Recognition engine.
|
|
92
|
+
* It enrolls a speaker given a set of utterances and then constructs a profile for the enrolled speaker.
|
|
93
|
+
*/
|
|
94
|
+
export declare class EagleProfiler extends EagleBase {
|
|
95
|
+
private readonly _pv_eagle_profiler_enroll;
|
|
96
|
+
private readonly _pv_eagle_profiler_flush;
|
|
97
|
+
private readonly _pv_eagle_profiler_reset;
|
|
98
|
+
private readonly _pv_eagle_profiler_delete;
|
|
99
|
+
private readonly _objectAddress;
|
|
100
|
+
private readonly _percentageAddress;
|
|
101
|
+
private readonly _frameLength;
|
|
102
|
+
private readonly _profileSize;
|
|
103
|
+
private constructor();
|
|
104
|
+
/**
|
|
105
|
+
* The length of the input pcm required by `.enroll()`.
|
|
106
|
+
*/
|
|
107
|
+
get frameLength(): number;
|
|
108
|
+
/**
|
|
109
|
+
* Creates an instance of profiler component of the Eagle Speaker Recognition Engine.
|
|
110
|
+
*
|
|
111
|
+
* @param accessKey AccessKey obtained from Picovoice Console (https://console.picovoice.ai/).
|
|
112
|
+
* @param model Eagle model options.
|
|
113
|
+
* @param model.base64 The model in base64 string to initialize Eagle.
|
|
114
|
+
* @param model.publicPath The model path relative to the public directory.
|
|
115
|
+
* @param model.customWritePath Custom path to save the model in storage.
|
|
116
|
+
* Set to a different name to use multiple models across `eagle` instances.
|
|
117
|
+
* @param model.forceWrite Flag to overwrite the model in storage even if it exists.
|
|
118
|
+
* @param model.version Version of the model file. Increment to update the model file in storage.
|
|
119
|
+
* @param options Optional configuration arguments.
|
|
120
|
+
* @param options.device String representation of the device (e.g., CPU or GPU) to use. If set to `best`, the most
|
|
121
|
+
* suitable device is selected automatically. If set to `gpu`, the engine uses the first available GPU device. To select a specific
|
|
122
|
+
* GPU device, set this argument to `gpu:${GPU_INDEX}`, where `${GPU_INDEX}` is the index of the target GPU. If set to
|
|
123
|
+
* `cpu`, the engine will run on the CPU with the default number of threads. To specify the number of threads, set this
|
|
124
|
+
* argument to `cpu:${NUM_THREADS}`, where `${NUM_THREADS}` is the desired number of threads.
|
|
125
|
+
* @param options.minEnrollmentChunks Minimum number of chunks to be processed before enroll returns 100%
|
|
126
|
+
* @param options.voiceThreshold Sensitivity threshold for detecting voice.
|
|
127
|
+
*
|
|
128
|
+
* @return An instance of the Eagle Profiler.
|
|
129
|
+
*/
|
|
130
|
+
static create(accessKey: string, model: EagleModel, options?: EagleProfilerOptions): Promise<EagleProfiler>;
|
|
131
|
+
static _init(accessKey: string, modelPath: string, options?: EagleProfilerOptions): Promise<EagleProfiler>;
|
|
132
|
+
/**
|
|
133
|
+
* Enrolls a speaker. This function should be called multiple times with different utterances of the same speaker
|
|
134
|
+
* until `percentage` reaches `100.0`, at which point a speaker voice profile can be exported using `.export()`.
|
|
135
|
+
* Any further enrollment can be used to improve the speaker profile. The minimum length of the input pcm to
|
|
136
|
+
* `.enroll()` can be obtained by calling `.minEnrollSamples`.
|
|
137
|
+
* The audio data used for enrollment should satisfy the following requirements:
|
|
138
|
+
* - only one speaker should be present in the audio
|
|
139
|
+
* - the speaker should be speaking in a normal voice
|
|
140
|
+
* - the audio should contain no speech from other speakers and no other sounds (e.g. music)
|
|
141
|
+
* - it should be captured in a quiet environment with no background noise
|
|
142
|
+
* @param pcm Audio data for enrollment. The audio needs to have a sample rate equal to `.sampleRate` and be
|
|
143
|
+
* 16-bit linearly-encoded. EagleProfiler operates on single-channel audio.
|
|
144
|
+
*
|
|
145
|
+
* @return The percentage of completeness of the speaker enrollment process.
|
|
146
|
+
*/
|
|
147
|
+
enroll(pcm: Int16Array): Promise<number>;
|
|
148
|
+
/**
|
|
149
|
+
* Marks the end of the audio stream, flushes internal state of the object, and returns the percentage of enrollment
|
|
150
|
+
* completed.
|
|
151
|
+
*
|
|
152
|
+
* @return The percentage of completeness of the speaker enrollment process.
|
|
153
|
+
*/
|
|
154
|
+
flush(): Promise<number>;
|
|
155
|
+
/**
|
|
156
|
+
* Exports the speaker profile of the current session.
|
|
157
|
+
* Will throw error if the profile is not ready.
|
|
158
|
+
*
|
|
159
|
+
* @return An EagleProfile object.
|
|
160
|
+
*/
|
|
161
|
+
export(): Promise<EagleProfile>;
|
|
162
|
+
/**
|
|
163
|
+
* Resets the internal state of Eagle Profiler.
|
|
164
|
+
* It should be called before starting a new enrollment session.
|
|
165
|
+
*/
|
|
166
|
+
reset(): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Releases resources acquired by Eagle Profiler
|
|
169
|
+
*/
|
|
170
|
+
release(): Promise<void>;
|
|
171
|
+
private static _initProfilerWasm;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* JavaScript/WebAssembly binding for Eagle Speaker Recognition engine.
|
|
175
|
+
* It processes incoming audio in consecutive frames and emits a similarity score for each enrolled speaker.
|
|
176
|
+
*/
|
|
177
|
+
export declare class Eagle extends EagleBase {
|
|
178
|
+
private readonly _pv_eagle_process;
|
|
179
|
+
private readonly _pv_eagle_scores_delete;
|
|
180
|
+
private readonly _pv_eagle_delete;
|
|
181
|
+
private readonly _objectAddress;
|
|
182
|
+
private readonly _scoresAddressAddress;
|
|
183
|
+
private readonly _minProcessSamples;
|
|
184
|
+
private constructor();
|
|
185
|
+
/**
|
|
186
|
+
* Number of audio samples per frame expected by Eagle (i.e. length of the array passed into `.process()`)
|
|
187
|
+
*/
|
|
188
|
+
get minProcessSamples(): number;
|
|
189
|
+
/**
|
|
190
|
+
* Creates an instance of the Picovoice Eagle Speaker Recognition Engine.
|
|
191
|
+
*
|
|
192
|
+
* @param accessKey AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)
|
|
193
|
+
* @param model Eagle model options.
|
|
194
|
+
* @param model.base64 The model in base64 string to initialize Eagle.
|
|
195
|
+
* @param model.publicPath The model path relative to the public directory.
|
|
196
|
+
* @param model.customWritePath Custom path to save the model in storage.
|
|
197
|
+
* Set to a different name to use multiple models across `eagle` instances.
|
|
198
|
+
* @param model.forceWrite Flag to overwrite the model in storage even if it exists.
|
|
199
|
+
* @param model.version Version of the model file. Increment to update the model file in storage.
|
|
200
|
+
* @param options Optional configuration arguments.
|
|
201
|
+
* @param options.device String representation of the device (e.g., CPU or GPU) to use. If set to `best`, the most
|
|
202
|
+
* suitable device is selected automatically. If set to `gpu`, the engine uses the first available GPU device. To select a specific
|
|
203
|
+
* GPU device, set this argument to `gpu:${GPU_INDEX}`, where `${GPU_INDEX}` is the index of the target GPU. If set to
|
|
204
|
+
* `cpu`, the engine will run on the CPU with the default number of threads. To specify the number of threads, set this
|
|
205
|
+
* argument to `cpu:${NUM_THREADS}`, where `${NUM_THREADS}` is the desired number of threads.
|
|
206
|
+
* @param options.voiceThreshold Sensitivity threshold for detecting voice.
|
|
207
|
+
*
|
|
208
|
+
* @return An instance of the Eagle engine.
|
|
209
|
+
*/
|
|
210
|
+
static create(accessKey: string, model: EagleModel, options?: EagleOptions): Promise<Eagle>;
|
|
211
|
+
static _init(accessKey: string, modelPath: string, options?: EagleOptions): Promise<Eagle>;
|
|
212
|
+
/**
|
|
213
|
+
* Processes audio and returns a list of similarity scores for each speaker profile.
|
|
214
|
+
*
|
|
215
|
+
* @param pcm Array of audio samples. The minimum number of samples per frame can be attained by calling
|
|
216
|
+
* `.minProcessSamples`. The incoming audio needs to have a sample rate equal to `.sampleRate` and be 16-bit
|
|
217
|
+
* linearly-encoded. Eagle operates on single-channel audio.
|
|
218
|
+
* @param speakerProfiles One or more Eagle speaker profiles. These can be constructed using `EagleProfiler`.
|
|
219
|
+
*
|
|
220
|
+
* @return A list of similarity scores for each speaker profile. A higher score indicates that the voice
|
|
221
|
+
* belongs to the corresponding speaker. The range is [0, 1] with 1.0 representing a perfect match.
|
|
222
|
+
*/
|
|
223
|
+
process(pcm: Int16Array, speakerProfiles: EagleProfile[] | EagleProfile): Promise<number[] | null>;
|
|
224
|
+
/**
|
|
225
|
+
* Releases resources acquired by Eagle
|
|
226
|
+
*/
|
|
227
|
+
release(): Promise<void>;
|
|
228
|
+
/**
|
|
229
|
+
* Lists all available devices that Eagle can use for inference.
|
|
230
|
+
* Each entry in the list can be the used as the `device` argument for the `.create` method.
|
|
231
|
+
*
|
|
232
|
+
* @returns List of all available devices that Eagle can use for inference.
|
|
233
|
+
*/
|
|
234
|
+
static listAvailableDevices(): Promise<string[]>;
|
|
235
|
+
private static _initWasm;
|
|
236
|
+
}
|
|
237
|
+
export {};
|
|
246
238
|
//# sourceMappingURL=eagle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eagle.d.ts","sourceRoot":"","sources":["../../src/eagle.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAcpC,OAAO,EACL,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"eagle.d.ts","sourceRoot":"","sources":["../../src/eagle.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAcpC,OAAO,EACL,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,oBAAoB,EAErB,MAAM,SAAS,CAAC;AA0BjB,KAAK,mCAAmC,GAAG,MAAM,MAAM,CAAC;AACxD,KAAK,6BAA6B,GAAG,CACnC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,KACnB,MAAM,CAAC;AACZ,KAAK,kCAAkC,GAAG,CACxC,MAAM,EAAE,MAAM,EACd,uBAAuB,EAAE,MAAM,KAC5B,MAAM,CAAC;AAqBZ,KAAK,8CAA8C,GAAG,CACpD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,KACf,MAAM,CAAC;AACZ,KAAK,qBAAqB,GAAG,MAAM,MAAM,CAAC;AAC1C,KAAK,mCAAmC,GAAG,CACzC,eAAe,EAAE,MAAM,EACvB,kBAAkB,EAAE,MAAM,KACvB,MAAM,CAAC;AACZ,KAAK,mCAAmC,GAAG,CACzC,eAAe,EAAE,MAAM,EACvB,kBAAkB,EAAE,MAAM,KACvB,MAAM,CAAC;AACZ,KAAK,mBAAmB,GAAG,MAAM,MAAM,CAAC;AACxC,KAAK,eAAe,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAC7C,KAAK,uBAAuB,GAAG,CAC7B,YAAY,EAAE,MAAM,EACpB,iBAAiB,EAAE,MAAM,KACtB,MAAM,CAAC;AACZ,KAAK,wBAAwB,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;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C,uBAAuB,CAA8B;IACtE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAuB;IAExD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAS;IAE/C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAE5C,OAAO;IAaP;;OAEG;IACH,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;WACiB,MAAM,CACxB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,KAAK,CAAC;WAaG,KAAK,CACvB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,KAAK,CAAC;IAqDjB;;;;;;;;;;OAUG;IACU,OAAO,CAClB,GAAG,EAAE,UAAU,EACf,eAAe,EAAE,YAAY,EAAE,GAAG,YAAY,GAC7C,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;IA0H3B;;OAEG;IACU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAUrC;;;;;OAKG;WACiB,oBAAoB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;mBAqHxC,SAAS;CA2K/B"}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { PvError } from '@picovoice/web-utils';
|
|
2
|
-
import { PvStatus } from './types';
|
|
3
|
-
declare class EagleError extends Error {
|
|
4
|
-
private readonly _status;
|
|
5
|
-
private readonly _shortMessage;
|
|
6
|
-
private readonly _messageStack;
|
|
7
|
-
constructor(status: PvStatus, message: string, messageStack?: string[], pvError?: PvError | null);
|
|
8
|
-
get status(): PvStatus;
|
|
9
|
-
get shortMessage(): string;
|
|
10
|
-
get messageStack(): string[];
|
|
11
|
-
private static errorToString;
|
|
12
|
-
}
|
|
13
|
-
declare class EagleOutOfMemoryError extends EagleError {
|
|
14
|
-
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
15
|
-
}
|
|
16
|
-
declare class EagleIOError extends EagleError {
|
|
17
|
-
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
18
|
-
}
|
|
19
|
-
declare class EagleInvalidArgumentError extends EagleError {
|
|
20
|
-
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
21
|
-
}
|
|
22
|
-
declare class EagleStopIterationError extends EagleError {
|
|
23
|
-
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
24
|
-
}
|
|
25
|
-
declare class EagleKeyError extends EagleError {
|
|
26
|
-
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
27
|
-
}
|
|
28
|
-
declare class EagleInvalidStateError extends EagleError {
|
|
29
|
-
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
30
|
-
}
|
|
31
|
-
declare class EagleRuntimeError extends EagleError {
|
|
32
|
-
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
33
|
-
}
|
|
34
|
-
declare class EagleActivationError extends EagleError {
|
|
35
|
-
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
36
|
-
}
|
|
37
|
-
declare class EagleActivationLimitReachedError extends EagleError {
|
|
38
|
-
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
39
|
-
}
|
|
40
|
-
declare class EagleActivationThrottledError extends EagleError {
|
|
41
|
-
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
42
|
-
}
|
|
43
|
-
declare class EagleActivationRefusedError extends EagleError {
|
|
44
|
-
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
45
|
-
}
|
|
46
|
-
export { EagleError, EagleOutOfMemoryError, EagleIOError, EagleInvalidArgumentError, EagleStopIterationError, EagleKeyError, EagleInvalidStateError, EagleRuntimeError, EagleActivationError, EagleActivationLimitReachedError, EagleActivationThrottledError, EagleActivationRefusedError, };
|
|
47
|
-
export declare function pvStatusToException(pvStatus: PvStatus, errorMessage: string, messageStack?: string[], pvError?: PvError | null): EagleError;
|
|
1
|
+
import { PvError } from '@picovoice/web-utils';
|
|
2
|
+
import { PvStatus } from './types';
|
|
3
|
+
declare class EagleError extends Error {
|
|
4
|
+
private readonly _status;
|
|
5
|
+
private readonly _shortMessage;
|
|
6
|
+
private readonly _messageStack;
|
|
7
|
+
constructor(status: PvStatus, message: string, messageStack?: string[], pvError?: PvError | null);
|
|
8
|
+
get status(): PvStatus;
|
|
9
|
+
get shortMessage(): string;
|
|
10
|
+
get messageStack(): string[];
|
|
11
|
+
private static errorToString;
|
|
12
|
+
}
|
|
13
|
+
declare class EagleOutOfMemoryError extends EagleError {
|
|
14
|
+
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
15
|
+
}
|
|
16
|
+
declare class EagleIOError extends EagleError {
|
|
17
|
+
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
18
|
+
}
|
|
19
|
+
declare class EagleInvalidArgumentError extends EagleError {
|
|
20
|
+
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
21
|
+
}
|
|
22
|
+
declare class EagleStopIterationError extends EagleError {
|
|
23
|
+
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
24
|
+
}
|
|
25
|
+
declare class EagleKeyError extends EagleError {
|
|
26
|
+
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
27
|
+
}
|
|
28
|
+
declare class EagleInvalidStateError extends EagleError {
|
|
29
|
+
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
30
|
+
}
|
|
31
|
+
declare class EagleRuntimeError extends EagleError {
|
|
32
|
+
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
33
|
+
}
|
|
34
|
+
declare class EagleActivationError extends EagleError {
|
|
35
|
+
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
36
|
+
}
|
|
37
|
+
declare class EagleActivationLimitReachedError extends EagleError {
|
|
38
|
+
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
39
|
+
}
|
|
40
|
+
declare class EagleActivationThrottledError extends EagleError {
|
|
41
|
+
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
42
|
+
}
|
|
43
|
+
declare class EagleActivationRefusedError extends EagleError {
|
|
44
|
+
constructor(message: string, messageStack?: string[], pvError?: PvError | null);
|
|
45
|
+
}
|
|
46
|
+
export { EagleError, EagleOutOfMemoryError, EagleIOError, EagleInvalidArgumentError, EagleStopIterationError, EagleKeyError, EagleInvalidStateError, EagleRuntimeError, EagleActivationError, EagleActivationLimitReachedError, EagleActivationThrottledError, EagleActivationRefusedError, };
|
|
47
|
+
export declare function pvStatusToException(pvStatus: PvStatus, errorMessage: string, messageStack?: string[], pvError?: PvError | null): EagleError;
|
|
48
48
|
//# sourceMappingURL=eagle_errors.d.ts.map
|