@ssml-builder-js/azure-tts-client 2.15.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 +11 -0
- package/dist/index.d.mts +52 -5
- package/dist/index.d.ts +52 -5
- package/dist/index.js +510 -154
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +512 -155
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/client.ts +4 -0
- package/src/errors.ts +23 -1
- package/src/index.ts +12 -1
- package/src/safe.ts +238 -111
- package/src/synthesis.ts +361 -66
- package/src/types.ts +31 -0
- package/test/v216-pipeline.test.ts +110 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
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
|
+
|
|
3
14
|
## 2.15.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -66,6 +66,23 @@ interface TtsConfig {
|
|
|
66
66
|
/** Exact source text segments used to map individual Azure events. */
|
|
67
67
|
sourceTextSegments?: SsmlSourceTextSegment[];
|
|
68
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;
|
|
69
86
|
}
|
|
70
87
|
type SynthesisChunkStatus = "pending" | "synthesizing" | "success" | "failed";
|
|
71
88
|
interface SsmlSynthesisBoundary {
|
|
@@ -85,6 +102,7 @@ interface SsmlSynthesisBoundary {
|
|
|
85
102
|
/** Audio offset within the originating chunk before merge. */
|
|
86
103
|
chunkAudioOffsetMs?: number;
|
|
87
104
|
requestId?: string;
|
|
105
|
+
mappingStatus: MappingStatus;
|
|
88
106
|
}
|
|
89
107
|
interface SsmlSynthesisViseme {
|
|
90
108
|
visemeId: number;
|
|
@@ -98,6 +116,7 @@ interface SsmlSynthesisViseme {
|
|
|
98
116
|
originalTextRange?: SsmlTextRange;
|
|
99
117
|
chunkAudioOffsetMs?: number;
|
|
100
118
|
requestId?: string;
|
|
119
|
+
mappingStatus: MappingStatus;
|
|
101
120
|
}
|
|
102
121
|
interface SsmlSynthesisBookmark {
|
|
103
122
|
name: string;
|
|
@@ -111,6 +130,7 @@ interface SsmlSynthesisBookmark {
|
|
|
111
130
|
originalTextRange?: SsmlTextRange;
|
|
112
131
|
chunkAudioOffsetMs?: number;
|
|
113
132
|
requestId?: string;
|
|
133
|
+
mappingStatus: MappingStatus;
|
|
114
134
|
}
|
|
115
135
|
/** Audio and Azure Speech synchronization events emitted for one SSML request. */
|
|
116
136
|
interface SsmlSynthesisResult {
|
|
@@ -132,6 +152,7 @@ interface SsmlSynthesisResult {
|
|
|
132
152
|
};
|
|
133
153
|
/** MIME type of a result produced by an explicit merge operation. */
|
|
134
154
|
mimeType?: string;
|
|
155
|
+
audioSpec?: AudioSpecification;
|
|
135
156
|
}
|
|
136
157
|
interface MergedSynthesisResult extends SsmlSynthesisResult {
|
|
137
158
|
mimeType: string;
|
|
@@ -152,6 +173,8 @@ interface SynthesizeChunksOptions {
|
|
|
152
173
|
signal?: AbortSignal;
|
|
153
174
|
timeoutMs?: number;
|
|
154
175
|
sourceNodePath?: string[];
|
|
176
|
+
concurrency?: number;
|
|
177
|
+
retryOptions?: RetryOptions;
|
|
155
178
|
}
|
|
156
179
|
interface SynthesisProgressEvent {
|
|
157
180
|
/** 1-based completed chunk count retained for backward compatibility. */
|
|
@@ -163,6 +186,9 @@ interface SynthesisProgressEvent {
|
|
|
163
186
|
status: SynthesisChunkStatus;
|
|
164
187
|
durationMs: number;
|
|
165
188
|
error?: unknown;
|
|
189
|
+
retryAttempt?: number;
|
|
190
|
+
nextRetryDelayMs?: number;
|
|
191
|
+
isRetrying?: boolean;
|
|
166
192
|
}
|
|
167
193
|
interface AzureTtsLogger {
|
|
168
194
|
debug?: (...args: unknown[]) => void;
|
|
@@ -179,9 +205,11 @@ interface AzureTtsClientOptions {
|
|
|
179
205
|
outputFormat?: string;
|
|
180
206
|
logger?: AzureTtsLogger;
|
|
181
207
|
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
208
|
+
concurrency?: number;
|
|
209
|
+
retryOptions?: RetryOptions;
|
|
182
210
|
}
|
|
183
211
|
|
|
184
|
-
type SynthesisErrorKind = "validation-error" | "azure-api-error" | "merge-error" | "unsupported-format-error" | "cancelled" | "timeout";
|
|
212
|
+
type SynthesisErrorKind = "validation-error" | "azure-api-error" | "merge-error" | "audio-format-mismatch" | "unsupported-format-error" | "cancelled" | "timeout";
|
|
185
213
|
declare class AzureTtsError extends Error {
|
|
186
214
|
readonly kind: "azure-api-error";
|
|
187
215
|
readonly status: number;
|
|
@@ -207,13 +235,19 @@ declare class MergeError extends Error {
|
|
|
207
235
|
readonly cause: unknown;
|
|
208
236
|
constructor(message: string, cause?: unknown);
|
|
209
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
|
+
}
|
|
210
244
|
/** Thrown when audio buffers require container re-multiplexing before they can be merged. */
|
|
211
245
|
declare class UnsupportedMergeFormatError extends Error {
|
|
212
246
|
readonly kind: "unsupported-format-error";
|
|
213
247
|
readonly format: string;
|
|
214
248
|
constructor(format: string);
|
|
215
249
|
}
|
|
216
|
-
type AzureTtsSynthesisError = AzureTtsError | MergeError | UnsupportedMergeFormatError | SynthesisCancelledError | SynthesisTimeoutError;
|
|
250
|
+
type AzureTtsSynthesisError = AzureTtsError | MergeError | AudioFormatMismatchError | UnsupportedMergeFormatError | SynthesisCancelledError | SynthesisTimeoutError;
|
|
217
251
|
|
|
218
252
|
interface SsmlValidationError {
|
|
219
253
|
readonly kind: "validation-error";
|
|
@@ -268,6 +302,8 @@ interface SynthesizeSsmlChunksSafeOptions extends AzureValidationOptions {
|
|
|
268
302
|
timeoutMs?: number;
|
|
269
303
|
sourceNodePath?: string[];
|
|
270
304
|
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
305
|
+
concurrency?: number;
|
|
306
|
+
retryOptions?: RetryOptions;
|
|
271
307
|
}
|
|
272
308
|
type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, SsmlSynthesisError | ChunkValidationError>;
|
|
273
309
|
interface SynthesisClient {
|
|
@@ -293,20 +329,31 @@ declare class AzureTtsClient {
|
|
|
293
329
|
type MergeAudioFormat = "wav" | "mp3" | "raw";
|
|
294
330
|
interface MergeAudioOptions {
|
|
295
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;
|
|
296
341
|
}
|
|
297
342
|
interface MergeSynthesisOptions extends MergeAudioOptions {
|
|
298
|
-
customMerger?: (buffers: ArrayBuffer[],
|
|
343
|
+
customMerger?: (buffers: ArrayBuffer[], context: CustomMergerContext) => Promise<ArrayBuffer> | ArrayBuffer;
|
|
299
344
|
}
|
|
300
345
|
type AsyncMergeSynthesisOptions = MergeSynthesisOptions & {
|
|
301
346
|
customMerger: NonNullable<MergeSynthesisOptions["customMerger"]>;
|
|
302
347
|
};
|
|
348
|
+
/** Extracts the stream specification from a WAV/MP3 header and output-format fallback. */
|
|
349
|
+
declare function inspectAudioSpecification(buffer: ArrayBuffer, format: string): AudioSpecification;
|
|
303
350
|
/** Returns whether the named output format can be safely concatenated without re-multiplexing. */
|
|
304
351
|
declare function resolveMergeAudioFormat(format: string): MergeAudioFormat | undefined;
|
|
305
352
|
declare function canMergeAudioFormat(format: string): boolean;
|
|
306
353
|
/** Merges audio buffers while preserving the invariants of supported containers. */
|
|
307
354
|
declare function mergeAudioBuffers(buffers: readonly ArrayBuffer[], options: MergeAudioOptions): ArrayBuffer;
|
|
308
355
|
declare function synthesizeSsml(ssml: string, config: TtsConfig): Promise<SsmlSynthesisResult>;
|
|
309
|
-
/** Synthesizes chunks
|
|
356
|
+
/** Synthesizes chunks with bounded concurrency, retries transient failures, and merges in chunk order. */
|
|
310
357
|
declare function synthesizeSsmlChunks(chunks: readonly (SsmlSynthesisChunk | string)[], config: TtsConfig): Promise<SsmlSynthesisResult>;
|
|
311
358
|
declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: AsyncMergeSynthesisOptions): Promise<MergedSynthesisResult>;
|
|
312
359
|
declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: MergeAudioOptions): MergedSynthesisResult;
|
|
@@ -341,4 +388,4 @@ interface AzureVoiceCatalog {
|
|
|
341
388
|
/** Fetches and deduplicates the current Azure Speech voice catalog for one or more regions. */
|
|
342
389
|
declare function fetchAzureVoiceCatalog(options: FetchAzureVoiceCatalogOptions): Promise<AzureVoiceCatalog>;
|
|
343
390
|
|
|
344
|
-
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 };
|
|
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
|
@@ -66,6 +66,23 @@ interface TtsConfig {
|
|
|
66
66
|
/** Exact source text segments used to map individual Azure events. */
|
|
67
67
|
sourceTextSegments?: SsmlSourceTextSegment[];
|
|
68
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;
|
|
69
86
|
}
|
|
70
87
|
type SynthesisChunkStatus = "pending" | "synthesizing" | "success" | "failed";
|
|
71
88
|
interface SsmlSynthesisBoundary {
|
|
@@ -85,6 +102,7 @@ interface SsmlSynthesisBoundary {
|
|
|
85
102
|
/** Audio offset within the originating chunk before merge. */
|
|
86
103
|
chunkAudioOffsetMs?: number;
|
|
87
104
|
requestId?: string;
|
|
105
|
+
mappingStatus: MappingStatus;
|
|
88
106
|
}
|
|
89
107
|
interface SsmlSynthesisViseme {
|
|
90
108
|
visemeId: number;
|
|
@@ -98,6 +116,7 @@ interface SsmlSynthesisViseme {
|
|
|
98
116
|
originalTextRange?: SsmlTextRange;
|
|
99
117
|
chunkAudioOffsetMs?: number;
|
|
100
118
|
requestId?: string;
|
|
119
|
+
mappingStatus: MappingStatus;
|
|
101
120
|
}
|
|
102
121
|
interface SsmlSynthesisBookmark {
|
|
103
122
|
name: string;
|
|
@@ -111,6 +130,7 @@ interface SsmlSynthesisBookmark {
|
|
|
111
130
|
originalTextRange?: SsmlTextRange;
|
|
112
131
|
chunkAudioOffsetMs?: number;
|
|
113
132
|
requestId?: string;
|
|
133
|
+
mappingStatus: MappingStatus;
|
|
114
134
|
}
|
|
115
135
|
/** Audio and Azure Speech synchronization events emitted for one SSML request. */
|
|
116
136
|
interface SsmlSynthesisResult {
|
|
@@ -132,6 +152,7 @@ interface SsmlSynthesisResult {
|
|
|
132
152
|
};
|
|
133
153
|
/** MIME type of a result produced by an explicit merge operation. */
|
|
134
154
|
mimeType?: string;
|
|
155
|
+
audioSpec?: AudioSpecification;
|
|
135
156
|
}
|
|
136
157
|
interface MergedSynthesisResult extends SsmlSynthesisResult {
|
|
137
158
|
mimeType: string;
|
|
@@ -152,6 +173,8 @@ interface SynthesizeChunksOptions {
|
|
|
152
173
|
signal?: AbortSignal;
|
|
153
174
|
timeoutMs?: number;
|
|
154
175
|
sourceNodePath?: string[];
|
|
176
|
+
concurrency?: number;
|
|
177
|
+
retryOptions?: RetryOptions;
|
|
155
178
|
}
|
|
156
179
|
interface SynthesisProgressEvent {
|
|
157
180
|
/** 1-based completed chunk count retained for backward compatibility. */
|
|
@@ -163,6 +186,9 @@ interface SynthesisProgressEvent {
|
|
|
163
186
|
status: SynthesisChunkStatus;
|
|
164
187
|
durationMs: number;
|
|
165
188
|
error?: unknown;
|
|
189
|
+
retryAttempt?: number;
|
|
190
|
+
nextRetryDelayMs?: number;
|
|
191
|
+
isRetrying?: boolean;
|
|
166
192
|
}
|
|
167
193
|
interface AzureTtsLogger {
|
|
168
194
|
debug?: (...args: unknown[]) => void;
|
|
@@ -179,9 +205,11 @@ interface AzureTtsClientOptions {
|
|
|
179
205
|
outputFormat?: string;
|
|
180
206
|
logger?: AzureTtsLogger;
|
|
181
207
|
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
208
|
+
concurrency?: number;
|
|
209
|
+
retryOptions?: RetryOptions;
|
|
182
210
|
}
|
|
183
211
|
|
|
184
|
-
type SynthesisErrorKind = "validation-error" | "azure-api-error" | "merge-error" | "unsupported-format-error" | "cancelled" | "timeout";
|
|
212
|
+
type SynthesisErrorKind = "validation-error" | "azure-api-error" | "merge-error" | "audio-format-mismatch" | "unsupported-format-error" | "cancelled" | "timeout";
|
|
185
213
|
declare class AzureTtsError extends Error {
|
|
186
214
|
readonly kind: "azure-api-error";
|
|
187
215
|
readonly status: number;
|
|
@@ -207,13 +235,19 @@ declare class MergeError extends Error {
|
|
|
207
235
|
readonly cause: unknown;
|
|
208
236
|
constructor(message: string, cause?: unknown);
|
|
209
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
|
+
}
|
|
210
244
|
/** Thrown when audio buffers require container re-multiplexing before they can be merged. */
|
|
211
245
|
declare class UnsupportedMergeFormatError extends Error {
|
|
212
246
|
readonly kind: "unsupported-format-error";
|
|
213
247
|
readonly format: string;
|
|
214
248
|
constructor(format: string);
|
|
215
249
|
}
|
|
216
|
-
type AzureTtsSynthesisError = AzureTtsError | MergeError | UnsupportedMergeFormatError | SynthesisCancelledError | SynthesisTimeoutError;
|
|
250
|
+
type AzureTtsSynthesisError = AzureTtsError | MergeError | AudioFormatMismatchError | UnsupportedMergeFormatError | SynthesisCancelledError | SynthesisTimeoutError;
|
|
217
251
|
|
|
218
252
|
interface SsmlValidationError {
|
|
219
253
|
readonly kind: "validation-error";
|
|
@@ -268,6 +302,8 @@ interface SynthesizeSsmlChunksSafeOptions extends AzureValidationOptions {
|
|
|
268
302
|
timeoutMs?: number;
|
|
269
303
|
sourceNodePath?: string[];
|
|
270
304
|
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
305
|
+
concurrency?: number;
|
|
306
|
+
retryOptions?: RetryOptions;
|
|
271
307
|
}
|
|
272
308
|
type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, SsmlSynthesisError | ChunkValidationError>;
|
|
273
309
|
interface SynthesisClient {
|
|
@@ -293,20 +329,31 @@ declare class AzureTtsClient {
|
|
|
293
329
|
type MergeAudioFormat = "wav" | "mp3" | "raw";
|
|
294
330
|
interface MergeAudioOptions {
|
|
295
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;
|
|
296
341
|
}
|
|
297
342
|
interface MergeSynthesisOptions extends MergeAudioOptions {
|
|
298
|
-
customMerger?: (buffers: ArrayBuffer[],
|
|
343
|
+
customMerger?: (buffers: ArrayBuffer[], context: CustomMergerContext) => Promise<ArrayBuffer> | ArrayBuffer;
|
|
299
344
|
}
|
|
300
345
|
type AsyncMergeSynthesisOptions = MergeSynthesisOptions & {
|
|
301
346
|
customMerger: NonNullable<MergeSynthesisOptions["customMerger"]>;
|
|
302
347
|
};
|
|
348
|
+
/** Extracts the stream specification from a WAV/MP3 header and output-format fallback. */
|
|
349
|
+
declare function inspectAudioSpecification(buffer: ArrayBuffer, format: string): AudioSpecification;
|
|
303
350
|
/** Returns whether the named output format can be safely concatenated without re-multiplexing. */
|
|
304
351
|
declare function resolveMergeAudioFormat(format: string): MergeAudioFormat | undefined;
|
|
305
352
|
declare function canMergeAudioFormat(format: string): boolean;
|
|
306
353
|
/** Merges audio buffers while preserving the invariants of supported containers. */
|
|
307
354
|
declare function mergeAudioBuffers(buffers: readonly ArrayBuffer[], options: MergeAudioOptions): ArrayBuffer;
|
|
308
355
|
declare function synthesizeSsml(ssml: string, config: TtsConfig): Promise<SsmlSynthesisResult>;
|
|
309
|
-
/** Synthesizes chunks
|
|
356
|
+
/** Synthesizes chunks with bounded concurrency, retries transient failures, and merges in chunk order. */
|
|
310
357
|
declare function synthesizeSsmlChunks(chunks: readonly (SsmlSynthesisChunk | string)[], config: TtsConfig): Promise<SsmlSynthesisResult>;
|
|
311
358
|
declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: AsyncMergeSynthesisOptions): Promise<MergedSynthesisResult>;
|
|
312
359
|
declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: MergeAudioOptions): MergedSynthesisResult;
|
|
@@ -341,4 +388,4 @@ interface AzureVoiceCatalog {
|
|
|
341
388
|
/** Fetches and deduplicates the current Azure Speech voice catalog for one or more regions. */
|
|
342
389
|
declare function fetchAzureVoiceCatalog(options: FetchAzureVoiceCatalogOptions): Promise<AzureVoiceCatalog>;
|
|
343
390
|
|
|
344
|
-
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 };
|
|
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 };
|