@breeze.blue/sdk 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +31 -1
- package/dist/audio.d.ts +1 -0
- package/dist/audio.js +2 -0
- package/dist/client.d.ts +16 -4
- package/dist/client.js +19 -5
- package/dist/types.d.ts +19 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
- `voices.random(...)` accepts optional `languageCode` and `voiceType`
|
|
6
|
+
(`"default"` or `"personal"`) filters that narrow the random pool.
|
|
7
|
+
- Added `voices.streamDesignPreview(...)`, which returns a live
|
|
8
|
+
`AudioResponse` with `generatedVoiceId`; the Node `stream()` helper consumes
|
|
9
|
+
its response body directly.
|
|
10
|
+
- Clarified that `voices.streamPreview(...)` downloads an already completed
|
|
11
|
+
preview.
|
|
12
|
+
|
|
13
|
+
## 0.12.0
|
|
14
|
+
|
|
15
|
+
- Voice listings preserve the `created_at_unix desc` default and support the
|
|
16
|
+
shared Daily Trend with `{ sort: "trend", voiceType: "default" }`, signed
|
|
17
|
+
snapshot pagination, and language/category/gender/age/tone/accent filters.
|
|
18
|
+
|
|
3
19
|
## 0.11.0
|
|
4
20
|
|
|
5
21
|
- Added canonical Voice `tags`, personal tag overrides, favorite management,
|
package/README.md
CHANGED
|
@@ -406,6 +406,14 @@ or voice ID.
|
|
|
406
406
|
|
|
407
407
|
```ts
|
|
408
408
|
const voices = await client.voices.search({ search: "calm documentary narrator" });
|
|
409
|
+
const newestFirst = await client.voices.search();
|
|
410
|
+
const dailyTrend = await client.voices.search({
|
|
411
|
+
voiceType: "default",
|
|
412
|
+
sort: "trend",
|
|
413
|
+
languageCode: "zh",
|
|
414
|
+
gender: ["female", "neutral"],
|
|
415
|
+
tone: ["warm"],
|
|
416
|
+
});
|
|
409
417
|
const taggedFavorites = await client.voices.search({
|
|
410
418
|
favoritesOnly: true,
|
|
411
419
|
tags: ["narration", "novel=三体"],
|
|
@@ -417,6 +425,8 @@ const settings = await client.voices.getSettings(firstVoiceId);
|
|
|
417
425
|
|
|
418
426
|
const randomVoice = await client.voices.random();
|
|
419
427
|
console.log(randomVoice.voiceId, randomVoice.name);
|
|
428
|
+
// Narrow the random pool by language and/or voice source.
|
|
429
|
+
const randomCatalogVoice = await client.voices.random({ languageCode: "zh", voiceType: "default" });
|
|
420
430
|
|
|
421
431
|
// Discover the current code-only Voice Metadata contract before building a form.
|
|
422
432
|
const metadataOptions = await client.voices.metadataOptions();
|
|
@@ -424,6 +434,11 @@ console.log(metadataOptions.languageCodes);
|
|
|
424
434
|
console.log(metadataOptions.accentCodesByLanguage.en);
|
|
425
435
|
```
|
|
426
436
|
|
|
437
|
+
Voice listings keep the published default of stable creation-time order from
|
|
438
|
+
newest to oldest. Use `{ sort: "trend", voiceType: "default" }` for the shared
|
|
439
|
+
Daily Trend order. Search queries remain relevance-ranked; Trend is only a
|
|
440
|
+
weak prior within the same relevance tier.
|
|
441
|
+
|
|
427
442
|
Breeze voice creation is always two steps: produce a **preview**, let the
|
|
428
443
|
user accept it, then **save the preview** as a real voice. Two ways to
|
|
429
444
|
produce a preview:
|
|
@@ -450,9 +465,24 @@ const design = await client.voices.createDesignPreview({
|
|
|
450
465
|
generatedVoiceId = design.previews[0].generatedVoiceId;
|
|
451
466
|
```
|
|
452
467
|
|
|
468
|
+
For the fastest first audio, generate one design preview as a live 24 kHz mono
|
|
469
|
+
PCM response. The Node `stream()` helper consumes the response body directly;
|
|
470
|
+
a clean end means `generatedVoiceId` is ready to save:
|
|
471
|
+
|
|
472
|
+
```ts
|
|
473
|
+
import { stream } from "@breeze.blue/sdk/node";
|
|
474
|
+
|
|
475
|
+
const livePreview = await client.voices.streamDesignPreview({
|
|
476
|
+
voiceDescription: "Warm documentary narrator with clear articulation.",
|
|
477
|
+
text: "This is a short preview script.",
|
|
478
|
+
});
|
|
479
|
+
await stream(livePreview);
|
|
480
|
+
generatedVoiceId = livePreview.generatedVoiceId!;
|
|
481
|
+
```
|
|
482
|
+
|
|
453
483
|
`files` is also accepted with exactly one item.
|
|
454
484
|
|
|
455
|
-
|
|
485
|
+
Download a completed preview so the user can audition it, then save the one they
|
|
456
486
|
pick:
|
|
457
487
|
|
|
458
488
|
```ts
|
package/dist/audio.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export declare class AudioResponse {
|
|
|
34
34
|
readonly response: Response;
|
|
35
35
|
readonly contentType: string;
|
|
36
36
|
readonly historyItemId: string | null;
|
|
37
|
+
readonly generatedVoiceId: string | null;
|
|
37
38
|
readonly filename: string | null;
|
|
38
39
|
constructor(response: Response, options?: AudioResponseOptions);
|
|
39
40
|
get headers(): Headers;
|
package/dist/audio.js
CHANGED
|
@@ -2,12 +2,14 @@ export class AudioResponse {
|
|
|
2
2
|
response;
|
|
3
3
|
contentType;
|
|
4
4
|
historyItemId;
|
|
5
|
+
generatedVoiceId;
|
|
5
6
|
filename;
|
|
6
7
|
#buffer = null;
|
|
7
8
|
constructor(response, options = {}) {
|
|
8
9
|
this.response = response;
|
|
9
10
|
this.contentType = response.headers.get("content-type")?.split(";", 1)[0].trim() || "application/octet-stream";
|
|
10
11
|
this.historyItemId = response.headers.get("history-item-id");
|
|
12
|
+
this.generatedVoiceId = response.headers.get("generated-voice-id");
|
|
11
13
|
this.filename = options.filename ?? filenameFromContentDisposition(response.headers.get("content-disposition"));
|
|
12
14
|
}
|
|
13
15
|
get headers() {
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AudioResponse } from "./audio.js";
|
|
2
|
-
import type { AudioRequestOptions, BreezeBlueWebSocket, AsyncTextToSpeechJob, Balance, BreezeBlueClientOptions, GenericStatus, GenerationJob, HistoryItem, HistoryList, HistoryListParams, Model, RequestOptions, RealtimeTextToSpeechConnectOptions, RealtimeTextToSpeechEvent, RealtimeTextToSpeechManagedConnectOptions, RealtimeTextToSpeechMessage, RealtimeTextToSpeechSession, RealtimeTextToSpeechSessionRequest, SavedVoice, SaveVoiceRequest, StreamTextToSpeechOptions, TextToSpeechRequest, TtsEnhanceRequest, TtsEnhanceResponse, Usage, UsageParams, Voice, VoiceClonePreview, VoiceClonePreviewRequest, VoiceDesignRequest, VoiceDesignResponse, VoiceEditRequest, VoiceList, VoiceMetadataOptions, VoiceSearchParams, VoiceSettings } from "./types.js";
|
|
2
|
+
import type { AudioRequestOptions, BreezeBlueWebSocket, AsyncTextToSpeechJob, Balance, BreezeBlueClientOptions, GenericStatus, GenerationJob, HistoryItem, HistoryList, HistoryListParams, Model, RequestOptions, RealtimeTextToSpeechConnectOptions, RealtimeTextToSpeechEvent, RealtimeTextToSpeechManagedConnectOptions, RealtimeTextToSpeechMessage, RealtimeTextToSpeechSession, RealtimeTextToSpeechSessionRequest, SavedVoice, SaveVoiceRequest, StreamTextToSpeechOptions, TextToSpeechRequest, TtsEnhanceRequest, TtsEnhanceResponse, Usage, UsageParams, Voice, VoiceClonePreview, VoiceClonePreviewRequest, VoiceDesignRequest, VoiceDesignResponse, VoiceDesignStreamRequest, VoiceEditRequest, VoiceList, VoiceMetadataOptions, VoiceRandomParams, VoiceSearchParams, VoiceSettings } from "./types.js";
|
|
3
3
|
export declare class BreezeBlueClient {
|
|
4
4
|
readonly apiKey: string | undefined;
|
|
5
5
|
readonly baseUrl: string;
|
|
@@ -207,11 +207,18 @@ declare class VoicesResource {
|
|
|
207
207
|
/**
|
|
208
208
|
* Search every voice visible to the account. Catalog results use hybrid
|
|
209
209
|
* semantic and text relevance; personal voices match by name, description,
|
|
210
|
-
* or identifier.
|
|
210
|
+
* or identifier. Listings default to stable creation-time order from newest
|
|
211
|
+
* to oldest. Pass sort: "trend" with voiceType: "default" for the shared
|
|
212
|
+
* Daily Trend order.
|
|
211
213
|
*/
|
|
212
214
|
search(params?: VoiceSearchParams, options?: RequestOptions): Promise<VoiceList>;
|
|
213
215
|
get(voiceId: string, options?: RequestOptions): Promise<Voice>;
|
|
214
|
-
|
|
216
|
+
/**
|
|
217
|
+
* Pick one random voice visible to the account. Pass `languageCode` and/or
|
|
218
|
+
* `voiceType` to narrow the pool; with no filters the pool is personal
|
|
219
|
+
* voices plus the public catalog.
|
|
220
|
+
*/
|
|
221
|
+
random(params?: VoiceRandomParams, options?: RequestOptions): Promise<Voice>;
|
|
215
222
|
/** Return stable Voice Metadata codes and language-accent constraints. */
|
|
216
223
|
metadataOptions(options?: RequestOptions): Promise<VoiceMetadataOptions>;
|
|
217
224
|
edit(voiceId: string, request: VoiceEditRequest, options?: RequestOptions): Promise<GenericStatus>;
|
|
@@ -233,7 +240,12 @@ declare class VoicesResource {
|
|
|
233
240
|
* {@link savePreview}.
|
|
234
241
|
*/
|
|
235
242
|
createDesignPreview(request: VoiceDesignRequest, options?: AudioRequestOptions): Promise<VoiceDesignResponse>;
|
|
236
|
-
/**
|
|
243
|
+
/**
|
|
244
|
+
* Generate exactly one voice design preview as live 24 kHz mono PCM.
|
|
245
|
+
* A clean end means `generatedVoiceId` is ready for {@link savePreview}.
|
|
246
|
+
*/
|
|
247
|
+
streamDesignPreview(request: VoiceDesignStreamRequest, options?: RequestOptions): Promise<AudioResponse>;
|
|
248
|
+
/** Download the completed audio of a clone or design preview. */
|
|
237
249
|
streamPreview(generatedVoiceId: string, options?: AudioRequestOptions): Promise<AudioResponse>;
|
|
238
250
|
/** Persist a clone or design preview as a real voice asset. */
|
|
239
251
|
savePreview(request: SaveVoiceRequest, options?: RequestOptions): Promise<SavedVoice>;
|
package/dist/client.js
CHANGED
|
@@ -1492,10 +1492,12 @@ class VoicesResource {
|
|
|
1492
1492
|
/**
|
|
1493
1493
|
* Search every voice visible to the account. Catalog results use hybrid
|
|
1494
1494
|
* semantic and text relevance; personal voices match by name, description,
|
|
1495
|
-
* or identifier.
|
|
1495
|
+
* or identifier. Listings default to stable creation-time order from newest
|
|
1496
|
+
* to oldest. Pass sort: "trend" with voiceType: "default" for the shared
|
|
1497
|
+
* Daily Trend order.
|
|
1496
1498
|
*/
|
|
1497
1499
|
async search(params = {}, options) {
|
|
1498
|
-
const result = await this.client.requestJson("GET", "/v1/voices", params, undefined, options);
|
|
1500
|
+
const result = await this.client.requestJson("GET", "/v1/voices", { sort: "created_at_unix", sortDirection: "desc", ...params }, undefined, options);
|
|
1499
1501
|
return Array.isArray(result.voices)
|
|
1500
1502
|
? { ...result, voices: result.voices.map(stripHiddenVoiceFields) }
|
|
1501
1503
|
: result;
|
|
@@ -1504,8 +1506,13 @@ class VoicesResource {
|
|
|
1504
1506
|
const result = await this.client.requestJson("GET", `/v1/voices/${encodeURIComponent(voiceId)}`, undefined, undefined, options);
|
|
1505
1507
|
return stripHiddenVoiceFields(result);
|
|
1506
1508
|
}
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
+
/**
|
|
1510
|
+
* Pick one random voice visible to the account. Pass `languageCode` and/or
|
|
1511
|
+
* `voiceType` to narrow the pool; with no filters the pool is personal
|
|
1512
|
+
* voices plus the public catalog.
|
|
1513
|
+
*/
|
|
1514
|
+
async random(params = {}, options) {
|
|
1515
|
+
const result = await this.client.requestJson("GET", "/v1/voices/random", params, undefined, options);
|
|
1509
1516
|
return stripHiddenVoiceFields(result);
|
|
1510
1517
|
}
|
|
1511
1518
|
/** Return stable Voice Metadata codes and language-accent constraints. */
|
|
@@ -1554,7 +1561,14 @@ class VoicesResource {
|
|
|
1554
1561
|
createDesignPreview(request, options = {}) {
|
|
1555
1562
|
return this.client.requestJson("POST", "/v1/voice-previews/design", { outputFormat: options.outputFormat }, request, options);
|
|
1556
1563
|
}
|
|
1557
|
-
/**
|
|
1564
|
+
/**
|
|
1565
|
+
* Generate exactly one voice design preview as live 24 kHz mono PCM.
|
|
1566
|
+
* A clean end means `generatedVoiceId` is ready for {@link savePreview}.
|
|
1567
|
+
*/
|
|
1568
|
+
streamDesignPreview(request, options) {
|
|
1569
|
+
return this.client.requestAudio("POST", "/v1/voice-previews/design/stream", undefined, request, options);
|
|
1570
|
+
}
|
|
1571
|
+
/** Download the completed audio of a clone or design preview. */
|
|
1558
1572
|
streamPreview(generatedVoiceId, options = {}) {
|
|
1559
1573
|
return this.client.requestAudio("GET", `/v1/voice-previews/${encodeURIComponent(generatedVoiceId)}/stream`, { outputFormat: options.outputFormat }, undefined, options);
|
|
1560
1574
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -351,12 +351,23 @@ export interface VoiceMetadataOptions {
|
|
|
351
351
|
toneMaxItems: number;
|
|
352
352
|
accentCodesByLanguage: Record<VoiceLanguageCode, VoiceAccent[]>;
|
|
353
353
|
}
|
|
354
|
+
export interface VoiceRandomParams {
|
|
355
|
+
/** Only pick from voices whose saved audio language matches this code. */
|
|
356
|
+
languageCode?: VoiceLanguageCode;
|
|
357
|
+
/** Voice source filter. Omit to pick from personal voices and the public catalog. */
|
|
358
|
+
voiceType?: "default" | "personal" | string;
|
|
359
|
+
}
|
|
354
360
|
export interface VoiceSearchParams {
|
|
355
361
|
search?: string;
|
|
356
362
|
languageCode?: VoiceLanguageCode;
|
|
363
|
+
primaryCategoryCode?: string;
|
|
364
|
+
gender?: VoiceGender[];
|
|
365
|
+
age?: VoiceAge[];
|
|
366
|
+
tone?: VoiceTone[];
|
|
367
|
+
accent?: VoiceAccent;
|
|
357
368
|
origin?: "designed" | "cloned" | string;
|
|
358
369
|
voiceType?: "all" | "default" | "personal" | string;
|
|
359
|
-
sort?: "created_at_unix" | "name" | string;
|
|
370
|
+
sort?: "created_at_unix" | "name" | "trend" | string;
|
|
360
371
|
sortDirection?: "asc" | "desc";
|
|
361
372
|
nextPageToken?: string;
|
|
362
373
|
page?: number;
|
|
@@ -413,6 +424,13 @@ export interface VoiceDesignRequest {
|
|
|
413
424
|
guidanceScale?: number | null;
|
|
414
425
|
previewCount?: number;
|
|
415
426
|
}
|
|
427
|
+
export interface VoiceDesignStreamRequest {
|
|
428
|
+
voiceDescription: string;
|
|
429
|
+
text?: string;
|
|
430
|
+
modelId?: string;
|
|
431
|
+
languageCode?: VoiceLanguageCode;
|
|
432
|
+
guidanceScale?: number | null;
|
|
433
|
+
}
|
|
416
434
|
export interface VoiceDesignPreview {
|
|
417
435
|
generatedVoiceId: string;
|
|
418
436
|
audioBase64: string;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.
|
|
1
|
+
export declare const SDK_VERSION = "0.13.0";
|
|
2
2
|
export declare const SDK_NAME = "@breeze.blue/sdk";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.
|
|
1
|
+
export const SDK_VERSION = "0.13.0";
|
|
2
2
|
export const SDK_NAME = "@breeze.blue/sdk";
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breeze.blue/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "ESM-first TypeScript SDK for the Breeze Blue Developer API.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"author": "Breeze Blue <support@
|
|
6
|
+
"author": "Breeze Blue <support@breezeblue.ai>",
|
|
7
7
|
"homepage": "https://breezeblue.ai",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|