@streamoji/aitwin 0.6.2 → 0.6.3
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 +18 -1
- package/dist/aitwin.cjs +6 -6
- package/dist/aitwin.js +2555 -2454
- package/dist/index.d.ts +286 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,6 +98,7 @@ Provide **`id`** (cloud twin), **`avatarId`/`faceId`** (R2 custom face), or **`a
|
|
|
98
98
|
| `authToken` | Bearer for TTS + encrypted assets; omitted → dev `getAuthToken` |
|
|
99
99
|
| `ttsEngineId` | TTS engine (default Cartesia). Optional if `voiceId` is packed as `engine:voice` |
|
|
100
100
|
| `voiceId` | Voice id, or packed `ttsEngineId:voiceId` (e.g. `visemetts:eve`) |
|
|
101
|
+
| `language` | Default TTS language for `speakText()` and `connect()` (`en`, `es-MX`, `auto`, …) |
|
|
101
102
|
| `speakingRate` | Default `0.85` |
|
|
102
103
|
| `idleHandoffHoldMs` | Milliseconds to hold still sil after speech before resuming the idle video loop (default `200`) |
|
|
103
104
|
| `showErrorOverlay` | Canvas error overlay (default `true`) |
|
|
@@ -147,11 +148,25 @@ After speech ends, the twin returns to a still closed-mouth frame before the idl
|
|
|
147
148
|
|
|
148
149
|
Applies to both `speakText()` and voice `connect()` playback.
|
|
149
150
|
|
|
151
|
+
#### Language
|
|
152
|
+
|
|
153
|
+
`language` is a uniform code for visemetts and Cartesia. Pass it on `<AiTwin>`, `speakText()`, or `connect()`. Per-call options override the prop. Omitted → the API default.
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
await twinRef.current?.speakText("Hola, ¿cómo estás?", {
|
|
157
|
+
ttsEngineId: "visemetts",
|
|
158
|
+
voiceId: "eve",
|
|
159
|
+
language: "es-MX",
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
`auto` is visemetts-only. Cartesia also accepts extra codes (`nl`, `pl`, `th`, …). See `TTS_LANGUAGE_CATALOG` / `ttsLanguagesForEngine()`.
|
|
164
|
+
|
|
150
165
|
### Ref handle
|
|
151
166
|
|
|
152
167
|
| Method | Description |
|
|
153
168
|
|--------|-------------|
|
|
154
|
-
| `speakText(text, options?)` | SSE TTS + lipsync; optional per-call `
|
|
169
|
+
| `speakText(text, options?)` | SSE TTS + lipsync; optional per-call `ttsEngineId` / `voiceId` / `language` |
|
|
155
170
|
| `connect(options)` | Mic + WebSocket voice session (`/ws/voice`) |
|
|
156
171
|
| `disconnect()` | End voice session |
|
|
157
172
|
| `isConnected()` | Whether voice WebSocket is active |
|
|
@@ -195,6 +210,7 @@ function VoiceDemo() {
|
|
|
195
210
|
authToken: authJwt,
|
|
196
211
|
voiceId: optionalCartesiaUuid,
|
|
197
212
|
speakingRate: 0.85,
|
|
213
|
+
language: "es-MX",
|
|
198
214
|
});
|
|
199
215
|
};
|
|
200
216
|
|
|
@@ -222,6 +238,7 @@ WebSocket URL: `wss://<api-host>/ws/voice?<query>`. The SDK builds it from `conn
|
|
|
222
238
|
| `tenant` | Yes | Always `aiTwin` |
|
|
223
239
|
| `voiceId` | No | Cartesia UUID, visemetts name (`eve`), or packed `engine:voice` |
|
|
224
240
|
| `ttsEngineId` | No | `visemetts` or Cartesia id; also parsed from packed `voiceId` |
|
|
241
|
+
| `language` | No | Uniform TTS language (`en`, `es-MX`, `auto`, …) for visemetts and Cartesia |
|
|
225
242
|
| `personaId` | No | getAiTwin `knowledgeContextId` when present |
|
|
226
243
|
| `speaking_rate` | No | `0.5`–`1.5`, default `0.85` |
|
|
227
244
|
| `tts_stream` | No | Default `true` (server TTS + `avatar_audio_chunk`) |
|