react-native-wakeword-sid 1.1.55

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.
Files changed (77) hide show
  1. package/KeyWordRNBridge.podspec +58 -0
  2. package/LICENSE +21 -0
  3. package/README.md +281 -0
  4. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  5. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  6. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  7. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  8. package/android/.gradle/8.9/gc.properties +0 -0
  9. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  10. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  11. package/android/.gradle/vcs-1/gc.properties +0 -0
  12. package/android/build.gradle +48 -0
  13. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar +0 -0
  14. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar.md5 +1 -0
  15. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar.sha1 +1 -0
  16. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.pom +10 -0
  17. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.pom.md5 +1 -0
  18. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.pom.sha1 +1 -0
  19. package/android/settings.gradle +2 -0
  20. package/android/src/main/AndroidManifest.xml +13 -0
  21. package/android/src/main/assets/hey_lookdeep.dm +0 -0
  22. package/android/src/main/assets/layer1.dm +0 -0
  23. package/android/src/main/assets/need_help_now.dm +0 -0
  24. package/android/src/main/java/com/davoice/DaVoiceUnifiedPackage.java +29 -0
  25. package/android/src/main/java/com/davoice/keywordspotting/KeyWordRNBridge.java +335 -0
  26. package/android/src/main/java/com/davoice/speakeridrn/SpeakerIdRNBridge.java_not_used_yet +588 -0
  27. package/android/src/main/libs/MyLibrary-release.aar +0 -0
  28. package/app.plugin.js +60 -0
  29. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/Info.plist +44 -0
  30. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +386 -0
  31. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Headers/KeyWordDetection.h +18 -0
  32. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Info.plist +0 -0
  33. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/KeyWordDetection +0 -0
  34. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.abi.json +5758 -0
  35. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.private.swiftinterface +159 -0
  36. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  37. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.swiftinterface +159 -0
  38. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/module.modulemap +11 -0
  39. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +768 -0
  40. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Headers/KeyWordDetection.h +18 -0
  41. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Info.plist +0 -0
  42. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/KeyWordDetection +0 -0
  43. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.abi.json +5758 -0
  44. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +159 -0
  45. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  46. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftinterface +159 -0
  47. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json +5758 -0
  48. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +159 -0
  49. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  50. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +159 -0
  51. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/module.modulemap +11 -0
  52. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeDirectory +0 -0
  53. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeRequirements +0 -0
  54. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeRequirements-1 +0 -0
  55. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeResources +297 -0
  56. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeSignature +0 -0
  57. package/ios/KeyWordRNBridge/KeyWordRNBridge.h +19 -0
  58. package/ios/KeyWordRNBridge/KeyWordRNBridge.m +642 -0
  59. package/ios/KeyWordRNBridge/KeyWordRNBridge.mm +416 -0
  60. package/ios/KeyWordRNBridge/models/coca_cola_model_28_05052025.onnx +0 -0
  61. package/ios/KeyWordRNBridge/models/embedding_model.onnx +0 -0
  62. package/ios/KeyWordRNBridge/models/hey_lookdeep.onnx +0 -0
  63. package/ios/KeyWordRNBridge/models/melspectrogram.onnx +0 -0
  64. package/ios/KeyWordRNBridge/models/need_help_now.onnx +0 -0
  65. package/ios/KeyWordRNBridge/models/silero_vad.onnx +0 -0
  66. package/package.json +74 -0
  67. package/react-native.config.js +10 -0
  68. package/wakewords/KeyWordRNBridge.d.ts +38 -0
  69. package/wakewords/KeyWordRNBridge.js +228 -0
  70. package/wakewords/SpeakerVerificationRNBridge.d.ts +32 -0
  71. package/wakewords/SpeakerVerificationRNBridge.js +124 -0
  72. package/wakewords/audioRoutingConfig.d.ts +17 -0
  73. package/wakewords/audioRoutingConfig.ts +28 -0
  74. package/wakewords/index.d.ts +16 -0
  75. package/wakewords/index.js +34 -0
  76. package/wakewords/useModel.d.ts +19 -0
  77. package/wakewords/useModel.tsx +235 -0
