react-native-davoice-tts 1.0.405 → 1.0.407

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 (43) hide show
  1. package/README.md +11 -0
  2. package/TTSRNBridge.podspec +1 -1
  3. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  4. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  5. package/android/.gradle/9.7.1/checksums/checksums.lock +0 -0
  6. package/android/.gradle/9.7.1/fileHashes/fileHashes.lock +0 -0
  7. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  8. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  9. package/android/build/reports/problems/problems-report.html +9 -2
  10. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar +0 -0
  11. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.md5 +1 -1
  12. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.sha1 +1 -1
  13. package/android/src/main/java/com/davoice/stt/rn/STTModule.kt +90 -22
  14. package/android/src/main/java/com/davoice/tts/rn/DaVoiceTTSBridge.java +16 -0
  15. package/ios/SpeechBridge/SpeechBridge.m +108 -12
  16. package/ios/TTSRNBridge/DaVoiceTTSBridge.m +6 -0
  17. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DavoiceTTS +0 -0
  18. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Headers/DavoiceTTS-Swift.h +24 -0
  19. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +1708 -360
  20. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +35 -0
  21. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  22. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +35 -0
  23. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DavoiceTTS +0 -0
  24. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Headers/DavoiceTTS-Swift.h +48 -0
  25. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +1708 -360
  26. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +35 -0
  27. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  28. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +35 -0
  29. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +1708 -360
  30. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +35 -0
  31. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  32. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +35 -0
  33. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeDirectory +0 -0
  34. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeRequirements-1 +0 -0
  35. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeResources +33 -33
  36. package/package.json +1 -1
  37. package/speech/index.d.ts +42 -1
  38. package/speech/index.ts +115 -4
  39. package/android/.gradle/9.2.0/checksums/checksums.lock +0 -0
  40. package/android/.gradle/9.2.0/fileHashes/fileHashes.bin +0 -0
  41. package/android/.gradle/9.2.0/fileHashes/fileHashes.lock +0 -0
  42. /package/android/.gradle/{9.2.0 → 9.7.1}/fileChanges/last-build.bin +0 -0
  43. /package/android/.gradle/{9.2.0 → 9.7.1}/gc.properties +0 -0
@@ -96,6 +96,17 @@ public enum AudioPlaybackHook {
96
96
  @objc final public func startSpeech(localeStr: Swift.String?, onboardingJsonPath: Swift.String)
97
97
  #endif
98
98
  #if compiler(>=5.3) && $NonescapableTypes
99
+ @objc final public func startSpeech(localeStr: Swift.String?, onboardingJsonPath: Swift.String, speakerId: Swift.String)
100
+ #endif
101
+ #if compiler(>=5.3) && $NonescapableTypes
102
+ @objc final public func startSpeech(localeStr: Swift.String?, speakers: [[Swift.String : Swift.String]])
103
+ #endif
104
+ @objc final public func addSpeaker(id: Swift.String, jsonOrPath: Swift.String) throws
105
+ @objc final public func setSpeakers(_ speakers: [[Swift.String : Swift.String]]) throws
106
+ @objc @discardableResult
107
+ final public func removeSpeaker(id: Swift.String) -> Swift.Bool
108
+ @objc final public func getSpeakerIds() -> [Swift.String]
109
+ #if compiler(>=5.3) && $NonescapableTypes
99
110
  @objc final public func stopSpeech(_ completion: ((Swift.Bool) -> Swift.Void)? = nil)
100
111
  #endif
101
112
  #if compiler(>=5.3) && $NonescapableTypes
@@ -148,6 +159,7 @@ public enum AudioPlaybackHook {
148
159
  get
149
160
  }
150
161
  }
162
+ @objc final public func getAllVoices() -> [Swift.String]
151
163
  @objc(changeVoice:completion:) final public func changeVoice(_ name: Swift.String, completion: @escaping (Swift.Int) -> Swift.Void)
152
164
  @objc final public var onLastUtteranceFinished: (() -> Swift.Void)?
153
165
  @objc deinit
@@ -243,6 +255,25 @@ public struct SpeakerEnrollment : Swift.Codable {
243
255
  public static func deserialize(_ data: Foundation.Data) throws -> DavoiceTTS.SpeakerEnrollment
244
256
  public func encode(to encoder: any Swift.Encoder) throws
245
257
  }
