react-native-davoice-tts 1.0.218 → 1.0.219
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/ios/SpeechBridge/SpeechBridge.m +153 -0
- 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 +3388 -3388
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +20 -20
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +20 -20
- 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 +3316 -3316
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +32 -32
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +32 -32
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +3316 -3316
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +32 -32
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +32 -32
- 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 +24 -99
- package/package.json +1 -1
- package/speech/index.ts +106 -0
- package/android/src/main/java/com/davoice/tts/rn/DaVoiceTTSPackage.java_old_using_new_for_both_stt_and_tts +0 -26
- package/ios/STTRNBridge/STTBridge.m_wtf +0 -109
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DaVoiceSTT copy.swift____ +0 -1202
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DaVoiceSTT.swift.bkup +0 -1000
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DaVoiceSTT.swift.latest +0 -1359
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DaVoiceSTT.swift1.swift__ +0 -1134
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DaVoiceSTT.swift__ +0 -1329
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DaVoiceSTT copy.swift____ +0 -1202
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DaVoiceSTT.swift.bkup +0 -1000
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DaVoiceSTT.swift.latest +0 -1359
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DaVoiceSTT.swift1.swift__ +0 -1134
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DaVoiceSTT.swift__ +0 -1329
|
@@ -14,6 +14,38 @@ import _StringProcessing
|
|
|
14
14
|
import _SwiftConcurrencyShims
|
|
15
15
|
import onnxruntime_objc
|
|
16
16
|
import phonemes
|
|
17
|
+
public typealias EngineSchedule = (_ url: Foundation.URL, _ onDone: @escaping () -> Swift.Void) -> Swift.Bool
|
|
18
|
+
public typealias IsEngineReady = () -> Swift.Bool
|
|
19
|
+
public typealias useOnlyEnginePlayback = () -> Swift.Bool
|
|
20
|
+
public typealias StopEnginePlayback = () -> Swift.Void
|
|
21
|
+
public typealias CurrentEngineProvider = () -> AVFAudio.AVAudioEngine?
|
|
22
|
+
public enum AudioPlaybackHook {
|
|
23
|
+
public static var engineScheduleFile: DavoiceTTS.EngineSchedule?
|
|
24
|
+
public static var isEngineReady: DavoiceTTS.IsEngineReady?
|
|
25
|
+
public static var useOnlyEnginePlayback: DavoiceTTS.useOnlyEnginePlayback?
|
|
26
|
+
public static var stopEnginePlayback: DavoiceTTS.StopEnginePlayback?
|
|
27
|
+
public static var currentEngine: DavoiceTTS.CurrentEngineProvider?
|
|
28
|
+
}
|
|
29
|
+
@objc public protocol STTDelegate {
|
|
30
|
+
@objc func stt(_ stt: DavoiceTTS.STT, didEmitEvent name: Swift.String, body: [Swift.String : Any]?)
|
|
31
|
+
}
|
|
32
|
+
@objc @_inheritsConvenienceInitializers @objcMembers final public class STT : ObjectiveC.NSObject, Speech.SFSpeechRecognizerDelegate {
|
|
33
|
+
@objc weak final public var delegate: (any DavoiceTTS.STTDelegate)?
|
|
34
|
+
@objc final public var continuous: Swift.Bool
|
|
35
|
+
@objc public static let supportedEvents: [Swift.String]
|
|
36
|
+
@objc final public func unPauseMicrophone()
|
|
37
|
+
@objc final public func pauseMicrophone()
|
|
38
|
+
@objc final public func isSpeechAvailable(_ completion: @escaping (Swift.Bool) -> Swift.Void)
|
|
39
|
+
@objc final public func isRecognizing() -> Swift.Bool
|
|
40
|
+
@objc final public func startSpeech(localeStr: Swift.String?)
|
|
41
|
+
@objc final public func stopSpeech(_ completion: ((Swift.Bool) -> Swift.Void)? = nil)
|
|
42
|
+
@objc final public func cancelSpeech(_ completion: ((Swift.Bool) -> Swift.Void)? = nil)
|
|
43
|
+
@objc final public func destroySpeech(_ completion: ((Swift.Bool) -> Swift.Void)? = nil)
|
|
44
|
+
@objc final public func teardown()
|
|
45
|
+
@objc final public func speechRecognizer(_ speechRecognizer: Speech.SFSpeechRecognizer, availabilityDidChange available: Swift.Bool)
|
|
46
|
+
@objc override dynamic public init()
|
|
47
|
+
@objc deinit
|
|
48
|
+
}
|
|
17
49
|
@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers final public class SwiftSoundQueue : ObjectiveC.NSObject, AVFAudio.AVAudioPlayerDelegate {
|
|
18
50
|
@objc deinit
|
|
19
51
|
public static let shared: DavoiceTTS.SwiftSoundQueue
|
|
@@ -46,35 +78,3 @@ import phonemes
|
|
|
46
78
|
@objc final public func speak(_ txt: Swift.String, sid: Swift.Int32 = 0)
|
|
47
79
|
@objc final public func synthesize_top(_ _text: Swift.String, speakerId: Swift.Int32 = 0, token: Foundation.UUID) throws -> AVFAudio.AVAudioPCMBuffer
|
|
48
80
|
}
|
|
49
|
-
@objc public protocol STTDelegate {
|
|
50
|
-
@objc func stt(_ stt: DavoiceTTS.STT, didEmitEvent name: Swift.String, body: [Swift.String : Any]?)
|
|
51
|
-
}
|
|
52
|
-
@objc @_inheritsConvenienceInitializers @objcMembers final public class STT : ObjectiveC.NSObject, Speech.SFSpeechRecognizerDelegate {
|
|
53
|
-
@objc weak final public var delegate: (any DavoiceTTS.STTDelegate)?
|
|
54
|
-
@objc final public var continuous: Swift.Bool
|
|
55
|
-
@objc public static let supportedEvents: [Swift.String]
|
|
56
|
-
@objc final public func unPauseMicrophone()
|
|
57
|
-
@objc final public func pauseMicrophone()
|
|
58
|
-
@objc final public func isSpeechAvailable(_ completion: @escaping (Swift.Bool) -> Swift.Void)
|
|
59
|
-
@objc final public func isRecognizing() -> Swift.Bool
|
|
60
|
-
@objc final public func startSpeech(localeStr: Swift.String?)
|
|
61
|
-
@objc final public func stopSpeech(_ completion: ((Swift.Bool) -> Swift.Void)? = nil)
|
|
62
|
-
@objc final public func cancelSpeech(_ completion: ((Swift.Bool) -> Swift.Void)? = nil)
|
|
63
|
-
@objc final public func destroySpeech(_ completion: ((Swift.Bool) -> Swift.Void)? = nil)
|
|
64
|
-
@objc final public func teardown()
|
|
65
|
-
@objc final public func speechRecognizer(_ speechRecognizer: Speech.SFSpeechRecognizer, availabilityDidChange available: Swift.Bool)
|
|
66
|
-
@objc override dynamic public init()
|
|
67
|
-
@objc deinit
|
|
68
|
-
}
|
|
69
|
-
public typealias EngineSchedule = (_ url: Foundation.URL, _ onDone: @escaping () -> Swift.Void) -> Swift.Bool
|
|
70
|
-
public typealias IsEngineReady = () -> Swift.Bool
|
|
71
|
-
public typealias useOnlyEnginePlayback = () -> Swift.Bool
|
|
72
|
-
public typealias StopEnginePlayback = () -> Swift.Void
|
|
73
|
-
public typealias CurrentEngineProvider = () -> AVFAudio.AVAudioEngine?
|
|
74
|
-
public enum AudioPlaybackHook {
|
|
75
|
-
public static var engineScheduleFile: DavoiceTTS.EngineSchedule?
|
|
76
|
-
public static var isEngineReady: DavoiceTTS.IsEngineReady?
|
|
77
|
-
public static var useOnlyEnginePlayback: DavoiceTTS.useOnlyEnginePlayback?
|
|
78
|
-
public static var stopEnginePlayback: DavoiceTTS.StopEnginePlayback?
|
|
79
|
-
public static var currentEngine: DavoiceTTS.CurrentEngineProvider?
|
|
80
|
-
}
|
|
@@ -14,6 +14,38 @@ import _StringProcessing
|
|
|
14
14
|
import _SwiftConcurrencyShims
|
|
15
15
|
import onnxruntime_objc
|
|
16
16
|
import phonemes
|
|
17
|
+
public typealias EngineSchedule = (_ url: Foundation.URL, _ onDone: @escaping () -> Swift.Void) -> Swift.Bool
|
|
18
|
+
public typealias IsEngineReady = () -> Swift.Bool
|
|
19
|
+
public typealias useOnlyEnginePlayback = () -> Swift.Bool
|
|
20
|
+
public typealias StopEnginePlayback = () -> Swift.Void
|
|
21
|
+
public typealias CurrentEngineProvider = () -> AVFAudio.AVAudioEngine?
|
|
22
|
+
public enum AudioPlaybackHook {
|
|
23
|
+
public static var engineScheduleFile: DavoiceTTS.EngineSchedule?
|
|
24
|
+
public static var isEngineReady: DavoiceTTS.IsEngineReady?
|
|
25
|
+
public static var useOnlyEnginePlayback: DavoiceTTS.useOnlyEnginePlayback?
|
|
26
|
+
public static var stopEnginePlayback: DavoiceTTS.StopEnginePlayback?
|
|
27
|
+
public static var currentEngine: DavoiceTTS.CurrentEngineProvider?
|
|
28
|
+
}
|
|
29
|
+
@objc public protocol STTDelegate {
|
|
30
|
+
@objc func stt(_ stt: DavoiceTTS.STT, didEmitEvent name: Swift.String, body: [Swift.String : Any]?)
|
|
31
|
+
}
|
|
32
|
+
@objc @_inheritsConvenienceInitializers @objcMembers final public class STT : ObjectiveC.NSObject, Speech.SFSpeechRecognizerDelegate {
|
|
33
|
+
@objc weak final public var delegate: (any DavoiceTTS.STTDelegate)?
|
|
34
|
+
@objc final public var continuous: Swift.Bool
|
|
35
|
+
@objc public static let supportedEvents: [Swift.String]
|
|
36
|
+
@objc final public func unPauseMicrophone()
|
|
37
|
+
@objc final public func pauseMicrophone()
|
|
38
|
+
@objc final public func isSpeechAvailable(_ completion: @escaping (Swift.Bool) -> Swift.Void)
|
|
39
|
+
@objc final public func isRecognizing() -> Swift.Bool
|
|
40
|
+
@objc final public func startSpeech(localeStr: Swift.String?)
|
|
41
|
+
@objc final public func stopSpeech(_ completion: ((Swift.Bool) -> Swift.Void)? = nil)
|
|
42
|
+
@objc final public func cancelSpeech(_ completion: ((Swift.Bool) -> Swift.Void)? = nil)
|
|
43
|
+
@objc final public func destroySpeech(_ completion: ((Swift.Bool) -> Swift.Void)? = nil)
|
|
44
|
+
@objc final public func teardown()
|
|
45
|
+
@objc final public func speechRecognizer(_ speechRecognizer: Speech.SFSpeechRecognizer, availabilityDidChange available: Swift.Bool)
|
|
46
|
+
@objc override dynamic public init()
|
|
47
|
+
@objc deinit
|
|
48
|
+
}
|
|
17
49
|
@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers final public class SwiftSoundQueue : ObjectiveC.NSObject, AVFAudio.AVAudioPlayerDelegate {
|
|
18
50
|
@objc deinit
|
|
19
51
|
public static let shared: DavoiceTTS.SwiftSoundQueue
|
|
@@ -46,35 +78,3 @@ import phonemes
|
|
|
46
78
|
@objc final public func speak(_ txt: Swift.String, sid: Swift.Int32 = 0)
|
|
47
79
|
@objc final public func synthesize_top(_ _text: Swift.String, speakerId: Swift.Int32 = 0, token: Foundation.UUID) throws -> AVFAudio.AVAudioPCMBuffer
|
|
48
80
|
}
|
|
49
|
-
@objc public protocol STTDelegate {
|
|
50
|
-
@objc func stt(_ stt: DavoiceTTS.STT, didEmitEvent name: Swift.String, body: [Swift.String : Any]?)
|
|
51
|
-
}
|
|
52
|
-
@objc @_inheritsConvenienceInitializers @objcMembers final public class STT : ObjectiveC.NSObject, Speech.SFSpeechRecognizerDelegate {
|
|
53
|
-
@objc weak final public var delegate: (any DavoiceTTS.STTDelegate)?
|
|
54
|
-
@objc final public var continuous: Swift.Bool
|
|
55
|
-
@objc public static let supportedEvents: [Swift.String]
|
|
56
|
-
@objc final public func unPauseMicrophone()
|
|
57
|
-
@objc final public func pauseMicrophone()
|
|
58
|
-
@objc final public func isSpeechAvailable(_ completion: @escaping (Swift.Bool) -> Swift.Void)
|
|
59
|
-
@objc final public func isRecognizing() -> Swift.Bool
|
|
60
|
-
@objc final public func startSpeech(localeStr: Swift.String?)
|
|
61
|
-
@objc final public func stopSpeech(_ completion: ((Swift.Bool) -> Swift.Void)? = nil)
|
|
62
|
-
@objc final public func cancelSpeech(_ completion: ((Swift.Bool) -> Swift.Void)? = nil)
|
|
63
|
-
@objc final public func destroySpeech(_ completion: ((Swift.Bool) -> Swift.Void)? = nil)
|
|
64
|
-
@objc final public func teardown()
|
|
65
|
-
@objc final public func speechRecognizer(_ speechRecognizer: Speech.SFSpeechRecognizer, availabilityDidChange available: Swift.Bool)
|
|
66
|
-
@objc override dynamic public init()
|
|
67
|
-
@objc deinit
|
|
68
|
-
}
|
|
69
|
-
public typealias EngineSchedule = (_ url: Foundation.URL, _ onDone: @escaping () -> Swift.Void) -> Swift.Bool
|
|
70
|
-
public typealias IsEngineReady = () -> Swift.Bool
|
|
71
|
-
public typealias useOnlyEnginePlayback = () -> Swift.Bool
|
|
72
|
-
public typealias StopEnginePlayback = () -> Swift.Void
|
|
73
|
-
public typealias CurrentEngineProvider = () -> AVFAudio.AVAudioEngine?
|
|
74
|
-
public enum AudioPlaybackHook {
|
|
75
|
-
public static var engineScheduleFile: DavoiceTTS.EngineSchedule?
|
|
76
|
-
public static var isEngineReady: DavoiceTTS.IsEngineReady?
|
|
77
|
-
public static var useOnlyEnginePlayback: DavoiceTTS.useOnlyEnginePlayback?
|
|
78
|
-
public static var stopEnginePlayback: DavoiceTTS.StopEnginePlayback?
|
|
79
|
-
public static var currentEngine: DavoiceTTS.CurrentEngineProvider?
|
|
80
|
-
}
|
|
Binary file
|
|
Binary file
|
|
@@ -4,26 +4,6 @@
|
|
|
4
4
|
<dict>
|
|
5
5
|
<key>files</key>
|
|
6
6
|
<dict>
|
|
7
|
-
<key>DaVoiceSTT copy.swift____</key>
|
|
8
|
-
<data>
|
|
9
|
-
GNiEn4LTq6llQd9G6H4CpUbLdQc=
|
|
10
|
-
</data>
|
|
11
|
-
<key>DaVoiceSTT.swift.bkup</key>
|
|
12
|
-
<data>
|
|
13
|
-
F+JV4h5eKuxwqp9trz5Ki4brMck=
|
|
14
|
-
</data>
|
|
15
|
-
<key>DaVoiceSTT.swift.latest</key>
|
|
16
|
-
<data>
|
|
17
|
-
m2Qj2L4Nq6VqtHDtb7CqBZyRGSM=
|
|
18
|
-
</data>
|
|
19
|
-
<key>DaVoiceSTT.swift1.swift__</key>
|
|
20
|
-
<data>
|
|
21
|
-
1pvdDJrydJDiblI11Y/VtW82EEA=
|
|
22
|
-
</data>
|
|
23
|
-
<key>DaVoiceSTT.swift__</key>
|
|
24
|
-
<data>
|
|
25
|
-
uwH3kVBmfoCYmhb+KD/KUcHWi7w=
|
|
26
|
-
</data>
|
|
27
7
|
<key>Headers/DavoiceTTS-Swift.h</key>
|
|
28
8
|
<data>
|
|
29
9
|
8YUveXhC8rHVNe1mL2jtgQyrZ/s=
|
|
@@ -34,11 +14,11 @@
|
|
|
34
14
|
</data>
|
|
35
15
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
36
16
|
<data>
|
|
37
|
-
|
|
17
|
+
cOvhtLr+0CtxLJ5ln3g/8WMAM3A=
|
|
38
18
|
</data>
|
|
39
19
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
40
20
|
<data>
|
|
41
|
-
|
|
21
|
+
akprk4oMXr625+jgZPLuf1ymMbg=
|
|
42
22
|
</data>
|
|
43
23
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
44
24
|
<data>
|
|
@@ -46,19 +26,19 @@
|
|
|
46
26
|
</data>
|
|
47
27
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
48
28
|
<data>
|
|
49
|
-
|
|
29
|
+
akprk4oMXr625+jgZPLuf1ymMbg=
|
|
50
30
|
</data>
|
|
51
31
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
|
|
52
32
|
<data>
|
|
53
|
-
|
|
33
|
+
jM8O+ScKeSkR2UcR7zdQHopr7DM=
|
|
54
34
|
</data>
|
|
55
35
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
56
36
|
<data>
|
|
57
|
-
|
|
37
|
+
cOvhtLr+0CtxLJ5ln3g/8WMAM3A=
|
|
58
38
|
</data>
|
|
59
39
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
60
40
|
<data>
|
|
61
|
-
|
|
41
|
+
9TYfU4//B2f1OfGS8+nPba8Bm/4=
|
|
62
42
|
</data>
|
|
63
43
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
64
44
|
<data>
|
|
@@ -66,11 +46,11 @@
|
|
|
66
46
|
</data>
|
|
67
47
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
|
68
48
|
<data>
|
|
69
|
-
|
|
49
|
+
9TYfU4//B2f1OfGS8+nPba8Bm/4=
|
|
70
50
|
</data>
|
|
71
51
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
|
|
72
52
|
<data>
|
|
73
|
-
|
|
53
|
+
Y4QvsYdDIkENra59XOpu4BhC34o=
|
|
74
54
|
</data>
|
|
75
55
|
<key>Modules/module.modulemap</key>
|
|
76
56
|
<data>
|
|
@@ -79,61 +59,6 @@
|
|
|
79
59
|
</dict>
|
|
80
60
|
<key>files2</key>
|
|
81
61
|
<dict>
|
|
82
|
-
<key>DaVoiceSTT copy.swift____</key>
|
|
83
|
-
<dict>
|
|
84
|
-
<key>hash</key>
|
|
85
|
-
<data>
|
|
86
|
-
GNiEn4LTq6llQd9G6H4CpUbLdQc=
|
|
87
|
-
</data>
|
|
88
|
-
<key>hash2</key>
|
|
89
|
-
<data>
|
|
90
|
-
7Bcfrj8OROvM3SbiSeSlzaSHPyBP+jVgns/oJ1/0+g4=
|
|
91
|
-
</data>
|
|
92
|
-
</dict>
|
|
93
|
-
<key>DaVoiceSTT.swift.bkup</key>
|
|
94
|
-
<dict>
|
|
95
|
-
<key>hash</key>
|
|
96
|
-
<data>
|
|
97
|
-
F+JV4h5eKuxwqp9trz5Ki4brMck=
|
|
98
|
-
</data>
|
|
99
|
-
<key>hash2</key>
|
|
100
|
-
<data>
|
|
101
|
-
MAnqwrqSd3RwRcJAXG6GC0LF7OBSYYjH7ScZOvk6Oiw=
|
|
102
|
-
</data>
|
|
103
|
-
</dict>
|
|
104
|
-
<key>DaVoiceSTT.swift.latest</key>
|
|
105
|
-
<dict>
|
|
106
|
-
<key>hash</key>
|
|
107
|
-
<data>
|
|
108
|
-
m2Qj2L4Nq6VqtHDtb7CqBZyRGSM=
|
|
109
|
-
</data>
|
|
110
|
-
<key>hash2</key>
|
|
111
|
-
<data>
|
|
112
|
-
GuDYulPaZWRCGhJPkahe24vpJVFMqzmETZL9fvgBA4k=
|
|
113
|
-
</data>
|
|
114
|
-
</dict>
|
|
115
|
-
<key>DaVoiceSTT.swift1.swift__</key>
|
|
116
|
-
<dict>
|
|
117
|
-
<key>hash</key>
|
|
118
|
-
<data>
|
|
119
|
-
1pvdDJrydJDiblI11Y/VtW82EEA=
|
|
120
|
-
</data>
|
|
121
|
-
<key>hash2</key>
|
|
122
|
-
<data>
|
|
123
|
-
LWPW9w7w9TDgzAqYLlKJzHf/e35KawpTX7Yjdp0PoRc=
|
|
124
|
-
</data>
|
|
125
|
-
</dict>
|
|
126
|
-
<key>DaVoiceSTT.swift__</key>
|
|
127
|
-
<dict>
|
|
128
|
-
<key>hash</key>
|
|
129
|
-
<data>
|
|
130
|
-
uwH3kVBmfoCYmhb+KD/KUcHWi7w=
|
|
131
|
-
</data>
|
|
132
|
-
<key>hash2</key>
|
|
133
|
-
<data>
|
|
134
|
-
VaPxNJj5KFBag9X7BmQNqwLvj52q40mRNmm9poQljac=
|
|
135
|
-
</data>
|
|
136
|
-
</dict>
|
|
137
62
|
<key>Headers/DavoiceTTS-Swift.h</key>
|
|
138
63
|
<dict>
|
|
139
64
|
<key>hash</key>
|
|
@@ -149,22 +74,22 @@
|
|
|
149
74
|
<dict>
|
|
150
75
|
<key>hash</key>
|
|
151
76
|
<data>
|
|
152
|
-
|
|
77
|
+
cOvhtLr+0CtxLJ5ln3g/8WMAM3A=
|
|
153
78
|
</data>
|
|
154
79
|
<key>hash2</key>
|
|
155
80
|
<data>
|
|
156
|
-
|
|
81
|
+
ITLXA2is4oU9ZEQihb/9O80ppMphkrTTucmMhvn9kOY=
|
|
157
82
|
</data>
|
|
158
83
|
</dict>
|
|
159
84
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
160
85
|
<dict>
|
|
161
86
|
<key>hash</key>
|
|
162
87
|
<data>
|
|
163
|
-
|
|
88
|
+
akprk4oMXr625+jgZPLuf1ymMbg=
|
|
164
89
|
</data>
|
|
165
90
|
<key>hash2</key>
|
|
166
91
|
<data>
|
|
167
|
-
|
|
92
|
+
mmDL/BXTR6uUYGIG4w3F8TM4DSmh3rAwuSYZMIQAudo=
|
|
168
93
|
</data>
|
|
169
94
|
</dict>
|
|
170
95
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
@@ -182,44 +107,44 @@
|
|
|
182
107
|
<dict>
|
|
183
108
|
<key>hash</key>
|
|
184
109
|
<data>
|
|
185
|
-
|
|
110
|
+
akprk4oMXr625+jgZPLuf1ymMbg=
|
|
186
111
|
</data>
|
|
187
112
|
<key>hash2</key>
|
|
188
113
|
<data>
|
|
189
|
-
|
|
114
|
+
mmDL/BXTR6uUYGIG4w3F8TM4DSmh3rAwuSYZMIQAudo=
|
|
190
115
|
</data>
|
|
191
116
|
</dict>
|
|
192
117
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
|
|
193
118
|
<dict>
|
|
194
119
|
<key>hash</key>
|
|
195
120
|
<data>
|
|
196
|
-
|
|
121
|
+
jM8O+ScKeSkR2UcR7zdQHopr7DM=
|
|
197
122
|
</data>
|
|
198
123
|
<key>hash2</key>
|
|
199
124
|
<data>
|
|
200
|
-
|
|
125
|
+
ZrMXfdcWHATayiHJGeweBQvYMFMY/O0CSfu4vZtTUNQ=
|
|
201
126
|
</data>
|
|
202
127
|
</dict>
|
|
203
128
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
204
129
|
<dict>
|
|
205
130
|
<key>hash</key>
|
|
206
131
|
<data>
|
|
207
|
-
|
|
132
|
+
cOvhtLr+0CtxLJ5ln3g/8WMAM3A=
|
|
208
133
|
</data>
|
|
209
134
|
<key>hash2</key>
|
|
210
135
|
<data>
|
|
211
|
-
|
|
136
|
+
ITLXA2is4oU9ZEQihb/9O80ppMphkrTTucmMhvn9kOY=
|
|
212
137
|
</data>
|
|
213
138
|
</dict>
|
|
214
139
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
215
140
|
<dict>
|
|
216
141
|
<key>hash</key>
|
|
217
142
|
<data>
|
|
218
|
-
|
|
143
|
+
9TYfU4//B2f1OfGS8+nPba8Bm/4=
|
|
219
144
|
</data>
|
|
220
145
|
<key>hash2</key>
|
|
221
146
|
<data>
|
|
222
|
-
|
|
147
|
+
du2KKRBYYy8EaGOm+bnazNjAD48S+5niMAo7x593P68=
|
|
223
148
|
</data>
|
|
224
149
|
</dict>
|
|
225
150
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
@@ -237,22 +162,22 @@
|
|
|
237
162
|
<dict>
|
|
238
163
|
<key>hash</key>
|
|
239
164
|
<data>
|
|
240
|
-
|
|
165
|
+
9TYfU4//B2f1OfGS8+nPba8Bm/4=
|
|
241
166
|
</data>
|
|
242
167
|
<key>hash2</key>
|
|
243
168
|
<data>
|
|
244
|
-
|
|
169
|
+
du2KKRBYYy8EaGOm+bnazNjAD48S+5niMAo7x593P68=
|
|
245
170
|
</data>
|
|
246
171
|
</dict>
|
|
247
172
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
|
|
248
173
|
<dict>
|
|
249
174
|
<key>hash</key>
|
|
250
175
|
<data>
|
|
251
|
-
|
|
176
|
+
Y4QvsYdDIkENra59XOpu4BhC34o=
|
|
252
177
|
</data>
|
|
253
178
|
<key>hash2</key>
|
|
254
179
|
<data>
|
|
255
|
-
|
|
180
|
+
Wt5b23kmofsa7dz6zgjQeU9lauhgAH0V5B9oLYKK6dE=
|
|
256
181
|
</data>
|
|
257
182
|
</dict>
|
|
258
183
|
<key>Modules/module.modulemap</key>
|
package/package.json
CHANGED
package/speech/index.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
// speech/index.ts
|
|
1
2
|
import { NativeModules, NativeEventEmitter, DeviceEventEmitter, Platform } from 'react-native';
|
|
2
3
|
|
|
4
|
+
// If you use typed-array -> base64, Buffer is convenient (works in RN)
|
|
5
|
+
let toBase64: (u8: Uint8Array) => string;
|
|
6
|
+
try {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
8
|
+
const { Buffer } = require('buffer');
|
|
9
|
+
toBase64 = (u8) => Buffer.from(u8.buffer, u8.byteOffset, u8.byteLength).toString('base64');
|
|
10
|
+
} catch {
|
|
11
|
+
// very rare fallback
|
|
12
|
+
toBase64 = (u8) => globalThis.btoa(String.fromCharCode(...u8));
|
|
13
|
+
}
|
|
14
|
+
|
|
3
15
|
// Native handles
|
|
4
16
|
const NativeSpeech = NativeModules.SpeechBridge; // iOS unified (if present)
|
|
5
17
|
const NativeSTT =
|
|
@@ -40,6 +52,22 @@ type NativeEventName =
|
|
|
40
52
|
| 'onSpeechVolumeChanged'
|
|
41
53
|
| 'onFinishedSpeaking';
|
|
42
54
|
|
|
55
|
+
// --- NEW: descriptor for external PCM payloads ---
|
|
56
|
+
export type ExternalPCM = {
|
|
57
|
+
/** base64 of raw PCM payload */
|
|
58
|
+
base64: string;
|
|
59
|
+
/** sample rate of payload (e.g., 16000, 22050, 24000, 44100, 48000) */
|
|
60
|
+
sampleRate: number;
|
|
61
|
+
/** number of channels in payload (default 1) */
|
|
62
|
+
channels?: number;
|
|
63
|
+
/** whether payload is interleaved (default true) */
|
|
64
|
+
interleaved?: boolean;
|
|
65
|
+
/** 'i16' for 16-bit signed integer, 'f32' for 32-bit float */
|
|
66
|
+
format: 'i16' | 'f32';
|
|
67
|
+
/** whether this item should trigger onFinishedSpeaking when done (default true) */
|
|
68
|
+
markAsLast?: boolean;
|
|
69
|
+
};
|
|
70
|
+
|
|
43
71
|
class Speech {
|
|
44
72
|
private sttEmitter: NativeEventEmitter | null = null;
|
|
45
73
|
private ttsEmitter: NativeEventEmitter | typeof DeviceEventEmitter | null = null;
|
|
@@ -340,6 +368,84 @@ private rewireListenersForMode() {
|
|
|
340
368
|
return NativeTTS.stopSpeaking();
|
|
341
369
|
}
|
|
342
370
|
|
|
371
|
+
// --- NEW: TTS passthroughs for external audio ---
|
|
372
|
+
|
|
373
|
+
/** Queue a WAV file (local path or file:// URL). Routed via AEC path, queued with speak(). */
|
|
374
|
+
async playWav(pathOrURL: string, markAsLast = true) {
|
|
375
|
+
// Prefer unified iOS bridge if present
|
|
376
|
+
if (Platform.OS === 'ios' && NativeSpeech?.playWav) {
|
|
377
|
+
return NativeSpeech.playWav(pathOrURL, markAsLast);
|
|
378
|
+
}
|
|
379
|
+
// Fallback: direct TTS bridge (Android + iOS fallback)
|
|
380
|
+
if (!NativeTTS?.playWav) throw new Error('playWav not available on this platform.');
|
|
381
|
+
return NativeTTS.playWav(pathOrURL, markAsLast);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Convenience: queue a typed array (Int16Array | Float32Array | ArrayBuffer) as PCM.
|
|
386
|
+
* We’ll base64 it and pass through to native with the right metadata.
|
|
387
|
+
*/
|
|
388
|
+
async playPCM(
|
|
389
|
+
data: ArrayBuffer | Int16Array | Float32Array,
|
|
390
|
+
opts: {
|
|
391
|
+
sampleRate: number;
|
|
392
|
+
channels?: number;
|
|
393
|
+
interleaved?: boolean;
|
|
394
|
+
/** If data is Int16Array → 'i16' (default); if Float32Array → 'f32' (default) */
|
|
395
|
+
format?: 'i16' | 'f32';
|
|
396
|
+
markAsLast?: boolean;
|
|
397
|
+
}
|
|
398
|
+
) {
|
|
399
|
+
let u8: Uint8Array;
|
|
400
|
+
let format: 'i16' | 'f32' = opts.format ?? 'i16';
|
|
401
|
+
|
|
402
|
+
if (data instanceof ArrayBuffer) {
|
|
403
|
+
// assume Int16 unless caller specified
|
|
404
|
+
u8 = new Uint8Array(data);
|
|
405
|
+
} else if (data instanceof Int16Array) {
|
|
406
|
+
u8 = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
407
|
+
format = opts.format ?? 'i16';
|
|
408
|
+
} else if (data instanceof Float32Array) {
|
|
409
|
+
u8 = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
410
|
+
format = opts.format ?? 'f32';
|
|
411
|
+
} else {
|
|
412
|
+
throw new Error('Unsupported PCM container');
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
const base64 = toBase64(u8);
|
|
416
|
+
return this.playBuffer({
|
|
417
|
+
base64,
|
|
418
|
+
sampleRate: opts.sampleRate,
|
|
419
|
+
channels: opts.channels ?? 1,
|
|
420
|
+
interleaved: opts.interleaved ?? true,
|
|
421
|
+
format,
|
|
422
|
+
markAsLast: opts.markAsLast ?? true,
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Queue raw PCM buffer from other TTS providers (base64 payload).
|
|
430
|
+
* Use ExternalPCM for full control of metadata.
|
|
431
|
+
*/
|
|
432
|
+
async playBuffer(desc: ExternalPCM) {
|
|
433
|
+
const payload = {
|
|
434
|
+
base64: desc.base64,
|
|
435
|
+
sampleRate: desc.sampleRate,
|
|
436
|
+
channels: desc.channels ?? 1,
|
|
437
|
+
interleaved: desc.interleaved ?? true,
|
|
438
|
+
format: desc.format,
|
|
439
|
+
markAsLast: desc.markAsLast ?? true,
|
|
440
|
+
};
|
|
441
|
+
if (Platform.OS === 'ios' && NativeSpeech?.playBuffer) {
|
|
442
|
+
return NativeSpeech.playBuffer(payload);
|
|
443
|
+
}
|
|
444
|
+
if (!NativeTTS?.playBuffer) throw new Error('playBuffer not available on this platform.');
|
|
445
|
+
return NativeTTS.playBuffer(payload);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
|
|
343
449
|
// ---------- Events ----------
|
|
344
450
|
private ensureListeners() {
|
|
345
451
|
if (this.subs.length) return;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
package com.davoice.tts.rn;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.NonNull;
|
|
4
|
-
import com.facebook.react.ReactPackage;
|
|
5
|
-
import com.facebook.react.bridge.NativeModule;
|
|
6
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
|
-
import com.facebook.react.uimanager.ViewManager;
|
|
8
|
-
import java.util.ArrayList;
|
|
9
|
-
import java.util.Collections;
|
|
10
|
-
import java.util.List;
|
|
11
|
-
|
|
12
|
-
public class DaVoiceTTSPackage implements ReactPackage {
|
|
13
|
-
@NonNull
|
|
14
|
-
@Override
|
|
15
|
-
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
|
16
|
-
List<NativeModule> modules = new ArrayList<>();
|
|
17
|
-
modules.add(new DaVoiceTTSBridge(reactContext));
|
|
18
|
-
return modules;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@NonNull
|
|
22
|
-
@Override
|
|
23
|
-
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
|
|
24
|
-
return Collections.emptyList();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
#import "STTBridge.h"
|
|
2
|
-
#import <React/RCTLog.h>
|
|
3
|
-
#import <React/RCTConvert.h>
|
|
4
|
-
|
|
5
|
-
// Import the generated Swift header for your target.
|
|
6
|
-
// Replace "YourTargetName-Swift.h" with your actual target name.
|
|
7
|
-
#import <DaVoiceTTS/DaVoiceTTS-Swift.h>
|
|
8
|
-
|
|
9
|
-
@interface STTBridge () <STTDelegate>
|
|
10
|
-
@property (nonatomic, strong, nullable) STT *stt;
|
|
11
|
-
@property (nonatomic, assign) BOOL hasListeners;
|
|
12
|
-
@end
|
|
13
|
-
|
|
14
|
-
@implementation STTBridge
|
|
15
|
-
|
|
16
|
-
RCT_EXPORT_MODULE(STT) // matches NativeModules.STT in stt/index.ts
|
|
17
|
-
|
|
18
|
-
+ (BOOL)requiresMainQueueSetup { return YES; }
|
|
19
|
-
|
|
20
|
-
- (NSArray<NSString *> *)supportedEvents
|
|
21
|
-
{
|
|
22
|
-
// Keep event names EXACTLY as the native STT emits.
|
|
23
|
-
return @[
|
|
24
|
-
@"onSpeechResults",
|
|
25
|
-
@"onSpeechStart",
|
|
26
|
-
@"onSpeechPartialResults",
|
|
27
|
-
@"onSpeechError",
|
|
28
|
-
@"onSpeechEnd",
|
|
29
|
-
@"onSpeechRecognized",
|
|
30
|
-
@"onSpeechVolumeChanged"
|
|
31
|
-
];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
- (void)startObserving { self.hasListeners = YES; }
|
|
35
|
-
- (void)stopObserving { self.hasListeners = NO; }
|
|
36
|
-
- (dispatch_queue_t)methodQueue { return dispatch_get_main_queue(); }
|
|
37
|
-
|
|
38
|
-
- (void)dealloc {
|
|
39
|
-
// Tear down safely
|
|
40
|
-
[self.stt destroySpeech:^(id _){}]; // optional; or call a direct Swift method if you exposed one
|
|
41
|
-
self.stt = nil;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
#pragma mark - STTDelegate (from Swift)
|
|
45
|
-
- (void)stt:(STT *)stt didEmitEvent:(NSString *)name body:(NSDictionary *)body
|
|
46
|
-
{
|
|
47
|
-
if (!self.hasListeners) return;
|
|
48
|
-
[self sendEventWithName:name body:body ?: @{}];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
#pragma mark - Helpers
|
|
52
|
-
- (void)ensureSTT {
|
|
53
|
-
if (!self.stt) {
|
|
54
|
-
self.stt = [STT new];
|
|
55
|
-
self.stt.delegate = self;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
#pragma mark - API (match your JS contract)
|
|
60
|
-
|
|
61
|
-
RCT_EXPORT_METHOD(startSpeech:(NSString *)locale
|
|
62
|
-
callback:(RCTResponseSenderBlock)callback)
|
|
63
|
-
{
|
|
64
|
-
[self ensureSTT];
|
|
65
|
-
[self.stt startSpeechWithLocaleStr:locale];
|
|
66
|
-
// parity with old Voice bridge: immediately callback with "false"
|
|
67
|
-
if (callback) callback(@[@(NO)]);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
RCT_EXPORT_METHOD(stopSpeech:(RCTResponseSenderBlock)callback)
|
|
71
|
-
{
|
|
72
|
-
if (!self.stt) { if (callback) callback(@[@(NO)]); return; }
|
|
73
|
-
[self.stt stopSpeech:^(BOOL _){}];
|
|
74
|
-
if (callback) callback(@[@(NO)]);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
RCT_EXPORT_METHOD(cancelSpeech:(RCTResponseSenderBlock)callback)
|
|
78
|
-
{
|
|
79
|
-
if (!self.stt) { if (callback) callback(@[@(NO)]); return; }
|
|
80
|
-
[self.stt cancelSpeech:^(BOOL _){}];
|
|
81
|
-
if (callback) callback(@[@(NO)]);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
RCT_EXPORT_METHOD(destroySpeech:(RCTResponseSenderBlock)callback)
|
|
85
|
-
{
|
|
86
|
-
if (self.stt) {
|
|
87
|
-
[self.stt destroySpeech:^(BOOL _){}];
|
|
88
|
-
self.stt = nil;
|
|
89
|
-
}
|
|
90
|
-
if (callback) callback(@[@(NO)]);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
RCT_EXPORT_METHOD(isSpeechAvailable:(RCTResponseSenderBlock)callback)
|
|
94
|
-
{
|
|
95
|
-
[STT new]; // ensures class is loaded; optional
|
|
96
|
-
// Call the Swift closure-based API
|
|
97
|
-
STT *tmp = self.stt ?: [STT new];
|
|
98
|
-
[tmp isSpeechAvailable:^(BOOL ok){
|
|
99
|
-
if (callback) callback(@[@(ok ? 1 : 0), [NSNull null]]);
|
|
100
|
-
}];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
RCT_EXPORT_METHOD(isRecognizing:(RCTResponseSenderBlock)callback)
|
|
104
|
-
{
|
|
105
|
-
BOOL running = self.stt ? [self.stt isRecognizing] : NO;
|
|
106
|
-
if (callback) callback(@[@(running ? 1 : 0)]);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
@end
|