ssml-builder-js 2.13.0 → 2.15.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 +12 -2
- package/dist/{chunk-LCTE26LS.mjs → chunk-BDY2Q2JL.mjs} +2 -2
- package/dist/{chunk-25LOR4AJ.mjs → chunk-FXUM45ZY.mjs} +402 -169
- package/dist/chunk-FXUM45ZY.mjs.map +1 -0
- package/dist/{chunk-CZ2F3TET.mjs → chunk-WXFLUCLR.mjs} +227 -9
- package/dist/chunk-WXFLUCLR.mjs.map +1 -0
- package/dist/core.d.mts +65 -17
- package/dist/core.d.ts +65 -17
- package/dist/core.js +401 -166
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +5 -1
- package/dist/elements.js +101 -8
- package/dist/elements.js.map +1 -1
- package/dist/elements.mjs +2 -2
- package/dist/{index.d-Xbr6ZWnK.d.mts → index.d-8BvkB9gz.d.mts} +40 -2
- package/dist/{index.d-Xbr6ZWnK.d.ts → index.d-8BvkB9gz.d.ts} +40 -2
- package/dist/index.d.mts +170 -18
- package/dist/index.d.ts +170 -18
- package/dist/index.js +1512 -489
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +612 -47
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +15 -2
- package/dist/react.d.ts +15 -2
- package/dist/react.js +204 -23
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +105 -17
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-25LOR4AJ.mjs.map +0 -1
- package/dist/chunk-CZ2F3TET.mjs.map +0 -1
- /package/dist/{chunk-LCTE26LS.mjs.map → chunk-BDY2Q2JL.mjs.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
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.js';
|
|
2
|
-
import { S as SsmlDiagnostic, A as AzureValidationOptions } from './index.d-
|
|
1
|
+
export { AudioElement, AzureDiagnosticCode, AzureLanguageNormalizationOptions, AzureSsmlValidationOptions, AzureUrlValidationResult, AzureUrlValidationRunnerOptions, 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, SsmlSourceMap, SsmlSourceMarker, SsmlSourceTextSegment, SsmlStructureIntegrityResult, SsmlStructureMismatch, SsmlText, SsmlTextNodeContext, SsmlTextRange, SsmlTtsEmbeddingNode, SsmlTurnNode, SsmlValidationError, SsmlVoiceConversionNode, SsmlVoiceElement, SubElement, VoiceElement, WordElement, areAzureLanguagesEquivalent, buildPartialSsml, buildSsml, createAzureUrlValidatorRunner, extractSsmlText, extractSsmlTranslatableText, fromPlainTextToSsml, getAzureVoiceCatalogMetadata, getBuiltInVoiceCatalogMetadata, getSsmlSourceMap, isValidAzureAudioDuration, mapSsmlTextNodes, normalizeAzureLanguage, parseSsml, splitSsmlDocument, validateAzureSsml, validateSsml, validateSsmlStructureIntegrity } from './core.js';
|
|
2
|
+
import { S as SsmlTextRange, a as SsmlSourceTextSegment, b as SsmlSourceMarker, c as SsmlDiagnostic, A as AzureValidationOptions } from './index.d-8BvkB9gz.js';
|
|
3
|
+
import * as SpeechSDK from 'microsoft-cognitiveservices-speech-sdk';
|
|
4
|
+
|
|
5
|
+
declare const DEFAULT_OUTPUT_FORMAT = "audio-16khz-128kbitrate-mono-mp3";
|
|
6
|
+
declare const OUTPUT_FORMATS: {
|
|
7
|
+
"raw-8khz-8bit-mono-mulaw": SpeechSDK.SpeechSynthesisOutputFormat.Raw8Khz8BitMonoMULaw;
|
|
8
|
+
"riff-16khz-16kbps-mono-siren": SpeechSDK.SpeechSynthesisOutputFormat.Riff16Khz16KbpsMonoSiren;
|
|
9
|
+
"audio-16khz-16kbps-mono-siren": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz16KbpsMonoSiren;
|
|
10
|
+
"audio-16khz-32kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3;
|
|
11
|
+
"audio-16khz-128kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz128KBitRateMonoMp3;
|
|
12
|
+
"audio-16khz-64kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz64KBitRateMonoMp3;
|
|
13
|
+
"audio-24khz-48kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz48KBitRateMonoMp3;
|
|
14
|
+
"audio-24khz-96kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz96KBitRateMonoMp3;
|
|
15
|
+
"audio-24khz-160kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz160KBitRateMonoMp3;
|
|
16
|
+
"raw-16khz-16bit-mono-truesilk": SpeechSDK.SpeechSynthesisOutputFormat.Raw16Khz16BitMonoTrueSilk;
|
|
17
|
+
"riff-16khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff16Khz16BitMonoPcm;
|
|
18
|
+
"riff-8khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff8Khz16BitMonoPcm;
|
|
19
|
+
"riff-24khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm;
|
|
20
|
+
"riff-8khz-8bit-mono-mulaw": SpeechSDK.SpeechSynthesisOutputFormat.Riff8Khz8BitMonoMULaw;
|
|
21
|
+
"raw-16khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw16Khz16BitMonoPcm;
|
|
22
|
+
"raw-24khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw24Khz16BitMonoPcm;
|
|
23
|
+
"raw-8khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw8Khz16BitMonoPcm;
|
|
24
|
+
"ogg-16khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Ogg16Khz16BitMonoOpus;
|
|
25
|
+
"ogg-24khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Ogg24Khz16BitMonoOpus;
|
|
26
|
+
"raw-48khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw48Khz16BitMonoPcm;
|
|
27
|
+
"riff-48khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff48Khz16BitMonoPcm;
|
|
28
|
+
"audio-48khz-96kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio48Khz96KBitRateMonoMp3;
|
|
29
|
+
"audio-48khz-192kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio48Khz192KBitRateMonoMp3;
|
|
30
|
+
"ogg-48khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Ogg48Khz16BitMonoOpus;
|
|
31
|
+
"webm-16khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Webm16Khz16BitMonoOpus;
|
|
32
|
+
"webm-24khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Webm24Khz16BitMonoOpus;
|
|
33
|
+
"webm-24khz-16bit-24kbps-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Webm24Khz16Bit24KbpsMonoOpus;
|
|
34
|
+
"raw-24khz-16bit-mono-truesilk": SpeechSDK.SpeechSynthesisOutputFormat.Raw24Khz16BitMonoTrueSilk;
|
|
35
|
+
"raw-8khz-8bit-mono-alaw": SpeechSDK.SpeechSynthesisOutputFormat.Raw8Khz8BitMonoALaw;
|
|
36
|
+
"riff-8khz-8bit-mono-alaw": SpeechSDK.SpeechSynthesisOutputFormat.Riff8Khz8BitMonoALaw;
|
|
37
|
+
"audio-16khz-16bit-32kbps-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz16Bit32KbpsMonoOpus;
|
|
38
|
+
"audio-24khz-16bit-48kbps-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz16Bit48KbpsMonoOpus;
|
|
39
|
+
"audio-24khz-16bit-24kbps-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz16Bit24KbpsMonoOpus;
|
|
40
|
+
"raw-22050hz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw22050Hz16BitMonoPcm;
|
|
41
|
+
"riff-22050hz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff22050Hz16BitMonoPcm;
|
|
42
|
+
"raw-44100hz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw44100Hz16BitMonoPcm;
|
|
43
|
+
"riff-44100hz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff44100Hz16BitMonoPcm;
|
|
44
|
+
"amr-wb-16000hz": SpeechSDK.SpeechSynthesisOutputFormat.AmrWb16000Hz;
|
|
45
|
+
"g722-16khz-64kbps": SpeechSDK.SpeechSynthesisOutputFormat.G72216Khz64Kbps;
|
|
46
|
+
};
|
|
47
|
+
type AzureTtsOutputFormat = keyof typeof OUTPUT_FORMATS;
|
|
48
|
+
declare function resolveMimeType(outputFormat: string): string;
|
|
3
49
|
|
|
4
50
|
interface TtsConfig {
|
|
5
51
|
signal?: AbortSignal;
|
|
@@ -13,13 +59,16 @@ interface TtsConfig {
|
|
|
13
59
|
start: number;
|
|
14
60
|
end: number;
|
|
15
61
|
};
|
|
16
|
-
/** Reports
|
|
17
|
-
onProgress?: (event:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
62
|
+
/** Reports chunk lifecycle events when using chunk synthesis. */
|
|
63
|
+
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
64
|
+
/** Metadata used to map synchronization events back to the source document. */
|
|
65
|
+
chunkIndex?: number;
|
|
66
|
+
sourceNodePath?: string[];
|
|
67
|
+
/** Exact source text segments used to map individual Azure events. */
|
|
68
|
+
sourceTextSegments?: SsmlSourceTextSegment[];
|
|
69
|
+
sourceMarkers?: SsmlSourceMarker[];
|
|
22
70
|
}
|
|
71
|
+
type SynthesisChunkStatus = "pending" | "synthesizing" | "success" | "failed";
|
|
23
72
|
interface SsmlSynthesisBoundary {
|
|
24
73
|
text: string;
|
|
25
74
|
audioOffsetMs: number;
|
|
@@ -28,6 +77,14 @@ interface SsmlSynthesisBoundary {
|
|
|
28
77
|
start: number;
|
|
29
78
|
end: number;
|
|
30
79
|
};
|
|
80
|
+
/** Chunk that produced this event. */
|
|
81
|
+
chunkIndex?: number;
|
|
82
|
+
/** Path of the source SSML node, when available. */
|
|
83
|
+
sourceNodePath?: string[];
|
|
84
|
+
/** Original text range represented by this event. */
|
|
85
|
+
originalTextRange?: SsmlTextRange;
|
|
86
|
+
/** Audio offset within the originating chunk before merge. */
|
|
87
|
+
chunkAudioOffsetMs?: number;
|
|
31
88
|
requestId?: string;
|
|
32
89
|
}
|
|
33
90
|
interface SsmlSynthesisViseme {
|
|
@@ -37,6 +94,10 @@ interface SsmlSynthesisViseme {
|
|
|
37
94
|
start: number;
|
|
38
95
|
end: number;
|
|
39
96
|
};
|
|
97
|
+
chunkIndex?: number;
|
|
98
|
+
sourceNodePath?: string[];
|
|
99
|
+
originalTextRange?: SsmlTextRange;
|
|
100
|
+
chunkAudioOffsetMs?: number;
|
|
40
101
|
requestId?: string;
|
|
41
102
|
}
|
|
42
103
|
interface SsmlSynthesisBookmark {
|
|
@@ -46,6 +107,10 @@ interface SsmlSynthesisBookmark {
|
|
|
46
107
|
start: number;
|
|
47
108
|
end: number;
|
|
48
109
|
};
|
|
110
|
+
chunkIndex?: number;
|
|
111
|
+
sourceNodePath?: string[];
|
|
112
|
+
originalTextRange?: SsmlTextRange;
|
|
113
|
+
chunkAudioOffsetMs?: number;
|
|
49
114
|
requestId?: string;
|
|
50
115
|
}
|
|
51
116
|
/** Audio and Azure Speech synchronization events emitted for one SSML request. */
|
|
@@ -66,6 +131,11 @@ interface SsmlSynthesisResult {
|
|
|
66
131
|
start: number;
|
|
67
132
|
end: number;
|
|
68
133
|
};
|
|
134
|
+
/** MIME type of a result produced by an explicit merge operation. */
|
|
135
|
+
mimeType?: string;
|
|
136
|
+
}
|
|
137
|
+
interface MergedSynthesisResult extends SsmlSynthesisResult {
|
|
138
|
+
mimeType: string;
|
|
69
139
|
}
|
|
70
140
|
interface SsmlSynthesisChunk {
|
|
71
141
|
ssml: string;
|
|
@@ -73,14 +143,27 @@ interface SsmlSynthesisChunk {
|
|
|
73
143
|
start: number;
|
|
74
144
|
end: number;
|
|
75
145
|
};
|
|
146
|
+
sourceNodePath?: string[];
|
|
147
|
+
sourceTextSegments?: SsmlSourceTextSegment[];
|
|
148
|
+
sourceMarkers?: SsmlSourceMarker[];
|
|
76
149
|
}
|
|
77
150
|
interface SynthesizeChunksOptions {
|
|
78
151
|
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
152
|
+
outputFormat?: AzureTtsOutputFormat | string;
|
|
153
|
+
signal?: AbortSignal;
|
|
154
|
+
timeoutMs?: number;
|
|
155
|
+
sourceNodePath?: string[];
|
|
79
156
|
}
|
|
80
157
|
interface SynthesisProgressEvent {
|
|
158
|
+
/** 1-based completed chunk count retained for backward compatibility. */
|
|
81
159
|
currentChunk: number;
|
|
82
160
|
totalChunks: number;
|
|
83
161
|
percent: number;
|
|
162
|
+
chunkIndex: number;
|
|
163
|
+
originalTextRange?: SsmlTextRange;
|
|
164
|
+
status: SynthesisChunkStatus;
|
|
165
|
+
durationMs: number;
|
|
166
|
+
error?: unknown;
|
|
84
167
|
}
|
|
85
168
|
interface AzureTtsLogger {
|
|
86
169
|
debug?: (...args: unknown[]) => void;
|
|
@@ -99,7 +182,9 @@ interface AzureTtsClientOptions {
|
|
|
99
182
|
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
100
183
|
}
|
|
101
184
|
|
|
185
|
+
type SynthesisErrorKind = "validation-error" | "azure-api-error" | "merge-error" | "unsupported-format-error" | "cancelled" | "timeout";
|
|
102
186
|
declare class AzureTtsError extends Error {
|
|
187
|
+
readonly kind: "azure-api-error";
|
|
103
188
|
readonly status: number;
|
|
104
189
|
readonly statusText: string;
|
|
105
190
|
readonly responseBody: string;
|
|
@@ -110,23 +195,57 @@ declare class AzureTtsSdkError extends AzureTtsError {
|
|
|
110
195
|
readonly errorDetails: string;
|
|
111
196
|
constructor(errorDetails: string);
|
|
112
197
|
}
|
|
198
|
+
declare class SynthesisCancelledError extends Error {
|
|
199
|
+
readonly kind: "cancelled";
|
|
200
|
+
constructor(message?: string);
|
|
201
|
+
}
|
|
202
|
+
declare class SynthesisTimeoutError extends Error {
|
|
203
|
+
readonly kind: "timeout";
|
|
204
|
+
constructor(message: string);
|
|
205
|
+
}
|
|
206
|
+
declare class MergeError extends Error {
|
|
207
|
+
readonly kind: "merge-error";
|
|
208
|
+
readonly cause: unknown;
|
|
209
|
+
constructor(message: string, cause?: unknown);
|
|
210
|
+
}
|
|
211
|
+
/** Thrown when audio buffers require container re-multiplexing before they can be merged. */
|
|
212
|
+
declare class UnsupportedMergeFormatError extends Error {
|
|
213
|
+
readonly kind: "unsupported-format-error";
|
|
214
|
+
readonly format: string;
|
|
215
|
+
constructor(format: string);
|
|
216
|
+
}
|
|
217
|
+
type AzureTtsSynthesisError = AzureTtsError | MergeError | UnsupportedMergeFormatError | SynthesisCancelledError | SynthesisTimeoutError;
|
|
113
218
|
|
|
114
219
|
interface SsmlValidationError {
|
|
115
|
-
readonly kind: "validation";
|
|
220
|
+
readonly kind: "validation-error";
|
|
116
221
|
readonly message: string;
|
|
117
222
|
readonly diagnostics: readonly SsmlDiagnostic[];
|
|
118
223
|
}
|
|
224
|
+
type SsmlSynthesisError = SsmlValidationError | AzureTtsSynthesisError;
|
|
225
|
+
declare class ChunkValidationError extends Error {
|
|
226
|
+
readonly kind: "validation-error";
|
|
227
|
+
readonly chunkIndex: number;
|
|
228
|
+
readonly diagnostics: readonly SsmlDiagnostic[];
|
|
229
|
+
constructor(chunkIndex: number, diagnostics: readonly SsmlDiagnostic[]);
|
|
230
|
+
}
|
|
119
231
|
type Result<T, E> = {
|
|
120
232
|
readonly ok: true;
|
|
121
233
|
readonly success: true;
|
|
122
234
|
readonly status: "success";
|
|
123
235
|
readonly value: T;
|
|
124
|
-
} | {
|
|
236
|
+
} | (E extends {
|
|
237
|
+
readonly kind: infer Kind extends SynthesisErrorKind;
|
|
238
|
+
} ? {
|
|
125
239
|
readonly ok: false;
|
|
126
240
|
readonly success: false;
|
|
127
|
-
readonly status:
|
|
241
|
+
readonly status: Kind;
|
|
128
242
|
readonly error: E;
|
|
129
|
-
}
|
|
243
|
+
} : {
|
|
244
|
+
readonly ok: false;
|
|
245
|
+
readonly success: false;
|
|
246
|
+
readonly status: SynthesisErrorKind;
|
|
247
|
+
readonly error: E;
|
|
248
|
+
});
|
|
130
249
|
type SynthesisResult<T, E> = Result<T, E>;
|
|
131
250
|
type Success<T> = Extract<Result<T, never>, {
|
|
132
251
|
readonly ok: true;
|
|
@@ -137,31 +256,61 @@ type ValidationErrorResult = Extract<Result<never, SsmlValidationError>, {
|
|
|
137
256
|
type AzureApiErrorResult = Extract<Result<never, AzureTtsError>, {
|
|
138
257
|
readonly status: "azure-api-error";
|
|
139
258
|
}>;
|
|
140
|
-
type SsmlSynthesisSafeResult = Result<SsmlSynthesisResult, never> | Result<never, SsmlValidationError> | Result<never,
|
|
259
|
+
type SsmlSynthesisSafeResult = Result<SsmlSynthesisResult, never> | Result<never, SsmlValidationError> | Result<never, SsmlSynthesisError>;
|
|
141
260
|
interface SynthesizeSsmlSafeOptions extends AzureValidationOptions {
|
|
142
261
|
/** Optional nested form for callers that want to keep validation settings grouped. */
|
|
143
262
|
validation?: AzureValidationOptions;
|
|
263
|
+
signal?: AbortSignal;
|
|
144
264
|
}
|
|
265
|
+
interface SynthesizeSsmlChunksSafeOptions extends AzureValidationOptions {
|
|
266
|
+
validation?: AzureValidationOptions;
|
|
267
|
+
outputFormat?: string;
|
|
268
|
+
signal?: AbortSignal;
|
|
269
|
+
timeoutMs?: number;
|
|
270
|
+
sourceNodePath?: string[];
|
|
271
|
+
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
272
|
+
}
|
|
273
|
+
type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, SsmlSynthesisError | ChunkValidationError>;
|
|
145
274
|
interface SynthesisClient {
|
|
146
|
-
synthesizeSsml(ssml: string): Promise<SsmlSynthesisResult>;
|
|
275
|
+
synthesizeSsml(ssml: string, options?: Partial<SynthesizeChunksOptions>): Promise<SsmlSynthesisResult>;
|
|
276
|
+
synthesizeChunks?(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
|
|
147
277
|
}
|
|
148
278
|
/** Validates SSML before invoking Azure and converts validation/API failures to one result shape. */
|
|
149
279
|
declare function synthesizeSsmlSafe(client: Pick<AzureTtsClient, "synthesizeSsml"> | SynthesisClient, ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
|
|
280
|
+
/** Validates every chunk before synthesis and returns a chunk-addressable result. */
|
|
281
|
+
declare function synthesizeSsmlChunksSafe(client: Pick<AzureTtsClient, "synthesizeSsml" | "synthesizeChunks"> | SynthesisClient, chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
|
|
150
282
|
|
|
151
283
|
declare class AzureTtsClient {
|
|
152
284
|
#private;
|
|
153
285
|
constructor(options: AzureTtsClientOptions);
|
|
154
286
|
synthesize(ssml: string): Promise<ArrayBuffer>;
|
|
155
|
-
synthesizeSsml(ssml: string): Promise<SsmlSynthesisResult>;
|
|
287
|
+
synthesizeSsml(ssml: string, options?: Partial<TtsConfig>): Promise<SsmlSynthesisResult>;
|
|
156
288
|
synthesizeChunks(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
|
|
157
289
|
synthesizeSsmlSafe(ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
|
|
290
|
+
synthesizeChunksSafe(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
|
|
291
|
+
synthesizeSsmlChunksSafe(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
|
|
158
292
|
}
|
|
159
293
|
|
|
294
|
+
type MergeAudioFormat = "wav" | "mp3" | "raw";
|
|
295
|
+
interface MergeAudioOptions {
|
|
296
|
+
format: AzureTtsOutputFormat;
|
|
297
|
+
}
|
|
298
|
+
interface MergeSynthesisOptions extends MergeAudioOptions {
|
|
299
|
+
customMerger?: (buffers: ArrayBuffer[], format: string) => Promise<ArrayBuffer> | ArrayBuffer;
|
|
300
|
+
}
|
|
301
|
+
type AsyncMergeSynthesisOptions = MergeSynthesisOptions & {
|
|
302
|
+
customMerger: NonNullable<MergeSynthesisOptions["customMerger"]>;
|
|
303
|
+
};
|
|
304
|
+
/** Returns whether the named output format can be safely concatenated without re-multiplexing. */
|
|
305
|
+
declare function resolveMergeAudioFormat(format: string): MergeAudioFormat | undefined;
|
|
306
|
+
declare function canMergeAudioFormat(format: string): boolean;
|
|
307
|
+
/** Merges audio buffers while preserving the invariants of supported containers. */
|
|
308
|
+
declare function mergeAudioBuffers(buffers: readonly ArrayBuffer[], options: MergeAudioOptions): ArrayBuffer;
|
|
160
309
|
declare function synthesizeSsml(ssml: string, config: TtsConfig): Promise<SsmlSynthesisResult>;
|
|
161
310
|
/** Synthesizes chunks sequentially, annotates synchronization events, and merges the results. */
|
|
162
311
|
declare function synthesizeSsmlChunks(chunks: readonly (SsmlSynthesisChunk | string)[], config: TtsConfig): Promise<SsmlSynthesisResult>;
|
|
163
|
-
|
|
164
|
-
declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[]):
|
|
312
|
+
declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: AsyncMergeSynthesisOptions): Promise<MergedSynthesisResult>;
|
|
313
|
+
declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: MergeAudioOptions): MergedSynthesisResult;
|
|
165
314
|
/** Backward-compatible audio-only synthesis helper. */
|
|
166
315
|
declare function synthesizeSpeech(ssml: string, config: TtsConfig): Promise<ArrayBuffer>;
|
|
167
316
|
|
|
@@ -174,6 +323,9 @@ interface AzureVoiceCatalogVoice {
|
|
|
174
323
|
locale: string;
|
|
175
324
|
secondaryLocales?: readonly string[];
|
|
176
325
|
styles?: readonly string[];
|
|
326
|
+
supportedTags?: readonly string[];
|
|
327
|
+
unsupportedTags?: readonly string[];
|
|
328
|
+
models?: readonly string[];
|
|
177
329
|
regions: readonly string[];
|
|
178
330
|
status?: "ga" | "preview" | "deprecated";
|
|
179
331
|
}
|
|
@@ -190,4 +342,4 @@ interface AzureVoiceCatalog {
|
|
|
190
342
|
/** Fetches and deduplicates the current Azure Speech voice catalog for one or more regions. */
|
|
191
343
|
declare function fetchAzureVoiceCatalog(options: FetchAzureVoiceCatalogOptions): Promise<AzureVoiceCatalog>;
|
|
192
344
|
|
|
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 };
|
|
345
|
+
export { type AzureApiErrorResult, type SsmlValidationError as AzureSsmlValidationError, AzureTtsClient, type AzureTtsClientOptions, AzureTtsError, type AzureTtsLogger, type AzureTtsOutputFormat, AzureTtsSdkError, type AzureTtsSynthesisError, type AzureVoiceCatalog, type AzureVoiceCatalogVoice, ChunkValidationError, DEFAULT_OUTPUT_FORMAT, type FetchAzureVoiceCatalogOptions, type FetchedAzureVoiceCatalogMetadata, type MergeAudioFormat, type MergeAudioOptions, MergeError, type MergeSynthesisOptions, type MergedSynthesisResult, type Result, type SsmlSynthesisBookmark, type SsmlSynthesisBoundary, type SsmlSynthesisChunk, type SsmlSynthesisChunksSafeResult, type SsmlSynthesisError, type SsmlSynthesisResult, type SsmlSynthesisSafeResult, type SsmlSynthesisViseme, type Success, SynthesisCancelledError, type SynthesisChunkStatus, type SynthesisErrorKind, type SynthesisProgressEvent, type SynthesisResult, SynthesisTimeoutError, type SynthesizeChunksOptions, type SynthesizeSsmlChunksSafeOptions, type SynthesizeSsmlSafeOptions, type TtsConfig, UnsupportedMergeFormatError, type ValidationErrorResult, canMergeAudioFormat, fetchAzureVoiceCatalog, mergeAudioBuffers, mergeSynthesisResults, resolveMergeAudioFormat, resolveMimeType, synthesizeSpeech, synthesizeSsml, synthesizeSsmlChunks, synthesizeSsmlChunksSafe, synthesizeSsmlSafe };
|