react-native-davoice 1.0.12 → 1.0.14
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/TTSRNBridge.podspec +1 -1
- package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar +0 -0
- package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.md5 +1 -1
- package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.sha1 +1 -1
- package/android/src/main/java/com/davoice/stt/rn/STTModule.kt +35 -12
- package/ios/SpeechBridge/SpeechBridge.m +134 -1
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/Info.plist +5 -5
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DavoiceTTS +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +7220 -6864
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +47 -44
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +47 -44
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DavoiceTTS +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +9075 -8719
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +46 -43
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +46 -43
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +9075 -8719
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +46 -43
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +46 -43
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeResources +30 -30
- package/package.json +1 -1
- package/speech/index.ts +119 -2
|
@@ -7,6 +7,7 @@ import AVFoundation
|
|
|
7
7
|
import Accelerate
|
|
8
8
|
import CommonCrypto
|
|
9
9
|
import Foundation
|
|
10
|
+
import ObjectiveC
|
|
10
11
|
import Speech
|
|
11
12
|
import Swift
|
|
12
13
|
import UIKit
|
|
@@ -15,49 +16,7 @@ import _StringProcessing
|
|
|
15
16
|
import _SwiftConcurrencyShims
|
|
16
17
|
import onnxruntime_objc
|
|
17
18
|
import phonemes
|
|
18
|
-
|
|
19
|
-
@objc deinit
|
|
20
|
-
public static let shared: DavoiceTTS.SwiftSoundQueue
|
|
21
|
-
final public func notifyWhenURLFinishes(_ url: Foundation.URL, _ cb: @escaping () -> Swift.Void)
|
|
22
|
-
final public var onItemDone: ((Foundation.URL) -> Swift.Void)?
|
|
23
|
-
final public var onQueueEmpty: (() -> Swift.Void)?
|
|
24
|
-
final public func enqueue(_ source: DavoiceTTS.SwiftSoundQueue.Source)
|
|
25
|
-
final public func enqueueMany(_ sources: [DavoiceTTS.SwiftSoundQueue.Source])
|
|
26
|
-
final public func stop()
|
|
27
|
-
public enum Source {
|
|
28
|
-
case fileURL(Foundation.URL)
|
|
29
|
-
case named(Swift.String)
|
|
30
|
-
}
|
|
31
|
-
@objc final public func audioPlayerDidFinishPlaying(_ p: AVFAudio.AVAudioPlayer, successfully ok: Swift.Bool)
|
|
32
|
-
final public func activatePlaybackOnlySession()
|
|
33
|
-
final public func activateSpeaker()
|
|
34
|
-
}
|
|
35
|
-
@objc @objcMembers final public class DaVoiceTTS : ObjectiveC.NSObject {
|
|
36
|
-
public struct Config {
|
|
37
|
-
}
|
|
38
|
-
@objc final public var onLastUtteranceFinished: (() -> Swift.Void)?
|
|
39
|
-
@objc deinit
|
|
40
|
-
@objc public static func activateLicense(licenseKey: Swift.String) -> Swift.Bool
|
|
41
|
-
@objc final public func setLicense(licenseKey: Swift.String) -> Swift.Bool
|
|
42
|
-
public struct Biquad {
|
|
43
|
-
public var b0: Swift.Float, b1: Swift.Float, b2: Swift.Float, a1: Swift.Float, a2: Swift.Float
|
|
44
|
-
public init(b0: Swift.Float, b1: Swift.Float, b2: Swift.Float, a1: Swift.Float, a2: Swift.Float)
|
|
45
|
-
public mutating func process(_ x: Swift.UnsafeMutablePointer<Swift.Float>, _ n: Swift.Int)
|
|
46
|
-
}
|
|
47
|
-
@objc public init(model: Foundation.URL) throws
|
|
48
|
-
@objc final public func stopSpeaking()
|
|
49
|
-
@objc final public func destroy()
|
|
50
|
-
@objc(speak:sid:) final public func speak(_ txt: Swift.String, sid: Swift.Int32 = 0)
|
|
51
|
-
@objc(speak:sid:speed:) final public func speak(_ txt: Swift.String, sid: Swift.Int32 = 0, speed: Swift.Float)
|
|
52
|
-
@objc final public func synthesize_top(_ _text: Swift.String, speakerId: Swift.Int32 = 0, token: Foundation.UUID, speed_adjuster: Swift.Float) throws -> AVFAudio.AVAudioPCMBuffer
|
|
53
|
-
@objc final public func playWav(_ url: Foundation.URL, markAsLastUtterance: Swift.Bool = true)
|
|
54
|
-
@objc final public func playBuffer(_ buffer: AVFAudio.AVAudioPCMBuffer, markAsLastUtterance: Swift.Bool = true)
|
|
55
|
-
}
|
|
56
|
-
@_inheritsConvenienceInitializers @objc final public class LicenseManager : ObjectiveC.NSObject {
|
|
57
|
-
@objc public static func isLicenseValid(licenseKey: Swift.String) -> Swift.Bool
|
|
58
|
-
@objc override dynamic public init()
|
|
59
|
-
@objc deinit
|
|
60
|
-
}
|
|
19
|
+
import ObjectiveC.runtime
|
|
61
20
|
public typealias EngineSchedule = (_ url: Foundation.URL, _ onDone: @escaping () -> Swift.Void) -> Swift.Bool
|
|
62
21
|
public typealias IsEngineReady = () -> Swift.Bool
|
|
63
22
|
public typealias useOnlyEnginePlayback = () -> Swift.Bool
|
|
@@ -69,6 +28,12 @@ public enum AudioPlaybackHook {
|
|
|
69
28
|
public static var useOnlyEnginePlayback: DavoiceTTS.useOnlyEnginePlayback?
|
|
70
29
|
public static var stopEnginePlayback: DavoiceTTS.StopEnginePlayback?
|
|
71
30
|
public static var currentEngine: DavoiceTTS.CurrentEngineProvider?
|
|
31
|
+
public static var isMicPaused: (() -> Swift.Bool)?
|
|
32
|
+
}
|
|
33
|
+
@_inheritsConvenienceInitializers @objc final public class LicenseManager : ObjectiveC.NSObject {
|
|
34
|
+
@objc public static func isLicenseValid(licenseKey: Swift.String) -> Swift.Bool
|
|
35
|
+
@objc override dynamic public init()
|
|
36
|
+
@objc deinit
|
|
72
37
|
}
|
|
73
38
|
public enum SVLogLevel : Swift.Int, Swift.Codable {
|
|
74
39
|
case off, error, warn, info, debug, trace
|
|
@@ -186,6 +151,7 @@ public enum SpeakerVerificationError : Swift.Error, Swift.CustomStringConvertibl
|
|
|
186
151
|
@objc final public var useShortSpeakerVerificationTailWindow: Swift.Bool
|
|
187
152
|
@objc final public var shortSpeakerVerificationTailSeconds: Swift.Float
|
|
188
153
|
@objc final public var speakerPreRollFlushMaxSeconds: Swift.Double
|
|
154
|
+
@objc deinit
|
|
189
155
|
@objc public static let supportedEvents: [Swift.String]
|
|
190
156
|
@objc final public func setLicense(licenseKey: Swift.String) -> Swift.Bool
|
|
191
157
|
@objc final public func pauseSpeechRecognitionLite()
|
|
@@ -209,7 +175,44 @@ public enum SpeakerVerificationError : Swift.Error, Swift.CustomStringConvertibl
|
|
|
209
175
|
@objc final public func teardown()
|
|
210
176
|
@objc final public func speechRecognizer(_ speechRecognizer: Speech.SFSpeechRecognizer, availabilityDidChange available: Swift.Bool)
|
|
211
177
|
@objc override dynamic public init()
|
|
178
|
+
}
|
|
179
|
+
@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers final public class SwiftSoundQueue : ObjectiveC.NSObject, AVFAudio.AVAudioPlayerDelegate {
|
|
212
180
|
@objc deinit
|
|
181
|
+
public static let shared: DavoiceTTS.SwiftSoundQueue
|
|
182
|
+
final public func notifyWhenURLFinishes(_ url: Foundation.URL, _ cb: @escaping () -> Swift.Void)
|
|
183
|
+
final public var onItemDone: ((Foundation.URL) -> Swift.Void)?
|
|
184
|
+
final public var onQueueEmpty: (() -> Swift.Void)?
|
|
185
|
+
final public func enqueue(_ source: DavoiceTTS.SwiftSoundQueue.Source)
|
|
186
|
+
final public func enqueueMany(_ sources: [DavoiceTTS.SwiftSoundQueue.Source])
|
|
187
|
+
final public func stop()
|
|
188
|
+
public enum Source {
|
|
189
|
+
case fileURL(Foundation.URL)
|
|
190
|
+
case named(Swift.String)
|
|
191
|
+
}
|
|
192
|
+
@objc final public func audioPlayerDidFinishPlaying(_ p: AVFAudio.AVAudioPlayer, successfully ok: Swift.Bool)
|
|
193
|
+
final public func activatePlaybackOnlySession()
|
|
194
|
+
final public func activateSpeaker()
|
|
195
|
+
}
|
|
196
|
+
@objc @objcMembers final public class DaVoiceTTS : ObjectiveC.NSObject {
|
|
197
|
+
public struct Config {
|
|
198
|
+
}
|
|
199
|
+
@objc final public var onLastUtteranceFinished: (() -> Swift.Void)?
|
|
200
|
+
@objc deinit
|
|
201
|
+
@objc public static func activateLicense(licenseKey: Swift.String) -> Swift.Bool
|
|
202
|
+
@objc final public func setLicense(licenseKey: Swift.String) -> Swift.Bool
|
|
203
|
+
public struct Biquad {
|
|
204
|
+
public var b0: Swift.Float, b1: Swift.Float, b2: Swift.Float, a1: Swift.Float, a2: Swift.Float
|
|
205
|
+
public init(b0: Swift.Float, b1: Swift.Float, b2: Swift.Float, a1: Swift.Float, a2: Swift.Float)
|
|
206
|
+
public mutating func process(_ x: Swift.UnsafeMutablePointer<Swift.Float>, _ n: Swift.Int)
|
|
207
|
+
}
|
|
208
|
+
@objc public init(model: Foundation.URL) throws
|
|
209
|
+
@objc final public func stopSpeaking()
|
|
210
|
+
@objc final public func destroy()
|
|
211
|
+
@objc(speak:sid:) final public func speak(_ txt: Swift.String, sid: Swift.Int32 = 0)
|
|
212
|
+
@objc(speak:sid:speed:) final public func speak(_ txt: Swift.String, sid: Swift.Int32 = 0, speed: Swift.Float)
|
|
213
|
+
@objc final public func synthesize_top(_ _text: Swift.String, speakerId: Swift.Int32 = 0, token: Foundation.UUID, speed_adjuster: Swift.Float) throws -> AVFAudio.AVAudioPCMBuffer
|
|
214
|
+
@objc final public func playWav(_ url: Foundation.URL, markAsLastUtterance: Swift.Bool = true)
|
|
215
|
+
@objc final public func playBuffer(_ buffer: AVFAudio.AVAudioPCMBuffer, markAsLastUtterance: Swift.Bool = true)
|
|
213
216
|
}
|
|
214
217
|
extension DavoiceTTS.SVLogLevel : Swift.Equatable {}
|
|
215
218
|
extension DavoiceTTS.SVLogLevel : Swift.Hashable {}
|
|
Binary file
|
|
@@ -7,6 +7,7 @@ import AVFoundation
|
|
|
7
7
|
import Accelerate
|
|
8
8
|
import CommonCrypto
|
|
9
9
|
import Foundation
|
|
10
|
+
import ObjectiveC
|
|
10
11
|
import Speech
|
|
11
12
|
import Swift
|
|
12
13
|
import UIKit
|
|
@@ -15,49 +16,7 @@ import _StringProcessing
|
|
|
15
16
|
import _SwiftConcurrencyShims
|
|
16
17
|
import onnxruntime_objc
|
|
17
18
|
import phonemes
|
|
18
|
-
|
|
19
|
-
@objc deinit
|
|
20
|
-
public static let shared: DavoiceTTS.SwiftSoundQueue
|
|
21
|
-
final public func notifyWhenURLFinishes(_ url: Foundation.URL, _ cb: @escaping () -> Swift.Void)
|
|
22
|
-
final public var onItemDone: ((Foundation.URL) -> Swift.Void)?
|
|
23
|
-
final public var onQueueEmpty: (() -> Swift.Void)?
|
|
24
|
-
final public func enqueue(_ source: DavoiceTTS.SwiftSoundQueue.Source)
|
|
25
|
-
final public func enqueueMany(_ sources: [DavoiceTTS.SwiftSoundQueue.Source])
|
|
26
|
-
final public func stop()
|
|
27
|
-
public enum Source {
|
|
28
|
-
case fileURL(Foundation.URL)
|
|
29
|
-
case named(Swift.String)
|
|
30
|
-
}
|
|
31
|
-
@objc final public func audioPlayerDidFinishPlaying(_ p: AVFAudio.AVAudioPlayer, successfully ok: Swift.Bool)
|
|
32
|
-
final public func activatePlaybackOnlySession()
|
|
33
|
-
final public func activateSpeaker()
|
|
34
|
-
}
|
|
35
|
-
@objc @objcMembers final public class DaVoiceTTS : ObjectiveC.NSObject {
|
|
36
|
-
public struct Config {
|
|
37
|
-
}
|
|
38
|
-
@objc final public var onLastUtteranceFinished: (() -> Swift.Void)?
|
|
39
|
-
@objc deinit
|
|
40
|
-
@objc public static func activateLicense(licenseKey: Swift.String) -> Swift.Bool
|
|
41
|
-
@objc final public func setLicense(licenseKey: Swift.String) -> Swift.Bool
|
|
42
|
-
public struct Biquad {
|
|
43
|
-
public var b0: Swift.Float, b1: Swift.Float, b2: Swift.Float, a1: Swift.Float, a2: Swift.Float
|
|
44
|
-
public init(b0: Swift.Float, b1: Swift.Float, b2: Swift.Float, a1: Swift.Float, a2: Swift.Float)
|
|
45
|
-
public mutating func process(_ x: Swift.UnsafeMutablePointer<Swift.Float>, _ n: Swift.Int)
|
|
46
|
-
}
|
|
47
|
-
@objc public init(model: Foundation.URL) throws
|
|
48
|
-
@objc final public func stopSpeaking()
|
|
49
|
-
@objc final public func destroy()
|
|
50
|
-
@objc(speak:sid:) final public func speak(_ txt: Swift.String, sid: Swift.Int32 = 0)
|
|
51
|
-
@objc(speak:sid:speed:) final public func speak(_ txt: Swift.String, sid: Swift.Int32 = 0, speed: Swift.Float)
|
|
52
|
-
@objc final public func synthesize_top(_ _text: Swift.String, speakerId: Swift.Int32 = 0, token: Foundation.UUID, speed_adjuster: Swift.Float) throws -> AVFAudio.AVAudioPCMBuffer
|
|
53
|
-
@objc final public func playWav(_ url: Foundation.URL, markAsLastUtterance: Swift.Bool = true)
|
|
54
|
-
@objc final public func playBuffer(_ buffer: AVFAudio.AVAudioPCMBuffer, markAsLastUtterance: Swift.Bool = true)
|
|
55
|
-
}
|
|
56
|
-
@_inheritsConvenienceInitializers @objc final public class LicenseManager : ObjectiveC.NSObject {
|
|
57
|
-
@objc public static func isLicenseValid(licenseKey: Swift.String) -> Swift.Bool
|
|
58
|
-
@objc override dynamic public init()
|
|
59
|
-
@objc deinit
|
|
60
|
-
}
|
|
19
|
+
import ObjectiveC.runtime
|
|
61
20
|
public typealias EngineSchedule = (_ url: Foundation.URL, _ onDone: @escaping () -> Swift.Void) -> Swift.Bool
|
|
62
21
|
public typealias IsEngineReady = () -> Swift.Bool
|
|
63
22
|
public typealias useOnlyEnginePlayback = () -> Swift.Bool
|
|
@@ -69,6 +28,12 @@ public enum AudioPlaybackHook {
|
|
|
69
28
|
public static var useOnlyEnginePlayback: DavoiceTTS.useOnlyEnginePlayback?
|
|
70
29
|
public static var stopEnginePlayback: DavoiceTTS.StopEnginePlayback?
|
|
71
30
|
public static var currentEngine: DavoiceTTS.CurrentEngineProvider?
|
|
31
|
+
public static var isMicPaused: (() -> Swift.Bool)?
|
|
32
|
+
}
|
|
33
|
+
@_inheritsConvenienceInitializers @objc final public class LicenseManager : ObjectiveC.NSObject {
|
|
34
|
+
@objc public static func isLicenseValid(licenseKey: Swift.String) -> Swift.Bool
|
|
35
|
+
@objc override dynamic public init()
|
|
36
|
+
@objc deinit
|
|
72
37
|
}
|
|
73
38
|
public enum SVLogLevel : Swift.Int, Swift.Codable {
|
|
74
39
|
case off, error, warn, info, debug, trace
|
|
@@ -186,6 +151,7 @@ public enum SpeakerVerificationError : Swift.Error, Swift.CustomStringConvertibl
|
|
|
186
151
|
@objc final public var useShortSpeakerVerificationTailWindow: Swift.Bool
|
|
187
152
|
@objc final public var shortSpeakerVerificationTailSeconds: Swift.Float
|
|
188
153
|
@objc final public var speakerPreRollFlushMaxSeconds: Swift.Double
|
|
154
|
+
@objc deinit
|
|
189
155
|
@objc public static let supportedEvents: [Swift.String]
|
|
190
156
|
@objc final public func setLicense(licenseKey: Swift.String) -> Swift.Bool
|
|
191
157
|
@objc final public func pauseSpeechRecognitionLite()
|
|
@@ -209,7 +175,44 @@ public enum SpeakerVerificationError : Swift.Error, Swift.CustomStringConvertibl
|
|
|
209
175
|
@objc final public func teardown()
|
|
210
176
|
@objc final public func speechRecognizer(_ speechRecognizer: Speech.SFSpeechRecognizer, availabilityDidChange available: Swift.Bool)
|
|
211
177
|
@objc override dynamic public init()
|
|
178
|
+
}
|
|
179
|
+
@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers final public class SwiftSoundQueue : ObjectiveC.NSObject, AVFAudio.AVAudioPlayerDelegate {
|
|
212
180
|
@objc deinit
|
|
181
|
+
public static let shared: DavoiceTTS.SwiftSoundQueue
|
|
182
|
+
final public func notifyWhenURLFinishes(_ url: Foundation.URL, _ cb: @escaping () -> Swift.Void)
|
|
183
|
+
final public var onItemDone: ((Foundation.URL) -> Swift.Void)?
|
|
184
|
+
final public var onQueueEmpty: (() -> Swift.Void)?
|
|
185
|
+
final public func enqueue(_ source: DavoiceTTS.SwiftSoundQueue.Source)
|
|
186
|
+
final public func enqueueMany(_ sources: [DavoiceTTS.SwiftSoundQueue.Source])
|
|
187
|
+
final public func stop()
|
|
188
|
+
public enum Source {
|
|
189
|
+
case fileURL(Foundation.URL)
|
|
190
|
+
case named(Swift.String)
|
|
191
|
+
}
|
|
192
|
+
@objc final public func audioPlayerDidFinishPlaying(_ p: AVFAudio.AVAudioPlayer, successfully ok: Swift.Bool)
|
|
193
|
+
final public func activatePlaybackOnlySession()
|
|
194
|
+
final public func activateSpeaker()
|
|
195
|
+
}
|
|
196
|
+
@objc @objcMembers final public class DaVoiceTTS : ObjectiveC.NSObject {
|
|
197
|
+
public struct Config {
|
|
198
|
+
}
|
|
199
|
+
@objc final public var onLastUtteranceFinished: (() -> Swift.Void)?
|
|
200
|
+
@objc deinit
|
|
201
|
+
@objc public static func activateLicense(licenseKey: Swift.String) -> Swift.Bool
|
|
202
|
+
@objc final public func setLicense(licenseKey: Swift.String) -> Swift.Bool
|
|
203
|
+
public struct Biquad {
|
|
204
|
+
public var b0: Swift.Float, b1: Swift.Float, b2: Swift.Float, a1: Swift.Float, a2: Swift.Float
|
|
205
|
+
public init(b0: Swift.Float, b1: Swift.Float, b2: Swift.Float, a1: Swift.Float, a2: Swift.Float)
|
|
206
|
+
public mutating func process(_ x: Swift.UnsafeMutablePointer<Swift.Float>, _ n: Swift.Int)
|
|
207
|
+
}
|
|
208
|
+
@objc public init(model: Foundation.URL) throws
|
|
209
|
+
@objc final public func stopSpeaking()
|
|
210
|
+
@objc final public func destroy()
|
|
211
|
+
@objc(speak:sid:) final public func speak(_ txt: Swift.String, sid: Swift.Int32 = 0)
|
|
212
|
+
@objc(speak:sid:speed:) final public func speak(_ txt: Swift.String, sid: Swift.Int32 = 0, speed: Swift.Float)
|
|
213
|
+
@objc final public func synthesize_top(_ _text: Swift.String, speakerId: Swift.Int32 = 0, token: Foundation.UUID, speed_adjuster: Swift.Float) throws -> AVFAudio.AVAudioPCMBuffer
|
|
214
|
+
@objc final public func playWav(_ url: Foundation.URL, markAsLastUtterance: Swift.Bool = true)
|
|
215
|
+
@objc final public func playBuffer(_ buffer: AVFAudio.AVAudioPCMBuffer, markAsLastUtterance: Swift.Bool = true)
|
|
213
216
|
}
|
|
214
217
|
extension DavoiceTTS.SVLogLevel : Swift.Equatable {}
|
|
215
218
|
extension DavoiceTTS.SVLogLevel : Swift.Hashable {}
|
|
Binary file
|
|
Binary file
|
|
@@ -14,43 +14,43 @@
|
|
|
14
14
|
</data>
|
|
15
15
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
16
16
|
<data>
|
|
17
|
-
|
|
17
|
+
HD9+QzXS6syt7YjX+LNINC/9ONI=
|
|
18
18
|
</data>
|
|
19
19
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
20
20
|
<data>
|
|
21
|
-
|
|
21
|
+
ykWSReidqKetKLAd6n2aNtpjLBM=
|
|
22
22
|
</data>
|
|
23
23
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
24
24
|
<data>
|
|
25
|
-
|
|
25
|
+
24PuZ36TSo/864HC3q4dNES7k8g=
|
|
26
26
|
</data>
|
|
27
27
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
28
28
|
<data>
|
|
29
|
-
|
|
29
|
+
ykWSReidqKetKLAd6n2aNtpjLBM=
|
|
30
30
|
</data>
|
|
31
31
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
|
|
32
32
|
<data>
|
|
33
|
-
|
|
33
|
+
XqMBUqJqRhvWqPyjX7CL12tVIcc=
|
|
34
34
|
</data>
|
|
35
35
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
36
36
|
<data>
|
|
37
|
-
|
|
37
|
+
HD9+QzXS6syt7YjX+LNINC/9ONI=
|
|
38
38
|
</data>
|
|
39
39
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
40
40
|
<data>
|
|
41
|
-
|
|
41
|
+
UIWkWLUjrxcQesesx3AgXLvvlO4=
|
|
42
42
|
</data>
|
|
43
43
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
44
44
|
<data>
|
|
45
|
-
|
|
45
|
+
lA1NL1gAWn8iZozZgfaDv4ufaYI=
|
|
46
46
|
</data>
|
|
47
47
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
|
48
48
|
<data>
|
|
49
|
-
|
|
49
|
+
UIWkWLUjrxcQesesx3AgXLvvlO4=
|
|
50
50
|
</data>
|
|
51
51
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
|
|
52
52
|
<data>
|
|
53
|
-
|
|
53
|
+
qqfqVj6qWKy5fRrVsu8k258Qhy4=
|
|
54
54
|
</data>
|
|
55
55
|
<key>Modules/module.modulemap</key>
|
|
56
56
|
<data>
|
|
@@ -74,110 +74,110 @@
|
|
|
74
74
|
<dict>
|
|
75
75
|
<key>hash</key>
|
|
76
76
|
<data>
|
|
77
|
-
|
|
77
|
+
HD9+QzXS6syt7YjX+LNINC/9ONI=
|
|
78
78
|
</data>
|
|
79
79
|
<key>hash2</key>
|
|
80
80
|
<data>
|
|
81
|
-
|
|
81
|
+
zBVq7MbisIIOPKo9p4khV97Q9zyp5L4mGJDh7HQdGCY=
|
|
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
|
-
|
|
88
|
+
ykWSReidqKetKLAd6n2aNtpjLBM=
|
|
89
89
|
</data>
|
|
90
90
|
<key>hash2</key>
|
|
91
91
|
<data>
|
|
92
|
-
|
|
92
|
+
QL35NTBJzwqAY4tvR2f0uN2YABNh3V7FSk8SQL2bNYU=
|
|
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
|
-
|
|
99
|
+
24PuZ36TSo/864HC3q4dNES7k8g=
|
|
100
100
|
</data>
|
|
101
101
|
<key>hash2</key>
|
|
102
102
|
<data>
|
|
103
|
-
|
|
103
|
+
r97G9JkyJphiFau9+zlfu8kuzP0AF1ywV1pDhovYzhU=
|
|
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
|
-
|
|
110
|
+
ykWSReidqKetKLAd6n2aNtpjLBM=
|
|
111
111
|
</data>
|
|
112
112
|
<key>hash2</key>
|
|
113
113
|
<data>
|
|
114
|
-
|
|
114
|
+
QL35NTBJzwqAY4tvR2f0uN2YABNh3V7FSk8SQL2bNYU=
|
|
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
|
-
|
|
121
|
+
XqMBUqJqRhvWqPyjX7CL12tVIcc=
|
|
122
122
|
</data>
|
|
123
123
|
<key>hash2</key>
|
|
124
124
|
<data>
|
|
125
|
-
|
|
125
|
+
oVyXgqwD9Zia4XAqe7W2g4twECQTsvD9WhvSH0N6x40=
|
|
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
|
-
|
|
132
|
+
HD9+QzXS6syt7YjX+LNINC/9ONI=
|
|
133
133
|
</data>
|
|
134
134
|
<key>hash2</key>
|
|
135
135
|
<data>
|
|
136
|
-
|
|
136
|
+
zBVq7MbisIIOPKo9p4khV97Q9zyp5L4mGJDh7HQdGCY=
|
|
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
|
-
|
|
143
|
+
UIWkWLUjrxcQesesx3AgXLvvlO4=
|
|
144
144
|
</data>
|
|
145
145
|
<key>hash2</key>
|
|
146
146
|
<data>
|
|
147
|
-
|
|
147
|
+
Eybqf+cGT84kwBwiMOf3VC6SHhXzJlHXLBDFu/DgGlU=
|
|
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
|
-
|
|
154
|
+
lA1NL1gAWn8iZozZgfaDv4ufaYI=
|
|
155
155
|
</data>
|
|
156
156
|
<key>hash2</key>
|
|
157
157
|
<data>
|
|
158
|
-
|
|
158
|
+
Hc7fdQuSxeqVuNZX9qzjuh8T9uOnjFKn5o2RCKWcNi4=
|
|
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
|
-
|
|
165
|
+
UIWkWLUjrxcQesesx3AgXLvvlO4=
|
|
166
166
|
</data>
|
|
167
167
|
<key>hash2</key>
|
|
168
168
|
<data>
|
|
169
|
-
|
|
169
|
+
Eybqf+cGT84kwBwiMOf3VC6SHhXzJlHXLBDFu/DgGlU=
|
|
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
|
-
|
|
176
|
+
qqfqVj6qWKy5fRrVsu8k258Qhy4=
|
|
177
177
|
</data>
|
|
178
178
|
<key>hash2</key>
|
|
179
179
|
<data>
|
|
180
|
-
|
|
180
|
+
Uhifgr8DxkQUu51antQeIt7AmeZxGYQlcE2me3LGkCc=
|
|
181
181
|
</data>
|
|
182
182
|
</dict>
|
|
183
183
|
<key>Modules/module.modulemap</key>
|
package/package.json
CHANGED
package/speech/index.ts
CHANGED
|
@@ -34,6 +34,12 @@ function sleep(ms: number) {
|
|
|
34
34
|
return new Promise<void>((r) => setTimeout(r, ms));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
let speechOpSeq = 0;
|
|
38
|
+
function nextSpeechOpId(prefix: string) {
|
|
39
|
+
speechOpSeq += 1;
|
|
40
|
+
return `${prefix}-${speechOpSeq}-${Date.now()}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
37
43
|
// If you use typed-array -> base64, Buffer is convenient (works in RN)
|
|
38
44
|
let toBase64: (u8: Uint8Array) => string;
|
|
39
45
|
try {
|
|
@@ -184,6 +190,8 @@ class Speech {
|
|
|
184
190
|
// top of file (new state)
|
|
185
191
|
private lastLocale: string | null = null;
|
|
186
192
|
private lastModel: string | null = null;
|
|
193
|
+
private lastOnboardingJsonPath: string | null = null;
|
|
194
|
+
private hasCompletedFullInit = false;
|
|
187
195
|
private iosTtsOnly = false; // when true, use NativeTTS directly on iOS
|
|
188
196
|
|
|
189
197
|
|
|
@@ -386,11 +394,13 @@ class Speech {
|
|
|
386
394
|
|
|
387
395
|
this.lastLocale = opts.locale;
|
|
388
396
|
this.lastModel = modelPath;
|
|
397
|
+
this.lastOnboardingJsonPath = opts.onboardingJsonPath ?? null;
|
|
389
398
|
|
|
390
399
|
if (Platform.OS === 'ios' && NativeSpeech?.initAll) {
|
|
391
400
|
this.iosTtsOnly = false; // full unified mode
|
|
392
401
|
this.teardownListeners(); // re-wire listeners for unified
|
|
393
402
|
const r = await NativeSpeech.initAll({ ...opts, model: modelPath });
|
|
403
|
+
this.hasCompletedFullInit = true;
|
|
394
404
|
this.ensureListeners();
|
|
395
405
|
return r;
|
|
396
406
|
}
|
|
@@ -440,6 +450,7 @@ class Speech {
|
|
|
440
450
|
const modelExt = this.resolveModelExt(opts.model);
|
|
441
451
|
console.log('[MODELDBG] initAll.modelExt (resolved)=', modelExt);
|
|
442
452
|
await NativeTTS.initTTS({ model: modelPath, modelExt });
|
|
453
|
+
this.hasCompletedFullInit = true;
|
|
443
454
|
}
|
|
444
455
|
|
|
445
456
|
async destroyAll() {
|
|
@@ -450,6 +461,7 @@ class Speech {
|
|
|
450
461
|
// iOS unified
|
|
451
462
|
if (Platform.OS === 'ios' && NativeSpeech?.destroyAll) {
|
|
452
463
|
const r = await NativeSpeech.destroyAll();
|
|
464
|
+
this.hasCompletedFullInit = false;
|
|
453
465
|
this.iosTtsOnly = false;
|
|
454
466
|
this.lastLocale = this.lastLocale ?? null;
|
|
455
467
|
this.teardownListeners();
|
|
@@ -463,10 +475,97 @@ class Speech {
|
|
|
463
475
|
NativeSTT.destroySpeech(() => res());
|
|
464
476
|
});
|
|
465
477
|
} catch {}
|
|
478
|
+
this.hasCompletedFullInit = false;
|
|
466
479
|
this.teardownListeners();
|
|
467
480
|
return 'Destroyed';
|
|
468
481
|
}
|
|
469
482
|
|
|
483
|
+
async initWithoutModel() {
|
|
484
|
+
if (!this.hasCompletedFullInit || !this.lastLocale) {
|
|
485
|
+
throw new Error('initWithoutModel() requires a successful initAll() first.');
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
if (Platform.OS === 'ios' && NativeSpeech?.initWithoutModel) {
|
|
489
|
+
this.iosTtsOnly = false;
|
|
490
|
+
this.teardownListeners();
|
|
491
|
+
const r = await NativeSpeech.initWithoutModel({
|
|
492
|
+
locale: this.lastLocale,
|
|
493
|
+
onboardingJsonPath: this.lastOnboardingJsonPath,
|
|
494
|
+
});
|
|
495
|
+
this.ensureListeners();
|
|
496
|
+
return r;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
if (!NativeSTT) {
|
|
500
|
+
throw new Error('Missing native STT bridge.');
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
this.ensureListeners();
|
|
504
|
+
return new Promise<void>((resolve, reject) => {
|
|
505
|
+
try {
|
|
506
|
+
if (typeof NativeSTT.initWithoutModel === 'function') {
|
|
507
|
+
NativeSTT.initWithoutModel(
|
|
508
|
+
this.lastLocale,
|
|
509
|
+
{ onboardingJsonPath: this.lastOnboardingJsonPath ?? null },
|
|
510
|
+
(err: string) => (err ? reject(new Error(err)) : resolve()),
|
|
511
|
+
);
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
if (Platform.OS === 'android') {
|
|
516
|
+
NativeSTT.startSpeech(
|
|
517
|
+
this.lastLocale,
|
|
518
|
+
{
|
|
519
|
+
EXTRA_LANGUAGE_MODEL: 'LANGUAGE_MODEL_FREE_FORM',
|
|
520
|
+
EXTRA_MAX_RESULTS: 5,
|
|
521
|
+
EXTRA_PARTIAL_RESULTS: true,
|
|
522
|
+
REQUEST_PERMISSIONS_AUTO: true,
|
|
523
|
+
onboardingJsonPath: this.lastOnboardingJsonPath ?? null,
|
|
524
|
+
},
|
|
525
|
+
(err: string) => (err ? reject(new Error(err)) : resolve()),
|
|
526
|
+
);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
NativeSTT.startSpeech(this.lastLocale, (err: string) =>
|
|
531
|
+
err ? reject(new Error(err)) : resolve(),
|
|
532
|
+
);
|
|
533
|
+
} catch (e) {
|
|
534
|
+
reject(e as any);
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
async destroyWihtouModel() {
|
|
540
|
+
if (!this.hasCompletedFullInit) {
|
|
541
|
+
throw new Error('destroyWihtouModel() requires a successful initAll() first.');
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
if (Platform.OS === 'ios' && NativeSpeech?.destroyWihtouModel) {
|
|
545
|
+
return NativeSpeech.destroyWihtouModel();
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
return new Promise<void>((resolve) => {
|
|
549
|
+
try {
|
|
550
|
+
if (typeof NativeSTT?.destroyWihtouModel === 'function') {
|
|
551
|
+
NativeSTT.destroyWihtouModel(() => resolve());
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
if (!NativeSTT?.destroySpeech) {
|
|
555
|
+
resolve();
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
NativeSTT.destroySpeech(() => resolve());
|
|
559
|
+
} catch {
|
|
560
|
+
resolve();
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
async destroyWithoutModel() {
|
|
566
|
+
return this.destroyWihtouModel();
|
|
567
|
+
}
|
|
568
|
+
|
|
470
569
|
// ---------- STT ----------
|
|
471
570
|
async start(locale: string, options: Record<string, any> = {}) {
|
|
472
571
|
this.ensureListeners();
|
|
@@ -527,6 +626,8 @@ class Speech {
|
|
|
527
626
|
// TODO: CHECK THE NATIVE SIDE DOES NOT REALLY AWAITS
|
|
528
627
|
async pauseSpeechRecognition(): Promise<void> {
|
|
529
628
|
this.logCall('pauseSpeechRecognitionLite');
|
|
629
|
+
const opId = nextSpeechOpId('pause-stt');
|
|
630
|
+
const startedAt = Date.now();
|
|
530
631
|
|
|
531
632
|
const mod: any = Platform.OS === 'ios' ? NativeSpeech : NativeSTT;
|
|
532
633
|
const fn = mod?.pauseSpeechRecognitionLite;
|
|
@@ -537,7 +638,9 @@ class Speech {
|
|
|
537
638
|
}
|
|
538
639
|
|
|
539
640
|
if (Platform.OS === 'ios' && typeof mod?.pauseSpeechRecognitionLiteAsync === 'function') {
|
|
641
|
+
dbg('[pauseSpeechRecognitionLiteAsync] begin', { opId, timeoutMs: 1500 });
|
|
540
642
|
const result = await mod.pauseSpeechRecognitionLiteAsync(1500);
|
|
643
|
+
dbg('[pauseSpeechRecognitionLiteAsync] resolved', { opId, elapsedMs: Date.now() - startedAt, result });
|
|
541
644
|
if (result?.ok === false) dbgErr('pauseSpeechRecognitionLiteAsync failed', result?.reason);
|
|
542
645
|
return;
|
|
543
646
|
}
|
|
@@ -569,8 +672,14 @@ class Speech {
|
|
|
569
672
|
});
|
|
570
673
|
}
|
|
571
674
|
|
|
572
|
-
async unPauseSpeechRecognition(
|
|
675
|
+
async unPauseSpeechRecognition(
|
|
676
|
+
times: number,
|
|
677
|
+
preFetchMs: number = 0,
|
|
678
|
+
timeoutMs: number = 2500,
|
|
679
|
+
): Promise<void> {
|
|
573
680
|
this.logCall('unPauseSpeechRecognitionLite', { times, preFetchMs });
|
|
681
|
+
const opId = nextSpeechOpId('unpause-stt');
|
|
682
|
+
const startedAt = Date.now();
|
|
574
683
|
|
|
575
684
|
const mod: any = Platform.OS === 'ios' ? NativeSpeech : NativeSTT;
|
|
576
685
|
const fn = mod?.unPauseSpeechRecognitionLite;
|
|
@@ -581,7 +690,15 @@ class Speech {
|
|
|
581
690
|
}
|
|
582
691
|
|
|
583
692
|
if (Platform.OS === 'ios' && typeof mod?.unPauseSpeechRecognitionLiteAsync === 'function') {
|
|
584
|
-
|
|
693
|
+
dbg('[unPauseSpeechRecognitionLiteAsync] begin', { opId, times, preFetchMs, timeoutMs });
|
|
694
|
+
const result = await mod.unPauseSpeechRecognitionLiteAsync(times, preFetchMs, timeoutMs);
|
|
695
|
+
dbg('[unPauseSpeechRecognitionLiteAsync] resolved', {
|
|
696
|
+
opId,
|
|
697
|
+
times,
|
|
698
|
+
preFetchMs,
|
|
699
|
+
elapsedMs: Date.now() - startedAt,
|
|
700
|
+
result,
|
|
701
|
+
});
|
|
585
702
|
if (result?.ok === false) dbgErr('unPauseSpeechRecognitionLiteAsync failed', result?.reason);
|
|
586
703
|
return;
|
|
587
704
|
}
|