@@ -0,0 +1,228 @@
1
+ // KeyWordRNBridge.js
2
+ import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
3
+
4
+ const { KeyWordRNBridge } = NativeModules;
5
+ const keywordRNBridgeEmitter = new NativeEventEmitter(KeyWordRNBridge);
6
+
7
+ if (KeyWordRNBridge) {
8
+ console.log("KeyWordRNBridge is loaded:", KeyWordRNBridge);
9
+ } else {
10
+ console.error("KeyWordRNBridge is not linked correctly.");
11
+ }
12
+
13
+ export class KeyWordRNBridgeInstance {
14
+ instanceId;
15
+ listeners = [];
16
+ isFirstInstance = false;
17
+
18
+ constructor(instanceId, isSticky) {
19
+ this.instanceId = instanceId;
20
+ this.isSticky = isSticky;
21
+ }
22
+
23
+ async createInstanceMulti(modelNames, thresholds, bufferCnts, msBetweenCallbacks) {
24
+ const instance = await KeyWordRNBridge.createInstanceMulti(
25
+ this.instanceId,
26
+ modelNames,
27
+ thresholds,
28
+ bufferCnts,
29
+ msBetweenCallbacks
30
+ );
31
+
32
+ if (instance && this.isFirstInstance) {
33
+ this.isFirstInstance = false;
34
+ await KeyWordRNBridge.startForegroundService(this.instanceId);
35
+ }
36
+
37
+ return instance;
38
+ }
39
+
40
+ async createInstance(modelName, threshold, bufferCnt) {
41
+ const instance = await KeyWordRNBridge.createInstance(
42
+ this.instanceId,
43
+ modelName,
44
+ threshold,
45
+ bufferCnt);
46
+ if (instance && this.isFirstInstance)
47
+ {
48
+ this.isFirstInstance = false;
49
+ await KeyWordRNBridge.startForegroundService(this.instanceId);
50
+ }
51
+ return instance;
52
+ }
53
+
54
+ // 1) Voice props (parity with VAD)
55
+ async getVoiceProps() {
56
+ try {
57
+ const voiceProps = await KeyWordRNBridge.getVoiceProps(this.instanceId);
58
+ return {
59
+ error: voiceProps.error,
60
+ voiceProbability: voiceProps.voiceProbability,
61
+ lastTimeHumanVoiceHeard: voiceProps.lastTimeHumanVoiceHeard,
62
+ };
63
+ } catch (error) {
64
+ console.error('Error getting voice properties:', error);
65
+ throw error;
66
+ }
67
+ }
68
+
69
+ // 2) Silent VAD control (iOS-only, optional but useful)
70
+ async startSilentVADDetection() {
71
+ if (Platform.OS === 'ios') {
72
+ return await KeyWordRNBridge.startSilentVADDetection(this.instanceId);
73
+ }
74
+ }
75
+
76
+ async stopSilentVADDetection() {
77
+ if (Platform.OS === 'ios') {
78
+ return await KeyWordRNBridge.stopSilentVADDetection(this.instanceId);
79
+ }
80
+ }
81
+
82
+ // 3) Explicit VAD start/stop (if exposed by your native bridge)
83
+ async startVADDetection() {
84
+ return await KeyWordRNBridge.startVADDetection(this.instanceId);
85
+ }
86
+ async stopVADDetection() {
87
+ return await KeyWordRNBridge.stopVADDetection(this.instanceId);
88
+ }
89
+
90
+ // 4) (Optional) VAD event listener if your native layer emits it
91
+ onVADDetectionEvent(callback) {
92
+ const listener = keywordRNBridgeEmitter.addListener('onVADDetectionEvent', (event) => {
93
+ if (event.instanceId === this.instanceId) {
94
+ callback(event.phrase);
95
+ }
96
+ });
97
+ this.listeners.push(listener);
98
+ return listener;
99
+ }
100
+
101
+ // Configure VAD runtime parameters
102
+ async setVADParams(threshold, msWindow) {
103
+ return await KeyWordRNBridge.setVADParams(this.instanceId, threshold, msWindow);
104
+ }
105
+
106
+ async getVADParams() {
107
+ // implement only if native exposes it
108
+ return await KeyWordRNBridge.getVADParams(this.instanceId);
109
+ }
110
+
111
+ async setKeywordDetectionLicense(license) {
112
+ return await KeyWordRNBridge.setKeywordDetectionLicense(this.instanceId, license);
113
+ }
114
+
115
+ async replaceKeywordDetectionModel(modelName, threshold, bufferCnt) {
116
+ return KeyWordRNBridge.replaceKeywordDetectionModel(this.instanceId, modelName, threshold, bufferCnt);
117
+ }
118
+ /*startForegroundService() {
119
+ return KeyWordRNBridge.startForegroundService(this.instanceId);
120
+ }
121
+
122
+ stopForegroundService() {
123
+ return KeyWordRNBridge.stopForegroundService(this.instanceId);
124
+ }*/
125
+ async setKeywordLicense(license) {
126
+ return KeyWordRNBridge.setKeywordLicense(this.instanceId, license);
127
+ }
128
+
129
+ async startKeywordDetection(threshold,
130
+ setActive = true,
131
+ duckOthers = false,
132
+ mixWithOthers = true,
133
+ defaultToSpeaker = true) {
134
+
135
+ if (Platform.OS === 'ios') {
136
+ return KeyWordRNBridge.startKeywordDetection(
137
+ this.instanceId,
138
+ threshold,
139
+ setActive,
140
+ duckOthers,
141
+ mixWithOthers,
142
+ defaultToSpeaker
143
+ );
144
+ } else {
145
+ return KeyWordRNBridge.startKeywordDetection(this.instanceId, threshold);
146
+ }
147
+ }
148
+
149
+ async getRecordingWav() {
150
+ return await KeyWordRNBridge.getRecordingWav(this.instanceId);
151
+ }
152
+
153
+ async stopKeywordDetection() {
154
+ return KeyWordRNBridge.stopKeywordDetection(this.instanceId);
155
+ }
156
+
157
+ async destroyInstance() {
158
+ return KeyWordRNBridge.destroyInstance(this.instanceId);
159
+ }
160
+
161
+ onKeywordDetectionEvent(callback) {
162
+ const listener = keywordRNBridgeEmitter.addListener('onKeywordDetectionEvent', (event) => {
163
+ if (event.instanceId === this.instanceId) {
164
+ console.log("event == .", event);
165
+ if (Platform.OS === 'ios') {
166
+ console.log("event == .", event);
167
+ callback(event.info);
168
+ } else {
169
+ callback(event.phrase);
170
+ }
171
+ }
172
+ });
173
+ this.listeners.push(listener);
174
+ return listener;
175
+ }
176
+
177
+ removeListeners() {
178
+ this.listeners.forEach((listener) => listener.remove());
179
+ this.listeners = [];
180
+ }
181
+ }
182
+
183
+ export const removeAllRNBridgeListeners = async () => {
184
+ keywordRNBridgeEmitter.removeAllListeners('onKeywordDetectionEvent');
185
+ keywordRNBridgeEmitter.removeAllListeners('onVADDetectionEvent'); // NEW
186
+ }
187
+
188
+ export const createKeyWordRNBridgeInstance = async (instanceId, isSticky) => {
189
+ return await new KeyWordRNBridgeInstance(instanceId, isSticky);
190
+ };
191
+
192
+ export const enableDucking = async () => {
193
+ if (Platform.OS === 'ios') {
194
+ await KeyWordRNBridge.enableAggressiveDucking();
195
+ }
196
+ }
197
+
198
+ export const disableDucking = async () => {
199
+ if (Platform.OS === 'ios') {
200
+ await KeyWordRNBridge.disableDucking();
201
+ }
202
+ }
203
+
204
+ export const restartListeningAfterDucking = async () => {
205
+ if (Platform.OS === 'ios') {
206
+ await KeyWordRNBridge.restartListeningAfterDucking();
207
+ }
208
+ }
209
+
210
+ export const initAudioSessAndDuckManage = async () => {
211
+ if (Platform.OS === 'ios') {
212
+ await KeyWordRNBridge.initAudioSessAndDuckManage();
213
+ }
214
+ }
215
+
216
+ export const disableDuckingAndCleanup = async () => {
217
+ if (Platform.OS === 'ios') {
218
+ await KeyWordRNBridge.disableDuckingAndCleanup();
219
+ }
220
+ }
221
+
222
+ // NEW: global audio routing config setter (per package, not per instance)
223
+ export const setWakewordAudioRoutingConfig = async (config) => {
224
+ if (Platform.OS === 'ios') {
225
+ // Native: implement KeyWordRNBridge.setAudioRoutingConfig(jsonString)
226
+ return KeyWordRNBridge.setAudioRoutingConfig(JSON.stringify(config));
227
+ }
228
+ };
@@ -0,0 +1,32 @@
1
+ export class SpeakerVerificationRNBridgeInstance {
2
+ constructor(engineId: any);
3
+ engineId: any;
4
+ /**
5
+ * Create the native speaker verifier engine.
6
+ *
7
+ * modelPathOrName:
8
+ * - absolute path OR "speaker_model.onnx" in the iOS app bundle
9
+ * - OR require('./assets/speaker_model.onnx')
10
+ *
11
+ * enrollmentJsonPathOrName:
12
+ * - absolute path OR "enrollment.json" in the iOS app bundle
13
+ * - OR require('./assets/enrollment.json')
14
+ *
15
+ * options (optional):
16
+ * { decisionThreshold, frameSize, tailSeconds, maxTailSeconds, cmn, expectedLayoutBDT, logLevel }
17
+ */
18
+ create(modelPathOrName: any, enrollmentJsonPathOrName: any, options?: {}): Promise<any>;
19
+ /**
20
+ * Verify WAV by streaming in native.
21
+ *
22
+ * wavPathOrName:
23
+ * - absolute path OR "test.wav" in bundle
24
+ * - OR require('./assets/test.wav')
25
+ *
26
+ * resetState:
27
+ * - if true, clears internal streaming state before verification
28
+ */
29
+ verifyWavStreaming(wavPathOrName: any, resetState?: boolean): Promise<any>;
30
+ destroy(): Promise<any>;
31
+ }
32
+ export function createSpeakerVerificationInstance(engineId: any): Promise<SpeakerVerificationRNBridgeInstance>;
@@ -0,0 +1,124 @@
1
+ // wakewords/SpeakerVerificationRNBridge.js
2
+ import { NativeModules, Platform } from 'react-native';
3
+ import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
4
+
5
+ // Keep using the SAME native module (KeyWordRNBridge.m already exports these methods)
6
+ const { KeyWordRNBridge } = NativeModules;
7
+
8
+ function stripFileScheme(uri) {
9
+ if (!uri) return uri;
10
+ return uri.startsWith('file://') ? uri.replace('file://', '') : uri;
11
+ }
12
+
13
+ // Accepts:
14
+ // - string (absolute path OR "name.ext")
15
+ // - require('...') (number) -> resolved to uri/path
16
+ function normalizePathOrName(input) {
17
+ if (input == null) return input;
18
+
19
+ // require(...) returns a number in RN
20
+ if (typeof input === 'number') {
21
+ const src = resolveAssetSource(input);
22
+ // src.uri might be:
23
+ // - "file:///.../name.onnx" (iOS)
24
+ // - "asset:/name.onnx" or "assets:/..." (Android)
25
+ // We pass through; native iOS resolver handles bundle names too.
26
+ if (src?.uri) return stripFileScheme(src.uri);
27
+ return input;
28
+ }
29
+
30
+ if (typeof input === 'string') {
31
+ return stripFileScheme(input);
32
+ }
33
+
34
+ // if someone passes an object accidentally, just stringify it
35
+ return String(input);
36
+ }
37
+
38
+ export class SpeakerVerificationRNBridgeInstance {
39
+ engineId;
40
+
41
+ constructor(engineId) {
42
+ this.engineId = engineId;
43
+ }
44
+
45
+ /**
46
+ * Create the native speaker verifier engine.
47
+ *
48
+ * modelPathOrName:
49
+ * - absolute path OR "speaker_model.onnx" in the iOS app bundle
50
+ * - OR require('./assets/speaker_model.onnx')
51
+ *
52
+ * enrollmentJsonPathOrName:
53
+ * - absolute path OR "enrollment.json" in the iOS app bundle
54
+ * - OR require('./assets/enrollment.json')
55
+ *
56
+ * options (optional):
57
+ * { decisionThreshold, frameSize, tailSeconds, maxTailSeconds, cmn, expectedLayoutBDT, logLevel }
58
+ */
59
+ async create(modelPathOrName, enrollmentJsonPathOrName, options = {}) {
60
+ if (!KeyWordRNBridge?.createSpeakerVerifier) {
61
+ throw new Error('KeyWordRNBridge.createSpeakerVerifier is not available (native not linked / iOS only?)');
62
+ }
63
+
64
+ if (Platform.OS !== 'ios') {
65
+ throw new Error('Speaker verification bridge is currently implemented for iOS only.');
66
+ }
67
+
68
+ const modelArg = normalizePathOrName(modelPathOrName);
69
+ const jsonArg = normalizePathOrName(enrollmentJsonPathOrName);
70
+
71
+ return await KeyWordRNBridge.createSpeakerVerifier(
72
+ this.engineId,
73
+ modelArg,
74
+ jsonArg,
75
+ options || {}
76
+ );
77
+ }
78
+
79
+ /**
80
+ * Verify WAV by streaming in native.
81
+ *
82
+ * wavPathOrName:
83
+ * - absolute path OR "test.wav" in bundle
84
+ * - OR require('./assets/test.wav')
85
+ *
86
+ * resetState:
87
+ * - if true, clears internal streaming state before verification
88
+ */
89
+ async verifyWavStreaming(wavPathOrName, resetState = true) {
90
+ if (!KeyWordRNBridge?.verifySpeakerWavStreaming) {
91
+ throw new Error('KeyWordRNBridge.verifySpeakerWavStreaming is not available (native not linked / iOS only?)');
92
+ }
93
+
94
+ if (Platform.OS !== 'ios') {
95
+ throw new Error('Speaker verification bridge is currently implemented for iOS only.');
96
+ }
97
+
98
+ const wavArg = normalizePathOrName(wavPathOrName);
99
+
100
+ return await KeyWordRNBridge.verifySpeakerWavStreaming(
101
+ this.engineId,
102
+ wavArg,
103
+ !!resetState
104
+ );
105
+ }
106
+
107
+ async destroy() {
108
+ if (!KeyWordRNBridge?.destroySpeakerVerifier) {
109
+ throw new Error('KeyWordRNBridge.destroySpeakerVerifier is not available (native not linked / iOS only?)');
110
+ }
111
+
112
+ if (Platform.OS !== 'ios') {
113
+ // no-op for now
114
+ return { ok: true, engineId: this.engineId, noop: true };
115
+ }
116
+
117
+ return await KeyWordRNBridge.destroySpeakerVerifier(this.engineId);
118
+ }
119
+ }
120
+
121
+ // Convenience creator (parity with wakeword side)
122
+ export const createSpeakerVerificationInstance = async (engineId) => {
123
+ return new SpeakerVerificationRNBridgeInstance(engineId);
124
+ };
@@ -0,0 +1,17 @@
1
+ export type RouteConfigEntry = {
2
+ category: 'playAndRecord' | 'record' | 'soloAmbient' | 'ambient' | 'playback';
3
+ mode: 'default' | 'measurement' | 'voiceChat' | 'videoRecording' | 'gameChat';
4
+ options: ('mixWithOthers' | 'duckOthers' | 'allowBluetooth' | 'allowBluetoothA2DP' | 'allowAirPlay' | 'defaultToSpeaker' | 'overrideMutedMicrophoneInterruption')[];
5
+ preferredInput: 'none' | 'builtInMic';
6
+ };
7
+ export type AudioRoutingConfig = {
8
+ default: RouteConfigEntry;
9
+ byOutputPort: {
10
+ carAudio?: RouteConfigEntry;
11
+ builtInReceiver?: RouteConfigEntry;
12
+ builtInSpeaker?: RouteConfigEntry;
13
+ bluetoothA2DP?: RouteConfigEntry;
14
+ bluetoothHFP?: RouteConfigEntry;
15
+ headphones?: RouteConfigEntry;
16
+ };
17
+ };
@@ -0,0 +1,28 @@
1
+ // wakewords/audioRoutingConfig.ts
2
+ export type RouteConfigEntry = {
3
+ category: 'playAndRecord' | 'record' | 'soloAmbient' | 'ambient' | 'playback';
4
+ mode: 'default' | 'measurement' | 'voiceChat' | 'videoRecording' | 'gameChat';
5
+ options: (
6
+ | 'mixWithOthers'
7
+ | 'duckOthers'
8
+ | 'allowBluetooth'
9
+ | 'allowBluetoothA2DP'
10
+ | 'allowAirPlay'
11
+ | 'defaultToSpeaker'
12
+ | 'overrideMutedMicrophoneInterruption'
13
+ )[];
14
+ preferredInput: 'none' | 'builtInMic'; // nil vs phone mic
15
+ };
16
+
17
+ export type AudioRoutingConfig = {
18
+ default: RouteConfigEntry;
19
+ byOutputPort: {
20
+ carAudio?: RouteConfigEntry; // .carAudio (CarPlay)
21
+ builtInReceiver?: RouteConfigEntry; // .builtInReceiver (earpiece)
22
+ builtInSpeaker?: RouteConfigEntry; // .builtInSpeaker
23
+ bluetoothA2DP?: RouteConfigEntry; // .bluetoothA2DP
24
+ bluetoothHFP?: RouteConfigEntry; // .bluetoothHFP
25
+ headphones?: RouteConfigEntry; // .headphones
26
+ // add more as needed
27
+ };
28
+ };
@@ -0,0 +1,16 @@
1
+ export default useModel;
2
+ import { enableDucking } from './KeyWordRNBridge';
3
+ import { disableDucking } from './KeyWordRNBridge';
4
+ import { initAudioSessAndDuckManage } from './KeyWordRNBridge';
5
+ import { restartListeningAfterDucking } from './KeyWordRNBridge';
6
+ import { removeAllRNBridgeListeners } from './KeyWordRNBridge';
7
+ import { createKeyWordRNBridgeInstance } from './KeyWordRNBridge';
8
+ import { KeyWordRNBridgeInstance } from './KeyWordRNBridge';
9
+ import { setWakewordAudioRoutingConfig } from './KeyWordRNBridge';
10
+ import { createSpeakerVerificationInstance } from './SpeakerVerificationRNBridge';
11
+ import { SpeakerVerificationRNBridgeInstance } from './SpeakerVerificationRNBridge';
12
+ import useModel from './useModel';
13
+ export { enableDucking, disableDucking, initAudioSessAndDuckManage, restartListeningAfterDucking, removeAllRNBridgeListeners, createKeyWordRNBridgeInstance, KeyWordRNBridgeInstance, setWakewordAudioRoutingConfig, createSpeakerVerificationInstance, SpeakerVerificationRNBridgeInstance, useModel };
14
+
15
+ // Re-export routing types for consumers:
16
+ export type { AudioRoutingConfig, RouteConfigEntry } from './audioRoutingConfig';
@@ -0,0 +1,34 @@
1
+ // wakewords/index.js
2
+
3
+ import useModel from './useModel';
4
+ import {
5
+ createKeyWordRNBridgeInstance,
6
+ removeAllRNBridgeListeners,
7
+ KeyWordRNBridgeInstance,
8
+ enableDucking,
9
+ disableDucking,
10
+ initAudioSessAndDuckManage,
11
+ restartListeningAfterDucking,
12
+ setWakewordAudioRoutingConfig, // ← NEW
13
+ } from './KeyWordRNBridge';
14
+
15
+ // ✅ NEW speaker verification bridge exports
16
+ import {
17
+ createSpeakerVerificationInstance,
18
+ SpeakerVerificationRNBridgeInstance,
19
+ } from './SpeakerVerificationRNBridge';
20
+
21
+ export { enableDucking }
22
+ export { disableDucking }
23
+ export { initAudioSessAndDuckManage }
24
+ export { restartListeningAfterDucking }
25
+ export { removeAllRNBridgeListeners }
26
+ export { createKeyWordRNBridgeInstance }
27
+ export { KeyWordRNBridgeInstance }
28
+ export { setWakewordAudioRoutingConfig } // ← NEW
29
+
30
+ export { createSpeakerVerificationInstance }; // ✅ NEW
31
+ export { SpeakerVerificationRNBridgeInstance }; // ✅ NEW
32
+
33
+ export { useModel }; // Export only useModel
34
+ export default useModel; // Allow default import
@@ -0,0 +1,19 @@
1
+ interface instanceConfig {
2
+ id: string;
3
+ modelName: string;
4
+ threshold: number;
5
+ bufferCnt: number;
6
+ sticky: boolean;
7
+ }
8
+ /**
9
+ * Custom hook for handling keyword detection using KeyWordRNBridge
10
+ * @returns An object with functions and state for keyword detection
11
+ */
12
+ export declare const useModel: () => {
13
+ isListening: boolean;
14
+ startListening: () => Promise<void>;
15
+ loadModel: (useConfigs: instanceConfig[], callback: (phrase: string) => void) => Promise<void>;
16
+ setKeywordDetectionLicense: (licenseKey: string) => Promise<void>;
17
+ stopListening: () => Promise<void>;
18
+ };
19
+ export default useModel;