@ssml-builder-js/azure-tts-client 2.14.0 → 2.16.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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @ssml-builder-js/azure-tts-client
2
2
 
3
+ ## 2.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add shared URL validation for SSML chunks, transient retry and bounded parallel synthesis, structured diagnostics and synchronization mapping status, audio header/specification validation, and the stricter custom audio merger context.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @ssml-builder-js/ssml-core@2.16.0
13
+
14
+ ## 2.15.0
15
+
16
+ ### Minor Changes
17
+
18
+ - Add strict audio merge formats, discriminated synthesis errors, per-event source mappings, abortable URL validation, external audio muxers, and live Visual Editor voice capability warnings.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+ - @ssml-builder-js/ssml-core@2.15.0
24
+
3
25
  ## 2.14.0
4
26
 
5
27
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -1,4 +1,50 @@
1
- import { SsmlTextRange, SsmlDiagnostic, AzureValidationOptions } from '@ssml-builder-js/ssml-core';
1
+ import { SsmlTextRange, SsmlSourceTextSegment, SsmlSourceMarker, SsmlDiagnostic, AzureValidationOptions } from '@ssml-builder-js/ssml-core';
2
+ import * as SpeechSDK from 'microsoft-cognitiveservices-speech-sdk';
3
+
4
+ declare const DEFAULT_OUTPUT_FORMAT = "audio-16khz-128kbitrate-mono-mp3";
5
+ declare const OUTPUT_FORMATS: {
6
+ "raw-8khz-8bit-mono-mulaw": SpeechSDK.SpeechSynthesisOutputFormat.Raw8Khz8BitMonoMULaw;
7
+ "riff-16khz-16kbps-mono-siren": SpeechSDK.SpeechSynthesisOutputFormat.Riff16Khz16KbpsMonoSiren;
8
+ "audio-16khz-16kbps-mono-siren": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz16KbpsMonoSiren;
9
+ "audio-16khz-32kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3;
10
+ "audio-16khz-128kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz128KBitRateMonoMp3;
11
+ "audio-16khz-64kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz64KBitRateMonoMp3;
12
+ "audio-24khz-48kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz48KBitRateMonoMp3;
13
+ "audio-24khz-96kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz96KBitRateMonoMp3;
14
+ "audio-24khz-160kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz160KBitRateMonoMp3;
15
+ "raw-16khz-16bit-mono-truesilk": SpeechSDK.SpeechSynthesisOutputFormat.Raw16Khz16BitMonoTrueSilk;
16
+ "riff-16khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff16Khz16BitMonoPcm;
17
+ "riff-8khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff8Khz16BitMonoPcm;
18
+ "riff-24khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm;
19
+ "riff-8khz-8bit-mono-mulaw": SpeechSDK.SpeechSynthesisOutputFormat.Riff8Khz8BitMonoMULaw;
20
+ "raw-16khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw16Khz16BitMonoPcm;
21
+ "raw-24khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw24Khz16BitMonoPcm;
22
+ "raw-8khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw8Khz16BitMonoPcm;
23
+ "ogg-16khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Ogg16Khz16BitMonoOpus;
24
+ "ogg-24khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Ogg24Khz16BitMonoOpus;
25
+ "raw-48khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw48Khz16BitMonoPcm;
26
+ "riff-48khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff48Khz16BitMonoPcm;
27
+ "audio-48khz-96kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio48Khz96KBitRateMonoMp3;
28
+ "audio-48khz-192kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio48Khz192KBitRateMonoMp3;
29
+ "ogg-48khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Ogg48Khz16BitMonoOpus;
30
+ "webm-16khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Webm16Khz16BitMonoOpus;
31
+ "webm-24khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Webm24Khz16BitMonoOpus;
32
+ "webm-24khz-16bit-24kbps-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Webm24Khz16Bit24KbpsMonoOpus;
33
+ "raw-24khz-16bit-mono-truesilk": SpeechSDK.SpeechSynthesisOutputFormat.Raw24Khz16BitMonoTrueSilk;
34
+ "raw-8khz-8bit-mono-alaw": SpeechSDK.SpeechSynthesisOutputFormat.Raw8Khz8BitMonoALaw;
35
+ "riff-8khz-8bit-mono-alaw": SpeechSDK.SpeechSynthesisOutputFormat.Riff8Khz8BitMonoALaw;
36
+ "audio-16khz-16bit-32kbps-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz16Bit32KbpsMonoOpus;
37
+ "audio-24khz-16bit-48kbps-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz16Bit48KbpsMonoOpus;
38
+ "audio-24khz-16bit-24kbps-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz16Bit24KbpsMonoOpus;
39
+ "raw-22050hz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw22050Hz16BitMonoPcm;
40
+ "riff-22050hz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff22050Hz16BitMonoPcm;
41
+ "raw-44100hz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw44100Hz16BitMonoPcm;
42
+ "riff-44100hz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff44100Hz16BitMonoPcm;
43
+ "amr-wb-16000hz": SpeechSDK.SpeechSynthesisOutputFormat.AmrWb16000Hz;
44
+ "g722-16khz-64kbps": SpeechSDK.SpeechSynthesisOutputFormat.G72216Khz64Kbps;
45
+ };
46
+ type AzureTtsOutputFormat = keyof typeof OUTPUT_FORMATS;
47
+ declare function resolveMimeType(outputFormat: string): string;
2
48
 
