@breeze.blue/sdk 0.12.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 CHANGED
@@ -1,5 +1,15 @@
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
+
3
13
  ## 0.12.0
4
14
 
5
15
  - Voice listings preserve the `created_at_unix desc` default and support the
package/README.md CHANGED
@@ -425,6 +425,8 @@ const settings = await client.voices.getSettings(firstVoiceId);
425
425
 
426
426
  const randomVoice = await client.voices.random();
427
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" });
428
430
 
429
431
  // Discover the current code-only Voice Metadata contract before building a form.
430
432
  const metadataOptions = await client.voices.metadataOptions();
@@ -463,9 +465,24 @@ const design = await client.voices.createDesignPreview({
463
465
  generatedVoiceId = design.previews[0].generatedVoiceId;
464
466
  ```
465
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
+
466
483
  `files` is also accepted with exactly one item.
467
484
 
468
- Stream the preview so the user can audition it, then save the one they
485
+ Download a completed preview so the user can audition it, then save the one they
469
486
  pick:
470
487
 
471
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;
@@ -213,7 +213,12 @@ declare class VoicesResource {
213
213
  */
214
214
  search(params?: VoiceSearchParams, options?: RequestOptions): Promise<VoiceList>;
215
215
  get(voiceId: string, options?: RequestOptions): Promise<Voice>;
216
- random(options?: RequestOptions): Promise<Voice>;
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>;
217
222
  /** Return stable Voice Metadata codes and language-accent constraints. */
218
223
  metadataOptions(options?: RequestOptions): Promise<VoiceMetadataOptions>;
219
224
  edit(voiceId: string, request: VoiceEditRequest, options?: RequestOptions): Promise<GenericStatus>;
@@ -235,7 +240,12 @@ declare class VoicesResource {
235
240
  * {@link savePreview}.
236
241
  */
237
242
  createDesignPreview(request: VoiceDesignRequest, options?: AudioRequestOptions): Promise<VoiceDesignResponse>;
238
- /** Stream the audio of a clone or design preview before saving. */
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. */
239
249
  streamPreview(generatedVoiceId: string, options?: AudioRequestOptions): Promise<AudioResponse>;
240
250
  /** Persist a clone or design preview as a real voice asset. */
241
251
  savePreview(request: SaveVoiceRequest, options?: RequestOptions): Promise<SavedVoice>;
package/dist/client.js CHANGED
@@ -1506,8 +1506,13 @@ class VoicesResource {
1506
1506
  const result = await this.client.requestJson("GET", `/v1/voices/${encodeURIComponent(voiceId)}`, undefined, undefined, options);
1507
1507
  return stripHiddenVoiceFields(result);
1508
1508
  }
1509
- async random(options) {
1510
- const result = await this.client.requestJson("GET", "/v1/voices/random", undefined, undefined, options);
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);
1511
1516
  return stripHiddenVoiceFields(result);
1512
1517
  }
1513
1518
  /** Return stable Voice Metadata codes and language-accent constraints. */
@@ -1556,7 +1561,14 @@ class VoicesResource {
1556
1561
  createDesignPreview(request, options = {}) {
1557
1562
  return this.client.requestJson("POST", "/v1/voice-previews/design", { outputFormat: options.outputFormat }, request, options);
1558
1563
  }
1559
- /** Stream the audio of a clone or design preview before saving. */
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. */
1560
1572
  streamPreview(generatedVoiceId, options = {}) {
1561
1573
  return this.client.requestAudio("GET", `/v1/voice-previews/${encodeURIComponent(generatedVoiceId)}/stream`, { outputFormat: options.outputFormat }, undefined, options);
1562
1574
  }
package/dist/types.d.ts CHANGED
@@ -351,6 +351,12 @@ 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;
@@ -418,6 +424,13 @@ export interface VoiceDesignRequest {
418
424
  guidanceScale?: number | null;
419
425
  previewCount?: number;
420
426
  }
427
+ export interface VoiceDesignStreamRequest {
428
+ voiceDescription: string;
429
+ text?: string;
430
+ modelId?: string;
431
+ languageCode?: VoiceLanguageCode;
432
+ guidanceScale?: number | null;
433
+ }
421
434
  export interface VoiceDesignPreview {
422
435
  generatedVoiceId: string;
423
436
  audioBase64: string;
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "0.12.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.12.0";
1
+ export const SDK_VERSION = "0.13.0";
2
2
  export const SDK_NAME = "@breeze.blue/sdk";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breeze.blue/sdk",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "ESM-first TypeScript SDK for the Breeze Blue Developer API.",
5
5
  "license": "MIT",
6
6
  "author": "Breeze Blue <support@breezeblue.ai>",