react-native-davoice-tts 1.0.1

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 (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -0
  3. package/README.md_wakew +282 -0
  4. package/TTSRNBridge.podspec +32 -0
  5. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  6. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  7. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  8. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  9. package/android/.gradle/8.9/gc.properties +0 -0
  10. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  11. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  12. package/android/.gradle/vcs-1/gc.properties +0 -0
  13. package/android/build.gradle +42 -0
  14. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar +0 -0
  15. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.md5 +1 -0
  16. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.sha1 +1 -0
  17. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.pom +38 -0
  18. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.pom.md5 +1 -0
  19. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.pom.sha1 +1 -0
  20. package/android/settings.gradle +2 -0
  21. package/android/src/main/AndroidManifest.xml +17 -0
  22. package/android/src/main/assets/coca_cola_model_28_05052025.onnx +0 -0
  23. package/android/src/main/assets/embedding_model.onnx +0 -0
  24. package/android/src/main/assets/hey_lookdeep.onnx +0 -0
  25. package/android/src/main/assets/melspectrogram.onnx +0 -0
  26. package/android/src/main/assets/need_help_now.onnx +0 -0
  27. package/android/src/main/assets/silero_vad.onnx +0 -0
  28. package/android/src/main/java/com/davoice/tts/rn/DaVoiceTTSBridge.java +63 -0
  29. package/android/src/main/java/com/davoice/tts/rn/DaVoiceTTSPackage.java +26 -0
  30. package/android/src/main/libs/MyLibrary-release.aar +0 -0
  31. package/app.plugin.js +60 -0
  32. package/ios/TTSRNBridge/DaVoiceTTSBridge.h +7 -0
  33. package/ios/TTSRNBridge/DaVoiceTTSBridge.m +77 -0
  34. package/ios/TTSRNBridge/DavoiceTTS.xcframework/Info.plist +44 -0
  35. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DavoiceTTS +0 -0
  36. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Headers/DavoiceTTS-Swift.h +340 -0
  37. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Info.plist +0 -0
  38. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +1739 -0
  39. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +37 -0
  40. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  41. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +37 -0
  42. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/module.modulemap +4 -0
  43. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DavoiceTTS +0 -0
  44. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Headers/DavoiceTTS-Swift.h +676 -0
  45. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Info.plist +0 -0
  46. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +1739 -0
  47. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +37 -0
  48. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  49. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +37 -0
  50. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +1739 -0
  51. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +37 -0
  52. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  53. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +37 -0
  54. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/module.modulemap +4 -0
  55. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeDirectory +0 -0
  56. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeRequirements +0 -0
  57. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeRequirements-1 +0 -0
  58. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeResources +282 -0
  59. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeSignature +0 -0
  60. package/ios/TTSRNBridge/TTSRNBridge.swift +48 -0
  61. package/ios/TTSRNBridge/libphonemes.a +0 -0
  62. package/ios/TTSRNBridge/libucd.a +0 -0
  63. package/ios/TTSRNBridge/models/model.onnx +0 -0
  64. package/ios/TTSRNBridge/models/model.onnx.json +503 -0
  65. package/package.json +44 -0
  66. package/phonemes_dir/en_dict +0 -0
  67. package/phonemes_dir/intonations +0 -0
  68. package/phonemes_dir/lang/gmw/en-US +15 -0
  69. package/phonemes_dir/phondata +0 -0
  70. package/phonemes_dir/phonindex +0 -0
  71. package/phonemes_dir/phontab +0 -0
  72. package/tts/DaVoiceTTSBridge.d.ts +6 -0
  73. package/tts/DaVoiceTTSBridge.js +25 -0
  74. package/tts/index.d.ts +3 -0
  75. package/tts/index.js +4 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 frymanofer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ New tts package
2
+
3
+ example usage:
4
+
5
+ import { DaVoiceTTSInstance } from 'react-native-davoice-tts';
6
+
7
+ const tts = new DaVoiceTTSInstance();
8
+
9
+ await tts.initTTS({
10
+ model: '/path/to/model.onnx',
11
+ tokens: '/path/to/tokens.json',
12
+ espeak: '/path/to/phonemes',
13
+ voice: 'en_US',
14
+ });
15
+
16
+ await tts.speak('Hello world!', 0);
@@ -0,0 +1,282 @@
1
+ # React-Native "wake word" by Davoice
2
+
3
+ ## React-Native "wake word" also known as "react-native hotword", "react-native trigger word”, "react-native phrase spotting” and more...
4
+
5
+ By [DaVoice.io](https://davoice.io)
6
+
7
+ [![Twitter URL](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Ftwitter.com%2FDaVoiceAI)](https://twitter.com/DaVoiceAI)
8
+
9
+ Welcome to **Davoice React-Native Wake Word / hotword / Keywords Detection** – Wake words and keyword detection solution designed by **DaVoice.io**.
10
+
11
+ ## New:
12
+ Fix IOS crash when retaking microphone after a call.
13
+
14
+ Fix IOS issue with static Podfile linkage.
15
+
16
+ Reduce ios minimum version to 11 (was 13.5)
17
+
18
+ ## About this package:
19
+
20
+ This is a **"wake word"** package for React Native. A "wake word" is a keyword that activates your device, like "Hey Siri" or "OK Google". "Wake Word" is also known as "keyword detection", "Phrase Recognition", "Phrase Spotting", “Voice triggered”, “hot word”, “trigger word”
21
+
22
+ It also provide **Voice Commands** AKA **Speech to Intent**. **Voice Commands** refers to the ability to recognize a spoken word or phrase
23
+ and directly associate it with a specific action or operation within an application. Unlike a **"wake word"**, which typically serves to activate or wake up the application,
24
+ Speech to Intent goes further by enabling complex interactions and functionalities based on the recognized intent behind the speech.
25
+
26
+ For example, a wake word like "Hey App" might activate the application, while Speech
27
+ to Intent could process a phrase like "Play my favorite song" or "Order a coffee" to
28
+ execute corresponding tasks within the app.
29
+ Speech to Intent is often triggered after a wake word activates the app, making it a key
30
+ component of more advanced voice-controlled applications. This layered approach allows for
31
+ seamless and intuitive voice-driven user experiences.
32
+
33
+ More questions? - Contact us at info@DaVoice.io
34
+
35
+ ## Features
36
+
37
+ - **High Accuracy:** We have succesfully reached over 99% accurary for all our models. **Here is on of our customer's benchmarks**:
38
+
39
+ ```
40
+ MODEL DETECTION RATE
41
+ ===========================
42
+ DaVoice 0.992481
43
+ Top Player 0.874812
44
+ Third 0.626567
45
+ ```
46
+
47
+ Please check this link for an official benchmake by lookdeep.health:
48
+ https://www.reddit.com/r/Python/comments/1ioo4yd/bulletproof_wakewordkeyword_spotting/
49
+
50
+ - **Easy to deploy wake word with React Native:** Check out our example: "rn_example/DetectingKeyWords.js". With a few simple lines of code, you have your own keyword detecting enabled app.
51
+ - **Cross-Platform Support:** Integrate Davoice KeywordsDetection into React-Native Framework. Both iOS and Android are supported.
52
+ - **Low Latency:** Experience near-instantaneous keyword detection.
53
+
54
+ ## Platforms and Supported Languages
55
+
56
+ - **React-Native wake word Android:** React Native Wrapper for Android.
57
+ - **React-Native wake word iOS:** React Native Wrapper for iOS.
58
+
59
+ # Wake word generator
60
+
61
+ ## Create your "custom wake word""
62
+
63
+ In order to generate your custom wake word you will need to:
64
+
65
+ - **Create wake word mode:**
66
+ Contact us at info@davoice.io with a list of your desired **"custom wake words"**.
67
+
68
+ We will send you corresponding models typically your **wake word phrase .onnx** for example:
69
+
70
+ A wake word ***"hey sky"** will correspond to **hey_sky.onnx**.
71
+
72
+ - **Add wake words to Android:**
73
+ Simply copy the new onnx files to:
74
+
75
+ android/app/src/main/assets/*.onnx
76
+
77
+ - **Add Wake word to IOS**
78
+ Copy new models somewhere under ios/YourProjectName.
79
+
80
+ You can create a folder ios/YourProjectName/models/ and copy there there.
81
+
82
+ Now add each onnx file to xcode making sure you opt-in “copy if needed”.
83
+
84
+ - **In React/JS code add the new onnx files to your configuration**
85
+
86
+ Change:
87
+
88
+ ```
89
+ // Create an array of instance configurations
90
+
91
+ const instanceConfigs:instanceConfig[] = [
92
+
93
+ { id: 'need_help_now', modelName: 'need_help_now.onnx', threshold: 0.9999, bufferCnt: 3 , sticky: false },
94
+
95
+ ];
96
+
97
+ To:
98
+
99
+ // Create an array of instance configurations
100
+
101
+ const instanceConfigs:instanceConfig[] = [
102
+
103
+ { id: 'my_wake_word', modelName: 'my_wake_word.onnx', threshold: 0.9999, bufferCnt: 3 , sticky: false },
104
+
105
+ ];
106
+
107
+ For example if your generated custom wake word" is "hey sky":
108
+
109
+ // Create an array of instance configurations
110
+
111
+ const instanceConfigs:instanceConfig[] = [
112
+
113
+ { id: 'hey sky', modelName: 'hey_sky.onnx', threshold: 0.9999, bufferCnt: 3 , sticky: false },
114
+
115
+ ];
116
+ ```
117
+
118
+ - **Last step - Rebuild your project**
119
+
120
+ ## Contact
121
+
122
+ For any questions, requirements, or more support for React-Native, please contact us at info@davoice.io.
123
+
124
+ # IOS and Android Package
125
+
126
+ ## Installation
127
+ npm install react-native-wakeword
128
+
129
+ ## Android:
130
+ Add this to your android/build.gradle file:
131
+
132
+ allprojects {
133
+
134
+ repositories {
135
+
136
+ // react-native-wakeword added
137
+
138
+ maven { url "${project(":react-native-wakeword").projectDir}/libs" }
139
+
140
+ maven { url("${project(':react-native-wakeword').projectDir}/libs") }
141
+
142
+ maven {
143
+ url("${project(':react-native-wakeword').projectDir}/libs")
144
+ }
145
+
146
+ // End react-native-wakeword added
147
+
148
+ ... your other lines...
149
+
150
+ ## Githhub examples:
151
+
152
+ ### Checkout examples on:
153
+ https://github.com/frymanofer/ReactNative_WakeWordDetection
154
+
155
+ https://github.com/frymanofer/ReactNative_WakeWordDetection/example_npm
156
+
157
+ ## FAQ:
158
+
159
+ ### What is a wake word?
160
+
161
+ A **"wake word"** is a keyword or phrase that activates your device, like "Hey Siri" or "OK Google". "Wake Word" is also known as "keyword detection", "Phrase Recognition", "Phrase Spotting", “Voice triggered”, “hot word”, “trigger word”...
162
+
163
+ ### What is a Speech to Intent?
164
+
165
+ **"Speech to Intent"** refers to the ability to recognize a spoken word or phrase
166
+ and directly associate it with a specific action or operation within an application.
167
+
168
+ Unlike a **"wake word"**, which typically serves to activate or wake up the application,
169
+ Speech to Intent goes further by enabling complex interactions and functionalities
170
+ based on the recognized intent behind the speech.
171
+
172
+ For example, a wake word like "Hey App" might activate the application, while Speech
173
+ to Intent could process a phrase like "Play my favorite song" or "Order a coffee" to
174
+ execute corresponding tasks within the app.
175
+ Speech to Intent is often triggered after a wake word activates the app, making it a key
176
+ component of more advanced voice-controlled applications. This layered approach allows for
177
+ seamless and intuitive voice-driven user experiences.
178
+
179
+ ### How accurate is the platform?
180
+
181
+ We have succesfully reached over 99% "wake word" accurary for all our models. **Here is on of our customer's benchmarks**:
182
+
183
+ ```
184
+ MODEL DETECTION RATE
185
+ ===========================
186
+ DaVoice 0.992481
187
+ Top Player 0.874812
188
+ Third 0.626567
189
+ ```
190
+
191
+ ### Key words
192
+
193
+ "DaVoice.io"
194
+ "Voice commands"
195
+ "Wake word detection github"
196
+ “Voice triggered”
197
+ “hot word”
198
+ “react-native trigger word”
199
+ “react-native Voice triggered”
200
+ “react-native hot word”
201
+ "react-native wake word",
202
+ "Wake word generator",
203
+ "hot word generator",
204
+ "trigger word generator",
205
+ "Custom wake word generator",
206
+ "Custom hot word",
207
+ "Custom trigger word",
208
+ "Custom wake word",
209
+ "voice commands",
210
+ "wake word",
211
+ "wakeword",
212
+ "wake words",
213
+ "keyword detection",
214
+ "keyword spotting",
215
+ "speech to intent",
216
+ "voice commands",
217
+ "voice to intent",
218
+ "phrase spotting",
219
+ "react native wake word",
220
+ "Davoice.io wake word",
221
+ "Davoice wake word",
222
+ "Davoice react native wake word",
223
+ "Davoice react-native wake word",
224
+ "wake",
225
+ "word",
226
+ "Voice Commands Recognition",
227
+ "lightweight Voice Commands Recognition",
228
+ "customized lightweight Voice Commands Recognition",
229
+ "rn wake word"
230
+ "Davoice.io",
231
+ "voice commands",
232
+ "wake word",
233
+ "wakeword",
234
+ "wake words",
235
+ "keyword detection",
236
+ "keyword spotting",
237
+ "Wake word detection github"
238
+ "Wake Word"
239
+ "keyword detection"
240
+ "Phrase Recognition"
241
+ "Phrase Spotting"
242
+ "react-native wake word",
243
+ "Custom wake word",
244
+ "voice commands",
245
+ "wake word",
246
+ "wakeword",
247
+ "wake words",
248
+ "keyword detection",
249
+ "keyword spotting",
250
+ "speech to intent",
251
+ "voice to intent",
252
+ "phrase spotting",
253
+ "react native wake word",
254
+ "Davoice.io wake word",
255
+ "Davoice wake word",
256
+ "Davoice wake word",
257
+ "Davoice react native wake word",
258
+ "Davoice.io react-native wake word",
259
+ "wake",
260
+ "word",
261
+ "Voice Commands Recognition",
262
+ "lightweight Voice Commands Recognition",
263
+ "customized lightweight Voice Commands Recognition",
264
+ "rn wake word"
265
+ "speech to intent",
266
+ "voice to intent",
267
+ "phrase spotting",
268
+ "react native wake word",
269
+ "Davoice.io wake word",
270
+ "Davoice wake word",
271
+ "Davoice react native wake word",
272
+ "Davoice react-native wake word",
273
+ "wake",
274
+ "word",
275
+ "Voice Commands Recognition",
276
+ "lightweight Voice Commands Recognition",
277
+ "customized lightweight Voice Commands Recognition",
278
+ "Custom wake word",
279
+ "rn wake word"
280
+
281
+
282
+
@@ -0,0 +1,32 @@
1
+ require 'json'
2
+
3
+ Pod::Spec.new do |s|
4
+ s.name = "TTSRNBridge"
5
+ s.version = "1.0.8" # Update to your package version
6
+ s.summary = "TTS for React Native."
7
+ s.description = <<-DESC
8
+ A React Native module for tts .
9
+ DESC
10
+ s.homepage = "https://github.com/frymanofer/KeywordsDetectionAndroidLibrary.git" # Update with your repo URL
11
+ s.license = { :type => "MIT" } # Update if different
12
+ s.author = { "Your Name" => "ofer@davoice.io" } # Update with your info
13
+ s.platform = :ios, "11"
14
+ # s.source = { :git => "https://github.com/frymanofer/KeywordsDetectionAndroidLibrary.git", :tag => s.version.to_s } # Update accordingly
15
+ s.source = { :path => "." }
16
+
17
+ # s.source_files = "ios/*.{h,m,mm,swift}"
18
+ s.resources = "ios/TTSRNBridge/models/*"
19
+ s.source_files = 'ios/TTSRNBridge/DaVoiceTTSBridge.m', 'ios/TTSRNBridge/DaVoiceTTSBridge.h'
20
+
21
+ #s.static_framework = true
22
+ # Add your static libraries explicitly as vendored_libraries
23
+ s.vendored_libraries = "ios/TTSRNBridge/libucd.a", "ios/TTSRNBridge/libphonemes.a"
24
+
25
+ s.vendored_frameworks = "ios/TTSRNBridge/DavoiceTTS.xcframework"
26
+
27
+ s.dependency "React-Core"
28
+ s.dependency "onnxruntime-objc", "~> 1.20.0"
29
+ s.preserve_paths = 'docs', 'CHANGELOG.md', 'LICENSE', 'package.json'
30
+
31
+ end
32
+
File without changes
@@ -0,0 +1,2 @@
1
+ #Sun Nov 17 16:24:00 IST 2024
2
+ gradle.version=8.9
File without changes
@@ -0,0 +1,42 @@
1
+ apply plugin: 'com.android.library'
2
+
3
+ android {
4
+ compileSdkVersion 33
5
+
6
+ defaultConfig {
7
+ minSdkVersion 26
8
+ targetSdkVersion 33
9
+ consumerProguardFiles 'consumer-rules.pro'
10
+ }
11
+
12
+ sourceSets {
13
+ main {
14
+ assets.srcDirs = ['src/main/assets']
15
+ jniLibs.srcDirs = ['src/main/jniLibs'] // Add this line if needed
16
+ }
17
+ }
18
+ }
19
+
20
+ repositories {
21
+ google()
22
+ mavenCentral()
23
+ maven {
24
+ url './libs'
25
+ }
26
+ maven {
27
+ url "$projectDir/libs"
28
+ }
29
+ mavenLocal()
30
+ }
31
+
32
+ dependencies {
33
+ implementation "com.facebook.react:react-native:+"
34
+ api 'com.davoice:tts:1.0.0'
35
+ }
36
+
37
+ // Run this once to be able to run the application with BUCK
38
+ // puts all compile dependencies into folder libs for BUCK to use
39
+ task copyDownloadableDepsToLibs(type: Copy) {
40
+ from configurations.implementation
41
+ into 'libs'
42
+ }
@@ -0,0 +1 @@
1
+ 4dae9166896ad14504248257a2089fa3 tts-1.0.0.aar
@@ -0,0 +1 @@
1
+ 85362eeee83f7509327ed3edef88083e21694bef tts-1.0.0.aar
@@ -0,0 +1,38 @@
1
+ <project xmlns="http://maven.apache.org/POM/4.0.0"
2
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
4
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+
6
+ <modelVersion>4.0.0</modelVersion>
7
+
8
+ <!-- Your Maven coordinates -->
9
+ <groupId>com.davoice</groupId>
10
+ <artifactId>tts</artifactId>
11
+ <version>1.0.0</version>
12
+ <packaging>aar</packaging>
13
+
14
+ <name>DaVoice TTS</name>
15
+ <description>
16
+ Advanced text-to-speech (TTS) library by DaVoice for Android, packaged as an AAR.
17
+ </description>
18
+ <url>https://davoice.io</url>
19
+
20
+ <licenses>
21
+ <license>
22
+ <name>Proprietary License</name>
23
+ <url>https://davoice.io/license</url>
24
+ <distribution>repo</distribution>
25
+ </license>
26
+ </licenses>
27
+
28
+ <developers>
29
+ <developer>
30
+ <id>davoice</id>
31
+ <name>DaVoice Team</name>
32
+ <email>support@davoice.io</email>
33
+ <organization>DaVoice LTD</organization>
34
+ <organizationUrl>https://davoice.io</organizationUrl>
35
+ </developer>
36
+ </developers>
37
+
38
+ </project>
@@ -0,0 +1 @@
1
+ 751a7e1f63e63b9ec1832fa597bf4b0c tts-1.0.0.pom
@@ -0,0 +1 @@
1
+ cdae716fc67e3faa885f98c97db85d5ac47751cc tts-1.0.0.pom
@@ -0,0 +1,2 @@
1
+ include ':react-native-davoice-tts'
2
+ project(':react-native-davoice-tts').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-davoice-tts/android')
@@ -0,0 +1,17 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.davoice.keywordspotting">
3
+
4
+ <uses-permission android:name="android.permission.INTERNET" />
5
+ <uses-permission android:name="android.permission.RECORD_AUDIO"/>
6
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
7
+ <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
8
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE"/>
9
+ <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
10
+ <uses-permission android:name="android.permission.WAKE_LOCK"/>
11
+
12
+ <!-- Required for microphone access in Android 14 -->
13
+ <uses-permission android:name="android.permission.CAPTURE_AUDIO_OUTPUT"/>
14
+ <uses-permission android:name="android.permission.CAPTURE_MEDIA_OUTPUT"/>
15
+
16
+ </manifest>
17
+
@@ -0,0 +1,63 @@
1
+ package com.davoice.tts.rn;
2
+
3
+ import com.davoice.tts.DaVoiceTTSInterface; // core wrapper with all init logic
4
+ import com.facebook.react.bridge.Promise;
5
+ import com.facebook.react.bridge.ReactApplicationContext;
6
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
7
+ import com.facebook.react.bridge.ReactMethod;
8
+
9
+ /**
10
+ * Minimal RN bridge:
11
+ * NativeModules.DaVoiceTTSBridge.initTTS(modelName)
12
+ * NativeModules.DaVoiceTTSBridge.speak(text, speakerId)
13
+ *
14
+ * Everything else is handled by DaVoiceTTSInterface.
15
+ */
16
+ public class DaVoiceTTSBridge extends ReactContextBaseJavaModule {
17
+
18
+ private final DaVoiceTTSInterface tts;
19
+
20
+ public DaVoiceTTSBridge(ReactApplicationContext context) {
21
+ super(context);
22
+ this.tts = new DaVoiceTTSInterface(context);
23
+ }
24
+
25
+ @Override
26
+ public String getName() {
27
+ return "DaVoiceTTSBridge";
28
+ }
29
+
30
+ @ReactMethod
31
+ public void initTTS(String modelName, Promise promise) {
32
+ try {
33
+ // Defaults match your AAR behavior
34
+ DaVoiceTTSInterface.Config cfg = new DaVoiceTTSInterface.Config(
35
+ modelName, // e.g., "model.onnx"
36
+ "en-US", // default voice
37
+ "phonemes_dir" // asset dir name
38
+ );
39
+ boolean ok = tts.initTTS(cfg);
40
+ if (!ok) {
41
+ promise.reject("InitFailed", "Engine/TTS init failed");
42
+ return;
43
+ }
44
+ promise.resolve(true);
45
+ } catch (Exception e) {
46
+ promise.reject("InitError", e.getMessage(), e);
47
+ }
48
+ }
49
+
50
+ @ReactMethod
51
+ public void speak(String text, int speakerId, Promise promise) {
52
+ try {
53
+ tts.speak(text, speakerId);
54
+ promise.resolve(null);
55
+ } catch (Exception e) {
56
+ promise.reject("SpeakError", e.getMessage(), e);
57
+ }
58
+ }
59
+
60
+ // RN event API stubs (avoid warnings if JS subscribes)
61
+ @ReactMethod public void addListener(String eventName) { /* no-op */ }
62
+ @ReactMethod public void removeListeners(double count) { /* no-op */ }
63
+ }
@@ -0,0 +1,26 @@
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
+ }
package/app.plugin.js ADDED
@@ -0,0 +1,60 @@
1
+ // app.plugin.js
2
+ const { withAndroidManifest, withProjectBuildGradle } = require('@expo/config-plugins');
3
+
4
+ function withReactNativeWakeword(config) {
5
+ //
6
+ // 1. Add necessary permissions to AndroidManifest (if needed).
7
+ // For example, if `react-native-wakeword` needs RECORD_AUDIO.
8
+ //
9
+ config = withAndroidManifest(config, (config) => {
10
+ const androidManifest = config.modResults;
11
+
12
+ // Ensure 'uses-permission' array exists
13
+ if (!androidManifest.manifest['uses-permission']) {
14
+ androidManifest.manifest['uses-permission'] = [];
15
+ }
16
+
17
+ const permissions = androidManifest.manifest['uses-permission'];
18
+ const hasRecordAudio = permissions.some(
19
+ (permission) => permission.$['android:name'] === 'android.permission.RECORD_AUDIO'
20
+ );
21
+
22
+ // Add RECORD_AUDIO permission if not present
23
+ if (!hasRecordAudio) {
24
+ permissions.push({ $: { 'android:name': 'android.permission.RECORD_AUDIO' } });
25
+ }
26
+
27
+ return config;
28
+ });
29
+
30
+ //
31
+ // 2. Insert Maven repository or other Gradle config in the project's
32
+ // top-level build.gradle (only if your library requires custom artifacts).
33
+ //
34
+ config = withProjectBuildGradle(config, (config) => {
35
+ const buildGradle = config.modResults.contents;
36
+
37
+ // This snippet references a local "libs" folder inside your library package.
38
+ // Adjust the path if your artifacts are elsewhere or not needed.
39
+ const wakewordMaven = `
40
+ // react-native-wakeword added
41
+ maven { url("$rootDir/../node_modules/react-native-wakeword/libs") }
42
+ // End react-native-wakeword added
43
+ `;
44
+
45
+ // Only add the snippet once
46
+ if (!buildGradle.includes('react-native-wakeword added')) {
47
+ config.modResults.contents = buildGradle.replace(
48
+ /repositories\s*{/,
49
+ `repositories {\n${wakewordMaven}`
50
+ );
51
+ }
52
+
53
+ return config;
54
+ });
55
+
56
+ return config;
57
+ }
58
+
59
+ module.exports = withReactNativeWakeword;
60
+
@@ -0,0 +1,7 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTEventEmitter.h>
3
+
4
+ #import <DaVoiceTTS/DaVoiceTTS-Swift.h>
5
+
6
+ @interface DaVoiceTTSBridge : RCTEventEmitter <RCTBridgeModule>
7
+ @end