@ssml-builder-js/azure-tts-client 2.13.0 → 2.14.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 +65 -9
- package/dist/index.d.ts +65 -9
- package/dist/index.js +363 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +357 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/client.ts +20 -2
- package/src/errors.ts +11 -0
- package/src/index.ts +13 -3
- package/src/safe.ts +129 -1
- package/src/synthesis.ts +263 -17
- package/src/types.ts +32 -2
- package/src/voiceCatalog.ts +15 -0
- package/test/v213-pipeline.test.ts +4 -0
- package/test/v214-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.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add safe container-aware audio merging, preflight-validated SSML chunk synthesis with structured progress events, source mapping metadata, controlled URL validation, and voice capability details in the Visual Editor.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @ssml-builder-js/ssml-core@2.14.0
|
|
13
|
+
|
|
3
14
|
## 2.13.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SsmlDiagnostic, AzureValidationOptions } from '@ssml-builder-js/ssml-core';
|
|
1
|
+
import { SsmlTextRange, SsmlDiagnostic, AzureValidationOptions } from '@ssml-builder-js/ssml-core';
|
|
2
2
|
|
|
3
3
|
interface TtsConfig {
|
|
4
4
|
signal?: AbortSignal;
|
|
@@ -12,13 +12,13 @@ interface TtsConfig {
|
|
|
12
12
|
start: number;
|
|
13
13
|
end: number;
|
|
14
14
|
};
|
|
15
|
-
/** Reports
|
|
16
|
-
onProgress?: (event:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}) => void;
|
|
15
|
+
/** Reports chunk lifecycle events when using chunk synthesis. */
|
|
16
|
+
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
17
|
+
/** Metadata used to map synchronization events back to the source document. */
|
|
18
|
+
chunkIndex?: number;
|
|
19
|
+
sourceNodePath?: string[];
|
|
21
20
|
}
|
|
21
|
+
type SynthesisChunkStatus = "pending" | "synthesizing" | "success" | "failed";
|
|
22
22
|
interface SsmlSynthesisBoundary {
|
|
23
23
|
text: string;
|
|
24
24
|
audioOffsetMs: number;
|
|
@@ -27,6 +27,14 @@ interface SsmlSynthesisBoundary {
|
|
|
27
27
|
start: number;
|
|
28
28
|
end: number;
|
|
29
29
|
};
|
|
30
|
+
/** Chunk that produced this event. */
|
|
31
|
+
chunkIndex?: number;
|
|
32
|
+
/** Path of the source SSML node, when available. */
|
|
33
|
+
sourceNodePath?: string[];
|
|
34
|
+
/** Original text range represented by this event. */
|
|
35
|
+
originalTextRange?: SsmlTextRange;
|
|
36
|
+
/** Audio offset within the originating chunk before merge. */
|
|
37
|
+
chunkAudioOffsetMs?: number;
|
|
30
38
|
requestId?: string;
|
|
31
39
|
}
|
|
32
40
|
interface SsmlSynthesisViseme {
|
|
@@ -36,6 +44,10 @@ interface SsmlSynthesisViseme {
|
|
|
36
44
|
start: number;
|
|
37
45
|
end: number;
|
|
38
46
|
};
|
|
47
|
+
chunkIndex?: number;
|
|
48
|
+
sourceNodePath?: string[];
|
|
49
|
+
originalTextRange?: SsmlTextRange;
|
|
50
|
+
chunkAudioOffsetMs?: number;
|
|
39
51
|
requestId?: string;
|
|
40
52
|
}
|
|
41
53
|
interface SsmlSynthesisBookmark {
|
|
@@ -45,6 +57,10 @@ interface SsmlSynthesisBookmark {
|
|
|
45
57
|
start: number;
|
|
46
58
|
end: number;
|
|
47
59
|
};
|
|
60
|
+
chunkIndex?: number;
|
|
61
|
+
sourceNodePath?: string[];
|
|
62
|
+
originalTextRange?: SsmlTextRange;
|
|
63
|
+
chunkAudioOffsetMs?: number;
|
|
48
64
|
requestId?: string;
|
|
49
65
|
}
|
|
50
66
|
/** Audio and Azure Speech synchronization events emitted for one SSML request. */
|
|
@@ -72,14 +88,21 @@ interface SsmlSynthesisChunk {
|
|
|
72
88
|
start: number;
|
|
73
89
|
end: number;
|
|
74
90
|
};
|
|
91
|
+
sourceNodePath?: string[];
|
|
75
92
|
}
|
|
76
93
|
interface SynthesizeChunksOptions {
|
|
77
94
|
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
78
95
|
}
|
|
79
96
|
interface SynthesisProgressEvent {
|
|
97
|
+
/** 1-based completed chunk count retained for backward compatibility. */
|
|
80
98
|
currentChunk: number;
|
|
81
99
|
totalChunks: number;
|
|
82
100
|
percent: number;
|
|
101
|
+
chunkIndex: number;
|
|
102
|
+
originalTextRange?: SsmlTextRange;
|
|
103
|
+
status: SynthesisChunkStatus;
|
|
104
|
+
durationMs: number;
|
|
105
|
+
error?: unknown;
|
|
83
106
|
}
|
|
84
107
|
interface AzureTtsLogger {
|
|
85
108
|
debug?: (...args: unknown[]) => void;
|
|
@@ -109,12 +132,23 @@ declare class AzureTtsSdkError extends AzureTtsError {
|
|
|
109
132
|
readonly errorDetails: string;
|
|
110
133
|
constructor(errorDetails: string);
|
|
111
134
|
}
|
|
135
|
+
/** Thrown when audio buffers require container re-multiplexing before they can be merged. */
|
|
136
|
+
declare class UnsupportedMergeFormatError extends Error {
|
|
137
|
+
readonly format: string;
|
|
138
|
+
constructor(format: string);
|
|
139
|
+
}
|
|
112
140
|
|
|
113
141
|
interface SsmlValidationError {
|
|
114
142
|
readonly kind: "validation";
|
|
115
143
|
readonly message: string;
|
|
116
144
|
readonly diagnostics: readonly SsmlDiagnostic[];
|
|
117
145
|
}
|
|
146
|
+
declare class ChunkValidationError extends Error {
|
|
147
|
+
readonly kind: "chunk-validation";
|
|
148
|
+
readonly chunkIndex: number;
|
|
149
|
+
readonly diagnostics: readonly SsmlDiagnostic[];
|
|
150
|
+
constructor(chunkIndex: number, diagnostics: readonly SsmlDiagnostic[]);
|
|
151
|
+
}
|
|
118
152
|
type Result<T, E> = {
|
|
119
153
|
readonly ok: true;
|
|
120
154
|
readonly success: true;
|
|
@@ -141,11 +175,22 @@ interface SynthesizeSsmlSafeOptions extends AzureValidationOptions {
|
|
|
141
175
|
/** Optional nested form for callers that want to keep validation settings grouped. */
|
|
142
176
|
validation?: AzureValidationOptions;
|
|
143
177
|
}
|
|
178
|
+
interface SynthesizeSsmlChunksSafeOptions extends AzureValidationOptions {
|
|
179
|
+
validation?: AzureValidationOptions;
|
|
180
|
+
outputFormat?: string;
|
|
181
|
+
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
182
|
+
}
|
|
183
|
+
type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, AzureTtsError>;
|
|
144
184
|
interface SynthesisClient {
|
|
145
185
|
synthesizeSsml(ssml: string): Promise<SsmlSynthesisResult>;
|
|
186
|
+
synthesizeChunks?(chunks: readonly (SsmlSynthesisChunk | string)[], options?: {
|
|
187
|
+
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
188
|
+
}): Promise<SsmlSynthesisResult>;
|
|
146
189
|
}
|
|
147
190
|
/** Validates SSML before invoking Azure and converts validation/API failures to one result shape. */
|
|
148
191
|
declare function synthesizeSsmlSafe(client: Pick<AzureTtsClient, "synthesizeSsml"> | SynthesisClient, ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
|
|
192
|
+
/** Validates every chunk before synthesis and returns a chunk-addressable result. */
|
|
193
|
+
declare function synthesizeSsmlChunksSafe(client: Pick<AzureTtsClient, "synthesizeSsml" | "synthesizeChunks"> | SynthesisClient, chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
|
|
149
194
|
|
|
150
195
|
declare class AzureTtsClient {
|
|
151
196
|
#private;
|
|
@@ -154,13 +199,21 @@ declare class AzureTtsClient {
|
|
|
154
199
|
synthesizeSsml(ssml: string): Promise<SsmlSynthesisResult>;
|
|
155
200
|
synthesizeChunks(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
|
|
156
201
|
synthesizeSsmlSafe(ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
|
|
202
|
+
synthesizeChunksSafe(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
|
|
203
|
+
synthesizeSsmlChunksSafe(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
|
|
157
204
|
}
|
|
158
205
|
|
|
206
|
+
type MergeAudioFormat = "wav" | "mp3" | "raw";
|
|
207
|
+
/** Returns whether the named output format can be safely concatenated without re-multiplexing. */
|
|
208
|
+
declare function resolveMergeAudioFormat(format: string): MergeAudioFormat | undefined;
|
|
209
|
+
declare function canMergeAudioFormat(format: string): boolean;
|
|
210
|
+
/** Merges audio buffers while preserving the invariants of supported containers. */
|
|
211
|
+
declare function mergeAudioBuffers(buffers: readonly ArrayBuffer[], format: string): ArrayBuffer;
|
|
159
212
|
declare function synthesizeSsml(ssml: string, config: TtsConfig): Promise<SsmlSynthesisResult>;
|
|
160
213
|
/** Synthesizes chunks sequentially, annotates synchronization events, and merges the results. */
|
|
161
214
|
declare function synthesizeSsmlChunks(chunks: readonly (SsmlSynthesisChunk | string)[], config: TtsConfig): Promise<SsmlSynthesisResult>;
|
|
162
215
|
/** Concatenates audio buffers and shifts all synchronization events by prior chunk durations. */
|
|
163
|
-
declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[]): SsmlSynthesisResult;
|
|
216
|
+
declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], format?: string): SsmlSynthesisResult;
|
|
164
217
|
/** Backward-compatible audio-only synthesis helper. */
|
|
165
218
|
declare function synthesizeSpeech(ssml: string, config: TtsConfig): Promise<ArrayBuffer>;
|
|
166
219
|
|
|
@@ -173,6 +226,9 @@ interface AzureVoiceCatalogVoice {
|
|
|
173
226
|
locale: string;
|
|
174
227
|
secondaryLocales?: readonly string[];
|
|
175
228
|
styles?: readonly string[];
|
|
229
|
+
supportedTags?: readonly string[];
|
|
230
|
+
unsupportedTags?: readonly string[];
|
|
231
|
+
models?: readonly string[];
|
|
176
232
|
regions: readonly string[];
|
|
177
233
|
status?: "ga" | "preview" | "deprecated";
|
|
178
234
|
}
|
|
@@ -189,4 +245,4 @@ interface AzureVoiceCatalog {
|
|
|
189
245
|
/** Fetches and deduplicates the current Azure Speech voice catalog for one or more regions. */
|
|
190
246
|
declare function fetchAzureVoiceCatalog(options: FetchAzureVoiceCatalogOptions): Promise<AzureVoiceCatalog>;
|
|
191
247
|
|
|
192
|
-
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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SsmlDiagnostic, AzureValidationOptions } from '@ssml-builder-js/ssml-core';
|
|
1
|
+
import { SsmlTextRange, SsmlDiagnostic, AzureValidationOptions } from '@ssml-builder-js/ssml-core';
|
|
2
2
|
|
|
3
3
|
interface TtsConfig {
|
|
4
4
|
signal?: AbortSignal;
|
|
@@ -12,13 +12,13 @@ interface TtsConfig {
|
|
|
12
12
|
start: number;
|
|
13
13
|
end: number;
|
|
14
14
|
};
|
|
15
|
-
/** Reports
|
|
16
|
-
onProgress?: (event:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}) => void;
|
|
15
|
+
/** Reports chunk lifecycle events when using chunk synthesis. */
|
|
16
|
+
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
17
|
+
/** Metadata used to map synchronization events back to the source document. */
|
|
18
|
+
chunkIndex?: number;
|
|
19
|
+
sourceNodePath?: string[];
|
|
21
20
|
}
|
|
21
|
+
type SynthesisChunkStatus = "pending" | "synthesizing" | "success" | "failed";
|
|
22
22
|
interface SsmlSynthesisBoundary {
|
|
23
23
|
text: string;
|
|
24
24
|
audioOffsetMs: number;
|
|
@@ -27,6 +27,14 @@ interface SsmlSynthesisBoundary {
|
|
|
27
27
|
start: number;
|
|
28
28
|
end: number;
|
|
29
29
|
};
|
|
30
|
+
/** Chunk that produced this event. */
|
|
31
|
+
chunkIndex?: number;
|
|
32
|
+
/** Path of the source SSML node, when available. */
|
|
33
|
+
sourceNodePath?: string[];
|
|
34
|
+
/** Original text range represented by this event. */
|
|
35
|
+
originalTextRange?: SsmlTextRange;
|
|
36
|
+
/** Audio offset within the originating chunk before merge. */
|
|
37
|
+
chunkAudioOffsetMs?: number;
|
|
30
38
|
requestId?: string;
|
|
31
39
|
}
|
|
32
40
|
interface SsmlSynthesisViseme {
|
|
@@ -36,6 +44,10 @@ interface SsmlSynthesisViseme {
|
|
|
36
44
|
start: number;
|
|
37
45
|
end: number;
|
|
38
46
|
};
|
|
47
|
+
chunkIndex?: number;
|
|
48
|
+
sourceNodePath?: string[];
|
|
49
|
+
originalTextRange?: SsmlTextRange;
|
|
50
|
+
chunkAudioOffsetMs?: number;
|
|
39
51
|
requestId?: string;
|
|
40
52
|
}
|
|
41
53
|
interface SsmlSynthesisBookmark {
|
|
@@ -45,6 +57,10 @@ interface SsmlSynthesisBookmark {
|
|
|
45
57
|
start: number;
|
|
46
58
|
end: number;
|
|
47
59
|
};
|
|
60
|
+
chunkIndex?: number;
|
|
61
|
+
sourceNodePath?: string[];
|
|
62
|
+
originalTextRange?: SsmlTextRange;
|
|
63
|
+
chunkAudioOffsetMs?: number;
|
|
48
64
|
requestId?: string;
|
|
49
65
|
}
|
|
50
66
|
/** Audio and Azure Speech synchronization events emitted for one SSML request. */
|
|
@@ -72,14 +88,21 @@ interface SsmlSynthesisChunk {
|
|
|
72
88
|
start: number;
|
|
73
89
|
end: number;
|
|
74
90
|
};
|
|
91
|
+
sourceNodePath?: string[];
|
|
75
92
|
}
|
|
76
93
|
interface SynthesizeChunksOptions {
|
|
77
94
|
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
78
95
|
}
|
|
79
96
|
interface SynthesisProgressEvent {
|
|
97
|
+
/** 1-based completed chunk count retained for backward compatibility. */
|
|
80
98
|
currentChunk: number;
|
|
81
99
|
totalChunks: number;
|
|
82
100
|
percent: number;
|
|
101
|
+
chunkIndex: number;
|
|
102
|
+
originalTextRange?: SsmlTextRange;
|
|
103
|
+
status: SynthesisChunkStatus;
|
|
104
|
+
durationMs: number;
|
|
105
|
+
error?: unknown;
|
|
83
106
|
}
|
|
84
107
|
interface AzureTtsLogger {
|
|
85
108
|
debug?: (...args: unknown[]) => void;
|
|
@@ -109,12 +132,23 @@ declare class AzureTtsSdkError extends AzureTtsError {
|
|
|
109
132
|
readonly errorDetails: string;
|
|
110
133
|
constructor(errorDetails: string);
|
|
111
134
|
}
|
|
135
|
+
/** Thrown when audio buffers require container re-multiplexing before they can be merged. */
|
|
136
|
+
declare class UnsupportedMergeFormatError extends Error {
|
|
137
|
+
readonly format: string;
|
|
138
|
+
constructor(format: string);
|
|
139
|
+
}
|
|
112
140
|
|
|
113
141
|
interface SsmlValidationError {
|
|
114
142
|
readonly kind: "validation";
|
|
115
143
|
readonly message: string;
|
|
116
144
|
readonly diagnostics: readonly SsmlDiagnostic[];
|
|
117
145
|
}
|
|
146
|
+
declare class ChunkValidationError extends Error {
|
|
147
|
+
readonly kind: "chunk-validation";
|
|
148
|
+
readonly chunkIndex: number;
|
|
149
|
+
readonly diagnostics: readonly SsmlDiagnostic[];
|
|
150
|
+
constructor(chunkIndex: number, diagnostics: readonly SsmlDiagnostic[]);
|
|
151
|
+
}
|
|
118
152
|
type Result<T, E> = {
|
|
119
153
|
readonly ok: true;
|
|
120
154
|
readonly success: true;
|
|
@@ -141,11 +175,22 @@ interface SynthesizeSsmlSafeOptions extends AzureValidationOptions {
|
|
|
141
175
|
/** Optional nested form for callers that want to keep validation settings grouped. */
|
|
142
176
|
validation?: AzureValidationOptions;
|
|
143
177
|
}
|
|
178
|
+
interface SynthesizeSsmlChunksSafeOptions extends AzureValidationOptions {
|
|
179
|
+
validation?: AzureValidationOptions;
|
|
180
|
+
outputFormat?: string;
|
|
181
|
+
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
182
|
+
}
|
|
183
|
+
type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, AzureTtsError>;
|
|
144
184
|
interface SynthesisClient {
|
|
145
185
|
synthesizeSsml(ssml: string): Promise<SsmlSynthesisResult>;
|
|
186
|
+
synthesizeChunks?(chunks: readonly (SsmlSynthesisChunk | string)[], options?: {
|
|
187
|
+
onProgress?: (event: SynthesisProgressEvent) => void;
|
|
188
|
+
}): Promise<SsmlSynthesisResult>;
|
|
146
189
|
}
|
|
147
190
|
/** Validates SSML before invoking Azure and converts validation/API failures to one result shape. */
|
|
148
191
|
declare function synthesizeSsmlSafe(client: Pick<AzureTtsClient, "synthesizeSsml"> | SynthesisClient, ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
|
|
192
|
+
/** Validates every chunk before synthesis and returns a chunk-addressable result. */
|
|
193
|
+
declare function synthesizeSsmlChunksSafe(client: Pick<AzureTtsClient, "synthesizeSsml" | "synthesizeChunks"> | SynthesisClient, chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
|
|
149
194
|
|
|
150
195
|
declare class AzureTtsClient {
|
|
151
196
|
#private;
|
|
@@ -154,13 +199,21 @@ declare class AzureTtsClient {
|
|
|
154
199
|
synthesizeSsml(ssml: string): Promise<SsmlSynthesisResult>;
|
|
155
200
|
synthesizeChunks(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
|
|
156
201
|
synthesizeSsmlSafe(ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
|
|
202
|
+
synthesizeChunksSafe(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
|
|
203
|
+
synthesizeSsmlChunksSafe(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
|
|
157
204
|
}
|
|
158
205
|
|
|
206
|
+
type MergeAudioFormat = "wav" | "mp3" | "raw";
|
|
207
|
+
/** Returns whether the named output format can be safely concatenated without re-multiplexing. */
|
|
208
|
+
declare function resolveMergeAudioFormat(format: string): MergeAudioFormat | undefined;
|
|
209
|
+
declare function canMergeAudioFormat(format: string): boolean;
|
|
210
|
+
/** Merges audio buffers while preserving the invariants of supported containers. */
|
|
211
|
+
declare function mergeAudioBuffers(buffers: readonly ArrayBuffer[], format: string): ArrayBuffer;
|
|
159
212
|
declare function synthesizeSsml(ssml: string, config: TtsConfig): Promise<SsmlSynthesisResult>;
|
|
160
213
|
/** Synthesizes chunks sequentially, annotates synchronization events, and merges the results. */
|
|
161
214
|
declare function synthesizeSsmlChunks(chunks: readonly (SsmlSynthesisChunk | string)[], config: TtsConfig): Promise<SsmlSynthesisResult>;
|
|
162
215
|
/** Concatenates audio buffers and shifts all synchronization events by prior chunk durations. */
|
|
163
|
-
declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[]): SsmlSynthesisResult;
|
|
216
|
+
declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], format?: string): SsmlSynthesisResult;
|
|
164
217
|
/** Backward-compatible audio-only synthesis helper. */
|
|
165
218
|
declare function synthesizeSpeech(ssml: string, config: TtsConfig): Promise<ArrayBuffer>;
|
|
166
219
|
|
|
@@ -173,6 +226,9 @@ interface AzureVoiceCatalogVoice {
|
|
|
173
226
|
locale: string;
|
|
174
227
|
secondaryLocales?: readonly string[];
|
|
175
228
|
styles?: readonly string[];
|
|
229
|
+
supportedTags?: readonly string[];
|
|
230
|
+
unsupportedTags?: readonly string[];
|
|
231
|
+
models?: readonly string[];
|
|
176
232
|
regions: readonly string[];
|
|
177
233
|
status?: "ga" | "preview" | "deprecated";
|
|
178
234
|
}
|
|
@@ -189,4 +245,4 @@ interface AzureVoiceCatalog {
|
|
|
189
245
|
/** Fetches and deduplicates the current Azure Speech voice catalog for one or more regions. */
|
|
190
246
|
declare function fetchAzureVoiceCatalog(options: FetchAzureVoiceCatalogOptions): Promise<AzureVoiceCatalog>;
|
|
191
247
|
|
|
192
|
-
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 };
|
|
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 };
|