@streamoji/aitwin 0.6.1 → 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 +22 -4
- package/dist/aitwin.cjs +6 -6
- package/dist/aitwin.js +2635 -2488
- package/dist/index.d.ts +306 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -82,10 +82,18 @@ export declare type AiTwinProps = {
|
|
|
82
82
|
authToken?: string;
|
|
83
83
|
/** Avatar API base (TTS, session-value, voice). Default: package `DEFAULT_API_BASE`. */
|
|
84
84
|
apiBase?: string;
|
|
85
|
-
/** TTS engine when using `assets` or `avatarId`/`faceId` (default: Cartesia). */
|
|
85
|
+
/** TTS engine when using `assets` or `avatarId`/`faceId` (default: Cartesia). Optional if `voiceId` is packed as `engine:voice`. */
|
|
86
86
|
ttsEngineId?: TtsEngineId;
|
|
87
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* TTS voice id. May be a bare id (`eve`, Cartesia UUID) or packed
|
|
89
|
+
* `ttsEngineId:voiceId` (e.g. `visemetts:eve`).
|
|
90
|
+
*/
|
|
88
91
|
voiceId?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Default TTS language for `speakText()` and voice `connect()`.
|
|
94
|
+
* Uniform code for visemetts and Cartesia (`en`, `es-MX`, `auto`, …).
|
|
95
|
+
*/
|
|
96
|
+
language?: TtsLanguage;
|
|
89
97
|
/** API speakingRate (default: 0.85). */
|
|
90
98
|
speakingRate?: number;
|
|
91
99
|
className?: string;
|
|
@@ -202,6 +210,11 @@ export declare type AiTwinWidgetProps = {
|
|
|
202
210
|
apiBase?: string;
|
|
203
211
|
/** TTS voice id override. */
|
|
204
212
|
voiceId?: string;
|
|
213
|
+
/**
|
|
214
|
+
* Default TTS language for `speakText()` and voice `connect()`.
|
|
215
|
+
* Uniform code for visemetts and Cartesia (`en`, `es-MX`, `auto`, …).
|
|
216
|
+
*/
|
|
217
|
+
language?: TtsLanguage;
|
|
205
218
|
/** API speakingRate (default 0.85). */
|
|
206
219
|
speakingRate?: number;
|
|
207
220
|
/**
|
|
@@ -278,6 +291,11 @@ export declare type AvatarTtsSpeakOptions = {
|
|
|
278
291
|
speakingRate?: number;
|
|
279
292
|
/** Overrides controller default for this request. */
|
|
280
293
|
ttsEngineId?: TtsEngineId;
|
|
294
|
+
/**
|
|
295
|
+
* Uniform TTS language code (`en`, `es-MX`, `auto`, …).
|
|
296
|
+
* Sent as `language` on `/avatar_ttsWithPoses`.
|
|
297
|
+
*/
|
|
298
|
+
language?: TtsLanguage;
|
|
281
299
|
};
|
|
282
300
|
|
|
283
301
|
/** Pair transitions for playback, including sil→first and last→sil bookends. */
|
|
@@ -304,6 +322,8 @@ export declare function createRealtimeVoiceLipsyncController(onStatus: (status:
|
|
|
304
322
|
|
|
305
323
|
export declare const DEFAULT_TTS_ENGINE_ID: TtsEngineId;
|
|
306
324
|
|
|
325
|
+
export declare const DEFAULT_TTS_LANGUAGE: TtsLanguage;
|
|
326
|
+
|
|
307
327
|
export declare const EMOTION_TO_EYEBROW: Record<ExpressionEmotion, number>;
|
|
308
328
|
|
|
309
329
|
export declare function emotionToEyebrow(emotion: ExpressionEmotion): number;
|
|
@@ -395,6 +415,10 @@ export declare function getAiTwinSourceUrl(faceId: string, cdnBase?: string, ext
|
|
|
395
415
|
/** Public CDN thumbnail for custom-faces/{faceId}/ (same id as pipeline avatarId). */
|
|
396
416
|
export declare function getAiTwinThumbnailUrl(faceId: string, cdnBase?: string): string;
|
|
397
417
|
|
|
418
|
+
export declare function isTtsLanguageCode(raw: string): raw is TtsLanguage;
|
|
419
|
+
|
|
420
|
+
export declare function isTtsLanguageSupported(engineId: TtsEngineId, language: string): boolean;
|
|
421
|
+
|
|
398
422
|
export declare function listSkippedVisemeEntries(queue: VisemeQueueItem[]): SkippedVisemeEntry[];
|
|
399
423
|
|
|
400
424
|
/** Visemes removed by compaction (for debug). */
|
|
@@ -407,9 +431,21 @@ export declare function normalizeOculusViseme(symbol: string | null | undefined)
|
|
|
407
431
|
|
|
408
432
|
export declare function normalizeStreamEmotion(raw: string | undefined | null, fallback?: ExpressionEmotion): ExpressionEmotion;
|
|
409
433
|
|
|
434
|
+
/** Trimmed language code, or undefined when empty. */
|
|
435
|
+
export declare function normalizeTtsLanguage(raw?: string | null): TtsLanguage | undefined;
|
|
436
|
+
|
|
410
437
|
/** Oculus viseme ids for Talking Lady stills and pair transitions (15 standard). */
|
|
411
438
|
export declare const OCULUS_VISEME_IDS: readonly ["aa", "CH", "DD", "E", "FF", "I", "O", "PP", "RR", "SS", "TH", "U", "kk", "nn", "sil"];
|
|
412
439
|
|
|
440
|
+
/**
|
|
441
|
+
* `voiceId` may be a bare id (`eve`) or packed `engine:voice` (`visemetts:eve`).
|
|
442
|
+
* Cartesia UUIDs have no colon, so they stay a plain voice id.
|
|
443
|
+
*/
|
|
444
|
+
export declare function parsePackedVoiceId(raw?: string): {
|
|
445
|
+
ttsEngineId?: TtsEngineId;
|
|
446
|
+
voiceId?: string;
|
|
447
|
+
};
|
|
448
|
+
|
|
413
449
|
export declare const PLAYBACK_SAMPLE_RATE = 16000;
|
|
414
450
|
|
|
415
451
|
declare type RawVisemeTransition = {
|
|
@@ -510,6 +546,12 @@ export declare const SPEAKING_RATE_MAX = 1.5;
|
|
|
510
546
|
|
|
511
547
|
export declare const SPEAKING_RATE_MIN = 0.5;
|
|
512
548
|
|
|
549
|
+
/** Merge explicit `ttsEngineId` with a possibly packed `voiceId`. Packed engine wins only if engine is omitted. */
|
|
550
|
+
export declare function splitVoiceIdSpec(ttsEngineId?: TtsEngineId, voiceId?: string): {
|
|
551
|
+
ttsEngineId?: TtsEngineId;
|
|
552
|
+
voiceId?: string;
|
|
553
|
+
};
|
|
554
|
+
|
|
513
555
|
export declare const TTS_ENGINE_CARTESIA = "eng_c9b1e6d4";
|
|
514
556
|
|
|
515
557
|
/** Opaque TTS engine ids — must match backend TTS_ENGINE_MAP in main.py. */
|
|
@@ -520,8 +562,265 @@ export declare const TTS_ENGINE_INWORLD = "eng_d4e8f3a2";
|
|
|
520
562
|
/** streamoji-ai-avatar viseme TTS (`POST /avatar_ttsWithPoses`). */
|
|
521
563
|
export declare const TTS_ENGINE_VISEMETTS = "visemetts";
|
|
522
564
|
|
|
565
|
+
/**
|
|
566
|
+
* Uniform TTS language codes for visemetts and Cartesia (`eng_c9b1e6d4`).
|
|
567
|
+
* Passed as `language` on `/avatar_ttsWithPoses` and `/ws/voice`.
|
|
568
|
+
*/
|
|
569
|
+
export declare const TTS_LANGUAGE_CATALOG: readonly [{
|
|
570
|
+
readonly code: "en";
|
|
571
|
+
readonly label: "English";
|
|
572
|
+
readonly visemetts: true;
|
|
573
|
+
readonly cartesia: true;
|
|
574
|
+
}, {
|
|
575
|
+
readonly code: "es";
|
|
576
|
+
readonly label: "Spanish";
|
|
577
|
+
readonly visemetts: true;
|
|
578
|
+
readonly cartesia: true;
|
|
579
|
+
}, {
|
|
580
|
+
readonly code: "es-MX";
|
|
581
|
+
readonly label: "Spanish (Mexico)";
|
|
582
|
+
readonly visemetts: true;
|
|
583
|
+
readonly cartesia: true;
|
|
584
|
+
}, {
|
|
585
|
+
readonly code: "es-ES";
|
|
586
|
+
readonly label: "Spanish (Spain)";
|
|
587
|
+
readonly visemetts: true;
|
|
588
|
+
readonly cartesia: true;
|
|
589
|
+
}, {
|
|
590
|
+
readonly code: "pt";
|
|
591
|
+
readonly label: "Portuguese";
|
|
592
|
+
readonly visemetts: true;
|
|
593
|
+
readonly cartesia: true;
|
|
594
|
+
}, {
|
|
595
|
+
readonly code: "pt-BR";
|
|
596
|
+
readonly label: "Portuguese (Brazil)";
|
|
597
|
+
readonly visemetts: true;
|
|
598
|
+
readonly cartesia: true;
|
|
599
|
+
}, {
|
|
600
|
+
readonly code: "pt-PT";
|
|
601
|
+
readonly label: "Portuguese (Portugal)";
|
|
602
|
+
readonly visemetts: true;
|
|
603
|
+
readonly cartesia: true;
|
|
604
|
+
}, {
|
|
605
|
+
readonly code: "fr";
|
|
606
|
+
readonly label: "French";
|
|
607
|
+
readonly visemetts: true;
|
|
608
|
+
readonly cartesia: true;
|
|
609
|
+
}, {
|
|
610
|
+
readonly code: "de";
|
|
611
|
+
readonly label: "German";
|
|
612
|
+
readonly visemetts: true;
|
|
613
|
+
readonly cartesia: true;
|
|
614
|
+
}, {
|
|
615
|
+
readonly code: "it";
|
|
616
|
+
readonly label: "Italian";
|
|
617
|
+
readonly visemetts: true;
|
|
618
|
+
readonly cartesia: true;
|
|
619
|
+
}, {
|
|
620
|
+
readonly code: "zh";
|
|
621
|
+
readonly label: "Chinese";
|
|
622
|
+
readonly visemetts: true;
|
|
623
|
+
readonly cartesia: true;
|
|
624
|
+
}, {
|
|
625
|
+
readonly code: "ja";
|
|
626
|
+
readonly label: "Japanese";
|
|
627
|
+
readonly visemetts: true;
|
|
628
|
+
readonly cartesia: true;
|
|
629
|
+
}, {
|
|
630
|
+
readonly code: "hi";
|
|
631
|
+
readonly label: "Hindi";
|
|
632
|
+
readonly visemetts: true;
|
|
633
|
+
readonly cartesia: true;
|
|
634
|
+
}, {
|
|
635
|
+
readonly code: "ko";
|
|
636
|
+
readonly label: "Korean";
|
|
637
|
+
readonly visemetts: true;
|
|
638
|
+
readonly cartesia: true;
|
|
639
|
+
}, {
|
|
640
|
+
readonly code: "ru";
|
|
641
|
+
readonly label: "Russian";
|
|
642
|
+
readonly visemetts: true;
|
|
643
|
+
readonly cartesia: true;
|
|
644
|
+
}, {
|
|
645
|
+
readonly code: "tr";
|
|
646
|
+
readonly label: "Turkish";
|
|
647
|
+
readonly visemetts: true;
|
|
648
|
+
readonly cartesia: true;
|
|
649
|
+
}, {
|
|
650
|
+
readonly code: "id";
|
|
651
|
+
readonly label: "Indonesian";
|
|
652
|
+
readonly visemetts: true;
|
|
653
|
+
readonly cartesia: true;
|
|
654
|
+
}, {
|
|
655
|
+
readonly code: "ar";
|
|
656
|
+
readonly label: "Arabic";
|
|
657
|
+
readonly visemetts: true;
|
|
658
|
+
readonly cartesia: true;
|
|
659
|
+
}, {
|
|
660
|
+
readonly code: "ar-EG";
|
|
661
|
+
readonly label: "Arabic (Egypt)";
|
|
662
|
+
readonly visemetts: true;
|
|
663
|
+
readonly cartesia: true;
|
|
664
|
+
}, {
|
|
665
|
+
readonly code: "ar-AE";
|
|
666
|
+
readonly label: "Arabic (UAE)";
|
|
667
|
+
readonly visemetts: true;
|
|
668
|
+
readonly cartesia: true;
|
|
669
|
+
}, {
|
|
670
|
+
readonly code: "vi";
|
|
671
|
+
readonly label: "Vietnamese";
|
|
672
|
+
readonly visemetts: true;
|
|
673
|
+
readonly cartesia: true;
|
|
674
|
+
}, {
|
|
675
|
+
readonly code: "bn";
|
|
676
|
+
readonly label: "Bengali";
|
|
677
|
+
readonly visemetts: true;
|
|
678
|
+
readonly cartesia: true;
|
|
679
|
+
}, {
|
|
680
|
+
readonly code: "auto";
|
|
681
|
+
readonly label: "Auto-detect";
|
|
682
|
+
readonly visemetts: true;
|
|
683
|
+
readonly cartesia: false;
|
|
684
|
+
}, {
|
|
685
|
+
readonly code: "nl";
|
|
686
|
+
readonly label: "Dutch";
|
|
687
|
+
readonly visemetts: false;
|
|
688
|
+
readonly cartesia: true;
|
|
689
|
+
}, {
|
|
690
|
+
readonly code: "pl";
|
|
691
|
+
readonly label: "Polish";
|
|
692
|
+
readonly visemetts: false;
|
|
693
|
+
readonly cartesia: true;
|
|
694
|
+
}, {
|
|
695
|
+
readonly code: "sv";
|
|
696
|
+
readonly label: "Swedish";
|
|
697
|
+
readonly visemetts: false;
|
|
698
|
+
readonly cartesia: true;
|
|
699
|
+
}, {
|
|
700
|
+
readonly code: "tl";
|
|
701
|
+
readonly label: "Tagalog";
|
|
702
|
+
readonly visemetts: false;
|
|
703
|
+
readonly cartesia: true;
|
|
704
|
+
}, {
|
|
705
|
+
readonly code: "bg";
|
|
706
|
+
readonly label: "Bulgarian";
|
|
707
|
+
readonly visemetts: false;
|
|
708
|
+
readonly cartesia: true;
|
|
709
|
+
}, {
|
|
710
|
+
readonly code: "ro";
|
|
711
|
+
readonly label: "Romanian";
|
|
712
|
+
readonly visemetts: false;
|
|
713
|
+
readonly cartesia: true;
|
|
714
|
+
}, {
|
|
715
|
+
readonly code: "cs";
|
|
716
|
+
readonly label: "Czech";
|
|
717
|
+
readonly visemetts: false;
|
|
718
|
+
readonly cartesia: true;
|
|
719
|
+
}, {
|
|
720
|
+
readonly code: "el";
|
|
721
|
+
readonly label: "Greek";
|
|
722
|
+
readonly visemetts: false;
|
|
723
|
+
readonly cartesia: true;
|
|
724
|
+
}, {
|
|
725
|
+
readonly code: "fi";
|
|
726
|
+
readonly label: "Finnish";
|
|
727
|
+
readonly visemetts: false;
|
|
728
|
+
readonly cartesia: true;
|
|
729
|
+
}, {
|
|
730
|
+
readonly code: "hr";
|
|
731
|
+
readonly label: "Croatian";
|
|
732
|
+
readonly visemetts: false;
|
|
733
|
+
readonly cartesia: true;
|
|
734
|
+
}, {
|
|
735
|
+
readonly code: "ms";
|
|
736
|
+
readonly label: "Malay";
|
|
737
|
+
readonly visemetts: false;
|
|
738
|
+
readonly cartesia: true;
|
|
739
|
+
}, {
|
|
740
|
+
readonly code: "sk";
|
|
741
|
+
readonly label: "Slovak";
|
|
742
|
+
readonly visemetts: false;
|
|
743
|
+
readonly cartesia: true;
|
|
744
|
+
}, {
|
|
745
|
+
readonly code: "da";
|
|
746
|
+
readonly label: "Danish";
|
|
747
|
+
readonly visemetts: false;
|
|
748
|
+
readonly cartesia: true;
|
|
749
|
+
}, {
|
|
750
|
+
readonly code: "ta";
|
|
751
|
+
readonly label: "Tamil";
|
|
752
|
+
readonly visemetts: false;
|
|
753
|
+
readonly cartesia: true;
|
|
754
|
+
}, {
|
|
755
|
+
readonly code: "uk";
|
|
756
|
+
readonly label: "Ukrainian";
|
|
757
|
+
readonly visemetts: false;
|
|
758
|
+
readonly cartesia: true;
|
|
759
|
+
}, {
|
|
760
|
+
readonly code: "hu";
|
|
761
|
+
readonly label: "Hungarian";
|
|
762
|
+
readonly visemetts: false;
|
|
763
|
+
readonly cartesia: true;
|
|
764
|
+
}, {
|
|
765
|
+
readonly code: "no";
|
|
766
|
+
readonly label: "Norwegian";
|
|
767
|
+
readonly visemetts: false;
|
|
768
|
+
readonly cartesia: true;
|
|
769
|
+
}, {
|
|
770
|
+
readonly code: "th";
|
|
771
|
+
readonly label: "Thai";
|
|
772
|
+
readonly visemetts: false;
|
|
773
|
+
readonly cartesia: true;
|
|
774
|
+
}, {
|
|
775
|
+
readonly code: "he";
|
|
776
|
+
readonly label: "Hebrew";
|
|
777
|
+
readonly visemetts: false;
|
|
778
|
+
readonly cartesia: true;
|
|
779
|
+
}, {
|
|
780
|
+
readonly code: "ka";
|
|
781
|
+
readonly label: "Georgian";
|
|
782
|
+
readonly visemetts: false;
|
|
783
|
+
readonly cartesia: true;
|
|
784
|
+
}, {
|
|
785
|
+
readonly code: "te";
|
|
786
|
+
readonly label: "Telugu";
|
|
787
|
+
readonly visemetts: false;
|
|
788
|
+
readonly cartesia: true;
|
|
789
|
+
}, {
|
|
790
|
+
readonly code: "gu";
|
|
791
|
+
readonly label: "Gujarati";
|
|
792
|
+
readonly visemetts: false;
|
|
793
|
+
readonly cartesia: true;
|
|
794
|
+
}, {
|
|
795
|
+
readonly code: "kn";
|
|
796
|
+
readonly label: "Kannada";
|
|
797
|
+
readonly visemetts: false;
|
|
798
|
+
readonly cartesia: true;
|
|
799
|
+
}, {
|
|
800
|
+
readonly code: "ml";
|
|
801
|
+
readonly label: "Malayalam";
|
|
802
|
+
readonly visemetts: false;
|
|
803
|
+
readonly cartesia: true;
|
|
804
|
+
}, {
|
|
805
|
+
readonly code: "mr";
|
|
806
|
+
readonly label: "Marathi";
|
|
807
|
+
readonly visemetts: false;
|
|
808
|
+
readonly cartesia: true;
|
|
809
|
+
}, {
|
|
810
|
+
readonly code: "pa";
|
|
811
|
+
readonly label: "Punjabi";
|
|
812
|
+
readonly visemetts: false;
|
|
813
|
+
readonly cartesia: true;
|
|
814
|
+
}];
|
|
815
|
+
|
|
816
|
+
export declare const TTS_LANGUAGE_CODES: readonly TtsLanguage[];
|
|
817
|
+
|
|
523
818
|
export declare type TtsEngineId = typeof TTS_ENGINE_GOOGLE | typeof TTS_ENGINE_INWORLD | typeof TTS_ENGINE_CARTESIA | typeof TTS_ENGINE_VISEMETTS;
|
|
524
819
|
|
|
820
|
+
export declare type TtsLanguage = (typeof TTS_LANGUAGE_CATALOG)[number]["code"];
|
|
821
|
+
|
|
822
|
+
export declare function ttsLanguagesForEngine(engineId: TtsEngineId): TtsLanguage[];
|
|
823
|
+
|
|
525
824
|
/** Runtime face bundle URLs (R2 custom-faces or local /twins/…). */
|
|
526
825
|
export declare type TwinAssetUrls = {
|
|
527
826
|
/** Plain assets: sil.png, idle.mp4, atlas.json */
|
|
@@ -564,6 +863,11 @@ export declare type VoiceConnectOptions = {
|
|
|
564
863
|
ttsEngineId?: TtsEngineId;
|
|
565
864
|
/** Cartesia voice UUID, or visemetts name (e.g. `eve`). */
|
|
566
865
|
voiceId?: string;
|
|
866
|
+
/**
|
|
867
|
+
* Uniform TTS language code (`en`, `es-MX`, `auto`, …).
|
|
868
|
+
* Sent as `language` on `/ws/voice` and redirected `/avatar_ttsWithPoses` calls.
|
|
869
|
+
*/
|
|
870
|
+
language?: TtsLanguage;
|
|
567
871
|
/** Persona / knowledge context id (from getAiTwin `knowledgeContextId`). */
|
|
568
872
|
personaId?: string;
|
|
569
873
|
speakingRate?: number;
|