react-native-wakeword 1.1.35 → 1.1.39
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/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar +0 -0
- package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar.md5 +1 -1
- package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar.sha1 +1 -1
- package/android/src/main/AndroidManifest.xml +0 -4
- package/android/src/main/java/com/davoice/DaVoiceUnifiedPackage.java +29 -0
- package/android/src/main/java/com/davoice/keywordspotting/KeyWordRNBridge.java +112 -0
- package/android/src/main/java/com/davoice/speakeridrn/SpeakerIdRNBridge.java +588 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/KeyWordDetection +0 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.abi.json +406 -41
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.private.swiftinterface +5 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.swiftinterface +5 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/KeyWordDetection +0 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.abi.json +406 -41
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +5 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftinterface +5 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json +406 -41
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +5 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +5 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeResources +24 -24
- package/package.json +3 -1
- package/react-native.config.js +10 -0
- package/speakerid/SpeakerIdRNBridge.d.ts +49 -0
- package/speakerid/SpeakerIdRNBridge.js +193 -0
- package/speakerid/index.d.ts +22 -0
- package/speakerid/index.js +28 -0
- package/speakerid/models/speaker_id.dm +0 -0
- package/wakewords/index.d.ts +8 -8
- package/android/src/main/assets/coca_cola_model_28_05052025.dm +0 -0
- package/android/src/main/java/com/davoice/keywordspotting/KeyWordRNBridgePackage.java +0 -25
- package/wakewords/index.d.ts.chat_idiot +0 -2
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#
|
|
1
|
+
#Fri Sep 26 21:12:50 IDT 2025
|
|
2
2
|
gradle.version=8.9
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
a02b7b681dd396f5bc166b0cfff4f555 keyworddetection-1.0.0.aar
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
91688619763ad075812224fede497f6b441232d1 keyworddetection-1.0.0.aar
|
|
@@ -9,9 +9,5 @@
|
|
|
9
9
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
|
10
10
|
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
|
11
11
|
|
|
12
|
-
<!-- Required for microphone access in Android 14 -->
|
|
13
|
-
<uses-permission android:name="android.permission.CAPTURE_AUDIO_OUTPUT"/>
|
|
14
|
-
<uses-permission android:name="android.permission.CAPTURE_MEDIA_OUTPUT"/>
|
|
15
|
-
|
|
16
12
|
</manifest>
|
|
17
13
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
package com.davoice;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactPackage;
|
|
4
|
+
import com.facebook.react.bridge.NativeModule;
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
|
+
import com.facebook.react.uimanager.ViewManager;
|
|
7
|
+
|
|
8
|
+
// Your two existing modules:
|
|
9
|
+
import com.davoice.keywordspotting.KeyWordRNBridge;
|
|
10
|
+
import com.davoice.speakeridrn.SpeakerIdRNBridge;
|
|
11
|
+
|
|
12
|
+
import java.util.Arrays;
|
|
13
|
+
import java.util.Collections;
|
|
14
|
+
import java.util.List;
|
|
15
|
+
|
|
16
|
+
public class DaVoiceUnifiedPackage implements ReactPackage {
|
|
17
|
+
@Override
|
|
18
|
+
public List<NativeModule> createNativeModules(ReactApplicationContext rc) {
|
|
19
|
+
return Arrays.asList(
|
|
20
|
+
new KeyWordRNBridge(rc),
|
|
21
|
+
new SpeakerIdRNBridge(rc)
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@Override
|
|
26
|
+
public List<ViewManager> createViewManagers(ReactApplicationContext rc) {
|
|
27
|
+
return Collections.emptyList();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -15,6 +15,12 @@ public class KeyWordRNBridge extends ReactContextBaseJavaModule {
|
|
|
15
15
|
private static final String REACT_CLASS = "KeyWordRNBridge";
|
|
16
16
|
private static ReactApplicationContext reactContext;
|
|
17
17
|
|
|
18
|
+
// VAD API:
|
|
19
|
+
private final Map<String, Float> vadThresholdByInstance = new HashMap<>();
|
|
20
|
+
private final Map<String, Integer> vadMsWindowByInstance = new HashMap<>();
|
|
21
|
+
private static final float DEFAULT_VAD_THRESHOLD = 0.45f;
|
|
22
|
+
private static final int DEFAULT_VAD_MSWINDOW = 1000;
|
|
23
|
+
|
|
18
24
|
// Map to hold multiple instances
|
|
19
25
|
private Map<String, KeyWordsDetection> instances = new HashMap<>();
|
|
20
26
|
|
|
@@ -75,6 +81,9 @@ public class KeyWordRNBridge extends ReactContextBaseJavaModule {
|
|
|
75
81
|
keyWordsDetection.initialize((detected, modelName) -> onKeywordDetected(instanceId, detected, modelName));
|
|
76
82
|
|
|
77
83
|
instances.put(instanceId, keyWordsDetection);
|
|
84
|
+
vadThresholdByInstance.put(instanceId, DEFAULT_VAD_THRESHOLD);
|
|
85
|
+
vadMsWindowByInstance.put(instanceId, DEFAULT_VAD_MSWINDOW);
|
|
86
|
+
|
|
78
87
|
promise.resolve("Multi-model instance created with ID: " + instanceId);
|
|
79
88
|
|
|
80
89
|
} catch (Exception e) {
|
|
@@ -93,6 +102,8 @@ public class KeyWordRNBridge extends ReactContextBaseJavaModule {
|
|
|
93
102
|
try {
|
|
94
103
|
KeyWordsDetection keyWordsDetection = new KeyWordsDetection(reactContext, modelName, threshold, bufferCnt);
|
|
95
104
|
keyWordsDetection.initialize((detected, ignored) -> onKeywordDetected(instanceId, detected, modelName));
|
|
105
|
+
vadThresholdByInstance.put(instanceId, DEFAULT_VAD_THRESHOLD);
|
|
106
|
+
vadMsWindowByInstance.put(instanceId, DEFAULT_VAD_MSWINDOW);
|
|
96
107
|
|
|
97
108
|
instances.put(instanceId, keyWordsDetection);
|
|
98
109
|
promise.resolve("Instance created with ID: " + instanceId);
|
|
@@ -185,6 +196,8 @@ public class KeyWordRNBridge extends ReactContextBaseJavaModule {
|
|
|
185
196
|
@ReactMethod
|
|
186
197
|
public void destroyInstance(String instanceId, Promise promise) {
|
|
187
198
|
KeyWordsDetection instance = instances.remove(instanceId);
|
|
199
|
+
vadThresholdByInstance.remove(instanceId); // NEW
|
|
200
|
+
vadMsWindowByInstance.remove(instanceId); // NEW
|
|
188
201
|
if (instance != null) {
|
|
189
202
|
instance.stopListening();
|
|
190
203
|
// Additional cleanup if necessary
|
|
@@ -211,6 +224,105 @@ public class KeyWordRNBridge extends ReactContextBaseJavaModule {
|
|
|
211
224
|
.emit(eventName, params);
|
|
212
225
|
}
|
|
213
226
|
|
|
227
|
+
// VAD API:
|
|
228
|
+
|
|
229
|
+
// ===== Add: VAD parity methods (anywhere among other @ReactMethod methods) =====
|
|
230
|
+
@ReactMethod
|
|
231
|
+
public void getVoiceProps(String instanceId, Promise promise) {
|
|
232
|
+
KeyWordsDetection instance = instances.get(instanceId);
|
|
233
|
+
if (instance == null) {
|
|
234
|
+
promise.reject("InstanceNotFound", "No instance found with ID: " + instanceId);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
try {
|
|
238
|
+
@SuppressWarnings("unchecked")
|
|
239
|
+
Map<String, Object> props = instance.getVoiceProps();
|
|
240
|
+
WritableMap out = Arguments.createMap();
|
|
241
|
+
|
|
242
|
+
Object err = props.get("error");
|
|
243
|
+
Object prob = props.get("voiceProbability");
|
|
244
|
+
Object last = props.get("lastTimeHumanVoiceHeard");
|
|
245
|
+
|
|
246
|
+
out.putString("error", err == null ? "" : String.valueOf(err));
|
|
247
|
+
out.putDouble("voiceProbability", prob instanceof Number ? ((Number) prob).doubleValue() : 0.0);
|
|
248
|
+
out.putDouble("lastTimeHumanVoiceHeard", last instanceof Number ? ((Number) last).doubleValue() : 0.0);
|
|
249
|
+
|
|
250
|
+
promise.resolve(out);
|
|
251
|
+
} catch (Exception e) {
|
|
252
|
+
promise.reject("GetVoicePropsError", e.getMessage());
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
@ReactMethod
|
|
257
|
+
public void startVADDetection(String instanceId, Promise promise) {
|
|
258
|
+
KeyWordsDetection instance = instances.get(instanceId);
|
|
259
|
+
if (instance == null) {
|
|
260
|
+
promise.reject("InstanceNotFound", "No instance found with ID: " + instanceId);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
try {
|
|
264
|
+
// after: API-21 safe
|
|
265
|
+
Float _thr = vadThresholdByInstance.get(instanceId);
|
|
266
|
+
float thr = (_thr != null) ? _thr : DEFAULT_VAD_THRESHOLD;
|
|
267
|
+
Integer _win = vadMsWindowByInstance.get(instanceId);
|
|
268
|
+
int win = (_win != null) ? _win : DEFAULT_VAD_MSWINDOW;
|
|
269
|
+
instance.setVADParams(thr, win);
|
|
270
|
+
boolean ok = instance.startVADListening();
|
|
271
|
+
promise.resolve(ok);
|
|
272
|
+
} catch (Exception e) {
|
|
273
|
+
promise.reject("StartVADError", e.getMessage());
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
@ReactMethod
|
|
278
|
+
public void stopVADDetection(String instanceId, Promise promise) {
|
|
279
|
+
KeyWordsDetection instance = instances.get(instanceId);
|
|
280
|
+
if (instance == null) {
|
|
281
|
+
promise.reject("InstanceNotFound", "No instance found with ID: " + instanceId);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
try {
|
|
285
|
+
instance.stopVADListening();
|
|
286
|
+
promise.resolve("Stopped VAD for instance: " + instanceId);
|
|
287
|
+
} catch (Exception e) {
|
|
288
|
+
promise.reject("StopVADError", e.getMessage());
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
@ReactMethod
|
|
293
|
+
public void setVADParams(String instanceId, double threshold, int msWindow, Promise promise) {
|
|
294
|
+
KeyWordsDetection instance = instances.get(instanceId);
|
|
295
|
+
if (instance == null) {
|
|
296
|
+
promise.reject("InstanceNotFound", "No instance found with ID: " + instanceId);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
try {
|
|
300
|
+
float thr = (float) threshold;
|
|
301
|
+
vadThresholdByInstance.put(instanceId, thr);
|
|
302
|
+
vadMsWindowByInstance.put(instanceId, msWindow);
|
|
303
|
+
instance.setVADParams(thr, msWindow);
|
|
304
|
+
promise.resolve(null);
|
|
305
|
+
} catch (Exception e) {
|
|
306
|
+
promise.reject("SetVADParamsError", e.getMessage());
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
@ReactMethod
|
|
311
|
+
public void getVADParams(String instanceId, Promise promise) {
|
|
312
|
+
if (!instances.containsKey(instanceId)) {
|
|
313
|
+
promise.reject("InstanceNotFound", "No instance found with ID: " + instanceId);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
WritableMap out = Arguments.createMap();
|
|
317
|
+
Float _thr = vadThresholdByInstance.get(instanceId);
|
|
318
|
+
float thr = (_thr != null) ? _thr : DEFAULT_VAD_THRESHOLD;
|
|
319
|
+
Integer _win = vadMsWindowByInstance.get(instanceId);
|
|
320
|
+
int win = (_win != null) ? _win : DEFAULT_VAD_MSWINDOW;
|
|
321
|
+
out.putDouble("threshold", (double) thr);
|
|
322
|
+
out.putInt("msWindow", win);
|
|
323
|
+
promise.resolve(out);
|
|
324
|
+
}
|
|
325
|
+
|
|
214
326
|
@ReactMethod
|
|
215
327
|
public void addListener(String eventName) {
|
|
216
328
|
// Set up any upstream listeners or background tasks as necessary
|