sonilo 0.9.0 → 0.11.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/dist/index.d.cts CHANGED
@@ -51,10 +51,13 @@ interface TextToMusicParams {
51
51
  prompt: string;
52
52
  duration: number;
53
53
  segments?: Segment[];
54
- /** "stream" (default) or "async" (required by `submit()` and `output_format: "wav"`). */
54
+ /** "stream" (default) or "async" (required by `submit()` and by any
55
+ * `outputFormat` other than the m4a default). */
55
56
  mode?: "stream" | "async";
56
- /** Container for the async result. `wav` requires `mode: "async"`. Defaults to m4a server-side. */
57
- outputFormat?: "m4a" | "wav";
57
+ /** Container for the async result. `wav` and `mp3` (320 kbps) are
58
+ * finalize-time transcodes and require `mode: "async"`; m4a is what the
59
+ * stream itself carries. Defaults to m4a server-side. */
60
+ outputFormat?: "m4a" | "wav" | "mp3";
58
61
  /** How many distinct music variants to generate in one request (1-10,
59
62
  * default 1). Cost scales linearly, and values above 1 are never covered
60
63
  * by the free trial. Values above 1 require `mode: "async"` — only
@@ -93,8 +96,9 @@ interface VideoToMusicParams {
93
96
  * `isolateVocals`; both are accepted and OR'd server-side. Requires
94
97
  * `mode: "async"` (auto-selected by `submit()`). */
95
98
  preserveSpeech?: boolean;
96
- /** Container for the async result. `wav` requires async. Defaults to m4a. */
97
- outputFormat?: "m4a" | "wav";
99
+ /** Container for the async result. `wav` and `mp3` (320 kbps) are
100
+ * finalize-time transcodes and require async. Defaults to m4a. */
101
+ outputFormat?: "m4a" | "wav" | "mp3";
98
102
  /** Duck the generated music under the source voice at finalize time.
99
103
  * Default-ON server-side in async mode: leave unset to keep it on, pass
100
104
  * `false` to opt out. Free, best-effort; only valid on `submit()`. */
@@ -269,12 +273,53 @@ interface VideoResult extends BaseTaskResult {
269
273
  video?: SfxMedia;
270
274
  duration_seconds?: number;
271
275
  }
276
+ /** Params for `videoToVideoMusic`.
277
+ *
278
+ * The delivered video's audio is decided by two independent knobs:
279
+ * `keepOriginalSound` picks the **voice source**, `ducking` picks how that
280
+ * voice and the generated music are **combined**.
281
+ *
282
+ * | Request | Audio in the returned video |
283
+ * | --- | --- |
284
+ * | neither set | generated music only — the source's own audio is removed |
285
+ * | `keepOriginalSound: true` | full original sound + music ducked under it |
286
+ * | `keepOriginalSound: true, ducking: false` | full original sound + static music mix |
287
+ * | `preserveSpeech: true` | isolated vocals + music ducked under them |
288
+ * | `preserveSpeech: true, ducking: false` | static vocal-forward mix of vocals + music |
289
+ *
290
+ * `keepOriginalSound` supersedes `preserveSpeech` — the voice source is a
291
+ * single choice, and keeping the whole track subsumes keeping only the
292
+ * isolated speech. No combination is rejected.
293
+ *
294
+ * The source picture is copied without re-encoding, so the input must carry
295
+ * H.264, H.265/HEVC, VP9 or AV1 video in an mp4, mov, m4v or webm container —
296
+ * animated gif and VP8 webm are rejected. Maximum input duration is 360
297
+ * seconds. */
272
298
  interface VideoToVideoMusicParams {
273
299
  video?: VideoInput;
274
300
  videoUrl?: string;
275
301
  prompt?: string;
276
- /** Keep the source speech/vocals in the output. Both this and the legacy
277
- * `isolateVocals` are accepted and OR'd server-side. */
302
+ /** How the music should develop over time. Same shape as
303
+ * `videoToMusic`'s: the first `start` must be 0. Supplying these skips the
304
+ * prompt-service plan the server would otherwise derive from `prompt`. */
305
+ segments?: Segment[];
306
+ /** Keep the source video's whole original audio track in the result, with
307
+ * the generated music combined under it. Defaults to `false`, so by
308
+ * default the returned video's audio is the generated music ALONE and the
309
+ * source's own audio is removed. Supersedes `preserveSpeech`. */
310
+ keepOriginalSound?: boolean;
311
+ /** How the voice and the generated music are combined — not whether a
312
+ * voice is kept. Default-ON server-side: leave unset for the dynamic duck
313
+ * (music dips only while the voice is present), pass `false` for a static
314
+ * voice-forward mix at a fixed offset. Has no effect when there is no
315
+ * voice source, i.e. neither `keepOriginalSound` nor `preserveSpeech` is
316
+ * set. Free and best-effort; silently falls back to generated-audio-only
317
+ * if the source has no usable audio track, voice isolation fails, or the
318
+ * mix fails. */
319
+ ducking?: boolean;
320
+ /** Keep only the source's isolated speech (not the whole track) in the
321
+ * output. Both this and the legacy `isolateVocals` are accepted and OR'd
322
+ * server-side. Superseded by `keepOriginalSound`. */
278
323
  preserveSpeech?: boolean;
279
324
  /** @deprecated Legacy alias for `preserveSpeech`. */
280
325
  isolateVocals?: boolean;
@@ -290,9 +335,20 @@ interface VideoToVideoSfxParams {
290
335
  prompt?: string;
291
336
  segments?: SfxSegment[];
292
337
  }
293
- /** Params for `videoToSound` and `videoToVideoSound`. Both endpoints take the
294
- * identical form, so they share one params type. */
295
- interface VideoToSoundParams {
338
+ /** Params for `videoToVideoSound`, and the base every `videoToSound` param
339
+ * also has. The two endpoints differ in exactly two fields, one in each
340
+ * direction, and both are enforced at the type level rather than left to the
341
+ * server to silently ignore:
342
+ *
343
+ * - `outputFormat` is **audio-only** — added by `VideoToSoundParams` below, so
344
+ * it simply does not exist on this type.
345
+ * - `keepOriginalSound` is **video-only** — declared here, so
346
+ * `VideoToSoundParams` inherits it and has to forbid it explicitly with
347
+ * `?: never` (the inheritance runs the other way, so it cannot just be
348
+ * omitted the way `outputFormat` is).
349
+ *
350
+ * Passing either field to the wrong endpoint is therefore a compile error. */
351
+ interface VideoToVideoSoundParams {
296
352
  video?: VideoInput;
297
353
  videoUrl?: string;
298
354
  /** Style hint for the generated music bed. */
@@ -301,10 +357,20 @@ interface VideoToSoundParams {
301
357
  sfxPrompt?: string;
302
358
  /** Per-segment SFX descriptions; must start at 0 and be contiguous. */
303
359
  segments?: SfxSegment[];
304
- /** Keep the source speech in the result. */
360
+ /** Keep the source video's whole original audio track in the result, with
361
+ * the generated music + SFX combined under it. Defaults to `false`, so by
362
+ * default the returned video's audio is the generated music and sound
363
+ * effects ALONE and the source's own audio is removed — and the result
364
+ * carries no `music_processed` stem, since with no voice source there is no
365
+ * processed track. Supersedes `preserveSpeech`. Video endpoint only. */
366
+ keepOriginalSound?: boolean;
367
+ /** Keep only the source's isolated speech (not the whole track) in the
368
+ * result. Superseded by `keepOriginalSound`. */
305
369
  preserveSpeech?: boolean;
306
- /** Duck the generated music under the source speech. Default-ON
307
- * server-side: leave unset to keep it on, pass `false` to opt out. */
370
+ /** How the voice and the generated bed are combined not whether a voice
371
+ * is kept. Default-ON server-side: leave unset for the dynamic duck, pass
372
+ * `false` for a static voice-forward mix. Has no effect when there is no
373
+ * voice source. */
308
374
  ducking?: boolean;
309
375
  /** How many distinct variants to generate in one request (1-10, default
310
376
  * 1). Cost scales linearly, and values above 1 are never covered by the
@@ -313,6 +379,22 @@ interface VideoToSoundParams {
313
379
  * one entry per variant. */
314
380
  variantsNum?: number;
315
381
  }
382
+ /** Params for `videoToSound`. Everything `videoToVideoSound` takes, plus the
383
+ * delivery container for the combined track. */
384
+ interface VideoToSoundParams extends VideoToVideoSoundParams {
385
+ /** Container for the combined music + SFX track. Defaults to `wav`;
386
+ * `mp3` is 320 kbps. Applies to the combined output only — the `music`
387
+ * and `sfx` stems keep their native formats. Not available on
388
+ * `videoToVideoSound`, which always returns an mp4. */
389
+ outputFormat?: "wav" | "m4a" | "mp3";
390
+ /** Not available on this endpoint. `keepOriginalSound` only means something
391
+ * when the deliverable is a video whose own audio could be preserved;
392
+ * `videoToSound` returns generated audio, and its default already keeps the
393
+ * source voice in the mix. Typed `never` so passing it is a compile error
394
+ * rather than a field the server silently drops — the mirror of how
395
+ * `outputFormat` is kept off `videoToVideoSound`. */
396
+ keepOriginalSound?: never;
397
+ }
316
398
  /** One variant's outputs on a `videoToSound` / `videoToVideoSound` result.
317
399
  * Present even at the default `variantsNum` of 1, as a single-entry array. */
318
400
  interface SoundOutputEntry {
@@ -421,7 +503,7 @@ declare class TextToMusic {
421
503
  /**
422
504
  * Submit an async text-to-music task; poll with
423
505
  * `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
424
- * `outputFormat: "wav"` and `variantsNum` above 1. `stream()`/`generate()`
506
+ * a non-m4a `outputFormat` and `variantsNum` above 1. `stream()`/`generate()`
425
507
  * remain the streaming path.
426
508
  */
427
509
  submit(params: TextToMusicParams): Promise<SfxTask>;
@@ -435,7 +517,7 @@ declare class VideoToMusic {
435
517
  /**
436
518
  * Submit an async video-to-music task; poll its result with
437
519
  * `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
438
- * `isolateVocals`/`preserveSpeech`, `outputFormat: "wav"`, and
520
+ * `isolateVocals`/`preserveSpeech`, a non-m4a `outputFormat`, and
439
521
  * `variantsNum` above 1 — the backend rejects all of these on the plain
440
522
  * stream, and they only ever run in async mode.
441
523
  */
@@ -489,8 +571,8 @@ declare class VideoToSound {
489
571
  declare class VideoToVideoSound {
490
572
  private readonly client;
491
573
  constructor(client: SoniloClient);
492
- submit(params: VideoToSoundParams): Promise<SfxTask>;
493
- generate(params: VideoToSoundParams, opts?: WaitOptions): Promise<SoundResult>;
574
+ submit(params: VideoToVideoSoundParams): Promise<SfxTask>;
575
+ generate(params: VideoToVideoSoundParams, opts?: WaitOptions): Promise<SoundResult>;
494
576
  }
495
577
 
496
578
  /** Dub a video into one or more target languages. Async only; the result
@@ -621,6 +703,6 @@ declare class RequestTimeoutError extends SoniloError {
621
703
  declare function download(media: SfxMedia | string | undefined, fetchFn?: typeof globalThis.fetch, timeout?: number): Promise<Uint8Array>;
622
704
 
623
705
  /** The SDK's own version. Generated by scripts/sync-versions.mjs — do not edit. */
624
- declare const VERSION = "0.9.0";
706
+ declare const VERSION = "0.11.0";
625
707
 
626
- export { APIError, type AccountServices, type AudioChunkEvent, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundOutputEntry, type SoundResult, type StreamEvent, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
708
+ export { APIError, type AccountServices, type AudioChunkEvent, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundOutputEntry, type SoundResult, type StreamEvent, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type VideoToVideoSoundParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
package/dist/index.d.ts CHANGED
@@ -51,10 +51,13 @@ interface TextToMusicParams {
51
51
  prompt: string;
52
52
  duration: number;
53
53
  segments?: Segment[];
54
- /** "stream" (default) or "async" (required by `submit()` and `output_format: "wav"`). */
54
+ /** "stream" (default) or "async" (required by `submit()` and by any
55
+ * `outputFormat` other than the m4a default). */
55
56
  mode?: "stream" | "async";
56
- /** Container for the async result. `wav` requires `mode: "async"`. Defaults to m4a server-side. */
57
- outputFormat?: "m4a" | "wav";
57
+ /** Container for the async result. `wav` and `mp3` (320 kbps) are
58
+ * finalize-time transcodes and require `mode: "async"`; m4a is what the
59
+ * stream itself carries. Defaults to m4a server-side. */
60
+ outputFormat?: "m4a" | "wav" | "mp3";
58
61
  /** How many distinct music variants to generate in one request (1-10,
59
62
  * default 1). Cost scales linearly, and values above 1 are never covered
60
63
  * by the free trial. Values above 1 require `mode: "async"` — only
@@ -93,8 +96,9 @@ interface VideoToMusicParams {
93
96
  * `isolateVocals`; both are accepted and OR'd server-side. Requires
94
97
  * `mode: "async"` (auto-selected by `submit()`). */
95
98
  preserveSpeech?: boolean;
96
- /** Container for the async result. `wav` requires async. Defaults to m4a. */
97
- outputFormat?: "m4a" | "wav";
99
+ /** Container for the async result. `wav` and `mp3` (320 kbps) are
100
+ * finalize-time transcodes and require async. Defaults to m4a. */
101
+ outputFormat?: "m4a" | "wav" | "mp3";
98
102
  /** Duck the generated music under the source voice at finalize time.
99
103
  * Default-ON server-side in async mode: leave unset to keep it on, pass
100
104
  * `false` to opt out. Free, best-effort; only valid on `submit()`. */
@@ -269,12 +273,53 @@ interface VideoResult extends BaseTaskResult {
269
273
  video?: SfxMedia;
270
274
  duration_seconds?: number;
271
275
  }
276
+ /** Params for `videoToVideoMusic`.
277
+ *
278
+ * The delivered video's audio is decided by two independent knobs:
279
+ * `keepOriginalSound` picks the **voice source**, `ducking` picks how that
280
+ * voice and the generated music are **combined**.
281
+ *
282
+ * | Request | Audio in the returned video |
283
+ * | --- | --- |
284
+ * | neither set | generated music only — the source's own audio is removed |
285
+ * | `keepOriginalSound: true` | full original sound + music ducked under it |
286
+ * | `keepOriginalSound: true, ducking: false` | full original sound + static music mix |
287
+ * | `preserveSpeech: true` | isolated vocals + music ducked under them |
288
+ * | `preserveSpeech: true, ducking: false` | static vocal-forward mix of vocals + music |
289
+ *
290
+ * `keepOriginalSound` supersedes `preserveSpeech` — the voice source is a
291
+ * single choice, and keeping the whole track subsumes keeping only the
292
+ * isolated speech. No combination is rejected.
293
+ *
294
+ * The source picture is copied without re-encoding, so the input must carry
295
+ * H.264, H.265/HEVC, VP9 or AV1 video in an mp4, mov, m4v or webm container —
296
+ * animated gif and VP8 webm are rejected. Maximum input duration is 360
297
+ * seconds. */
272
298
  interface VideoToVideoMusicParams {
273
299
  video?: VideoInput;
274
300
  videoUrl?: string;
275
301
  prompt?: string;
276
- /** Keep the source speech/vocals in the output. Both this and the legacy
277
- * `isolateVocals` are accepted and OR'd server-side. */
302
+ /** How the music should develop over time. Same shape as
303
+ * `videoToMusic`'s: the first `start` must be 0. Supplying these skips the
304
+ * prompt-service plan the server would otherwise derive from `prompt`. */
305
+ segments?: Segment[];
306
+ /** Keep the source video's whole original audio track in the result, with
307
+ * the generated music combined under it. Defaults to `false`, so by
308
+ * default the returned video's audio is the generated music ALONE and the
309
+ * source's own audio is removed. Supersedes `preserveSpeech`. */
310
+ keepOriginalSound?: boolean;
311
+ /** How the voice and the generated music are combined — not whether a
312
+ * voice is kept. Default-ON server-side: leave unset for the dynamic duck
313
+ * (music dips only while the voice is present), pass `false` for a static
314
+ * voice-forward mix at a fixed offset. Has no effect when there is no
315
+ * voice source, i.e. neither `keepOriginalSound` nor `preserveSpeech` is
316
+ * set. Free and best-effort; silently falls back to generated-audio-only
317
+ * if the source has no usable audio track, voice isolation fails, or the
318
+ * mix fails. */
319
+ ducking?: boolean;
320
+ /** Keep only the source's isolated speech (not the whole track) in the
321
+ * output. Both this and the legacy `isolateVocals` are accepted and OR'd
322
+ * server-side. Superseded by `keepOriginalSound`. */
278
323
  preserveSpeech?: boolean;
279
324
  /** @deprecated Legacy alias for `preserveSpeech`. */
280
325
  isolateVocals?: boolean;
@@ -290,9 +335,20 @@ interface VideoToVideoSfxParams {
290
335
  prompt?: string;
291
336
  segments?: SfxSegment[];
292
337
  }
293
- /** Params for `videoToSound` and `videoToVideoSound`. Both endpoints take the
294
- * identical form, so they share one params type. */
295
- interface VideoToSoundParams {
338
+ /** Params for `videoToVideoSound`, and the base every `videoToSound` param
339
+ * also has. The two endpoints differ in exactly two fields, one in each
340
+ * direction, and both are enforced at the type level rather than left to the
341
+ * server to silently ignore:
342
+ *
343
+ * - `outputFormat` is **audio-only** — added by `VideoToSoundParams` below, so
344
+ * it simply does not exist on this type.
345
+ * - `keepOriginalSound` is **video-only** — declared here, so
346
+ * `VideoToSoundParams` inherits it and has to forbid it explicitly with
347
+ * `?: never` (the inheritance runs the other way, so it cannot just be
348
+ * omitted the way `outputFormat` is).
349
+ *
350
+ * Passing either field to the wrong endpoint is therefore a compile error. */
351
+ interface VideoToVideoSoundParams {
296
352
  video?: VideoInput;
297
353
  videoUrl?: string;
298
354
  /** Style hint for the generated music bed. */
@@ -301,10 +357,20 @@ interface VideoToSoundParams {
301
357
  sfxPrompt?: string;
302
358
  /** Per-segment SFX descriptions; must start at 0 and be contiguous. */
303
359
  segments?: SfxSegment[];
304
- /** Keep the source speech in the result. */
360
+ /** Keep the source video's whole original audio track in the result, with
361
+ * the generated music + SFX combined under it. Defaults to `false`, so by
362
+ * default the returned video's audio is the generated music and sound
363
+ * effects ALONE and the source's own audio is removed — and the result
364
+ * carries no `music_processed` stem, since with no voice source there is no
365
+ * processed track. Supersedes `preserveSpeech`. Video endpoint only. */
366
+ keepOriginalSound?: boolean;
367
+ /** Keep only the source's isolated speech (not the whole track) in the
368
+ * result. Superseded by `keepOriginalSound`. */
305
369
  preserveSpeech?: boolean;
306
- /** Duck the generated music under the source speech. Default-ON
307
- * server-side: leave unset to keep it on, pass `false` to opt out. */
370
+ /** How the voice and the generated bed are combined not whether a voice
371
+ * is kept. Default-ON server-side: leave unset for the dynamic duck, pass
372
+ * `false` for a static voice-forward mix. Has no effect when there is no
373
+ * voice source. */
308
374
  ducking?: boolean;
309
375
  /** How many distinct variants to generate in one request (1-10, default
310
376
  * 1). Cost scales linearly, and values above 1 are never covered by the
@@ -313,6 +379,22 @@ interface VideoToSoundParams {
313
379
  * one entry per variant. */
314
380
  variantsNum?: number;
315
381
  }
382
+ /** Params for `videoToSound`. Everything `videoToVideoSound` takes, plus the
383
+ * delivery container for the combined track. */
384
+ interface VideoToSoundParams extends VideoToVideoSoundParams {
385
+ /** Container for the combined music + SFX track. Defaults to `wav`;
386
+ * `mp3` is 320 kbps. Applies to the combined output only — the `music`
387
+ * and `sfx` stems keep their native formats. Not available on
388
+ * `videoToVideoSound`, which always returns an mp4. */
389
+ outputFormat?: "wav" | "m4a" | "mp3";
390
+ /** Not available on this endpoint. `keepOriginalSound` only means something
391
+ * when the deliverable is a video whose own audio could be preserved;
392
+ * `videoToSound` returns generated audio, and its default already keeps the
393
+ * source voice in the mix. Typed `never` so passing it is a compile error
394
+ * rather than a field the server silently drops — the mirror of how
395
+ * `outputFormat` is kept off `videoToVideoSound`. */
396
+ keepOriginalSound?: never;
397
+ }
316
398
  /** One variant's outputs on a `videoToSound` / `videoToVideoSound` result.
317
399
  * Present even at the default `variantsNum` of 1, as a single-entry array. */
318
400
  interface SoundOutputEntry {
@@ -421,7 +503,7 @@ declare class TextToMusic {
421
503
  /**
422
504
  * Submit an async text-to-music task; poll with
423
505
  * `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
424
- * `outputFormat: "wav"` and `variantsNum` above 1. `stream()`/`generate()`
506
+ * a non-m4a `outputFormat` and `variantsNum` above 1. `stream()`/`generate()`
425
507
  * remain the streaming path.
426
508
  */
427
509
  submit(params: TextToMusicParams): Promise<SfxTask>;
@@ -435,7 +517,7 @@ declare class VideoToMusic {
435
517
  /**
436
518
  * Submit an async video-to-music task; poll its result with
437
519
  * `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
438
- * `isolateVocals`/`preserveSpeech`, `outputFormat: "wav"`, and
520
+ * `isolateVocals`/`preserveSpeech`, a non-m4a `outputFormat`, and
439
521
  * `variantsNum` above 1 — the backend rejects all of these on the plain
440
522
  * stream, and they only ever run in async mode.
441
523
  */
@@ -489,8 +571,8 @@ declare class VideoToSound {
489
571
  declare class VideoToVideoSound {
490
572
  private readonly client;
491
573
  constructor(client: SoniloClient);
492
- submit(params: VideoToSoundParams): Promise<SfxTask>;
493
- generate(params: VideoToSoundParams, opts?: WaitOptions): Promise<SoundResult>;
574
+ submit(params: VideoToVideoSoundParams): Promise<SfxTask>;
575
+ generate(params: VideoToVideoSoundParams, opts?: WaitOptions): Promise<SoundResult>;
494
576
  }
495
577
 
496
578
  /** Dub a video into one or more target languages. Async only; the result
@@ -621,6 +703,6 @@ declare class RequestTimeoutError extends SoniloError {
621
703
  declare function download(media: SfxMedia | string | undefined, fetchFn?: typeof globalThis.fetch, timeout?: number): Promise<Uint8Array>;
622
704
 
623
705
  /** The SDK's own version. Generated by scripts/sync-versions.mjs — do not edit. */
624
- declare const VERSION = "0.9.0";
706
+ declare const VERSION = "0.11.0";
625
707
 
626
- export { APIError, type AccountServices, type AudioChunkEvent, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundOutputEntry, type SoundResult, type StreamEvent, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
708
+ export { APIError, type AccountServices, type AudioChunkEvent, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundOutputEntry, type SoundResult, type StreamEvent, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type VideoToVideoSoundParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
package/dist/index.js CHANGED
@@ -305,7 +305,7 @@ var TextToMusic = class {
305
305
  /**
306
306
  * Submit an async text-to-music task; poll with
307
307
  * `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
308
- * `outputFormat: "wav"` and `variantsNum` above 1. `stream()`/`generate()`
308
+ * a non-m4a `outputFormat` and `variantsNum` above 1. `stream()`/`generate()`
309
309
  * remain the streaming path.
310
310
  */
311
311
  async submit(params) {
@@ -406,7 +406,7 @@ var VideoToMusic = class {
406
406
  /**
407
407
  * Submit an async video-to-music task; poll its result with
408
408
  * `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
409
- * `isolateVocals`/`preserveSpeech`, `outputFormat: "wav"`, and
409
+ * `isolateVocals`/`preserveSpeech`, a non-m4a `outputFormat`, and
410
410
  * `variantsNum` above 1 — the backend rejects all of these on the plain
411
411
  * stream, and they only ever run in async mode.
412
412
  */
@@ -415,11 +415,14 @@ var VideoToMusic = class {
415
415
  throw new SoniloError("Provide exactly one of video or videoUrl");
416
416
  }
417
417
  let mode = params.mode;
418
- const needsAsync = params.isolateVocals || params.preserveSpeech || params.ducking !== void 0 || params.outputFormat === "wav" || params.variantsNum !== void 0 && params.variantsNum > 1;
418
+ const needsAsync = params.isolateVocals || params.preserveSpeech || params.ducking !== void 0 || // Any non-m4a container is a finalize-time transcode, so it needs
419
+ // async. Checking != "m4a" rather than == "wav" keeps this correct
420
+ // as formats are added (mp3 landed after the original check).
421
+ params.outputFormat !== void 0 && params.outputFormat !== "m4a" || params.variantsNum !== void 0 && params.variantsNum > 1;
419
422
  if (mode === void 0) mode = "async";
420
423
  if (needsAsync && mode !== "async") {
421
424
  throw new SoniloError(
422
- 'isolateVocals/preserveSpeech/ducking/outputFormat "wav"/variantsNum > 1 require mode: "async"'
425
+ 'isolateVocals/preserveSpeech/ducking/outputFormat other than "m4a"/variantsNum > 1 require mode: "async"'
423
426
  );
424
427
  }
425
428
  const form = new FormData();
@@ -529,6 +532,13 @@ var VideoToVideoMusic = class {
529
532
  form.set("video_url", params.videoUrl);
530
533
  }
531
534
  if (params.prompt !== void 0) form.set("prompt", params.prompt);
535
+ if (params.segments !== void 0) {
536
+ form.set("segments", JSON.stringify(params.segments));
537
+ }
538
+ if (params.keepOriginalSound !== void 0) {
539
+ form.set("keep_original_sound", String(params.keepOriginalSound));
540
+ }
541
+ if (params.ducking !== void 0) form.set("ducking", String(params.ducking));
532
542
  if (params.preserveSpeech !== void 0) {
533
543
  form.set("preserve_speech", String(params.preserveSpeech));
534
544
  }
@@ -599,10 +609,16 @@ async function buildSoundForm(params) {
599
609
  if (params.segments !== void 0) {
600
610
  form.set("segments", JSON.stringify(params.segments));
601
611
  }
612
+ if (params.keepOriginalSound !== void 0) {
613
+ form.set("keep_original_sound", String(params.keepOriginalSound));
614
+ }
602
615
  if (params.preserveSpeech !== void 0) {
603
616
  form.set("preserve_speech", String(params.preserveSpeech));
604
617
  }
605
618
  if (params.ducking !== void 0) form.set("ducking", String(params.ducking));
619
+ if (params.outputFormat !== void 0) {
620
+ form.set("output_format", params.outputFormat);
621
+ }
606
622
  if (params.variantsNum !== void 0) {
607
623
  form.set("variants_num", String(params.variantsNum));
608
624
  }
@@ -689,7 +705,7 @@ var Dubbing = class {
689
705
  };
690
706
 
691
707
  // src/version.ts
692
- var VERSION = "0.9.0";
708
+ var VERSION = "0.11.0";
693
709
 
694
710
  // src/client.ts
695
711
  var DEFAULT_BASE_URL = "https://api.sonilo.com";