react-native-davoice-tts 1.0.310 → 1.0.312

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/README.md CHANGED
@@ -1,16 +1,325 @@
1
- New tts package
1
+ # react-native-davoice
2
2
 
3
- example usage:
3
+ React Native on-device speech package for:
4
4
 
5
- import { DaVoiceTTSInstance } from 'react-native-davoice-tts';
5
+ - **Speaker identification / speaker verification** - onboarding and real-time
6
+ - **Speech to Text / Real time ASR** - Real time ASR, Supports all languages. **Supports real time speaker verified and isolation**.
7
+ - **Voice Cloning / Text to Speech** - Cloning any voice any language.
8
+ - **On-device Text to Speech** - Human like text to speech, quality bits top cloud providers. Supports all cloned voices.
9
+ - **Smooth audio flow between all voice components** - Audio session handling across the flows.
10
+ - React Native support for iOS and Android
11
+
12
+ It works well with react-native-wakeword
13
+ - **Wake word / keyword detection / Hotword** - Real time Wake Word detection. **Supports real time speaker verified and isolation**.
14
+
15
+ It supports iOS and Android and is designed for apps that need a local voice pipeline with native audio-session handling.
16
+
17
+ This package pairs well with `react-native-wakeword`, which covers wake-word, keyword spotting, and related always-listening flows.
18
+
19
+ ## Features
20
+
21
+ - On-device TTS for React Native
22
+ - On-device STT for React Native
23
+ - Unified `speech/` API that can coordinate STT and TTS together
24
+ - Native event support for speech results, partials, volume, and TTS completion
25
+ - License activation and validation APIs
26
+ - Local model paths, bundled assets, and asset `require(...)` support
27
+ - WAV / audio playback helpers in the unified speech API
28
+ - iOS microphone and speech-recognition permission helpers
29
+
30
+ ## Package Layout
31
+
32
+ The package exposes three entry points:
33
+
34
+ - `react-native-davoice`
35
+ Default TTS entry point.
36
+ - `react-native-davoice/stt`
37
+ Standalone speech-to-text API.
38
+ - `react-native-davoice/speech`
39
+ Unified API for apps that use both TTS and STT together.
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ npm install react-native-davoice
45
+ ```
46
+
47
+ or
48
+
49
+ ```bash
50
+ yarn add react-native-davoice
51
+ ```
52
+
53
+ For iOS:
54
+
55
+ ```bash
56
+ cd ios
57
+ pod install
58
+ ```
59
+
60
+ React Native autolinking is supported.
61
+
62
+ ## When To Use Which API
63
+
64
+ Use `react-native-davoice/speech` if your app uses both STT and TTS and you want one bridge managing the flow.
65
+
66
+ Use `react-native-davoice` if you only need TTS.
67
+
68
+ Use `react-native-davoice/stt` if you only need speech recognition.
69
+
70
+ ## Quick Start
71
+
72
+ ### Unified Speech API
73
+
74
+ ```ts
75
+ import Speech from 'react-native-davoice/speech';
76
+
77
+ const model = require('./assets/models/model_ex_ariana.dm');
78
+
79
+ await Speech.setLicense('YOUR_LICENSE_KEY');
80
+ await Speech.initAll({
81
+ locale: 'en-US',
82
+ model,
83
+ });
84
+
85
+ Speech.onSpeechResults = (event) => {
86
+ console.log('results', event.value);
87
+ };
88
+
89
+ Speech.onSpeechPartialResults = (event) => {
90
+ console.log('partial', event.value);
91
+ };
92
+
93
+ Speech.onFinishedSpeaking = () => {
94
+ console.log('finished speaking');
95
+ };
96
+
97
+ await Speech.start('en-US');
98
+ await Speech.speak('Hello from DaVoice', 0, 1.0);
99
+ ```
100
+
101
+ ### TTS Only
102
+
103
+ ```ts
104
+ import { DaVoiceTTSInstance } from 'react-native-davoice';
6
105
 
7
106
  const tts = new DaVoiceTTSInstance();
8
107
 
