@framers/agentos-ext-streaming-tts-elevenlabs 0.2.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/LICENSE +23 -0
- package/SKILL.md +65 -0
- package/dist/ElevenLabsStreamingTTS.d.ts +64 -0
- package/dist/ElevenLabsStreamingTTS.d.ts.map +1 -0
- package/dist/ElevenLabsStreamingTTS.js +91 -0
- package/dist/ElevenLabsStreamingTTS.js.map +1 -0
- package/dist/ElevenLabsTTSSession.d.ts +147 -0
- package/dist/ElevenLabsTTSSession.d.ts.map +1 -0
- package/dist/ElevenLabsTTSSession.js +334 -0
- package/dist/ElevenLabsTTSSession.js.map +1 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +88 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +120 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/manifest.json +8 -0
- package/package.json +45 -0
- package/src/ElevenLabsStreamingTTS.ts +100 -0
- package/src/ElevenLabsTTSSession.ts +385 -0
- package/src/index.ts +125 -0
- package/src/types.ts +132 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file types.ts
|
|
3
|
+
* @description ElevenLabs-specific configuration types for the streaming TTS extension pack.
|
|
4
|
+
*
|
|
5
|
+
* These types define provider configuration for the ElevenLabs WebSocket Streaming API and
|
|
6
|
+
* the shared audio chunk shape emitted by the session.
|
|
7
|
+
*
|
|
8
|
+
* @module streaming-tts-elevenlabs/types
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* ElevenLabs-specific configuration for the streaming TTS session.
|
|
13
|
+
*
|
|
14
|
+
* All fields except `apiKey` are optional — sensible defaults are applied when omitted.
|
|
15
|
+
* The `apiKey` field is required and must be a valid ElevenLabs API key (xi-api-key).
|
|
16
|
+
*/
|
|
17
|
+
export interface ElevenLabsStreamingTTSConfig {
|
|
18
|
+
/**
|
|
19
|
+
* ElevenLabs API key (xi-api-key). Must be set to a non-empty string; the pack reads
|
|
20
|
+
* this from the `ELEVENLABS_API_KEY` secret when constructed via {@link createExtensionPack}.
|
|
21
|
+
*/
|
|
22
|
+
apiKey: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* ElevenLabs voice ID to use for synthesis.
|
|
26
|
+
*
|
|
27
|
+
* Find voice IDs in the ElevenLabs voice library or via the Voices API.
|
|
28
|
+
* @defaultValue '21m00Tcm4TlvDq8ikWAM' (Rachel — a neutral English voice)
|
|
29
|
+
* @see {@link https://elevenlabs.io/voice-library}
|
|
30
|
+
*/
|
|
31
|
+
voiceId?: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* ElevenLabs model ID to use for synthesis.
|
|
35
|
+
*
|
|
36
|
+
* - `eleven_turbo_v2` — optimized for low latency (~250 ms to first chunk).
|
|
37
|
+
* - `eleven_multilingual_v2` — highest quality, supports 29 languages.
|
|
38
|
+
* - `eleven_monolingual_v1` — English-only, balanced latency/quality.
|
|
39
|
+
*
|
|
40
|
+
* @defaultValue 'eleven_turbo_v2'
|
|
41
|
+
* @see {@link https://elevenlabs.io/docs/speech-synthesis/models}
|
|
42
|
+
*/
|
|
43
|
+
modelId?: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Voice stability (0.0 – 1.0).
|
|
47
|
+
*
|
|
48
|
+
* Lower values produce more expressive and varied speech; higher values are more
|
|
49
|
+
* consistent and monotone.
|
|
50
|
+
* @defaultValue 0.5
|
|
51
|
+
*/
|
|
52
|
+
stability?: number;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Similarity boost (0.0 – 1.0).
|
|
56
|
+
*
|
|
57
|
+
* Higher values cause the output to sound more similar to the original voice clone.
|
|
58
|
+
* Too high a value can introduce artefacts.
|
|
59
|
+
* @defaultValue 0.75
|
|
60
|
+
*/
|
|
61
|
+
similarityBoost?: number;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Style exaggeration (0.0 – 1.0).
|
|
65
|
+
*
|
|
66
|
+
* Amplifies the style of the original speaker. Increasing this setting may reduce
|
|
67
|
+
* overall generation speed. Only available for v2 models.
|
|
68
|
+
* @defaultValue 0.0
|
|
69
|
+
*/
|
|
70
|
+
style?: number;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Speaker boost.
|
|
74
|
+
*
|
|
75
|
+
* Boosts similarity to the original speaker. Recommended when a cloned voice is
|
|
76
|
+
* used and maximum fidelity is needed.
|
|
77
|
+
* @defaultValue true
|
|
78
|
+
*/
|
|
79
|
+
useSpeakerBoost?: boolean;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Generic streaming TTS session config forwarded from the voice pipeline.
|
|
84
|
+
*
|
|
85
|
+
* This is the provider-agnostic shape the AgentOS voice pipeline passes to
|
|
86
|
+
* {@link ElevenLabsStreamingTTS.startSession}.
|
|
87
|
+
*/
|
|
88
|
+
export interface StreamingTTSConfig {
|
|
89
|
+
/** Language / locale hint (e.g. `'en-US'`). Currently informational only for ElevenLabs. */
|
|
90
|
+
language?: string;
|
|
91
|
+
/** Provider-specific options forwarded verbatim to the adapter. */
|
|
92
|
+
providerOptions?: Record<string, unknown>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* A single chunk of synthesized audio emitted by {@link ElevenLabsTTSSession}.
|
|
97
|
+
*
|
|
98
|
+
* The `audio` field holds raw MP3 bytes returned by the ElevenLabs WebSocket stream.
|
|
99
|
+
* The `format` field is always `'mp3'` for this provider.
|
|
100
|
+
*/
|
|
101
|
+
export interface EncodedAudioChunk {
|
|
102
|
+
/** Raw audio bytes encoded as MP3. */
|
|
103
|
+
audio: Buffer;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Codec / container format. Always `'mp3'` for ElevenLabs streaming output.
|
|
107
|
+
*/
|
|
108
|
+
format: string;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Nominal sample rate of the audio, in Hz.
|
|
112
|
+
*
|
|
113
|
+
* ElevenLabs streaming returns 44.1 kHz MP3 audio when `output_format=mp3_44100_128`.
|
|
114
|
+
*/
|
|
115
|
+
sampleRate: number;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Rough estimated playback duration in milliseconds.
|
|
119
|
+
*
|
|
120
|
+
* Computed heuristically from the current text buffer word count (~150 WPM) rather than
|
|
121
|
+
* decoding the audio, so callers should treat this as a hint rather than a precise value.
|
|
122
|
+
*/
|
|
123
|
+
durationMs: number;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The input text associated with this audio chunk.
|
|
127
|
+
*
|
|
128
|
+
* For mid-stream binary chunks this is an empty string; ElevenLabs does not embed
|
|
129
|
+
* alignment data in the binary WebSocket messages.
|
|
130
|
+
*/
|
|
131
|
+
text: string;
|
|
132
|
+
}
|