@streamoji/aitwin 0.4.8 → 0.5.0

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/dist/index.d.ts CHANGED
@@ -167,8 +167,24 @@ export declare type AvatarTtsSpeakOptions = {
167
167
  ttsEngineId?: TtsEngineId;
168
168
  };
169
169
 
170
+ /** Pair transitions for playback, including sil→first and last→sil bookends. */
171
+ export declare function buildPlaybackTransitions(queue: VisemeQueueItem[]): RawVisemeTransition[];
172
+
173
+ /** Collapsed + compacted viseme series used for lipsync playback. */
174
+ export declare function buildPlaybackVisemeSeries(queue: VisemeQueueItem[]): VisemeQueueItem[];
175
+
176
+ export declare function buildRawVisemeTransitions(queue: VisemeQueueItem[]): RawVisemeTransition[];
177
+
170
178
  export declare function buildVoiceWebSocketUrl(options: RealtimeVoiceOptions): string;
171
179
 
180
+ /**
181
+ * Drop brief middle visemes in {aa,E,I} and {DD,SS,kk,CH} when either adjacent
182
+ * gap is under VISEME_SKIP_GAP_MS. First and last entries in the series are kept.
183
+ */
184
+ export declare function compactSkippableVisemes(series: VisemeQueueItem[]): VisemeQueueItem[];
185
+
186
+ export declare const CONSONANT_SKIP_GROUP: Set<string>;
187
+
172
188
  export declare function createAvatarTtsLipsyncController(onStatus: (status: AvatarTtsLipsyncStatus) => void, apiBase?: string, options?: AvatarTtsLipsyncControllerOptions): AvatarTtsLipsyncController;
173
189
 
174
190
  export declare function createRealtimeVoiceLipsyncController(onStatus: (status: AvatarTtsLipsyncStatus) => void, initialOptions?: RealtimeVoiceOptions): RealtimeVoiceLipsyncController;
@@ -250,6 +266,9 @@ export declare function getAiTwinSourceUrl(faceId: string, cdnBase?: string, ext
250
266
  /** Public CDN thumbnail for custom-faces/{faceId}/ (same id as pipeline avatarId). */
251
267
  export declare function getAiTwinThumbnailUrl(faceId: string, cdnBase?: string): string;
252
268
 
269
+ /** Visemes removed by compaction (for debug). */
270
+ export declare function listSkippedVisemes(queue: VisemeQueueItem[]): string[];
271
+
253
272
  export declare const MIC_SAMPLE_RATE = 16000;
254
273
 
255
274
  /** Google TTS streams Oculus viseme symbols; normalize casing and unknown ids. */
@@ -262,6 +281,13 @@ export declare const OCULUS_VISEME_IDS: readonly ["aa", "CH", "DD", "E", "FF", "
262
281
 
263
282
  export declare const PLAYBACK_SAMPLE_RATE = 16000;
264
283
 
284
+ declare type RawVisemeTransition = {
285
+ from: string;
286
+ to: string;
287
+ fromVtime: number;
288
+ toVtime: number;
289
+ };
290
+
265
291
  export declare type RealtimeLipsyncDebugSnapshot = {
266
292
  event: "metadata" | "audio_chunk" | "lipsync" | "bot_started" | "bot_stopped" | "user_started" | "interrupt" | "reset";
267
293
  spokenText: string;
@@ -312,6 +338,9 @@ export declare function resolveDirectFaceId(avatarId?: string, faceId?: string):
312
338
  /** Pick the active viseme at playback offset (latest vtime wins on overlap). */
313
339
  export declare function resolveVisemeAtTime(queue: VisemeQueueItem[], elapsedMs: number): string;
314
340
 
341
+ /** Latest non-sil viseme in the playback series at or before elapsedMs. */
342
+ export declare function resolveVisemeFromPlaybackSeries(series: VisemeQueueItem[], elapsedMs: number): string;
343
+
315
344
  /** Word active at playback offset (ms). */
316
345
  export declare function resolveWordAtTime(words: WordQueueItem[], timeMs: number): WordQueueItem | null;
317
346
 
@@ -350,6 +379,9 @@ export declare type TwinAssetUrls = {
350
379
 
351
380
  export declare const VISEME_IDS: readonly ["aa", "E", "I", "O", "U", "PP", "FF", "DD", "SS", "TH", "CH", "RR", "kk", "nn"];
352
381
 
382
+ /** Minimum gap (ms) between consecutive vtimes to keep a skippable viseme. */
383
+ export declare const VISEME_SKIP_GAP_MS = 35;
384
+
353
385
  /** Preset Cartesia voice (Katie) for testing without a custom clone. */
354
386
  export declare const VISEME_TEST_CARTESIA_VOICE_ID = "f786b574-daa5-4673-aa0c-cbe3e8534c02";
355
387
 
@@ -381,6 +413,8 @@ export declare type VoiceConnectOptions = {
381
413
  wsUrl?: string;
382
414
  };
383
415
 
416
+ export declare const VOWEL_SKIP_GROUP: Set<string>;
417
+
384
418
  export declare interface WordQueueItem {
385
419
  word: string;
386
420
  wtime: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoji/aitwin",
3
- "version": "0.4.8",
3
+ "version": "0.5.0",
4
4
  "description": "Embeddable React AI twin face with TTS lipsync",
5
5
  "type": "module",
6
6
  "main": "./dist/aitwin.cjs",