retiam 2.0.2 → 2.0.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/agent/AGENTS.md +4 -1
- package/agent/skill/SKILL.md +7 -4
- package/agent/skill/examples/NarratedMotion.ts +10 -2
- package/agent/skill/references/api.md +4 -2
- package/agent/skill/references/explainers.md +4 -2
- package/agent/skill/references/quality.md +3 -0
- package/agent/skill/references/tts.md +154 -60
- package/bin/lesson.js +39 -12
- package/dist/{UTIF-BrQ3Ng5l.min.js → UTIF-D6vx2UEX.min.js} +1 -1
- package/dist/{UTIF-CN0-pEnd.js → UTIF-mkffT70R.js} +1 -1
- package/dist/{index-yQIdejOj.js → index-CdBPrYbr.js} +3818 -3785
- package/dist/{index-3sAseSJQ.min.js → index-jgFyrc2D.min.js} +175 -175
- package/dist/libs/explainer/index.js +74 -73
- package/dist/libs/explainer/plan.js +162 -140
- package/dist/libs/explainer/types.d.ts +5 -0
- package/dist/libs/tts/animations/Speak.d.ts +13 -7
- package/dist/libs/tts/components/TTSNarrationComponent.d.ts +9 -7
- package/dist/libs/tts/core/TTSCache.d.ts +3 -3
- package/dist/libs/tts/core/TTSClient.d.ts +3 -3
- package/dist/libs/tts/core/types.d.ts +48 -6
- package/dist/libs/tts/index.d.ts +2 -1
- package/dist/libs/tts/index.js +165 -672
- package/dist/libs/tts/node/index.d.ts +10 -0
- package/dist/libs/tts/node/index.js +791 -0
- package/dist/libs/tts/providers/ElevenLabsTTSProvider.d.ts +30 -0
- package/dist/libs/tts/providers/ITTSProvider.d.ts +2 -2
- package/dist/libs/vite/index.js +1 -1
- package/dist/{main-lQwYAed8.min.js → main-Cc4QQbSK.min.js} +1 -1
- package/dist/{main-BTk_9jtl.js → main-DMu_5Qy7.js} +1 -1
- package/dist/{msEdgeV2-BLEnvPJa.js → msEdgeV2-D3w4Xsn-.js} +30 -29
- package/dist/retiam.es.js +1 -1
- package/dist/retiam.es.min.js +1 -1
- package/dist/src/engine/entities/composites/text/mathjaxInterop.d.ts +6 -0
- package/package.json +4 -2
- package/readme.md +20 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ElevenLabsGenerateOptions } from '../tts/core/types';
|
|
1
2
|
/** A visual profile is independent of the topic and teaching sequence. */
|
|
2
3
|
export type StyleId = 'mathematical' | 'excalidraw' | 'minimal' | 'cinematic';
|
|
3
4
|
export interface StyleProfile {
|
|
@@ -39,6 +40,8 @@ export interface LessonClaim {
|
|
|
39
40
|
export interface NarrationSegment {
|
|
40
41
|
id: string;
|
|
41
42
|
text: string;
|
|
43
|
+
/** Optional synthesis text with delivery tags; text remains clean for captions/cues. */
|
|
44
|
+
speechText?: string;
|
|
42
45
|
pauseAfterMs?: number;
|
|
43
46
|
}
|
|
44
47
|
/** Phrases are scoped to a segment. Repeated phrases require an explicit occurrence (1-based). */
|
|
@@ -73,6 +76,7 @@ export interface LessonPlan {
|
|
|
73
76
|
speed?: number;
|
|
74
77
|
pitch?: string;
|
|
75
78
|
volume?: number;
|
|
79
|
+
elevenlabs?: ElevenLabsGenerateOptions;
|
|
76
80
|
};
|
|
77
81
|
sources: LessonSource[];
|
|
78
82
|
claims?: LessonClaim[];
|
|
@@ -85,6 +89,7 @@ export interface TimedWord {
|
|
|
85
89
|
}
|
|
86
90
|
export interface SpeechAsset {
|
|
87
91
|
text: string;
|
|
92
|
+
speechText?: string;
|
|
88
93
|
durationMs: number;
|
|
89
94
|
words: TimedWord[];
|
|
90
95
|
url?: string;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { Animation, AnimOptions, Entity, Scene } from 'retiam';
|
|
2
2
|
import { Subtitles } from '../components/Subtitles';
|
|
3
|
-
import {
|
|
3
|
+
import { VoiceId, TTSAudioResult, ElevenLabsGenerateOptions } from '../core/types';
|
|
4
4
|
export interface SpeakOptions extends AnimOptions {
|
|
5
|
-
/**
|
|
6
|
-
voice?:
|
|
7
|
-
/** Speaking rate multiplier
|
|
5
|
+
/** Voice ID; omitted values use the active provider's default. */
|
|
6
|
+
voice?: VoiceId;
|
|
7
|
+
/** Speaking rate multiplier; omitted values inherit the provider default. */
|
|
8
8
|
speed?: number;
|
|
9
9
|
/** Pitch shift (for MsEdge TTS, e.g. "+0Hz", "+5st", "+10%"). */
|
|
10
10
|
pitch?: string | number;
|
|
11
|
+
/** Clean subtitle text when speech contains delivery or pronunciation tags. */
|
|
12
|
+
displayText?: string;
|
|
13
|
+
/** Per-utterance ElevenLabs delivery and model overrides. */
|
|
14
|
+
elevenlabs?: ElevenLabsGenerateOptions;
|
|
11
15
|
/** Optional Subtitles component to automatically synchronize closed captions. */
|
|
12
16
|
subtitles?: Subtitles;
|
|
13
17
|
/** Optional entity to animate with speaking micro-pulses. */
|
|
@@ -22,7 +26,7 @@ export interface SpeakOptions extends AnimOptions {
|
|
|
22
26
|
/**
|
|
23
27
|
* Retiam Animation for spoken narration.
|
|
24
28
|
*
|
|
25
|
-
* Synchronizes
|
|
29
|
+
* Synchronizes speech from the active provider, voiceover auto-ducking
|
|
26
30
|
* on Retiam's [[AudioManager]], timeline pacing, closed captions/subtitles, and entity micro-animations.
|
|
27
31
|
*
|
|
28
32
|
* @example
|
|
@@ -37,7 +41,7 @@ export interface SpeakOptions extends AnimOptions {
|
|
|
37
41
|
*/
|
|
38
42
|
export declare class Speak extends Animation {
|
|
39
43
|
readonly text: string;
|
|
40
|
-
readonly voice
|
|
44
|
+
readonly voice?: string;
|
|
41
45
|
readonly speed: number;
|
|
42
46
|
readonly pitch?: string | number;
|
|
43
47
|
readonly subtitles?: Subtitles;
|
|
@@ -46,6 +50,8 @@ export declare class Speak extends Animation {
|
|
|
46
50
|
readonly duckingRatio: number;
|
|
47
51
|
readonly volume: number;
|
|
48
52
|
private _audioResult;
|
|
53
|
+
private _audioTask;
|
|
54
|
+
private readonly _synthesisOptions;
|
|
49
55
|
private _isStarted;
|
|
50
56
|
private _baseScale;
|
|
51
57
|
constructor(text: string, options?: SpeakOptions);
|
|
@@ -64,7 +70,7 @@ export declare class Speak extends Animation {
|
|
|
64
70
|
/**
|
|
65
71
|
* High-level helper function to speak narration in a Retiam Scene.
|
|
66
72
|
*
|
|
67
|
-
* Synthesizes speech using
|
|
73
|
+
* Synthesizes speech using the active provider,
|
|
68
74
|
* synchronizes subtitles, ducks background music, and pauses scene progression
|
|
69
75
|
* for the duration of the audio.
|
|
70
76
|
*
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Component } from 'retiam';
|
|
2
|
-
import {
|
|
2
|
+
import { VoiceId, TTSAudioResult, TTSGenerateOptions, TTSPlaybackOptions, ElevenLabsGenerateOptions } from '../core/types';
|
|
3
3
|
export interface TTSNarrationOptions {
|
|
4
|
-
/**
|
|
5
|
-
voice?:
|
|
6
|
-
/**
|
|
4
|
+
/** Voice ID; omitted values use the active provider's default. */
|
|
5
|
+
voice?: VoiceId;
|
|
6
|
+
/** Speaking rate override; omitted values inherit the provider default. */
|
|
7
7
|
speed?: number;
|
|
8
|
+
elevenlabs?: ElevenLabsGenerateOptions;
|
|
8
9
|
/** Whether to visually pulse the entity's scale during speech. Defaults to true. */
|
|
9
10
|
animateSpeaking?: boolean;
|
|
10
11
|
/** Scale pulse amplitude during speech (e.g. 0.06 = ±6% pulse). Defaults to 0.05. */
|
|
@@ -19,12 +20,13 @@ export interface TTSNarrationOptions {
|
|
|
19
20
|
/**
|
|
20
21
|
* Retiam ECS Component that empowers any visual Entity with voice narration capabilities.
|
|
21
22
|
*
|
|
22
|
-
* Features
|
|
23
|
+
* Features speech synthesis through the active provider,
|
|
23
24
|
* voiceover ducking, and synchronized micro-interaction visual pulses while speaking.
|
|
24
25
|
*/
|
|
25
26
|
export declare class TTSNarrationComponent extends Component {
|
|
26
|
-
voice
|
|
27
|
-
speed
|
|
27
|
+
voice?: string;
|
|
28
|
+
speed?: number;
|
|
29
|
+
elevenlabs?: ElevenLabsGenerateOptions;
|
|
28
30
|
animateSpeaking: boolean;
|
|
29
31
|
pulseAmplitude: number;
|
|
30
32
|
pulseFrequency: number;
|
|
@@ -7,9 +7,9 @@ export declare class TTSCache {
|
|
|
7
7
|
private readonly cache;
|
|
8
8
|
constructor(maxSize?: number);
|
|
9
9
|
private static createKey;
|
|
10
|
-
get(text: string, voice: string, speed: number): TTSAudioResult | undefined;
|
|
11
|
-
set(text: string, voice: string, speed: number, result: TTSAudioResult): void;
|
|
12
|
-
has(text: string, voice: string, speed: number): boolean;
|
|
10
|
+
get(text: string, voice: string, speed: number, variant?: string): TTSAudioResult | undefined;
|
|
11
|
+
set(text: string, voice: string, speed: number, result: TTSAudioResult, variant?: string): void;
|
|
12
|
+
has(text: string, voice: string, speed: number, variant?: string): boolean;
|
|
13
13
|
clear(): void;
|
|
14
14
|
get size(): number;
|
|
15
15
|
}
|
|
@@ -34,7 +34,7 @@ export declare class TTSClient {
|
|
|
34
34
|
/** Releases provider resources and cached audio. */
|
|
35
35
|
dispose(): Promise<void>;
|
|
36
36
|
}
|
|
37
|
-
/** Global
|
|
37
|
+
/** Global speech facade for Retiam scenes. */
|
|
38
38
|
export declare class TTS {
|
|
39
39
|
/** Replaces the global client configuration and restores the built-in provider. */
|
|
40
40
|
static configure(config: TTSConfig): void;
|
|
@@ -46,7 +46,7 @@ export declare class TTS {
|
|
|
46
46
|
static get provider(): ITTSProvider;
|
|
47
47
|
/** Synthesizes text to speech. */
|
|
48
48
|
static synthesize(text: string, options?: TTSGenerateOptions): Promise<TTSAudioResult>;
|
|
49
|
-
/**
|
|
49
|
+
/** Legacy synthesis alias; follows the active provider. */
|
|
50
50
|
static msedge(text: string, options?: TTSGenerateOptions): Promise<TTSAudioResult>;
|
|
51
51
|
/** Streams synthesized speech sentence by sentence. */
|
|
52
52
|
static stream(text: string, options?: TTSGenerateOptions): AsyncGenerator<TTSStreamChunk>;
|
|
@@ -57,7 +57,7 @@ export declare class TTS {
|
|
|
57
57
|
}>;
|
|
58
58
|
/** Returns the active provider's voices. */
|
|
59
59
|
static getVoices(): VoiceInfo[];
|
|
60
|
-
/** Finds a
|
|
60
|
+
/** Finds a voice exposed by the active provider. */
|
|
61
61
|
static findVoice(query: string): VoiceInfo | undefined;
|
|
62
62
|
/** Recommended default voice. */
|
|
63
63
|
static readonly DEFAULT_VOICE: MsEdgeVoiceId;
|
|
@@ -4,7 +4,7 @@ import { AudioManager, VoiceoverOptions } from 'retiam';
|
|
|
4
4
|
* The open string union preserves autocomplete while accepting any current voice ID.
|
|
5
5
|
*/
|
|
6
6
|
export type MsEdgeVoiceId = "en-US-JennyNeural" | "en-US-GuyNeural" | "en-US-AriaNeural" | "en-US-AndrewNeural" | "en-US-AvaNeural" | "en-US-EmmaNeural" | "en-US-BrianNeural" | "en-US-ChristopherNeural" | "en-US-EricNeural" | "en-US-MichelleNeural" | "en-US-AnaNeural" | "en-US-SteffanNeural" | "en-US-AndrewMultilingualNeural" | "en-US-AvaMultilingualNeural" | "en-US-BrianMultilingualNeural" | "en-US-EmmaMultilingualNeural" | "en-GB-SoniaNeural" | "en-GB-RyanNeural" | "en-GB-LibbyNeural" | "en-GB-ThomasNeural" | "en-AU-NatashaNeural" | "en-AU-WilliamMultilingualNeural" | "en-CA-ClaraNeural" | "en-CA-LiamNeural" | "en-IN-NeerjaNeural" | "en-IN-PrabhatNeural" | "es-ES-ElviraNeural" | "fr-FR-DeniseNeural" | "fr-FR-HenriNeural" | "de-DE-KatjaNeural" | "de-DE-KillianNeural" | "it-IT-ElsaNeural" | "ja-JP-NanamiNeural" | "ja-JP-KeitaNeural" | "zh-CN-XiaoxiaoNeural" | "zh-CN-YunxiNeural" | (string & {});
|
|
7
|
-
/**
|
|
7
|
+
/** Provider voice identifier; preserves autocomplete for the built-in Edge voices. */
|
|
8
8
|
export type VoiceId = MsEdgeVoiceId;
|
|
9
9
|
/** Word or sentence timing metadata for synchronized captions. */
|
|
10
10
|
export interface WordBoundary {
|
|
@@ -18,13 +18,13 @@ export interface VoiceInfo {
|
|
|
18
18
|
id: string;
|
|
19
19
|
name: string;
|
|
20
20
|
language: string;
|
|
21
|
-
gender: "Female" | "Male";
|
|
21
|
+
gender: "Female" | "Male" | "Unknown";
|
|
22
22
|
traits?: string;
|
|
23
23
|
targetQuality?: string;
|
|
24
24
|
overallGrade?: string;
|
|
25
|
-
provider?: "msedge";
|
|
25
|
+
provider?: "msedge" | "elevenlabs";
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
27
|
+
/** Shared speech configuration and built-in Microsoft Edge settings. */
|
|
28
28
|
export interface TTSConfig {
|
|
29
29
|
/** Browser proxy endpoint. Defaults to "/api/tts/msedge". */
|
|
30
30
|
msedgeEndpoint?: string;
|
|
@@ -33,10 +33,48 @@ export interface TTSConfig {
|
|
|
33
33
|
/** Maximum utterances retained by the LRU cache. Defaults to 128. */
|
|
34
34
|
maxCacheSize?: number;
|
|
35
35
|
}
|
|
36
|
+
export type ElevenLabsModelId = "eleven_multilingual_v2" | "eleven_v3" | "eleven_v4" | "eleven_flash_v2_5" | "eleven_turbo_v2_5" | (string & {});
|
|
37
|
+
/** MP3 formats supported by the Retiam audio container and duration parser. */
|
|
38
|
+
export type ElevenLabsOutputFormat = "mp3_22050_32" | "mp3_24000_48" | "mp3_44100_32" | "mp3_44100_64" | "mp3_44100_96" | "mp3_44100_128" | "mp3_44100_192";
|
|
39
|
+
/** Settings are model-dependent; omitted fields use the voice's stored settings. */
|
|
40
|
+
export interface ElevenLabsVoiceSettings {
|
|
41
|
+
stability?: number;
|
|
42
|
+
similarityBoost?: number;
|
|
43
|
+
style?: number;
|
|
44
|
+
useSpeakerBoost?: boolean;
|
|
45
|
+
/** Speaking-rate multiplier, from 0.7 to 1.2. */
|
|
46
|
+
speed?: number;
|
|
47
|
+
}
|
|
48
|
+
export interface ElevenLabsGenerateOptions {
|
|
49
|
+
modelId?: ElevenLabsModelId;
|
|
50
|
+
voiceSettings?: ElevenLabsVoiceSettings;
|
|
51
|
+
languageCode?: string;
|
|
52
|
+
seed?: number;
|
|
53
|
+
previousText?: string;
|
|
54
|
+
nextText?: string;
|
|
55
|
+
applyTextNormalization?: "auto" | "on" | "off";
|
|
56
|
+
pronunciationDictionaries?: {
|
|
57
|
+
id: string;
|
|
58
|
+
versionId?: string;
|
|
59
|
+
}[];
|
|
60
|
+
}
|
|
61
|
+
/** Passed directly to ElevenLabsTTSProvider.init(); no Vite plugin is required. */
|
|
62
|
+
export interface ElevenLabsTTSConfig extends TTSConfig, ElevenLabsGenerateOptions {
|
|
63
|
+
/** Caller-supplied credential, retained only by this provider instance. */
|
|
64
|
+
apiKey?: string;
|
|
65
|
+
/** Default ElevenLabs voice ID. May also be supplied per utterance. */
|
|
66
|
+
voiceId?: string;
|
|
67
|
+
/** Defaults to https://api.elevenlabs.io. */
|
|
68
|
+
baseUrl?: string;
|
|
69
|
+
/** Defaults to mp3_44100_128. */
|
|
70
|
+
outputFormat?: ElevenLabsOutputFormat;
|
|
71
|
+
/** Request timeout, including response download. Defaults to 90000 ms. */
|
|
72
|
+
timeoutMs?: number;
|
|
73
|
+
}
|
|
36
74
|
/** Per-utterance synthesis options. */
|
|
37
75
|
export interface TTSGenerateOptions {
|
|
38
|
-
/**
|
|
39
|
-
voice?:
|
|
76
|
+
/** Voice ID; defaults to the active provider's configured voice. */
|
|
77
|
+
voice?: VoiceId;
|
|
40
78
|
/** Speaking-rate multiplier. Defaults to 1.0. */
|
|
41
79
|
speed?: number;
|
|
42
80
|
/** SSML pitch shift such as "+0Hz", "+5st", or "+10%". */
|
|
@@ -45,6 +83,10 @@ export interface TTSGenerateOptions {
|
|
|
45
83
|
volume?: string | number;
|
|
46
84
|
/** Custom sentence splitter for progressive streaming. */
|
|
47
85
|
splitPattern?: RegExp;
|
|
86
|
+
/** Caption text when synthesis text contains delivery tags or pronunciation markup. */
|
|
87
|
+
displayText?: string;
|
|
88
|
+
/** ElevenLabs model, delivery, pronunciation, and continuity overrides. */
|
|
89
|
+
elevenlabs?: ElevenLabsGenerateOptions;
|
|
48
90
|
}
|
|
49
91
|
/** Playback options for Retiam's voiceover bus. */
|
|
50
92
|
export interface TTSPlaybackOptions extends VoiceoverOptions {
|
package/dist/libs/tts/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Retiam
|
|
2
|
+
* Retiam speech synthesis, expressive narration, and subtitles with Edge and ElevenLabs.
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
@@ -11,6 +11,7 @@ export * from './core/TTSCache';
|
|
|
11
11
|
export * from './core/TTSClient';
|
|
12
12
|
export * from './providers/ITTSProvider';
|
|
13
13
|
export * from './providers/MsEdgeTTSProvider';
|
|
14
|
+
export * from './providers/ElevenLabsTTSProvider';
|
|
14
15
|
export * from './components/TTSNarrationComponent';
|
|
15
16
|
export * from './components/Subtitles';
|
|
16
17
|
export * from './animations/Speak';
|