ssml-builder-js 2.12.0 → 2.13.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/README.md +26 -1
- package/dist/{chunk-4BVNAUVR.mjs → chunk-25LOR4AJ.mjs} +134 -10
- package/dist/chunk-25LOR4AJ.mjs.map +1 -0
- package/dist/chunk-CZ2F3TET.mjs +1745 -0
- package/dist/chunk-CZ2F3TET.mjs.map +1 -0
- package/dist/{chunk-FHDFRM2F.mjs → chunk-LCTE26LS.mjs} +248 -1722
- package/dist/chunk-LCTE26LS.mjs.map +1 -0
- package/dist/core.d.mts +45 -3
- package/dist/core.d.ts +45 -3
- package/dist/core.js +133 -9
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +1 -1
- package/dist/elements.js +118 -1
- package/dist/elements.js.map +1 -1
- package/dist/elements.mjs +6 -4
- package/dist/elements.mjs.map +1 -1
- package/dist/index.d-Xbr6ZWnK.d.mts +214 -0
- package/dist/index.d-Xbr6ZWnK.d.ts +214 -0
- package/dist/index.d.mts +95 -2
- package/dist/index.d.ts +95 -2
- package/dist/index.js +1732 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +135 -4
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +61 -163
- package/dist/react.d.ts +61 -163
- package/dist/react.js +397 -15
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +139 -18
- package/dist/react.mjs.map +1 -1
- package/package.json +3 -2
- package/dist/chunk-4BVNAUVR.mjs.map +0 -1
- package/dist/chunk-FHDFRM2F.mjs.map +0 -1
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
type SsmlAttributeValue = string | number;
|
|
2
|
+
type SsmlAttributes = Record<string, SsmlAttributeValue>;
|
|
3
|
+
interface SsmlText {
|
|
4
|
+
type: "text";
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
type SsmlNode = string | SsmlText | SsmlElement;
|
|
8
|
+
interface SsmlElementBase {
|
|
9
|
+
children?: SsmlNode[];
|
|
10
|
+
attributes?: SsmlAttributes;
|
|
11
|
+
}
|
|
12
|
+
interface VoiceElement extends SsmlElementBase {
|
|
13
|
+
type: "voice";
|
|
14
|
+
name?: string;
|
|
15
|
+
effect?: string;
|
|
16
|
+
}
|
|
17
|
+
interface ProsodyElement extends SsmlElementBase {
|
|
18
|
+
type: "prosody";
|
|
19
|
+
rate?: SsmlAttributeValue;
|
|
20
|
+
pitch?: SsmlAttributeValue;
|
|
21
|
+
volume?: SsmlAttributeValue;
|
|
22
|
+
contour?: string;
|
|
23
|
+
range?: SsmlAttributeValue;
|
|
24
|
+
}
|
|
25
|
+
interface BreakElement extends SsmlElementBase {
|
|
26
|
+
type: "break";
|
|
27
|
+
time?: SsmlAttributeValue;
|
|
28
|
+
strength?: string;
|
|
29
|
+
}
|
|
30
|
+
interface ExpressAsElement extends SsmlElementBase {
|
|
31
|
+
type: "express-as" | "expressAs" | "mstts:express-as";
|
|
32
|
+
style?: string;
|
|
33
|
+
styleDegree?: SsmlAttributeValue;
|
|
34
|
+
role?: string;
|
|
35
|
+
}
|
|
36
|
+
interface SayAsElement extends SsmlElementBase {
|
|
37
|
+
type: "say-as" | "sayAs";
|
|
38
|
+
interpretAs?: string;
|
|
39
|
+
format?: string;
|
|
40
|
+
detail?: string;
|
|
41
|
+
}
|
|
42
|
+
interface PhonemeElement extends SsmlElementBase {
|
|
43
|
+
type: "phoneme";
|
|
44
|
+
alphabet?: string;
|
|
45
|
+
ph?: string;
|
|
46
|
+
}
|
|
47
|
+
interface EmphasisElement extends SsmlElementBase {
|
|
48
|
+
type: "emphasis";
|
|
49
|
+
level?: string;
|
|
50
|
+
}
|
|
51
|
+
interface AudioElement extends SsmlElementBase {
|
|
52
|
+
type: "audio";
|
|
53
|
+
src?: string;
|
|
54
|
+
desc?: string;
|
|
55
|
+
clipBegin?: SsmlAttributeValue;
|
|
56
|
+
clipEnd?: SsmlAttributeValue;
|
|
57
|
+
speed?: SsmlAttributeValue;
|
|
58
|
+
repeatCount?: SsmlAttributeValue;
|
|
59
|
+
repeatDuration?: SsmlAttributeValue;
|
|
60
|
+
soundLevel?: SsmlAttributeValue;
|
|
61
|
+
}
|
|
62
|
+
interface SubElement extends SsmlElementBase {
|
|
63
|
+
type: "sub";
|
|
64
|
+
alias?: string;
|
|
65
|
+
}
|
|
66
|
+
interface LangElement extends SsmlElementBase {
|
|
67
|
+
type: "lang";
|
|
68
|
+
lang?: string;
|
|
69
|
+
}
|
|
70
|
+
interface MarkElement extends SsmlElementBase {
|
|
71
|
+
type: "mark";
|
|
72
|
+
name?: string;
|
|
73
|
+
}
|
|
74
|
+
interface BookmarkElement extends SsmlElementBase {
|
|
75
|
+
type: "bookmark";
|
|
76
|
+
mark?: string;
|
|
77
|
+
}
|
|
78
|
+
interface LexiconElement extends SsmlElementBase {
|
|
79
|
+
type: "lexicon";
|
|
80
|
+
uri?: string;
|
|
81
|
+
}
|
|
82
|
+
interface ParagraphElement extends SsmlElementBase {
|
|
83
|
+
type: "p";
|
|
84
|
+
}
|
|
85
|
+
interface SentenceElement extends SsmlElementBase {
|
|
86
|
+
type: "s";
|
|
87
|
+
}
|
|
88
|
+
interface WordElement extends SsmlElementBase {
|
|
89
|
+
type: "w";
|
|
90
|
+
}
|
|
91
|
+
interface MsttsSilenceElement extends SsmlElementBase {
|
|
92
|
+
type: "mstts:silence" | "silence";
|
|
93
|
+
typeValue?: string;
|
|
94
|
+
silenceType?: string;
|
|
95
|
+
value?: SsmlAttributeValue;
|
|
96
|
+
}
|
|
97
|
+
interface MsttsVisemeElement extends SsmlElementBase {
|
|
98
|
+
type: "mstts:viseme" | "viseme";
|
|
99
|
+
typeValue?: string;
|
|
100
|
+
visemeType?: string;
|
|
101
|
+
}
|
|
102
|
+
interface MsttsAudioDurationElement extends SsmlElementBase {
|
|
103
|
+
type: "mstts:audioduration";
|
|
104
|
+
value?: SsmlAttributeValue;
|
|
105
|
+
}
|
|
106
|
+
interface SsmlDialogNode extends SsmlElementBase {
|
|
107
|
+
type: "mstts:dialog";
|
|
108
|
+
}
|
|
109
|
+
interface SsmlTurnNode extends SsmlElementBase {
|
|
110
|
+
type: "mstts:turn";
|
|
111
|
+
voice?: string;
|
|
112
|
+
speaker?: string;
|
|
113
|
+
}
|
|
114
|
+
interface SsmlBackgroundAudioNode extends SsmlElementBase {
|
|
115
|
+
type: "mstts:backgroundaudio";
|
|
116
|
+
src?: string;
|
|
117
|
+
volume?: SsmlAttributeValue;
|
|
118
|
+
fadeIn?: SsmlAttributeValue;
|
|
119
|
+
fadeOut?: SsmlAttributeValue;
|
|
120
|
+
/** XML spelling aliases retained for ergonomic object construction. */
|
|
121
|
+
fadein?: SsmlAttributeValue;
|
|
122
|
+
fadeout?: SsmlAttributeValue;
|
|
123
|
+
}
|
|
124
|
+
interface MsttsTtsEmbeddingElement extends SsmlElementBase {
|
|
125
|
+
type: "mstts:ttsembedding";
|
|
126
|
+
speakerProfileId?: string;
|
|
127
|
+
}
|
|
128
|
+
interface MsttsEmbeddingElement extends SsmlElementBase {
|
|
129
|
+
type: "mstts:embedding";
|
|
130
|
+
id?: string;
|
|
131
|
+
speakerProfileId?: string;
|
|
132
|
+
}
|
|
133
|
+
interface MsttsVoiceConversionElement extends SsmlElementBase {
|
|
134
|
+
type: "mstts:voiceconversion";
|
|
135
|
+
url?: string;
|
|
136
|
+
profile?: string;
|
|
137
|
+
speakerProfileId?: string;
|
|
138
|
+
}
|
|
139
|
+
interface CustomElement extends SsmlElementBase {
|
|
140
|
+
type: "custom" | "element";
|
|
141
|
+
name: string;
|
|
142
|
+
}
|
|
143
|
+
type SsmlElement = VoiceElement | ProsodyElement | BreakElement | ExpressAsElement | SayAsElement | PhonemeElement | EmphasisElement | AudioElement | SubElement | LangElement | MarkElement | BookmarkElement | LexiconElement | ParagraphElement | SentenceElement | WordElement | MsttsSilenceElement | MsttsVisemeElement | MsttsAudioDurationElement | SsmlDialogNode | SsmlTurnNode | SsmlBackgroundAudioNode | MsttsTtsEmbeddingElement | MsttsEmbeddingElement | MsttsVoiceConversionElement | CustomElement;
|
|
144
|
+
interface SsmlDocument {
|
|
145
|
+
type?: "speak";
|
|
146
|
+
version: string;
|
|
147
|
+
lang: string;
|
|
148
|
+
children?: SsmlNode[];
|
|
149
|
+
/** @deprecated Use children to represent the document body. */
|
|
150
|
+
content?: string;
|
|
151
|
+
attributes?: SsmlAttributes;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
type SsmlDiagnosticSeverity = "error" | "warning" | "info";
|
|
155
|
+
type SsmlDiagnosticSource = "ssml-static-validator";
|
|
156
|
+
type AzureDiagnosticCode = "azure-unknown-voice" | "azure-unsupported-style" | "azure-locale-mismatch" | "azure-unsupported-tag-for-voice" | "azure-unsupported-model-for-voice" | "azure-preview-voice" | "azure-deprecated-voice" | "azure-preview-tag" | "azure-deprecated-tag";
|
|
157
|
+
interface SsmlDiagnostic {
|
|
158
|
+
code?: AzureDiagnosticCode;
|
|
159
|
+
line: number;
|
|
160
|
+
column: number;
|
|
161
|
+
message: string;
|
|
162
|
+
severity: SsmlDiagnosticSeverity;
|
|
163
|
+
source: SsmlDiagnosticSource;
|
|
164
|
+
}
|
|
165
|
+
interface AzureVoiceDefinition {
|
|
166
|
+
name: string;
|
|
167
|
+
locale: string;
|
|
168
|
+
secondaryLocales?: readonly string[];
|
|
169
|
+
styles?: readonly string[];
|
|
170
|
+
supportedTags?: readonly string[];
|
|
171
|
+
unsupportedTags?: readonly string[];
|
|
172
|
+
models?: readonly string[];
|
|
173
|
+
regions?: readonly string[];
|
|
174
|
+
status?: "ga" | "preview" | "deprecated";
|
|
175
|
+
}
|
|
176
|
+
interface AzureValidationOptions {
|
|
177
|
+
allowedAudioOrigins?: readonly string[];
|
|
178
|
+
allowExternalAudio?: boolean;
|
|
179
|
+
allowHttpAudio?: boolean;
|
|
180
|
+
customVoiceStyleMap?: Record<string, readonly string[]>;
|
|
181
|
+
customVoiceDefinitions?: readonly AzureVoiceDefinition[];
|
|
182
|
+
/** Host-side validation hook for URL-bearing SSML attributes. */
|
|
183
|
+
urlValidator?: AzureUrlValidator;
|
|
184
|
+
/** Alias for urlValidator retained for applications that use the longer name. */
|
|
185
|
+
customUrlValidator?: AzureUrlValidator;
|
|
186
|
+
languageAliases?: Record<string, string | readonly string[]>;
|
|
187
|
+
maxLength?: number;
|
|
188
|
+
/** Maximum XML element nesting depth, counting `<speak>` as depth 1. */
|
|
189
|
+
maxXmlDepth?: number;
|
|
190
|
+
/** Optional model identifier used to validate a voice's model compatibility. */
|
|
191
|
+
model?: string;
|
|
192
|
+
normalizeLanguage?: (lang: string) => string;
|
|
193
|
+
/** Overrides the built-in preview tag list for this validation run. */
|
|
194
|
+
previewTags?: readonly string[];
|
|
195
|
+
/** Adds tags that should be reported as deprecated for this validation run. */
|
|
196
|
+
deprecatedTags?: readonly string[];
|
|
197
|
+
/** Explicit tag lifecycle metadata. This takes precedence over previewTags/deprecatedTags. */
|
|
198
|
+
tagStatuses?: Readonly<Record<string, "ga" | "preview" | "deprecated">>;
|
|
199
|
+
unknownVoicePolicy?: "error" | "warn" | "ignore";
|
|
200
|
+
unsupportedStylePolicy?: "error" | "warn" | "ignore";
|
|
201
|
+
validateNestedVoices?: boolean;
|
|
202
|
+
voiceCatalog?: readonly AzureVoiceDefinition[];
|
|
203
|
+
voiceDefinitions?: readonly AzureVoiceDefinition[];
|
|
204
|
+
}
|
|
205
|
+
type AzureUrlValidationResult = boolean | {
|
|
206
|
+
valid: boolean;
|
|
207
|
+
reason?: string;
|
|
208
|
+
};
|
|
209
|
+
type AzureUrlValidator = (url: string, context: {
|
|
210
|
+
tag: string;
|
|
211
|
+
attribute: string;
|
|
212
|
+
}) => AzureUrlValidationResult | Promise<AzureUrlValidationResult>;
|
|
213
|
+
|
|
214
|
+
export type { AzureValidationOptions as A, SsmlDiagnostic as S, SsmlDocument as a, SsmlElement as b };
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
type SsmlAttributeValue = string | number;
|
|
2
|
+
type SsmlAttributes = Record<string, SsmlAttributeValue>;
|
|
3
|
+
interface SsmlText {
|
|
4
|
+
type: "text";
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
type SsmlNode = string | SsmlText | SsmlElement;
|
|
8
|
+
interface SsmlElementBase {
|
|
9
|
+
children?: SsmlNode[];
|
|
10
|
+
attributes?: SsmlAttributes;
|
|
11
|
+
}
|
|
12
|
+
interface VoiceElement extends SsmlElementBase {
|
|
13
|
+
type: "voice";
|
|
14
|
+
name?: string;
|
|
15
|
+
effect?: string;
|
|
16
|
+
}
|
|
17
|
+
interface ProsodyElement extends SsmlElementBase {
|
|
18
|
+
type: "prosody";
|
|
19
|
+
rate?: SsmlAttributeValue;
|
|
20
|
+
pitch?: SsmlAttributeValue;
|
|
21
|
+
volume?: SsmlAttributeValue;
|
|
22
|
+
contour?: string;
|
|
23
|
+
range?: SsmlAttributeValue;
|
|
24
|
+
}
|
|
25
|
+
interface BreakElement extends SsmlElementBase {
|
|
26
|
+
type: "break";
|
|
27
|
+
time?: SsmlAttributeValue;
|
|
28
|
+
strength?: string;
|
|
29
|
+
}
|
|
30
|
+
interface ExpressAsElement extends SsmlElementBase {
|
|
31
|
+
type: "express-as" | "expressAs" | "mstts:express-as";
|
|
32
|
+
style?: string;
|
|
33
|
+
styleDegree?: SsmlAttributeValue;
|
|
34
|
+
role?: string;
|
|
35
|
+
}
|
|
36
|
+
interface SayAsElement extends SsmlElementBase {
|
|
37
|
+
type: "say-as" | "sayAs";
|
|
38
|
+
interpretAs?: string;
|
|
39
|
+
format?: string;
|
|
40
|
+
detail?: string;
|
|
41
|
+
}
|
|
42
|
+
interface PhonemeElement extends SsmlElementBase {
|
|
43
|
+
type: "phoneme";
|
|
44
|
+
alphabet?: string;
|
|
45
|
+
ph?: string;
|
|
46
|
+
}
|
|
47
|
+
interface EmphasisElement extends SsmlElementBase {
|
|
48
|
+
type: "emphasis";
|
|
49
|
+
level?: string;
|
|
50
|
+
}
|
|
51
|
+
interface AudioElement extends SsmlElementBase {
|
|
52
|
+
type: "audio";
|
|
53
|
+
src?: string;
|
|
54
|
+
desc?: string;
|
|
55
|
+
clipBegin?: SsmlAttributeValue;
|
|
56
|
+
clipEnd?: SsmlAttributeValue;
|
|
57
|
+
speed?: SsmlAttributeValue;
|
|
58
|
+
repeatCount?: SsmlAttributeValue;
|
|
59
|
+
repeatDuration?: SsmlAttributeValue;
|
|
60
|
+
soundLevel?: SsmlAttributeValue;
|
|
61
|
+
}
|
|
62
|
+
interface SubElement extends SsmlElementBase {
|
|
63
|
+
type: "sub";
|
|
64
|
+
alias?: string;
|
|
65
|
+
}
|
|
66
|
+
interface LangElement extends SsmlElementBase {
|
|
67
|
+
type: "lang";
|
|
68
|
+
lang?: string;
|
|
69
|
+
}
|
|
70
|
+
interface MarkElement extends SsmlElementBase {
|
|
71
|
+
type: "mark";
|
|
72
|
+
name?: string;
|
|
73
|
+
}
|
|
74
|
+
interface BookmarkElement extends SsmlElementBase {
|
|
75
|
+
type: "bookmark";
|
|
76
|
+
mark?: string;
|
|
77
|
+
}
|
|
78
|
+
interface LexiconElement extends SsmlElementBase {
|
|
79
|
+
type: "lexicon";
|
|
80
|
+
uri?: string;
|
|
81
|
+
}
|
|
82
|
+
interface ParagraphElement extends SsmlElementBase {
|
|
83
|
+
type: "p";
|
|
84
|
+
}
|
|
85
|
+
interface SentenceElement extends SsmlElementBase {
|
|
86
|
+
type: "s";
|
|
87
|
+
}
|
|
88
|
+
interface WordElement extends SsmlElementBase {
|
|
89
|
+
type: "w";
|
|
90
|
+
}
|
|
91
|
+
interface MsttsSilenceElement extends SsmlElementBase {
|
|
92
|
+
type: "mstts:silence" | "silence";
|
|
93
|
+
typeValue?: string;
|
|
94
|
+
silenceType?: string;
|
|
95
|
+
value?: SsmlAttributeValue;
|
|
96
|
+
}
|
|
97
|
+
interface MsttsVisemeElement extends SsmlElementBase {
|
|
98
|
+
type: "mstts:viseme" | "viseme";
|
|
99
|
+
typeValue?: string;
|
|
100
|
+
visemeType?: string;
|
|
101
|
+
}
|
|
102
|
+
interface MsttsAudioDurationElement extends SsmlElementBase {
|
|
103
|
+
type: "mstts:audioduration";
|
|
104
|
+
value?: SsmlAttributeValue;
|
|
105
|
+
}
|
|
106
|
+
interface SsmlDialogNode extends SsmlElementBase {
|
|
107
|
+
type: "mstts:dialog";
|
|
108
|
+
}
|
|
109
|
+
interface SsmlTurnNode extends SsmlElementBase {
|
|
110
|
+
type: "mstts:turn";
|
|
111
|
+
voice?: string;
|
|
112
|
+
speaker?: string;
|
|
113
|
+
}
|
|
114
|
+
interface SsmlBackgroundAudioNode extends SsmlElementBase {
|
|
115
|
+
type: "mstts:backgroundaudio";
|
|
116
|
+
src?: string;
|
|
117
|
+
volume?: SsmlAttributeValue;
|
|
118
|
+
fadeIn?: SsmlAttributeValue;
|
|
119
|
+
fadeOut?: SsmlAttributeValue;
|
|
120
|
+
/** XML spelling aliases retained for ergonomic object construction. */
|
|
121
|
+
fadein?: SsmlAttributeValue;
|
|
122
|
+
fadeout?: SsmlAttributeValue;
|
|
123
|
+
}
|
|
124
|
+
interface MsttsTtsEmbeddingElement extends SsmlElementBase {
|
|
125
|
+
type: "mstts:ttsembedding";
|
|
126
|
+
speakerProfileId?: string;
|
|
127
|
+
}
|
|
128
|
+
interface MsttsEmbeddingElement extends SsmlElementBase {
|
|
129
|
+
type: "mstts:embedding";
|
|
130
|
+
id?: string;
|
|
131
|
+
speakerProfileId?: string;
|
|
132
|
+
}
|
|
133
|
+
interface MsttsVoiceConversionElement extends SsmlElementBase {
|
|
134
|
+
type: "mstts:voiceconversion";
|
|
135
|
+
url?: string;
|
|
136
|
+
profile?: string;
|
|
137
|
+
speakerProfileId?: string;
|
|
138
|
+
}
|
|
139
|
+
interface CustomElement extends SsmlElementBase {
|
|
140
|
+
type: "custom" | "element";
|
|
141
|
+
name: string;
|
|
142
|
+
}
|
|
143
|
+
type SsmlElement = VoiceElement | ProsodyElement | BreakElement | ExpressAsElement | SayAsElement | PhonemeElement | EmphasisElement | AudioElement | SubElement | LangElement | MarkElement | BookmarkElement | LexiconElement | ParagraphElement | SentenceElement | WordElement | MsttsSilenceElement | MsttsVisemeElement | MsttsAudioDurationElement | SsmlDialogNode | SsmlTurnNode | SsmlBackgroundAudioNode | MsttsTtsEmbeddingElement | MsttsEmbeddingElement | MsttsVoiceConversionElement | CustomElement;
|
|
144
|
+
interface SsmlDocument {
|
|
145
|
+
type?: "speak";
|
|
146
|
+
version: string;
|
|
147
|
+
lang: string;
|
|
148
|
+
children?: SsmlNode[];
|
|
149
|
+
/** @deprecated Use children to represent the document body. */
|
|
150
|
+
content?: string;
|
|
151
|
+
attributes?: SsmlAttributes;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
type SsmlDiagnosticSeverity = "error" | "warning" | "info";
|
|
155
|
+
type SsmlDiagnosticSource = "ssml-static-validator";
|
|
156
|
+
type AzureDiagnosticCode = "azure-unknown-voice" | "azure-unsupported-style" | "azure-locale-mismatch" | "azure-unsupported-tag-for-voice" | "azure-unsupported-model-for-voice" | "azure-preview-voice" | "azure-deprecated-voice" | "azure-preview-tag" | "azure-deprecated-tag";
|
|
157
|
+
interface SsmlDiagnostic {
|
|
158
|
+
code?: AzureDiagnosticCode;
|
|
159
|
+
line: number;
|
|
160
|
+
column: number;
|
|
161
|
+
message: string;
|
|
162
|
+
severity: SsmlDiagnosticSeverity;
|
|
163
|
+
source: SsmlDiagnosticSource;
|
|
164
|
+
}
|
|
165
|
+
interface AzureVoiceDefinition {
|
|
166
|
+
name: string;
|
|
167
|
+
locale: string;
|
|
168
|
+
secondaryLocales?: readonly string[];
|
|
169
|
+
styles?: readonly string[];
|
|
170
|
+
supportedTags?: readonly string[];
|
|
171
|
+
unsupportedTags?: readonly string[];
|
|
172
|
+
models?: readonly string[];
|
|
173
|
+
regions?: readonly string[];
|
|
174
|
+
status?: "ga" | "preview" | "deprecated";
|
|
175
|
+
}
|
|
176
|
+
interface AzureValidationOptions {
|
|
177
|
+
allowedAudioOrigins?: readonly string[];
|
|
178
|
+
allowExternalAudio?: boolean;
|
|
179
|
+
allowHttpAudio?: boolean;
|
|
180
|
+
customVoiceStyleMap?: Record<string, readonly string[]>;
|
|
181
|
+
customVoiceDefinitions?: readonly AzureVoiceDefinition[];
|
|
182
|
+
/** Host-side validation hook for URL-bearing SSML attributes. */
|
|
183
|
+
urlValidator?: AzureUrlValidator;
|
|
184
|
+
/** Alias for urlValidator retained for applications that use the longer name. */
|
|
185
|
+
customUrlValidator?: AzureUrlValidator;
|
|
186
|
+
languageAliases?: Record<string, string | readonly string[]>;
|
|
187
|
+
maxLength?: number;
|
|
188
|
+
/** Maximum XML element nesting depth, counting `<speak>` as depth 1. */
|
|
189
|
+
maxXmlDepth?: number;
|
|
190
|
+
/** Optional model identifier used to validate a voice's model compatibility. */
|
|
191
|
+
model?: string;
|
|
192
|
+
normalizeLanguage?: (lang: string) => string;
|
|
193
|
+
/** Overrides the built-in preview tag list for this validation run. */
|
|
194
|
+
previewTags?: readonly string[];
|
|
195
|
+
/** Adds tags that should be reported as deprecated for this validation run. */
|
|
196
|
+
deprecatedTags?: readonly string[];
|
|
197
|
+
/** Explicit tag lifecycle metadata. This takes precedence over previewTags/deprecatedTags. */
|
|
198
|
+
tagStatuses?: Readonly<Record<string, "ga" | "preview" | "deprecated">>;
|
|
199
|
+
unknownVoicePolicy?: "error" | "warn" | "ignore";
|
|
200
|
+
unsupportedStylePolicy?: "error" | "warn" | "ignore";
|
|
201
|
+
validateNestedVoices?: boolean;
|
|
202
|
+
voiceCatalog?: readonly AzureVoiceDefinition[];
|
|
203
|
+
voiceDefinitions?: readonly AzureVoiceDefinition[];
|
|
204
|
+
}
|
|
205
|
+
type AzureUrlValidationResult = boolean | {
|
|
206
|
+
valid: boolean;
|
|
207
|
+
reason?: string;
|
|
208
|
+
};
|
|
209
|
+
type AzureUrlValidator = (url: string, context: {
|
|
210
|
+
tag: string;
|
|
211
|
+
attribute: string;
|
|
212
|
+
}) => AzureUrlValidationResult | Promise<AzureUrlValidationResult>;
|
|
213
|
+
|
|
214
|
+
export type { AzureValidationOptions as A, SsmlDiagnostic as S, SsmlDocument as a, SsmlElement as b };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { AudioElement, AzureDiagnosticCode, AzureLanguageNormalizationOptions, AzureSsmlValidationOptions, AzureValidationOptions, AzureVoiceCatalogMetadata, AzureVoiceDefinition, AzureVoiceMetadata, BookmarkElement, BreakElement, BuildPartialSsmlOptions, CustomElement, EmphasisElement, ExpressAsElement, ExtractSsmlTranslatableTextOptions, FromPlainTextToSsmlOptions, LangElement, LexiconElement, MapSsmlTextNodesOptions, MarkElement, MsttsAudioDurationElement, MsttsEmbeddingElement, MsttsSilenceElement, MsttsTtsEmbeddingElement, MsttsVisemeElement, MsttsVoiceConversionElement, NamedElement, ParagraphElement, PhonemeElement, ProsodyElement, SayAsElement, SentenceElement, SsmlAttributeValue, SsmlAttributes, SsmlBackgroundAudioNode, SsmlBreakElement, SsmlDiagnostic, SsmlDiagnosticSeverity, SsmlDiagnosticSource, SsmlDialogNode, SsmlDocument, SsmlElement, SsmlElementBase, SsmlEmbeddingNode, SsmlExpressAsElement, SsmlNode, SsmlPartialContext, SsmlPartialProsody, SsmlPartialVoice, SsmlPhonemeElement, SsmlProsodyElement, SsmlSayAsElement, SsmlStructureIntegrityResult, SsmlStructureMismatch, SsmlText, SsmlTextNodeContext, SsmlTtsEmbeddingNode, SsmlTurnNode, SsmlValidationError, SsmlVoiceConversionNode, SsmlVoiceElement, SubElement, VoiceElement, WordElement, areAzureLanguagesEquivalent, buildPartialSsml, buildSsml, extractSsmlText, extractSsmlTranslatableText, fromPlainTextToSsml, getAzureVoiceCatalogMetadata, getBuiltInVoiceCatalogMetadata, isValidAzureAudioDuration, mapSsmlTextNodes, normalizeAzureLanguage, parseSsml, splitSsmlDocument, validateAzureSsml, validateSsml, validateSsmlStructureIntegrity } from './core.mjs';
|
|
1
|
+
export { AudioElement, AzureDiagnosticCode, AzureLanguageNormalizationOptions, AzureSsmlValidationOptions, AzureUrlValidationResult, AzureUrlValidator, AzureValidationOptions, AzureVoiceCatalogMetadata, AzureVoiceDefinition, AzureVoiceMetadata, BookmarkElement, BreakElement, BuildPartialSsmlOptions, CustomElement, EmphasisElement, ExpressAsElement, ExtractSsmlTranslatableTextOptions, FromPlainTextToSsmlOptions, LangElement, LexiconElement, MapSsmlTextNodesOptions, MarkElement, MsttsAudioDurationElement, MsttsEmbeddingElement, MsttsSilenceElement, MsttsTtsEmbeddingElement, MsttsVisemeElement, MsttsVoiceConversionElement, NamedElement, ParagraphElement, PhonemeElement, ProsodyElement, SayAsElement, SentenceElement, SplitSsmlOptions, SsmlAttributeValue, SsmlAttributes, SsmlBackgroundAudioNode, SsmlBreakElement, SsmlChunk, SsmlChunkContext, SsmlDiagnostic, SsmlDiagnosticSeverity, SsmlDiagnosticSource, SsmlDialogNode, SsmlDocument, SsmlElement, SsmlElementBase, SsmlEmbeddingNode, SsmlExpressAsElement, SsmlNode, SsmlPartialContext, SsmlPartialProsody, SsmlPartialVoice, SsmlPhonemeElement, SsmlProsodyElement, SsmlSayAsElement, SsmlStructureIntegrityResult, SsmlStructureMismatch, SsmlText, SsmlTextNodeContext, SsmlTextRange, SsmlTtsEmbeddingNode, SsmlTurnNode, SsmlValidationError, SsmlVoiceConversionNode, SsmlVoiceElement, SubElement, VoiceElement, WordElement, areAzureLanguagesEquivalent, buildPartialSsml, buildSsml, extractSsmlText, extractSsmlTranslatableText, fromPlainTextToSsml, getAzureVoiceCatalogMetadata, getBuiltInVoiceCatalogMetadata, isValidAzureAudioDuration, mapSsmlTextNodes, normalizeAzureLanguage, parseSsml, splitSsmlDocument, validateAzureSsml, validateSsml, validateSsmlStructureIntegrity } from './core.mjs';
|
|
2
|
+
import { S as SsmlDiagnostic, A as AzureValidationOptions } from './index.d-Xbr6ZWnK.mjs';
|
|
2
3
|
|
|
3
4
|
interface TtsConfig {
|
|
4
5
|
signal?: AbortSignal;
|
|
@@ -7,19 +8,45 @@ interface TtsConfig {
|
|
|
7
8
|
subscriptionKey: string;
|
|
8
9
|
region: string;
|
|
9
10
|
outputFormat?: string;
|
|
11
|
+
/** Original plain-text range represented by this synthesis request. */
|
|
12
|
+
sourceTextRange?: {
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
};
|
|
16
|
+
/** Reports completion of a chunk when using synthesizeSsmlChunks. */
|
|
17
|
+
onProgress?: (event: {
|
|
18
|
+
currentChunk: number;
|
|
19
|
+
totalChunks: number;
|
|
20
|
+
percent: number;
|
|
21
|
+
}) => void;
|
|
10
22
|
}
|
|
11
23
|
interface SsmlSynthesisBoundary {
|
|
12
24
|
text: string;
|
|
13
25
|
audioOffsetMs: number;
|
|
14
26
|
durationMs: number;
|
|
27
|
+
textRange?: {
|
|
28
|
+
start: number;
|
|
29
|
+
end: number;
|
|
30
|
+
};
|
|
31
|
+
requestId?: string;
|
|
15
32
|
}
|
|
16
33
|
interface SsmlSynthesisViseme {
|
|
17
34
|
visemeId: number;
|
|
18
35
|
audioOffsetMs: number;
|
|
36
|
+
textRange?: {
|
|
37
|
+
start: number;
|
|
38
|
+
end: number;
|
|
39
|
+
};
|
|
40
|
+
requestId?: string;
|
|
19
41
|
}
|
|
20
42
|
interface SsmlSynthesisBookmark {
|
|
21
43
|
name: string;
|
|
22
44
|
audioOffsetMs: number;
|
|
45
|
+
textRange?: {
|
|
46
|
+
start: number;
|
|
47
|
+
end: number;
|
|
48
|
+
};
|
|
49
|
+
requestId?: string;
|
|
23
50
|
}
|
|
24
51
|
/** Audio and Azure Speech synchronization events emitted for one SSML request. */
|
|
25
52
|
interface SsmlSynthesisResult {
|
|
@@ -32,6 +59,28 @@ interface SsmlSynthesisResult {
|
|
|
32
59
|
wordBoundaries?: SsmlSynthesisBoundary[];
|
|
33
60
|
visemes?: SsmlSynthesisViseme[];
|
|
34
61
|
bookmarks?: SsmlSynthesisBookmark[];
|
|
62
|
+
/** Request identifier returned by Azure Speech, when available. */
|
|
63
|
+
requestId?: string;
|
|
64
|
+
/** Original plain-text range represented by the result. */
|
|
65
|
+
textRange?: {
|
|
66
|
+
start: number;
|
|
67
|
+
end: number;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
interface SsmlSynthesisChunk {
|
|
71
|
+
ssml: string;
|
|
72
|
+
originalTextRange?: {
|
|
73
|
+
start: number;
|
|
74
|
+
end: number;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
interface SynthesizeChunksOptions {
|
|
78
|
+
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
79
|
+
}
|
|
80
|
+
interface SynthesisProgressEvent {
|
|
81
|
+
currentChunk: number;
|
|
82
|
+
totalChunks: number;
|
|
83
|
+
percent: number;
|
|
35
84
|
}
|
|
36
85
|
interface AzureTtsLogger {
|
|
37
86
|
debug?: (...args: unknown[]) => void;
|
|
@@ -47,6 +96,7 @@ interface AzureTtsClientOptions {
|
|
|
47
96
|
endpoint?: string;
|
|
48
97
|
outputFormat?: string;
|
|
49
98
|
logger?: AzureTtsLogger;
|
|
99
|
+
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
50
100
|
}
|
|
51
101
|
|
|
52
102
|
declare class AzureTtsError extends Error {
|
|
@@ -61,14 +111,57 @@ declare class AzureTtsSdkError extends AzureTtsError {
|
|
|
61
111
|
constructor(errorDetails: string);
|
|
62
112
|
}
|
|
63
113
|
|
|
114
|
+
interface SsmlValidationError {
|
|
115
|
+
readonly kind: "validation";
|
|
116
|
+
readonly message: string;
|
|
117
|
+
readonly diagnostics: readonly SsmlDiagnostic[];
|
|
118
|
+
}
|
|
119
|
+
type Result<T, E> = {
|
|
120
|
+
readonly ok: true;
|
|
121
|
+
readonly success: true;
|
|
122
|
+
readonly status: "success";
|
|
123
|
+
readonly value: T;
|
|
124
|
+
} | {
|
|
125
|
+
readonly ok: false;
|
|
126
|
+
readonly success: false;
|
|
127
|
+
readonly status: "validation-error" | "azure-api-error";
|
|
128
|
+
readonly error: E;
|
|
129
|
+
};
|
|
130
|
+
type SynthesisResult<T, E> = Result<T, E>;
|
|
131
|
+
type Success<T> = Extract<Result<T, never>, {
|
|
132
|
+
readonly ok: true;
|
|
133
|
+
}>;
|
|
134
|
+
type ValidationErrorResult = Extract<Result<never, SsmlValidationError>, {
|
|
135
|
+
readonly status: "validation-error";
|
|
136
|
+
}>;
|
|
137
|
+
type AzureApiErrorResult = Extract<Result<never, AzureTtsError>, {
|
|
138
|
+
readonly status: "azure-api-error";
|
|
139
|
+
}>;
|
|
140
|
+
type SsmlSynthesisSafeResult = Result<SsmlSynthesisResult, never> | Result<never, SsmlValidationError> | Result<never, AzureTtsError>;
|
|
141
|
+
interface SynthesizeSsmlSafeOptions extends AzureValidationOptions {
|
|
142
|
+
/** Optional nested form for callers that want to keep validation settings grouped. */
|
|
143
|
+
validation?: AzureValidationOptions;
|
|
144
|
+
}
|
|
145
|
+
interface SynthesisClient {
|
|
146
|
+
synthesizeSsml(ssml: string): Promise<SsmlSynthesisResult>;
|
|
147
|
+
}
|
|
148
|
+
/** Validates SSML before invoking Azure and converts validation/API failures to one result shape. */
|
|
149
|
+
declare function synthesizeSsmlSafe(client: Pick<AzureTtsClient, "synthesizeSsml"> | SynthesisClient, ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
|
|
150
|
+
|
|
64
151
|
declare class AzureTtsClient {
|
|
65
152
|
#private;
|
|
66
153
|
constructor(options: AzureTtsClientOptions);
|
|
67
154
|
synthesize(ssml: string): Promise<ArrayBuffer>;
|
|
68
155
|
synthesizeSsml(ssml: string): Promise<SsmlSynthesisResult>;
|
|
156
|
+
synthesizeChunks(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
|
|
157
|
+
synthesizeSsmlSafe(ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
|
|
69
158
|
}
|
|
70
159
|
|
|
71
160
|
declare function synthesizeSsml(ssml: string, config: TtsConfig): Promise<SsmlSynthesisResult>;
|
|
161
|
+
/** Synthesizes chunks sequentially, annotates synchronization events, and merges the results. */
|
|
162
|
+
declare function synthesizeSsmlChunks(chunks: readonly (SsmlSynthesisChunk | string)[], config: TtsConfig): Promise<SsmlSynthesisResult>;
|
|
163
|
+
/** Concatenates audio buffers and shifts all synchronization events by prior chunk durations. */
|
|
164
|
+
declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[]): SsmlSynthesisResult;
|
|
72
165
|
/** Backward-compatible audio-only synthesis helper. */
|
|
73
166
|
declare function synthesizeSpeech(ssml: string, config: TtsConfig): Promise<ArrayBuffer>;
|
|
74
167
|
|
|
@@ -97,4 +190,4 @@ interface AzureVoiceCatalog {
|
|
|
97
190
|
/** Fetches and deduplicates the current Azure Speech voice catalog for one or more regions. */
|
|
98
191
|
declare function fetchAzureVoiceCatalog(options: FetchAzureVoiceCatalogOptions): Promise<AzureVoiceCatalog>;
|
|
99
192
|
|
|
100
|
-
export { AzureTtsClient, type AzureTtsClientOptions, AzureTtsError, type AzureTtsLogger, AzureTtsSdkError, type AzureVoiceCatalog, type AzureVoiceCatalogVoice, type FetchAzureVoiceCatalogOptions, type FetchedAzureVoiceCatalogMetadata, type SsmlSynthesisBookmark, type SsmlSynthesisBoundary, type SsmlSynthesisResult, type SsmlSynthesisViseme, type TtsConfig, fetchAzureVoiceCatalog, synthesizeSpeech, synthesizeSsml };
|
|
193
|
+
export { type AzureApiErrorResult, type SsmlValidationError as AzureSsmlValidationError, AzureTtsClient, type AzureTtsClientOptions, AzureTtsError, type AzureTtsLogger, AzureTtsSdkError, type AzureVoiceCatalog, type AzureVoiceCatalogVoice, type FetchAzureVoiceCatalogOptions, type FetchedAzureVoiceCatalogMetadata, type Result, type SsmlSynthesisBookmark, type SsmlSynthesisBoundary, type SsmlSynthesisChunk, type SsmlSynthesisResult, type SsmlSynthesisSafeResult, type SsmlSynthesisViseme, type Success, type SynthesisProgressEvent, type SynthesisResult, type SynthesizeChunksOptions, type SynthesizeSsmlSafeOptions, type TtsConfig, type ValidationErrorResult, fetchAzureVoiceCatalog, mergeSynthesisResults, synthesizeSpeech, synthesizeSsml, synthesizeSsmlChunks, synthesizeSsmlSafe };
|