258
+ public struct SVSpeaker {
259
+ public let id: Swift.String
260
+ public let enrollment: DavoiceTTS.SpeakerEnrollment
261
+ public let threshold: Swift.Float
262
+ public let contentKey: Swift.String
263
+ #if compiler(>=5.3) && $NonescapableTypes
264
+ public init(id: Swift.String, enrollment: DavoiceTTS.SpeakerEnrollment, threshold: Swift.Float? = nil)
265
+ #endif
266
+ public static func contentKey(of e: DavoiceTTS.SpeakerEnrollment) -> Swift.String
267
+ }
268
+ public enum SVSpeakerSet {
269
+ public static let defaultSpeakerId: Swift.String
270
+ public static func loadEnrollment(jsonOrPath: Swift.String) throws -> DavoiceTTS.SpeakerEnrollment
271
+ #if compiler(>=5.3) && $NonescapableTypes
272
+ public static func incompatibility(_ e: DavoiceTTS.SpeakerEnrollment, base: DavoiceTTS.SpeakerVerificationConfig, baseDim: Swift.Int) -> Swift.String?
273
+ #endif
274
+ public static func upsert(_ list: [DavoiceTTS.SVSpeaker], _ s: DavoiceTTS.SVSpeaker) -> (list: [DavoiceTTS.SVSpeaker], removed: [Swift.String])
275
+ public static func build(_ items: [DavoiceTTS.SVSpeaker]) -> (list: [DavoiceTTS.SVSpeaker], removed: [Swift.String])
276
+ }
246
277
  public struct SVPendingInfo {
247
278
  public let bufferedSamples: Swift.Int
248
279
  public let bufferedSeconds: Swift.Float
@@ -257,6 +288,8 @@ public struct SpeakerVerificationResult {
257
288
  public let bestKind: Swift.String
258
289
  public let bestId: Swift.String
259
290
  public let isMatch: Swift.Bool
291
+ public let speakerId: Swift.String?
292
+ public let speakerScores: [Swift.String : Swift.Float]
260
293
  public let embeddingDim: Swift.Int
261
294
  public let usedSeconds: Swift.Float
262
295
  public let ortRunMs: Swift.Double
@@ -286,6 +319,8 @@ public enum SpeakerVerificationError : Swift.Error, Swift.CustomStringConvertibl
286
319
  #if compiler(>=5.3) && $NonescapableTypes
287
320
  final public func setEnrollment(_ enrollment: DavoiceTTS.SpeakerEnrollment?)
288
321
  #endif
322
+ final public func setSpeakers(_ list: [DavoiceTTS.SVSpeaker])
323
+ final public func currentSpeakers() -> [DavoiceTTS.SVSpeaker]
289
324
  @objc final public func resetStreamingState()
290
325
  final public func processFrame(frame: [Swift.Float]) throws -> DavoiceTTS.SpeakerVerificationOutput
291
326
  final public func verifyWavFileStreaming(path: Swift.String, resetState: Swift.Bool = true) throws -> DavoiceTTS.SpeakerVerificationResult
@@ -96,6 +96,17 @@ public enum AudioPlaybackHook {
96
96
  @objc final public func startSpeech(localeStr: Swift.String?, onboardingJsonPath: Swift.String)
97
97
  #endif
98
98
  #if compiler(>=5.3) && $NonescapableTypes
99
+ @objc final public func startSpeech(localeStr: Swift.String?, onboardingJsonPath: Swift.String, speakerId: Swift.String)
100
+ #endif
101
+ #if compiler(>=5.3) && $NonescapableTypes
102
+ @objc final public func startSpeech(localeStr: Swift.String?, speakers: [[Swift.String : Swift.String]])
103
+ #endif
104
+ @objc final public func addSpeaker(id: Swift.String, jsonOrPath: Swift.String) throws
105
+ @objc final public func setSpeakers(_ speakers: [[Swift.String : Swift.String]]) throws
106
+ @objc @discardableResult
107
+ final public func removeSpeaker(id: Swift.String) -> Swift.Bool
108
+ @objc final public func getSpeakerIds() -> [Swift.String]
109
+ #if compiler(>=5.3) && $NonescapableTypes
99
110
  @objc final public func stopSpeech(_ completion: ((Swift.Bool) -> Swift.Void)? = nil)
100
111
  #endif
101
112
  #if compiler(>=5.3) && $NonescapableTypes
@@ -148,6 +159,7 @@ public enum AudioPlaybackHook {
148
159
  get
149
160
  }
150
161
  }
162
+ @objc final public func getAllVoices() -> [Swift.String]
151
163
  @objc(changeVoice:completion:) final public func changeVoice(_ name: Swift.String, completion: @escaping (Swift.Int) -> Swift.Void)
152
164
  @objc final public var onLastUtteranceFinished: (() -> Swift.Void)?
153
165
  @objc deinit
@@ -243,6 +255,25 @@ public struct SpeakerEnrollment : Swift.Codable {
243
255
  public static func deserialize(_ data: Foundation.Data) throws -> DavoiceTTS.SpeakerEnrollment
244
256
  public func encode(to encoder: any Swift.Encoder) throws
245
257
  }
258
+ public struct SVSpeaker {
259
+ public let id: Swift.String
260
+ public let enrollment: DavoiceTTS.SpeakerEnrollment
261
+ public let threshold: Swift.Float
262
+ public let contentKey: Swift.String
263
+ #if compiler(>=5.3) && $NonescapableTypes
264
+ public init(id: Swift.String, enrollment: DavoiceTTS.SpeakerEnrollment, threshold: Swift.Float? = nil)
265
+ #endif
266
+ public static func contentKey(of e: DavoiceTTS.SpeakerEnrollment) -> Swift.String
267
+ }
268
+ public enum SVSpeakerSet {
269
+ public static let defaultSpeakerId: Swift.String
270
+ public static func loadEnrollment(jsonOrPath: Swift.String) throws -> DavoiceTTS.SpeakerEnrollment
271
+ #if compiler(>=5.3) && $NonescapableTypes
272
+ public static func incompatibility(_ e: DavoiceTTS.SpeakerEnrollment, base: DavoiceTTS.SpeakerVerificationConfig, baseDim: Swift.Int) -> Swift.String?
273
+ #endif
274
+ public static func upsert(_ list: [DavoiceTTS.SVSpeaker], _ s: DavoiceTTS.SVSpeaker) -> (list: [DavoiceTTS.SVSpeaker], removed: [Swift.String])
275
+ public static func build(_ items: [DavoiceTTS.SVSpeaker]) -> (list: [DavoiceTTS.SVSpeaker], removed: [Swift.String])
276
+ }
246
277
  public struct SVPendingInfo {
247
278
  public let bufferedSamples: Swift.Int
248
279
  public let bufferedSeconds: Swift.Float
@@ -257,6 +288,8 @@ public struct SpeakerVerificationResult {
257
288
  public let bestKind: Swift.String
258
289
  public let bestId: Swift.String
259
290
  public let isMatch: Swift.Bool
291
+ public let speakerId: Swift.String?
292
+ public let speakerScores: [Swift.String : Swift.Float]
260
293
  public let embeddingDim: Swift.Int
261
294
  public let usedSeconds: Swift.Float
262
295
  public let ortRunMs: Swift.Double
@@ -286,6 +319,8 @@ public enum SpeakerVerificationError : Swift.Error, Swift.CustomStringConvertibl
286
319
  #if compiler(>=5.3) && $NonescapableTypes
287
320
  final public func setEnrollment(_ enrollment: DavoiceTTS.SpeakerEnrollment?)
288
321
  #endif
322
+ final public func setSpeakers(_ list: [DavoiceTTS.SVSpeaker])
323
+ final public func currentSpeakers() -> [DavoiceTTS.SVSpeaker]
289
324
  @objc final public func resetStreamingState()
290
325
  final public func processFrame(frame: [Swift.Float]) throws -> DavoiceTTS.SpeakerVerificationOutput
291
326
  final public func verifyWavFileStreaming(path: Swift.String, resetState: Swift.Bool = true) throws -> DavoiceTTS.SpeakerVerificationResult
@@ -6,7 +6,7 @@
6
6
  <dict>
7
7
  <key>Headers/DavoiceTTS-Swift.h</key>
8
8
  <data>
9
- Ol7Jih6QTVscGg4aSdzZSMpY85c=
9
+ R+WjlWhzt3vGhbBxzcRRs3IHRSQ=
10
10
  </data>
11
11
  <key>Info.plist</key>
12
12
  <data>
@@ -14,43 +14,43 @@
14
14
  </data>
15
15
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
16
16
  <data>
17
- lXPJ7S/BjpxA50FEkGjQWeIDKBg=
17
+ aRVp1N4Oou/zdN1oK449OMYWkQ8=
18
18
  </data>
19
19
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
20
20
  <data>
21
- 5nEG+jclfCQRoZBSH2IRHjZBUWA=
21
+ DMLO2s83FqcO9+0Ezik1blpB1sE=
22
22
  </data>
23
23
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
24
24
  <data>
25
- dcnXg0AfWAuuI6K6l3zbR8bEYFc=
25
+ 47EO3zBK+ieILP/flT68fZK3xgg=
26
26
  </data>
27
27
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
28
28
  <data>
29
- 5nEG+jclfCQRoZBSH2IRHjZBUWA=
29
+ DMLO2s83FqcO9+0Ezik1blpB1sE=
30
30
  </data>
31
31
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
32
32
  <data>
33
- lqS+wchFk73aQnqPEpOkC5ch4FA=
33
+ GQFpEbWd9ztsO60P0ergXusfsP4=
34
34
  </data>
35
35
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
36
36
  <data>
37
- lXPJ7S/BjpxA50FEkGjQWeIDKBg=
37
+ aRVp1N4Oou/zdN1oK449OMYWkQ8=
38
38
  </data>
39
39
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
40
40
  <data>
41
- Wa5Z0ypUdD8aZT8THSlWooNE4QE=
41
+ myYkolVESaVDxB3fp+zyf5jBRwg=
42
42
  </data>
43
43
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
44
44
  <data>
45
- JIu3n6cJTHBOBAQC/52q2hvApH0=
45
+ vLDDx8g5AYTZDuzHoTb43NriJ5I=
46
46
  </data>
47
47
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
48
48
  <data>
49
- Wa5Z0ypUdD8aZT8THSlWooNE4QE=
49
+ myYkolVESaVDxB3fp+zyf5jBRwg=
50
50
  </data>
51
51
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
52
52
  <data>
53
- YTBIL9ELQfP8/M8kd8x0X2F2M2c=
53
+ Q118KAme7v7QObUKsHodPY/Iyyc=
54
54
  </data>
55
55
  <key>Modules/module.modulemap</key>
56
56
  <data>
@@ -63,121 +63,121 @@
63
63
  <dict>
64
64
  <key>hash</key>
65
65
  <data>
66
- Ol7Jih6QTVscGg4aSdzZSMpY85c=
66
+ R+WjlWhzt3vGhbBxzcRRs3IHRSQ=
67
67
  </data>
68
68
  <key>hash2</key>
69
69
  <data>
70
- wj0ia+/tRPYgXjymeNxLJGawOwlLXFCH6iK6i7JjKsg=
70
+ ScRP6gmuNcFABmolxLlGUgSb+blAQXCOTCJasUoYPKU=
71
71
  </data>
72
72
  </dict>
73
73
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
74
74
  <dict>
75
75
  <key>hash</key>
76
76
  <data>
77
- lXPJ7S/BjpxA50FEkGjQWeIDKBg=
77
+ aRVp1N4Oou/zdN1oK449OMYWkQ8=
78
78
  </data>
79
79
  <key>hash2</key>
80
80
  <data>
81
- XwiZDzIwSqHjraw5LdZYiPIz7aR85wV2LZE3A9R4Nxk=
81
+ WiWQRmpsJEsP9FLzYBD4H3HJ9AuzHgIRDeZ1y/oJkEg=
82
82
  </data>
83
83
  </dict>
84
84
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
85
85
  <dict>
86
86
  <key>hash</key>
87
87
  <data>
88
- 5nEG+jclfCQRoZBSH2IRHjZBUWA=
88
+ DMLO2s83FqcO9+0Ezik1blpB1sE=
89
89
  </data>
90
90
  <key>hash2</key>
91
91
  <data>
92
- rIA15GA94LYsb7hyLBkEh7YYaPNy5KZn8PF+DG1aWiY=
92
+ wk+Y93YINE6gHvsECjQRKZt6hnXa5vz+o9pCpu2wjks=
93
93
  </data>
94
94
  </dict>
95
95
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
96
96
  <dict>
97
97
  <key>hash</key>
98
98
  <data>
99
- dcnXg0AfWAuuI6K6l3zbR8bEYFc=
99
+ 47EO3zBK+ieILP/flT68fZK3xgg=
100
100
  </data>
101
101
  <key>hash2</key>
102
102
  <data>
103
- OV6rbphYMUiNdGhADpFpDbliFLoxjAOvOG2u1HkDbiE=
103
+ 2mRJt8XVBCMp2qPrRgMbaOpeMfe87Ix7FFvlcZ8zG0c=
104
104
  </data>
105
105
  </dict>
106
106
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
107
107
  <dict>
108
108
  <key>hash</key>
109
109
  <data>
110
- 5nEG+jclfCQRoZBSH2IRHjZBUWA=
110
+ DMLO2s83FqcO9+0Ezik1blpB1sE=
111
111
  </data>
112
112
  <key>hash2</key>
113
113
  <data>
114
- rIA15GA94LYsb7hyLBkEh7YYaPNy5KZn8PF+DG1aWiY=
114
+ wk+Y93YINE6gHvsECjQRKZt6hnXa5vz+o9pCpu2wjks=
115
115
  </data>
116
116
  </dict>
117
117
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
118
118
  <dict>
119
119
  <key>hash</key>
120
120
  <data>
121
- lqS+wchFk73aQnqPEpOkC5ch4FA=
121
+ GQFpEbWd9ztsO60P0ergXusfsP4=
122
122
  </data>
123
123
  <key>hash2</key>
124
124
  <data>
125
- wlAqYdRnIHaxamRHizebaB0mDba3544Xa8bsym4Vkkk=
125
+ NZyivWl5UwR1DVhUDJjtRTFEJD+HKiHgZnBCujoXkkw=
126
126
  </data>
127
127
  </dict>
128
128
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
129
129
  <dict>
130
130
  <key>hash</key>
131
131
  <data>
132
- lXPJ7S/BjpxA50FEkGjQWeIDKBg=
132
+ aRVp1N4Oou/zdN1oK449OMYWkQ8=
133
133
  </data>
134
134
  <key>hash2</key>
135
135
  <data>
136
- XwiZDzIwSqHjraw5LdZYiPIz7aR85wV2LZE3A9R4Nxk=
136
+ WiWQRmpsJEsP9FLzYBD4H3HJ9AuzHgIRDeZ1y/oJkEg=
137
137
  </data>
138
138
  </dict>
139
139
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
140
140
  <dict>
141
141
  <key>hash</key>
142
142
  <data>
143
- Wa5Z0ypUdD8aZT8THSlWooNE4QE=
143
+ myYkolVESaVDxB3fp+zyf5jBRwg=
144
144
  </data>
145
145
  <key>hash2</key>
146
146
  <data>
147
- PqeCEwjyzpOWkUuXT2sEZcUcDf3VZaAgFniw9r4Of8A=
147
+ KhVPiTAHvudIhJzckgOJ+FLPhDyymWjTj8j+RzZn5pY=
148
148
  </data>
149
149
  </dict>
150
150
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
151
151
  <dict>
152
152
  <key>hash</key>
153
153
  <data>
154
- JIu3n6cJTHBOBAQC/52q2hvApH0=
154
+ vLDDx8g5AYTZDuzHoTb43NriJ5I=
155
155
  </data>
156
156
  <key>hash2</key>
157
157
  <data>
158
- Iok2RKHU56dvDw/hIqP9wm4suVs/jKvfXXhr86eVHb8=
158
+ upfzqTnQfWcRiZqrVEt5R9tjoGyacNG3M+iKUaRc4oM=
159
159
  </data>
160
160
  </dict>
161
161
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
162
162
  <dict>
163
163
  <key>hash</key>
164
164
  <data>
165
- Wa5Z0ypUdD8aZT8THSlWooNE4QE=
165
+ myYkolVESaVDxB3fp+zyf5jBRwg=
166
166
  </data>
167
167
  <key>hash2</key>
168
168
  <data>
169
- PqeCEwjyzpOWkUuXT2sEZcUcDf3VZaAgFniw9r4Of8A=
169
+ KhVPiTAHvudIhJzckgOJ+FLPhDyymWjTj8j+RzZn5pY=
170
170
  </data>
171
171
  </dict>
172
172
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
173
173
  <dict>
174
174
  <key>hash</key>
175
175
  <data>
176
- YTBIL9ELQfP8/M8kd8x0X2F2M2c=
176
+ Q118KAme7v7QObUKsHodPY/Iyyc=
177
177
  </data>
178
178
  <key>hash2</key>
179
179
  <data>
180
- /nTqQ/CKKQbBa1Il7UwHmI/w4e0ugkQPDZSXu8jiS90=
180
+ LRsws2ctpmgZZc/BL6oZjpc/vXe9wI5PVY5C+JKWrBc=
181
181
  </data>
182
182
  </dict>
183
183
  <key>Modules/module.modulemap</key>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-davoice-tts",
3
- "version": "1.0.405",
3
+ "version": "1.0.407",
4
4
  "description": "tts library for React Native",
5
5
  "main": "tts/index.js",
6
6
  "types": "tts/index.d.ts",
package/speech/index.d.ts CHANGED
@@ -14,8 +14,20 @@ export type SpeechErrorEvent = {
14
14
  message?: string;
15
15
  };
16
16
  };
17
+ /**
18
+ * `speakerIds`/`speakerId` are present only when speaker verification is on:
19
+ * every verified speaker heard in the current sentence (first-appearance order)
20
+ * and the latest one. Reset after each final result.
21
+ */
17
22
  export type SpeechResultsEvent = {
18
23
  value: string[];
24
+ speakerIds?: string[];
25
+ speakerId?: string;
26
+ };
27
+ /** One enrolled speaker: `json` is the enrollment JSON itself or a path to it. */
28
+ export type SpeakerItem = {
29
+ id: string;
30
+ json: string;
19
31
  };
20
32
  export type SpeechVolumeChangeEvent = {
21
33
  value: number;
@@ -129,6 +141,11 @@ declare class Speech {
129
141
  private sttTransitionChain;
130
142
  private dbgAsset;
131
143
  private _onNativeFinishedSpeaking;
144
+ /** Voices available in the loaded .dm (the names changeVoice() accepts; the
145
+ * first is the default). Resolves [] when no ttsv2 .dm is loaded, the .dm has
146
+ * no voices, or the native side is unavailable.
147
+ */
148
+ getAllVoices(): Promise<string[]>;
132
149
  /** Reference voice, matched case-insensitively without .wav.
133
150
  * Returns 0 on match; -1 on fallback/unavailability. Missing names select the
134
151
  * first WAV (alphabetical order). Already generated audio keeps its voice.
@@ -145,6 +162,8 @@ declare class Speech {
145
162
  private lastLocale;
146
163
  private lastModel;
147
164
  private lastOnboardingJsonPath;
165
+ private lastSpeakerId;
166
+ private lastSpeakers;
148
167
  private hasCompletedFullInit;
149
168
  private hasCompletedTtsInit;
150
169
  private iosTtsOnly;
@@ -182,18 +201,40 @@ declare class Speech {
182
201
  * iOS: initialize STT then TTS via native SpeechBridge if available.
183
202
  * Android: no special init needed; optionally preload TTS (if you want).
184
203
  */
204
+ /**
205
+ * `onboardingJsonPath` (JSON or path) adds one speaker under `speakerId`
206
+ * (default "default"); `speakers` instead replaces the whole speaker set.
207
+ */
185
208
  initAll(opts: {
186
209
  locale: string;
187
210
  model: ModelRef;
188
211
  timeoutMs?: number;
189
212
  onboardingJsonPath?: string;
213
+ speakerId?: string;
214
+ speakers?: SpeakerItem[];
190
215
  }): Promise<any>;
191
216
  destroyAll(): Promise<any>;
192
217
  initWithoutModel(): Promise<any>;
193
218
  destroyWihtouModel(): Promise<any>;
194
219
  destroyWithoutModel(): Promise<any>;
195
220
  start(locale: string, options?: Record<string, any>): Promise<void>;
196
- startWithSVOnboardingJson(locale: string, onboardingJsonPath: string): Promise<void>;
221
+ /**
222
+ * Starts STT with one speaker. `onboardingJsonPath` may be the JSON itself or a
223
+ * path. The speaker is added to the current set under `speakerId` (default
224
+ * "default"); same id or same voiceprint replaces the older entry.
225
+ */
226
+ startWithSVOnboardingJson(locale: string, onboardingJsonPath: string, speakerId?: string): Promise<void>;
227
+ private svModule;
228
+ /** Starts STT with an array of speakers, replacing the current set. */
229
+ startWithSVSpeakers(locale: string, speakers: SpeakerItem[]): Promise<void>;
230
+ /** Adds (or replaces) one speaker. `jsonOrPath`: the enrollment JSON or a path. Resolves to the enrolled ids. */
231
+ addSpeaker(speakerId: string, jsonOrPath: string): Promise<string[]>;
232
+ /** Replaces the whole speaker set; an empty array turns speaker verification off. */
233
+ setSpeakers(speakers: SpeakerItem[]): Promise<string[]>;
234
+ /** Removes a speaker; removing the last one turns the gate off. Resolves false if unknown. */
235
+ removeSpeaker(speakerId: string): Promise<boolean>;
236
+ /** Enrolled speaker ids, in insertion order. */
237
+ getSpeakerIds(): Promise<string[]>;
197
238
  pauseSpeechRecognition(timeoutMs?: number): Promise<void>;
198
239
  unPauseSpeechRecognition(times: number, preFetchMs?: number, timeoutMs?: number): Promise<SpeechTransitionResult>;
199
240
  /** Pause mic/STT (Android native; iOS unified if present) */
package/speech/index.ts CHANGED
@@ -122,7 +122,14 @@ export type SpeechStartEvent = {};
122
122
  export type SpeechEndEvent = {};
123
123
  export type SpeechRecognizedEvent = { isFinal: boolean };
124
124
  export type SpeechErrorEvent = { error: { code?: string; message?: string } };
125
- export type SpeechResultsEvent = { value: string[] };
125
+ /**
126
+ * `speakerIds`/`speakerId` are present only when speaker verification is on:
127
+ * every verified speaker heard in the current sentence (first-appearance order)
128
+ * and the latest one. Reset after each final result.
129
+ */
130
+ export type SpeechResultsEvent = { value: string[]; speakerIds?: string[]; speakerId?: string };
131
+ /** One enrolled speaker: `json` is the enrollment JSON itself or a path to it. */
132
+ export type SpeakerItem = { id: string; json: string };
126
133
  export type SpeechVolumeChangeEvent = { value: number };
127
134
  export type NewSpeechWAVEvent = { path: string };
128
135
 
@@ -294,6 +301,22 @@ class Speech {
294
301
  if (r) r();
295
302
  }
296
303
 
304
+ /** Voices available in the loaded .dm (the names changeVoice() accepts; the
305
+ * first is the default). Resolves [] when no ttsv2 .dm is loaded, the .dm has
306
+ * no voices, or the native side is unavailable.
307
+ */
308
+ async getAllVoices(): Promise<string[]> {
309
+ const bridge = Platform.OS === 'ios' && !this.iosTtsOnly && this.hasCompletedFullInit
310
+ ? NativeSpeech : NativeTTS;
311
+ if ((Platform.OS !== 'android' && Platform.OS !== 'ios') || typeof bridge?.getAllVoices !== 'function') return [];
312
+ try {
313
+ const voices = await bridge.getAllVoices();
314
+ return Array.isArray(voices) ? voices.filter((v: unknown): v is string => typeof v === 'string') : [];
315
+ } catch {
316
+ return [];
317
+ }
318
+ }
319
+
297
320
  /** Reference voice, matched case-insensitively without .wav.
298
321
  * Returns 0 on match; -1 on fallback/unavailability. Missing names select the
299
322
  * first WAV (alphabetical order). Already generated audio keeps its voice.
@@ -375,6 +398,8 @@ class Speech {
375
398
  private lastLocale: string | null = null;
376
399
  private lastModel: string | null = null;
377
400
  private lastOnboardingJsonPath: string | null = null;
401
+ private lastSpeakerId: string | null = null;
402
+ private lastSpeakers: SpeakerItem[] | null = null;
378
403
  private hasCompletedFullInit = false;
379
404
  private hasCompletedTtsInit = false;
380
405
  private iosTtsOnly = false; // when true, use NativeTTS directly on iOS
@@ -594,7 +619,18 @@ class Speech {
594
619
  * iOS: initialize STT then TTS via native SpeechBridge if available.
595
620
  * Android: no special init needed; optionally preload TTS (if you want).
596
621
  */
597
- async initAll(opts: { locale: string; model: ModelRef; timeoutMs?: number; onboardingJsonPath?: string }) {
622
+ /**
623
+ * `onboardingJsonPath` (JSON or path) adds one speaker under `speakerId`
624
+ * (default "default"); `speakers` instead replaces the whole speaker set.
625
+ */
626
+ async initAll(opts: {
627
+ locale: string;
628
+ model: ModelRef;
629
+ timeoutMs?: number;
630
+ onboardingJsonPath?: string;
631
+ speakerId?: string;
632
+ speakers?: SpeakerItem[];
633
+ }) {
598
634
  this.dbgModel('initAll.opts.model (raw)', opts.model);
599
635
  this.dbgAsset('initAll.model', opts.model);
600
636
  this._cancelTtsWait('initAll');
@@ -607,6 +643,8 @@ class Speech {
607
643
  this.lastLocale = opts.locale;
608
644
  this.lastModel = modelPath;
609
645
  this.lastOnboardingJsonPath = opts.onboardingJsonPath ?? null;
646
+ this.lastSpeakerId = opts.speakerId ?? null;
647
+ this.lastSpeakers = opts.speakers ?? null;
610
648
 
611
649
  if (Platform.OS === 'ios' && NativeSpeech?.initAll) {
612
650
  if (this.iosTtsOnly) {
@@ -652,6 +690,8 @@ class Speech {
652
690
  EXTRA_PARTIAL_RESULTS: true,
653
691
  REQUEST_PERMISSIONS_AUTO: true,
654
692
  onboardingJsonPath: opts.onboardingJsonPath ?? null,
693
+ speakerId: opts.speakerId ?? null,
694
+ speakers: opts.speakers ?? null,
655
695
  },
656
696
  (err: string) => (err ? reject(new Error(err)) : resolve())
657
697
  );
@@ -729,6 +769,8 @@ class Speech {
729
769
  const r = await NativeSpeech.initWithoutModel({
730
770
  locale: this.lastLocale,
731
771
  onboardingJsonPath: this.lastOnboardingJsonPath,
772
+ speakerId: this.lastSpeakerId,
773
+ speakers: this.lastSpeakers,
732
774
  });
733
775
  this.ensureListeners();
734
776
  return r;
@@ -744,7 +786,11 @@ class Speech {
744
786
  if (typeof NativeSTT.initWithoutModel === 'function') {
745
787
  NativeSTT.initWithoutModel(
746
788
  this.lastLocale,
747
- { onboardingJsonPath: this.lastOnboardingJsonPath ?? null },
789
+ {
790
+ onboardingJsonPath: this.lastOnboardingJsonPath ?? null,
791
+ speakerId: this.lastSpeakerId ?? null,
792
+ speakers: this.lastSpeakers ?? null,
793
+ },
748
794
  (err: string) => (err ? reject(new Error(err)) : resolve()),
749
795
  );
750
796
  return;
@@ -759,6 +805,8 @@ class Speech {
759
805
  EXTRA_PARTIAL_RESULTS: true,
760
806
  REQUEST_PERMISSIONS_AUTO: true,
761
807
  onboardingJsonPath: this.lastOnboardingJsonPath ?? null,
808
+ speakerId: this.lastSpeakerId ?? null,
809
+ speakers: this.lastSpeakers ?? null,
762
810
  },
763
811
  (err: string) => (err ? reject(new Error(err)) : resolve()),
764
812
  );
@@ -847,8 +895,20 @@ class Speech {
847
895
  });
848
896
  }
849
897
 
850
- async startWithSVOnboardingJson(locale: string, onboardingJsonPath: string): Promise<void> {
898
+ /**
899
+ * Starts STT with one speaker. `onboardingJsonPath` may be the JSON itself or a
900
+ * path. The speaker is added to the current set under `speakerId` (default
901
+ * "default"); same id or same voiceprint replaces the older entry.
902
+ */
903
+ async startWithSVOnboardingJson(locale: string, onboardingJsonPath: string, speakerId?: string): Promise<void> {
851
904
  this.ensureListeners();
905
+ if (Platform.OS === 'android') {
906
+ return this.start(locale, { onboardingJsonPath, speakerId: speakerId ?? null });
907
+ }
908
+ if (speakerId && (NativeSpeech as any)?.addSpeaker) {
909
+ await this.addSpeaker(speakerId, onboardingJsonPath);
910
+ return this.start(locale);
911
+ }
852
912
  if (Platform.OS === 'ios' && (NativeSpeech as any)?.startSpeechWithSVOnboardingJsonAsync) {
853
913
  await (NativeSpeech as any).startSpeechWithSVOnboardingJsonAsync(locale, onboardingJsonPath, 2500);
854
914
  return;
@@ -861,6 +921,57 @@ class Speech {
861
921
  return this.start(locale);
862
922
  }
863
923
 
924
+ // ---------- Speaker verification (live multi-speaker) ----------
925
+ // All of these work before start (applied at the next start) or while STT is
926
+ // running (applied immediately, no restart). Duplicates (same id or same JSON)
927
+ // are replaced by the newest entry. Speakers persist until destroyAll().
928
+
929
+ private svModule(): any {
930
+ return Platform.OS === 'ios' ? NativeSpeech : NativeSTT;
931
+ }
932
+
933
+ /** Starts STT with an array of speakers, replacing the current set. */
934
+ async startWithSVSpeakers(locale: string, speakers: SpeakerItem[]): Promise<void> {
935
+ this.ensureListeners();
936
+ if (Platform.OS === 'ios') {
937
+ if (!(NativeSpeech as any)?.startSpeechWithSVSpeakers) throw new Error('startSpeechWithSVSpeakers not available');
938
+ await (NativeSpeech as any).startSpeechWithSVSpeakers(locale, speakers, 2500);
939
+ return;
940
+ }
941
+ if (!(NativeSTT as any)?.startSpeechWithSVSpeakers) throw new Error('startSpeechWithSVSpeakers not available');
942
+ return new Promise<void>((resolve) =>
943
+ (NativeSTT as any).startSpeechWithSVSpeakers(locale, speakers, () => resolve()),
944
+ );
945
+ }
946
+
947
+ /** Adds (or replaces) one speaker. `jsonOrPath`: the enrollment JSON or a path. Resolves to the enrolled ids. */
948
+ async addSpeaker(speakerId: string, jsonOrPath: string): Promise<string[]> {
949
+ const mod = this.svModule();
950
+ if (!mod?.addSpeaker) throw new Error('addSpeaker not available');
951
+ return mod.addSpeaker(speakerId, jsonOrPath);
952
+ }
953
+
954
+ /** Replaces the whole speaker set; an empty array turns speaker verification off. */
955
+ async setSpeakers(speakers: SpeakerItem[]): Promise<string[]> {
956
+ const mod = this.svModule();
957
+ if (!mod?.setSpeakers) throw new Error('setSpeakers not available');
958
+ return mod.setSpeakers(speakers);
959
+ }
960
+
961
+ /** Removes a speaker; removing the last one turns the gate off. Resolves false if unknown. */
962
+ async removeSpeaker(speakerId: string): Promise<boolean> {
963
+ const mod = this.svModule();
964
+ if (!mod?.removeSpeaker) throw new Error('removeSpeaker not available');
965
+ return mod.removeSpeaker(speakerId);
966
+ }
967
+
968
+ /** Enrolled speaker ids, in insertion order. */
969
+ async getSpeakerIds(): Promise<string[]> {
970
+ const mod = this.svModule();
971
+ if (!mod?.getSpeakerIds) return [];
972
+ return mod.getSpeakerIds();
973
+ }
974
+
864
975
  // Android: native pauseSpeechRecognitionLite is now bounded internally (~500ms, see
865
976
  // STT.kt runPauseResumeSerializedOnMain), so this timeout is a backstop, not the
866
977
  // primary fix - it guarantees this promise settles even if the bridge itself stalls.
File without changes