108
+ await tts.setLicense('YOUR_LICENSE_KEY');
9
109
  await tts.initTTS({
10
- model: '/path/to/model.onnx',
11
- tokens: '/path/to/tokens.json',
12
- espeak: '/path/to/phonemes',
13
- voice: 'en_US',
110
+ model: require('./assets/models/model_ex_ariana.dm'),
14
111
  });
15
112
 
16
- await tts.speak('Hello world!', 0);
113
+ tts.onFinishedSpeaking(() => {
114
+ console.log('done');
115
+ });
116
+
117
+ await tts.speak('Hello world', 0);
118
+ ```
119
+
120
+ ### STT Only
121
+
122
+ ```ts
123
+ import STT from 'react-native-davoice/stt';
124
+
125
+ await STT.setLicense('YOUR_LICENSE_KEY');
126
+
127
+ STT.onSpeechResults = (event) => {
128
+ console.log(event.value);
129
+ };
130
+
131
+ await STT.start('en-US');
132
+ ```
133
+
134
+ ## Unified Speech API
135
+
136
+ The unified API is intended for real voice flows where STT and TTS are part of the same experience.
137
+
138
+ Common methods:
139
+
140
+ - `initAll({ locale, model, timeoutMs?, onboardingJsonPath? })`
141
+ - `destroyAll()`
142
+ - `start(locale, options?)`
143
+ - `stop()`
144
+ - `cancel()`
145
+ - `speak(text, speakerId?, speed?)`
146
+ - `stopSpeaking()`
147
+ - `playWav(pathOrURL, markAsLast?)`
148
+ - `playPCM(data, { sampleRate, channels?, interleaved?, format?, markAsLast? })`
149
+ - `playBuffer({ base64, sampleRate, channels?, interleaved?, format, markAsLast? })`
150
+ - `pauseMicrophone()`
151
+ - `unPauseMicrophone()`
152
+ - `pauseSpeechRecognition()`
153
+ - `unPauseSpeechRecognition(times)`
154
+ - `isAvailable()`
155
+ - `isRecognizing()`
156
+ - `setLicense(licenseKey)`
157
+ - `isLicenseValid(licenseKey)`
158
+
159
+ Unified events:
160
+
161
+ - `onSpeechStart`
162
+ - `onSpeechRecognized`
163
+ - `onSpeechEnd`
164
+ - `onSpeechError`
165
+ - `onSpeechResults`
166
+ - `onSpeechPartialResults`
167
+ - `onSpeechVolumeChanged`
168
+ - `onFinishedSpeaking`
169
+ - `onNewSpeechWAV`
170
+ Android-only remote STT flow event.
171
+
172
+ ### iOS Permission Helpers
173
+
174
+ The unified API also exposes iOS permission helpers:
175
+
176
+ - `hasIOSMicPermissions()`
177
+ - `requestIOSMicPermissions(waitTimeout)`
178
+ - `hasIOSSpeechRecognitionPermissions()`
179
+ - `requestIOSSpeechRecognitionPermissions(waitTimeout)`
180
+
181
+ ## TTS API
182
+
183
+ TTS is exposed from the package root.
184
+
185
+ ```ts
186
+ import { DaVoiceTTSInstance } from 'react-native-davoice';
187
+ ```
188
+
189
+ Available methods:
190
+
191
+ - `initTTS({ model })`
192
+ - `setLicense(licenseKey)`
193
+ - `isLicenseValid(licenseKey)`
194
+ - `speak(text, speakerId?)`
195
+ - `stopSpeaking()`
196
+ - `destroy()`
197
+ - `onFinishedSpeaking(callback)`
198
+
199
+ ## STT API
200
+
201
+ ```ts
202
+ import STT from 'react-native-davoice/stt';
203
+ ```
204
+
205
+ Available methods:
206
+
207
+ - `start(locale, options?)`
208
+ - `stop()`
209
+ - `cancel()`
210
+ - `destroy()`
211
+ - `isAvailable()`
212
+ - `isRecognizing()`
213
+ - `setLicense(licenseKey)`
214
+ - `isLicenseValid(licenseKey)`
215
+
216
+ Available event handlers:
217
+
218
+ - `onSpeechStart`
219
+ - `onSpeechRecognized`
220
+ - `onSpeechEnd`
221
+ - `onSpeechError`
222
+ - `onSpeechResults`
223
+ - `onSpeechPartialResults`
224
+ - `onSpeechVolumeChanged`
225
+
226
+ ## License API
227
+
228
+ All entry points expose the same license helpers:
229
+
230
+ ```ts
231
+ await Speech.setLicense(key);
232
+ await Speech.isLicenseValid(key);
233
+
234
+ await tts.setLicense(key);
235
+ await tts.isLicenseValid(key);
236
+
237
+ await STT.setLicense(key);
238
+ await STT.isLicenseValid(key);
239
+ ```
240
+
241
+ For the unified `speech/` entry point, `setLicense` applies the license to both STT and TTS under the hood.
242
+
243
+ ## Models And Assets
244
+
245
+ Model arguments can be provided as:
246
+
247
+ - a local file path
248
+ - a bundled asset via `require(...)`
249
+ - a file URL
250
+ - in some APIs, a remote URL
251
+
252
+ Typical model formats used by this package include `.dm` and `.onnx`.
253
+
254
+ If your app bundles model files with Metro, make sure your React Native asset configuration includes the extensions you use.
255
+
256
+ ## Works Well With react-native-wakeword
257
+
258
+ If your product needs wake word, keyword spotting, or an always-listening front end, pair this package with `react-native-wakeword`.
259
+
260
+ A common production setup is:
261
+
262
+ 1. `react-native-wakeword` for wake word and wake-phase audio control.
263
+ 2. `react-native-davoice/speech` for STT, TTS, and the active voice session.
264
+
265
+ That separation works well for assistants, hands-free flows, and full on-device voice UX.
266
+
267
+ ## Platform Notes
268
+
269
+ ### iOS
270
+
271
+ - Run `pod install` after adding or updating the package.
272
+ - Microphone permission is required.
273
+ - Speech recognition permission may also be required for STT flows.
274
+
275
+ ### Android
276
+
277
+ - Autolinking is supported.
278
+ - The package includes native Android bridge registration.
279
+ - `onNewSpeechWAV` is Android-only.
280
+
281
+ ## Example
282
+
283
+ This README was aligned with the companion DaVoice React Native example app that demonstrates:
284
+
285
+ - TTS model selection
286
+ - STT flows
287
+ - combined speech orchestration
288
+ - integration alongside `react-native-wakeword`
289
+
290
+ ## Troubleshooting
291
+
292
+ ### Native module not found
293
+
294
+ Make sure:
295
+
296
+ - the package is installed in `node_modules`
297
+ - iOS pods are installed
298
+ - the app was rebuilt after installation
299
+
300
+ ### Model file cannot be resolved
301
+
302
+ Check:
303
+
304
+ - the model path is correct
305
+ - the asset was bundled correctly
306
+ - Metro is configured to include the model extension
307
+
308
+ ### TTS or STT fails to initialize
309
+
310
+ Check:
311
+
312
+ - the license was set before initialization
313
+ - the model file exists on device
314
+ - required permissions were granted
315
+
316
+ ## Support
317
+
318
+ For licensing, production integration, or custom deployments:
319
+
320
+ - Website: [https://davoice.io](https://davoice.io)
321
+ - Email: `info@davoice.io`
322
+
323
+ ## License
324
+
325
+ MIT for the React Native wrapper. Native model/runtime licensing may require a commercial DaVoice license depending on your deployment.
@@ -2,7 +2,7 @@ require 'json'
2
2
 
3
3
  Pod::Spec.new do |s|
4
4
  s.name = "TTSRNBridge"
5
- s.version = "1.0.183" # Update to your package version
5
+ s.version = "1.0.186" # Update to your package version
6
6
  s.summary = "TTS for React Native."
7
7
  s.description = <<-DESC
8
8
  A React Native module for tts .
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-davoice-tts",
3
- "version": "1.0.310",
3
+ "version": "1.0.312",
4
4
  "description": "tts library for React Native",
5
5
  "main": "tts/index.js",
6
6
  "types": "tts/index.d.ts",