3
49
  interface TtsConfig {
4
50
  signal?: AbortSignal;
@@ -17,6 +63,26 @@ interface TtsConfig {
17
63
  /** Metadata used to map synchronization events back to the source document. */
18
64
  chunkIndex?: number;
19
65
  sourceNodePath?: string[];
66
+ /** Exact source text segments used to map individual Azure events. */
67
+ sourceTextSegments?: SsmlSourceTextSegment[];
68
+ sourceMarkers?: SsmlSourceMarker[];
69
+ concurrency?: number;
70
+ retryOptions?: RetryOptions;
71
+ }
72
+ type MappingStatus = "exact" | "fallback" | "unmapped";
73
+ interface AudioSpecification {
74
+ format: string;
75
+ mimeType: string;
76
+ codec: "pcm" | "mp3" | "opus" | "silk" | "unknown";
77
+ sampleRate: number;
78
+ channels: number;
79
+ bitrate?: number;
80
+ isCompressed: boolean;
81
+ }
82
+ interface RetryOptions {
83
+ maxRetries: number;
84
+ initialDelayMs: number;
85
+ maxDelayMs: number;
20
86
  }
21
87
  type SynthesisChunkStatus = "pending" | "synthesizing" | "success" | "failed";
22
88
  interface SsmlSynthesisBoundary {
@@ -36,6 +102,7 @@ interface SsmlSynthesisBoundary {
36
102
  /** Audio offset within the originating chunk before merge. */
37
103
  chunkAudioOffsetMs?: number;
38
104
  requestId?: string;
105
+ mappingStatus: MappingStatus;
39
106
  }
40
107
  interface SsmlSynthesisViseme {
41
108
  visemeId: number;
@@ -49,6 +116,7 @@ interface SsmlSynthesisViseme {
49
116
  originalTextRange?: SsmlTextRange;
50
117
  chunkAudioOffsetMs?: number;
51
118
  requestId?: string;
119
+ mappingStatus: MappingStatus;
52
120
  }
53
121
  interface SsmlSynthesisBookmark {
54
122
  name: string;
@@ -62,6 +130,7 @@ interface SsmlSynthesisBookmark {
62
130
  originalTextRange?: SsmlTextRange;
63
131
  chunkAudioOffsetMs?: number;
64
132
  requestId?: string;
133
+ mappingStatus: MappingStatus;
65
134
  }
66
135
  /** Audio and Azure Speech synchronization events emitted for one SSML request. */
67
136
  interface SsmlSynthesisResult {
@@ -81,6 +150,12 @@ interface SsmlSynthesisResult {
81
150
  start: number;
82
151
  end: number;
83
152
  };
153
+ /** MIME type of a result produced by an explicit merge operation. */
154
+ mimeType?: string;
155
+ audioSpec?: AudioSpecification;
156
+ }
157
+ interface MergedSynthesisResult extends SsmlSynthesisResult {
158
+ mimeType: string;
84
159
  }
85
160
  interface SsmlSynthesisChunk {
86
161
  ssml: string;
@@ -89,9 +164,17 @@ interface SsmlSynthesisChunk {
89
164
  end: number;
90
165
  };
91
166
  sourceNodePath?: string[];
167
+ sourceTextSegments?: SsmlSourceTextSegment[];
168
+ sourceMarkers?: SsmlSourceMarker[];
92
169
  }
93
170
  interface SynthesizeChunksOptions {
94
171
  onProgress?: (event: SynthesisProgressEvent) => void;
172
+ outputFormat?: AzureTtsOutputFormat | string;
173
+ signal?: AbortSignal;
174
+ timeoutMs?: number;
175
+ sourceNodePath?: string[];
176
+ concurrency?: number;
177
+ retryOptions?: RetryOptions;
95
178
  }
96
179
  interface SynthesisProgressEvent {
97
180
  /** 1-based completed chunk count retained for backward compatibility. */
@@ -103,6 +186,9 @@ interface SynthesisProgressEvent {
103
186
  status: SynthesisChunkStatus;
104
187
  durationMs: number;
105
188
  error?: unknown;
189
+ retryAttempt?: number;
190
+ nextRetryDelayMs?: number;
191
+ isRetrying?: boolean;
106
192
  }
107
193
  interface AzureTtsLogger {
108
194
  debug?: (...args: unknown[]) => void;
@@ -119,9 +205,13 @@ interface AzureTtsClientOptions {
119
205
  outputFormat?: string;
120
206
  logger?: AzureTtsLogger;
121
207
  onProgress?: (event: SynthesisProgressEvent) => void;
208
+ concurrency?: number;
209
+ retryOptions?: RetryOptions;
122
210
  }
123
211
 
212
+ type SynthesisErrorKind = "validation-error" | "azure-api-error" | "merge-error" | "audio-format-mismatch" | "unsupported-format-error" | "cancelled" | "timeout";
124
213
  declare class AzureTtsError extends Error {
214
+ readonly kind: "azure-api-error";
125
215
  readonly status: number;
126
216
  readonly statusText: string;
127
217
  readonly responseBody: string;
@@ -132,19 +222,41 @@ declare class AzureTtsSdkError extends AzureTtsError {
132
222
  readonly errorDetails: string;
133
223
  constructor(errorDetails: string);
134
224
  }
225
+ declare class SynthesisCancelledError extends Error {
226
+ readonly kind: "cancelled";
227
+ constructor(message?: string);
228
+ }
229
+ declare class SynthesisTimeoutError extends Error {
230
+ readonly kind: "timeout";
231
+ constructor(message: string);
232
+ }
233
+ declare class MergeError extends Error {
234
+ readonly kind: "merge-error";
235
+ readonly cause: unknown;
236
+ constructor(message: string, cause?: unknown);
237
+ }
238
+ /** Thrown when chunk headers describe incompatible audio streams. */
239
+ declare class AudioFormatMismatchError extends Error {
240
+ readonly kind: "audio-format-mismatch";
241
+ readonly inputSpecs: readonly AudioSpecification[];
242
+ constructor(message: string, inputSpecs?: readonly AudioSpecification[]);
243
+ }
135
244
  /** Thrown when audio buffers require container re-multiplexing before they can be merged. */
136
245
  declare class UnsupportedMergeFormatError extends Error {
246
+ readonly kind: "unsupported-format-error";
137
247
  readonly format: string;
138
248
  constructor(format: string);
139
249
  }
250
+ type AzureTtsSynthesisError = AzureTtsError | MergeError | AudioFormatMismatchError | UnsupportedMergeFormatError | SynthesisCancelledError | SynthesisTimeoutError;
140
251
 
141
252
  interface SsmlValidationError {
142
- readonly kind: "validation";
253
+ readonly kind: "validation-error";
143
254
  readonly message: string;
144
255
  readonly diagnostics: readonly SsmlDiagnostic[];
145
256
  }
257
+ type SsmlSynthesisError = SsmlValidationError | AzureTtsSynthesisError;
146
258
  declare class ChunkValidationError extends Error {
147
- readonly kind: "chunk-validation";
259
+ readonly kind: "validation-error";
148
260
  readonly chunkIndex: number;
149
261
  readonly diagnostics: readonly SsmlDiagnostic[];
150
262
  constructor(chunkIndex: number, diagnostics: readonly SsmlDiagnostic[]);
@@ -154,12 +266,19 @@ type Result<T, E> = {
154
266
  readonly success: true;
155
267
  readonly status: "success";
156
268
  readonly value: T;
157
- } | {
269
+ } | (E extends {
270
+ readonly kind: infer Kind extends SynthesisErrorKind;
271
+ } ? {
158
272
  readonly ok: false;
159
273
  readonly success: false;
160
- readonly status: "validation-error" | "azure-api-error";
274
+ readonly status: Kind;
161
275
  readonly error: E;
162
- };
276
+ } : {
277
+ readonly ok: false;
278
+ readonly success: false;
279
+ readonly status: SynthesisErrorKind;
280
+ readonly error: E;
281
+ });
163
282
  type SynthesisResult<T, E> = Result<T, E>;
164
283
  type Success<T> = Extract<Result<T, never>, {
165
284
  readonly ok: true;
@@ -170,22 +289,26 @@ type ValidationErrorResult = Extract<Result<never, SsmlValidationError>, {
170
289
  type AzureApiErrorResult = Extract<Result<never, AzureTtsError>, {
171
290
  readonly status: "azure-api-error";
172
291
  }>;
173
- type SsmlSynthesisSafeResult = Result<SsmlSynthesisResult, never> | Result<never, SsmlValidationError> | Result<never, AzureTtsError>;
292
+ type SsmlSynthesisSafeResult = Result<SsmlSynthesisResult, never> | Result<never, SsmlValidationError> | Result<never, SsmlSynthesisError>;
174
293
  interface SynthesizeSsmlSafeOptions extends AzureValidationOptions {
175
294
  /** Optional nested form for callers that want to keep validation settings grouped. */
176
295
  validation?: AzureValidationOptions;
296
+ signal?: AbortSignal;
177
297
  }
178
298
  interface SynthesizeSsmlChunksSafeOptions extends AzureValidationOptions {
179
299
  validation?: AzureValidationOptions;
180
300
  outputFormat?: string;
301
+ signal?: AbortSignal;
302
+ timeoutMs?: number;
303
+ sourceNodePath?: string[];
181
304
  onProgress?: (event: SynthesisProgressEvent) => void;
305
+ concurrency?: number;
306
+ retryOptions?: RetryOptions;
182
307
  }
183
- type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, AzureTtsError>;
308
+ type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, SsmlSynthesisError | ChunkValidationError>;
184
309
  interface SynthesisClient {
185
- synthesizeSsml(ssml: string): Promise<SsmlSynthesisResult>;
186
- synthesizeChunks?(chunks: readonly (SsmlSynthesisChunk | string)[], options?: {
187
- onProgress?: (event: SynthesisProgressEvent) => void;
188
- }): Promise<SsmlSynthesisResult>;
310
+ synthesizeSsml(ssml: string, options?: Partial<SynthesizeChunksOptions>): Promise<SsmlSynthesisResult>;
311
+ synthesizeChunks?(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
189
312
  }
190
313
  /** Validates SSML before invoking Azure and converts validation/API failures to one result shape. */
191
314
  declare function synthesizeSsmlSafe(client: Pick<AzureTtsClient, "synthesizeSsml"> | SynthesisClient, ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
@@ -196,7 +319,7 @@ declare class AzureTtsClient {
196
319
  #private;
197
320
  constructor(options: AzureTtsClientOptions);
198
321
  synthesize(ssml: string): Promise<ArrayBuffer>;
199
- synthesizeSsml(ssml: string): Promise<SsmlSynthesisResult>;
322
+ synthesizeSsml(ssml: string, options?: Partial<TtsConfig>): Promise<SsmlSynthesisResult>;
200
323
  synthesizeChunks(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
201
324
  synthesizeSsmlSafe(ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
202
325
  synthesizeChunksSafe(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
@@ -204,16 +327,36 @@ declare class AzureTtsClient {
204
327
  }
205
328
 
206
329
  type MergeAudioFormat = "wav" | "mp3" | "raw";
330
+ interface MergeAudioOptions {
331
+ format: AzureTtsOutputFormat;
332
+ signal?: AbortSignal;
333
+ outputMimeType?: string;
334
+ }
335
+ type InputAudioSpecs = AudioSpecification[];
336
+ interface CustomMergerContext {
337
+ format: string;
338
+ outputMimeType: string;
339
+ inputSpecs: InputAudioSpecs;
340
+ signal: AbortSignal;
341
+ }
342
+ interface MergeSynthesisOptions extends MergeAudioOptions {
343
+ customMerger?: (buffers: ArrayBuffer[], context: CustomMergerContext) => Promise<ArrayBuffer> | ArrayBuffer;
344
+ }
345
+ type AsyncMergeSynthesisOptions = MergeSynthesisOptions & {
346
+ customMerger: NonNullable<MergeSynthesisOptions["customMerger"]>;
347
+ };
348
+ /** Extracts the stream specification from a WAV/MP3 header and output-format fallback. */
349
+ declare function inspectAudioSpecification(buffer: ArrayBuffer, format: string): AudioSpecification;
207
350
  /** Returns whether the named output format can be safely concatenated without re-multiplexing. */
208
351
  declare function resolveMergeAudioFormat(format: string): MergeAudioFormat | undefined;
209
352
  declare function canMergeAudioFormat(format: string): boolean;
210
353
  /** Merges audio buffers while preserving the invariants of supported containers. */
211
- declare function mergeAudioBuffers(buffers: readonly ArrayBuffer[], format: string): ArrayBuffer;
354
+ declare function mergeAudioBuffers(buffers: readonly ArrayBuffer[], options: MergeAudioOptions): ArrayBuffer;
212
355
  declare function synthesizeSsml(ssml: string, config: TtsConfig): Promise<SsmlSynthesisResult>;
213
- /** Synthesizes chunks sequentially, annotates synchronization events, and merges the results. */
356
+ /** Synthesizes chunks with bounded concurrency, retries transient failures, and merges in chunk order. */
214
357
  declare function synthesizeSsmlChunks(chunks: readonly (SsmlSynthesisChunk | string)[], config: TtsConfig): Promise<SsmlSynthesisResult>;
215
- /** Concatenates audio buffers and shifts all synchronization events by prior chunk durations. */
216
- declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], format?: string): SsmlSynthesisResult;
358
+ declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: AsyncMergeSynthesisOptions): Promise<MergedSynthesisResult>;
359
+ declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: MergeAudioOptions): MergedSynthesisResult;
217
360
  /** Backward-compatible audio-only synthesis helper. */
218
361
  declare function synthesizeSpeech(ssml: string, config: TtsConfig): Promise<ArrayBuffer>;
219
362
 
@@ -245,4 +388,4 @@ interface AzureVoiceCatalog {
245
388
  /** Fetches and deduplicates the current Azure Speech voice catalog for one or more regions. */
246
389
  declare function fetchAzureVoiceCatalog(options: FetchAzureVoiceCatalogOptions): Promise<AzureVoiceCatalog>;
247
390
 
248
- export { type AzureApiErrorResult, type SsmlValidationError as AzureSsmlValidationError, AzureTtsClient, type AzureTtsClientOptions, AzureTtsError, type AzureTtsLogger, AzureTtsSdkError, type AzureVoiceCatalog, type AzureVoiceCatalogVoice, ChunkValidationError, type FetchAzureVoiceCatalogOptions, type FetchedAzureVoiceCatalogMetadata, type MergeAudioFormat, type Result, type SsmlSynthesisBookmark, type SsmlSynthesisBoundary, type SsmlSynthesisChunk, type SsmlSynthesisChunksSafeResult, type SsmlSynthesisResult, type SsmlSynthesisSafeResult, type SsmlSynthesisViseme, type Success, type SynthesisChunkStatus, type SynthesisProgressEvent, type SynthesisResult, type SynthesizeChunksOptions, type SynthesizeSsmlChunksSafeOptions, type SynthesizeSsmlSafeOptions, type TtsConfig, UnsupportedMergeFormatError, type ValidationErrorResult, canMergeAudioFormat, fetchAzureVoiceCatalog, mergeAudioBuffers, mergeSynthesisResults, resolveMergeAudioFormat, synthesizeSpeech, synthesizeSsml, synthesizeSsmlChunks, synthesizeSsmlChunksSafe, synthesizeSsmlSafe };
391
+ export { AudioFormatMismatchError, type AudioSpecification, type AzureApiErrorResult, type SsmlValidationError as AzureSsmlValidationError, AzureTtsClient, type AzureTtsClientOptions, AzureTtsError, type AzureTtsLogger, type AzureTtsOutputFormat, AzureTtsSdkError, type AzureTtsSynthesisError, type AzureVoiceCatalog, type AzureVoiceCatalogVoice, ChunkValidationError, type CustomMergerContext, DEFAULT_OUTPUT_FORMAT, type FetchAzureVoiceCatalogOptions, type FetchedAzureVoiceCatalogMetadata, type InputAudioSpecs, type MappingStatus, type MergeAudioFormat, type MergeAudioOptions, MergeError, type MergeSynthesisOptions, type MergedSynthesisResult, type Result, type RetryOptions, 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, inspectAudioSpecification, mergeAudioBuffers, mergeSynthesisResults, resolveMergeAudioFormat, resolveMimeType, synthesizeSpeech, synthesizeSsml, synthesizeSsmlChunks, synthesizeSsmlChunksSafe, synthesizeSsmlSafe };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,50 @@
1
- import { SsmlTextRange, SsmlDiagnostic, AzureValidationOptions } from '@ssml-builder-js/ssml-core';
1
+ import { SsmlTextRange, SsmlSourceTextSegment, SsmlSourceMarker, SsmlDiagnostic, AzureValidationOptions } from '@ssml-builder-js/ssml-core';
2
+ import * as SpeechSDK from 'microsoft-cognitiveservices-speech-sdk';
3
+
4
+ declare const DEFAULT_OUTPUT_FORMAT = "audio-16khz-128kbitrate-mono-mp3";
5
+ declare const OUTPUT_FORMATS: {
6
+ "raw-8khz-8bit-mono-mulaw": SpeechSDK.SpeechSynthesisOutputFormat.Raw8Khz8BitMonoMULaw;
7
+ "riff-16khz-16kbps-mono-siren": SpeechSDK.SpeechSynthesisOutputFormat.Riff16Khz16KbpsMonoSiren;
8
+ "audio-16khz-16kbps-mono-siren": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz16KbpsMonoSiren;
9
+ "audio-16khz-32kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3;
10
+ "audio-16khz-128kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz128KBitRateMonoMp3;
11
+ "audio-16khz-64kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz64KBitRateMonoMp3;
12
+ "audio-24khz-48kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz48KBitRateMonoMp3;
13
+ "audio-24khz-96kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz96KBitRateMonoMp3;
14
+ "audio-24khz-160kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz160KBitRateMonoMp3;
15
+ "raw-16khz-16bit-mono-truesilk": SpeechSDK.SpeechSynthesisOutputFormat.Raw16Khz16BitMonoTrueSilk;
16
+ "riff-16khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff16Khz16BitMonoPcm;
17
+ "riff-8khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff8Khz16BitMonoPcm;
18
+ "riff-24khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm;
19
+ "riff-8khz-8bit-mono-mulaw": SpeechSDK.SpeechSynthesisOutputFormat.Riff8Khz8BitMonoMULaw;
20
+ "raw-16khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw16Khz16BitMonoPcm;
21
+ "raw-24khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw24Khz16BitMonoPcm;
22
+ "raw-8khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw8Khz16BitMonoPcm;
23
+ "ogg-16khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Ogg16Khz16BitMonoOpus;
24
+ "ogg-24khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Ogg24Khz16BitMonoOpus;
25
+ "raw-48khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw48Khz16BitMonoPcm;
26
+ "riff-48khz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff48Khz16BitMonoPcm;
27
+ "audio-48khz-96kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio48Khz96KBitRateMonoMp3;
28
+ "audio-48khz-192kbitrate-mono-mp3": SpeechSDK.SpeechSynthesisOutputFormat.Audio48Khz192KBitRateMonoMp3;
29
+ "ogg-48khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Ogg48Khz16BitMonoOpus;
30
+ "webm-16khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Webm16Khz16BitMonoOpus;
31
+ "webm-24khz-16bit-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Webm24Khz16BitMonoOpus;
32
+ "webm-24khz-16bit-24kbps-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Webm24Khz16Bit24KbpsMonoOpus;
33
+ "raw-24khz-16bit-mono-truesilk": SpeechSDK.SpeechSynthesisOutputFormat.Raw24Khz16BitMonoTrueSilk;
34
+ "raw-8khz-8bit-mono-alaw": SpeechSDK.SpeechSynthesisOutputFormat.Raw8Khz8BitMonoALaw;
35
+ "riff-8khz-8bit-mono-alaw": SpeechSDK.SpeechSynthesisOutputFormat.Riff8Khz8BitMonoALaw;
36
+ "audio-16khz-16bit-32kbps-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Audio16Khz16Bit32KbpsMonoOpus;
37
+ "audio-24khz-16bit-48kbps-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz16Bit48KbpsMonoOpus;
38
+ "audio-24khz-16bit-24kbps-mono-opus": SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz16Bit24KbpsMonoOpus;
39
+ "raw-22050hz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw22050Hz16BitMonoPcm;
40
+ "riff-22050hz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff22050Hz16BitMonoPcm;
41
+ "raw-44100hz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Raw44100Hz16BitMonoPcm;
42
+ "riff-44100hz-16bit-mono-pcm": SpeechSDK.SpeechSynthesisOutputFormat.Riff44100Hz16BitMonoPcm;
43
+ "amr-wb-16000hz": SpeechSDK.SpeechSynthesisOutputFormat.AmrWb16000Hz;
44
+ "g722-16khz-64kbps": SpeechSDK.SpeechSynthesisOutputFormat.G72216Khz64Kbps;
45
+ };
46
+ type AzureTtsOutputFormat = keyof typeof OUTPUT_FORMATS;
47
+ declare function resolveMimeType(outputFormat: string): string;
2
48
 
3
49
  interface TtsConfig {
4
50
  signal?: AbortSignal;
@@ -17,6 +63,26 @@ interface TtsConfig {
17
63
  /** Metadata used to map synchronization events back to the source document. */
18
64
  chunkIndex?: number;
19
65
  sourceNodePath?: string[];
66
+ /** Exact source text segments used to map individual Azure events. */
67
+ sourceTextSegments?: SsmlSourceTextSegment[];
68
+ sourceMarkers?: SsmlSourceMarker[];
69
+ concurrency?: number;
70
+ retryOptions?: RetryOptions;
71
+ }
72
+ type MappingStatus = "exact" | "fallback" | "unmapped";
73
+ interface AudioSpecification {
74
+ format: string;
75
+ mimeType: string;
76
+ codec: "pcm" | "mp3" | "opus" | "silk" | "unknown";
77
+ sampleRate: number;
78
+ channels: number;
79
+ bitrate?: number;
80
+ isCompressed: boolean;
81
+ }
82
+ interface RetryOptions {
83
+ maxRetries: number;
84
+ initialDelayMs: number;
85
+ maxDelayMs: number;
20
86
  }
21
87
  type SynthesisChunkStatus = "pending" | "synthesizing" | "success" | "failed";
22
88
  interface SsmlSynthesisBoundary {
@@ -36,6 +102,7 @@ interface SsmlSynthesisBoundary {
36
102
  /** Audio offset within the originating chunk before merge. */
37
103
  chunkAudioOffsetMs?: number;
38
104
  requestId?: string;
105
+ mappingStatus: MappingStatus;
39
106
  }
40
107
  interface SsmlSynthesisViseme {
41
108
  visemeId: number;
@@ -49,6 +116,7 @@ interface SsmlSynthesisViseme {
49
116
  originalTextRange?: SsmlTextRange;
50
117
  chunkAudioOffsetMs?: number;
51
118
  requestId?: string;
119
+ mappingStatus: MappingStatus;
52
120
  }
53
121
  interface SsmlSynthesisBookmark {
54
122
  name: string;
@@ -62,6 +130,7 @@ interface SsmlSynthesisBookmark {
62
130
  originalTextRange?: SsmlTextRange;
63
131
  chunkAudioOffsetMs?: number;
64
132
  requestId?: string;
133
+ mappingStatus: MappingStatus;
65
134
  }
66
135
  /** Audio and Azure Speech synchronization events emitted for one SSML request. */
67
136
  interface SsmlSynthesisResult {
@@ -81,6 +150,12 @@ interface SsmlSynthesisResult {
81
150
  start: number;
82
151
  end: number;
83
152
  };
153
+ /** MIME type of a result produced by an explicit merge operation. */
154
+ mimeType?: string;
155
+ audioSpec?: AudioSpecification;
156
+ }
157
+ interface MergedSynthesisResult extends SsmlSynthesisResult {
158
+ mimeType: string;
84
159
  }
85
160
  interface SsmlSynthesisChunk {
86
161
  ssml: string;
@@ -89,9 +164,17 @@ interface SsmlSynthesisChunk {
89
164
  end: number;
90
165
  };
91
166
  sourceNodePath?: string[];
167
+ sourceTextSegments?: SsmlSourceTextSegment[];
168
+ sourceMarkers?: SsmlSourceMarker[];
92
169
  }
93
170
  interface SynthesizeChunksOptions {
94
171
  onProgress?: (event: SynthesisProgressEvent) => void;
172
+ outputFormat?: AzureTtsOutputFormat | string;
173
+ signal?: AbortSignal;
174
+ timeoutMs?: number;
175
+ sourceNodePath?: string[];
176
+ concurrency?: number;
177
+ retryOptions?: RetryOptions;
95
178
  }
96
179
  interface SynthesisProgressEvent {
97
180
  /** 1-based completed chunk count retained for backward compatibility. */
@@ -103,6 +186,9 @@ interface SynthesisProgressEvent {
103
186
  status: SynthesisChunkStatus;
104
187
  durationMs: number;
105
188
  error?: unknown;
189
+ retryAttempt?: number;
190
+ nextRetryDelayMs?: number;
191
+ isRetrying?: boolean;
106
192
  }
107
193
  interface AzureTtsLogger {
108
194
  debug?: (...args: unknown[]) => void;
@@ -119,9 +205,13 @@ interface AzureTtsClientOptions {
119
205
  outputFormat?: string;
120
206
  logger?: AzureTtsLogger;
121
207
  onProgress?: (event: SynthesisProgressEvent) => void;
208
+ concurrency?: number;
209
+ retryOptions?: RetryOptions;
122
210
  }
123
211
 
212
+ type SynthesisErrorKind = "validation-error" | "azure-api-error" | "merge-error" | "audio-format-mismatch" | "unsupported-format-error" | "cancelled" | "timeout";
124
213
  declare class AzureTtsError extends Error {
214
+ readonly kind: "azure-api-error";
125
215
  readonly status: number;
126
216
  readonly statusText: string;
127
217
  readonly responseBody: string;
@@ -132,19 +222,41 @@ declare class AzureTtsSdkError extends AzureTtsError {
132
222
  readonly errorDetails: string;
133
223
  constructor(errorDetails: string);
134
224
  }
225
+ declare class SynthesisCancelledError extends Error {
226
+ readonly kind: "cancelled";
227
+ constructor(message?: string);
228
+ }
229
+ declare class SynthesisTimeoutError extends Error {
230
+ readonly kind: "timeout";
231
+ constructor(message: string);
232
+ }
233
+ declare class MergeError extends Error {
234
+ readonly kind: "merge-error";
235
+ readonly cause: unknown;
236
+ constructor(message: string, cause?: unknown);
237
+ }
238
+ /** Thrown when chunk headers describe incompatible audio streams. */
239
+ declare class AudioFormatMismatchError extends Error {
240
+ readonly kind: "audio-format-mismatch";
241
+ readonly inputSpecs: readonly AudioSpecification[];
242
+ constructor(message: string, inputSpecs?: readonly AudioSpecification[]);
243
+ }
135
244
  /** Thrown when audio buffers require container re-multiplexing before they can be merged. */
136
245
  declare class UnsupportedMergeFormatError extends Error {
246
+ readonly kind: "unsupported-format-error";
137
247
  readonly format: string;
138
248
  constructor(format: string);
139
249
  }
250
+ type AzureTtsSynthesisError = AzureTtsError | MergeError | AudioFormatMismatchError | UnsupportedMergeFormatError | SynthesisCancelledError | SynthesisTimeoutError;
140
251
 
141
252
  interface SsmlValidationError {
142
- readonly kind: "validation";
253
+ readonly kind: "validation-error";
143
254
  readonly message: string;
144
255
  readonly diagnostics: readonly SsmlDiagnostic[];
145
256
  }
257
+ type SsmlSynthesisError = SsmlValidationError | AzureTtsSynthesisError;
146
258
  declare class ChunkValidationError extends Error {
147
- readonly kind: "chunk-validation";
259
+ readonly kind: "validation-error";
148
260
  readonly chunkIndex: number;
149
261
  readonly diagnostics: readonly SsmlDiagnostic[];
150
262
  constructor(chunkIndex: number, diagnostics: readonly SsmlDiagnostic[]);
@@ -154,12 +266,19 @@ type Result<T, E> = {
154
266
  readonly success: true;
155
267
  readonly status: "success";
156
268
  readonly value: T;
157
- } | {
269
+ } | (E extends {
270
+ readonly kind: infer Kind extends SynthesisErrorKind;
271
+ } ? {
158
272
  readonly ok: false;
159
273
  readonly success: false;
160
- readonly status: "validation-error" | "azure-api-error";
274
+ readonly status: Kind;
161
275
  readonly error: E;
162
- };
276
+ } : {
277
+ readonly ok: false;
278
+ readonly success: false;
279
+ readonly status: SynthesisErrorKind;
280
+ readonly error: E;
281
+ });
163
282
  type SynthesisResult<T, E> = Result<T, E>;
164
283
  type Success<T> = Extract<Result<T, never>, {
165
284
  readonly ok: true;
@@ -170,22 +289,26 @@ type ValidationErrorResult = Extract<Result<never, SsmlValidationError>, {
170
289
  type AzureApiErrorResult = Extract<Result<never, AzureTtsError>, {
171
290
  readonly status: "azure-api-error";
172
291
  }>;
173
- type SsmlSynthesisSafeResult = Result<SsmlSynthesisResult, never> | Result<never, SsmlValidationError> | Result<never, AzureTtsError>;
292
+ type SsmlSynthesisSafeResult = Result<SsmlSynthesisResult, never> | Result<never, SsmlValidationError> | Result<never, SsmlSynthesisError>;
174
293
  interface SynthesizeSsmlSafeOptions extends AzureValidationOptions {
175
294
  /** Optional nested form for callers that want to keep validation settings grouped. */
176
295
  validation?: AzureValidationOptions;
296
+ signal?: AbortSignal;
177
297
  }
178
298
  interface SynthesizeSsmlChunksSafeOptions extends AzureValidationOptions {
179
299
  validation?: AzureValidationOptions;
180
300
  outputFormat?: string;
301
+ signal?: AbortSignal;
302
+ timeoutMs?: number;
303
+ sourceNodePath?: string[];
181
304
  onProgress?: (event: SynthesisProgressEvent) => void;
305
+ concurrency?: number;
306
+ retryOptions?: RetryOptions;
182
307
  }
183
- type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, AzureTtsError>;
308
+ type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, SsmlSynthesisError | ChunkValidationError>;
184
309
  interface SynthesisClient {
185
- synthesizeSsml(ssml: string): Promise<SsmlSynthesisResult>;
186
- synthesizeChunks?(chunks: readonly (SsmlSynthesisChunk | string)[], options?: {
187
- onProgress?: (event: SynthesisProgressEvent) => void;
188
- }): Promise<SsmlSynthesisResult>;
310
+ synthesizeSsml(ssml: string, options?: Partial<SynthesizeChunksOptions>): Promise<SsmlSynthesisResult>;
311
+ synthesizeChunks?(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
189
312
  }
190
313
  /** Validates SSML before invoking Azure and converts validation/API failures to one result shape. */
191
314
  declare function synthesizeSsmlSafe(client: Pick<AzureTtsClient, "synthesizeSsml"> | SynthesisClient, ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
@@ -196,7 +319,7 @@ declare class AzureTtsClient {
196
319
  #private;
197
320
  constructor(options: AzureTtsClientOptions);
198
321
  synthesize(ssml: string): Promise<ArrayBuffer>;
199
- synthesizeSsml(ssml: string): Promise<SsmlSynthesisResult>;
322
+ synthesizeSsml(ssml: string, options?: Partial<TtsConfig>): Promise<SsmlSynthesisResult>;
200
323
  synthesizeChunks(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
201
324
  synthesizeSsmlSafe(ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
202
325
  synthesizeChunksSafe(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
@@ -204,16 +327,36 @@ declare class AzureTtsClient {
204
327
  }
205
328
 
206
329
  type MergeAudioFormat = "wav" | "mp3" | "raw";
330
+ interface MergeAudioOptions {
331
+ format: AzureTtsOutputFormat;
332
+ signal?: AbortSignal;
333
+ outputMimeType?: string;
334
+ }
335
+ type InputAudioSpecs = AudioSpecification[];
336
+ interface CustomMergerContext {
337
+ format: string;
338
+ outputMimeType: string;
339
+ inputSpecs: InputAudioSpecs;
340
+ signal: AbortSignal;
341
+ }
342
+ interface MergeSynthesisOptions extends MergeAudioOptions {
343
+ customMerger?: (buffers: ArrayBuffer[], context: CustomMergerContext) => Promise<ArrayBuffer> | ArrayBuffer;
344
+ }
345
+ type AsyncMergeSynthesisOptions = MergeSynthesisOptions & {
346
+ customMerger: NonNullable<MergeSynthesisOptions["customMerger"]>;
347
+ };
348
+ /** Extracts the stream specification from a WAV/MP3 header and output-format fallback. */
349
+ declare function inspectAudioSpecification(buffer: ArrayBuffer, format: string): AudioSpecification;
207
350
  /** Returns whether the named output format can be safely concatenated without re-multiplexing. */
208
351
  declare function resolveMergeAudioFormat(format: string): MergeAudioFormat | undefined;
209
352
  declare function canMergeAudioFormat(format: string): boolean;
210
353
  /** Merges audio buffers while preserving the invariants of supported containers. */
211
- declare function mergeAudioBuffers(buffers: readonly ArrayBuffer[], format: string): ArrayBuffer;
354
+ declare function mergeAudioBuffers(buffers: readonly ArrayBuffer[], options: MergeAudioOptions): ArrayBuffer;
212
355
  declare function synthesizeSsml(ssml: string, config: TtsConfig): Promise<SsmlSynthesisResult>;
213
- /** Synthesizes chunks sequentially, annotates synchronization events, and merges the results. */
356
+ /** Synthesizes chunks with bounded concurrency, retries transient failures, and merges in chunk order. */
214
357
  declare function synthesizeSsmlChunks(chunks: readonly (SsmlSynthesisChunk | string)[], config: TtsConfig): Promise<SsmlSynthesisResult>;
215
- /** Concatenates audio buffers and shifts all synchronization events by prior chunk durations. */
216
- declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], format?: string): SsmlSynthesisResult;
358
+ declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: AsyncMergeSynthesisOptions): Promise<MergedSynthesisResult>;
359
+ declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: MergeAudioOptions): MergedSynthesisResult;
217
360
  /** Backward-compatible audio-only synthesis helper. */
218
361
  declare function synthesizeSpeech(ssml: string, config: TtsConfig): Promise<ArrayBuffer>;
219
362
 
@@ -245,4 +388,4 @@ interface AzureVoiceCatalog {
245
388
  /** Fetches and deduplicates the current Azure Speech voice catalog for one or more regions. */
246
389
  declare function fetchAzureVoiceCatalog(options: FetchAzureVoiceCatalogOptions): Promise<AzureVoiceCatalog>;
247
390
 
248
- export { type AzureApiErrorResult, type SsmlValidationError as AzureSsmlValidationError, AzureTtsClient, type AzureTtsClientOptions, AzureTtsError, type AzureTtsLogger, AzureTtsSdkError, type AzureVoiceCatalog, type AzureVoiceCatalogVoice, ChunkValidationError, type FetchAzureVoiceCatalogOptions, type FetchedAzureVoiceCatalogMetadata, type MergeAudioFormat, type Result, type SsmlSynthesisBookmark, type SsmlSynthesisBoundary, type SsmlSynthesisChunk, type SsmlSynthesisChunksSafeResult, type SsmlSynthesisResult, type SsmlSynthesisSafeResult, type SsmlSynthesisViseme, type Success, type SynthesisChunkStatus, type SynthesisProgressEvent, type SynthesisResult, type SynthesizeChunksOptions, type SynthesizeSsmlChunksSafeOptions, type SynthesizeSsmlSafeOptions, type TtsConfig, UnsupportedMergeFormatError, type ValidationErrorResult, canMergeAudioFormat, fetchAzureVoiceCatalog, mergeAudioBuffers, mergeSynthesisResults, resolveMergeAudioFormat, synthesizeSpeech, synthesizeSsml, synthesizeSsmlChunks, synthesizeSsmlChunksSafe, synthesizeSsmlSafe };
391
+ export { AudioFormatMismatchError, type AudioSpecification, type AzureApiErrorResult, type SsmlValidationError as AzureSsmlValidationError, AzureTtsClient, type AzureTtsClientOptions, AzureTtsError, type AzureTtsLogger, type AzureTtsOutputFormat, AzureTtsSdkError, type AzureTtsSynthesisError, type AzureVoiceCatalog, type AzureVoiceCatalogVoice, ChunkValidationError, type CustomMergerContext, DEFAULT_OUTPUT_FORMAT, type FetchAzureVoiceCatalogOptions, type FetchedAzureVoiceCatalogMetadata, type InputAudioSpecs, type MappingStatus, type MergeAudioFormat, type MergeAudioOptions, MergeError, type MergeSynthesisOptions, type MergedSynthesisResult, type Result, type RetryOptions, 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, inspectAudioSpecification, mergeAudioBuffers, mergeSynthesisResults, resolveMergeAudioFormat, resolveMimeType, synthesizeSpeech, synthesizeSsml, synthesizeSsmlChunks, synthesizeSsmlChunksSafe, synthesizeSsmlSafe };