sonilo 0.9.0 → 0.10.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/README.md +13 -2
- package/dist/index.cjs +15 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -14
- package/dist/index.d.ts +56 -14
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
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`
|
|
57
|
-
|
|
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`
|
|
97
|
-
|
|
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,10 +273,35 @@ 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 depends on `ducking` and `preserveSpeech`:
|
|
279
|
+
*
|
|
280
|
+
* | Request | Audio in the returned video |
|
|
281
|
+
* | --- | --- |
|
|
282
|
+
* | neither set | source speech + music ducked under it |
|
|
283
|
+
* | `ducking: false` | music only |
|
|
284
|
+
* | `preserveSpeech: true` | isolated vocals + music ducked under them |
|
|
285
|
+
* | both (`ducking: false`) | static vocal-forward mix of vocals + music |
|
|
286
|
+
*
|
|
287
|
+
* The source picture is copied without re-encoding, so the input must carry
|
|
288
|
+
* H.264, H.265/HEVC, VP9 or AV1 video in an mp4, mov, m4v or webm container —
|
|
289
|
+
* animated gif and VP8 webm are rejected. Maximum input duration is 360
|
|
290
|
+
* seconds. */
|
|
272
291
|
interface VideoToVideoMusicParams {
|
|
273
292
|
video?: VideoInput;
|
|
274
293
|
videoUrl?: string;
|
|
275
294
|
prompt?: string;
|
|
295
|
+
/** How the music should develop over time. Same shape as
|
|
296
|
+
* `videoToMusic`'s: the first `start` must be 0. Supplying these skips the
|
|
297
|
+
* prompt-service plan the server would otherwise derive from `prompt`. */
|
|
298
|
+
segments?: Segment[];
|
|
299
|
+
/** Duck the generated music under the source's speech — or, with
|
|
300
|
+
* `preserveSpeech`, under the isolated vocals. Default-ON server-side:
|
|
301
|
+
* leave unset to keep it on, pass `false` for music-only audio. Free and
|
|
302
|
+
* best-effort; silently falls back to music-only if the source has no
|
|
303
|
+
* usable audio track, voice isolation fails, or the duck mix fails. */
|
|
304
|
+
ducking?: boolean;
|
|
276
305
|
/** Keep the source speech/vocals in the output. Both this and the legacy
|
|
277
306
|
* `isolateVocals` are accepted and OR'd server-side. */
|
|
278
307
|
preserveSpeech?: boolean;
|
|
@@ -290,9 +319,13 @@ interface VideoToVideoSfxParams {
|
|
|
290
319
|
prompt?: string;
|
|
291
320
|
segments?: SfxSegment[];
|
|
292
321
|
}
|
|
293
|
-
/** Params for `
|
|
294
|
-
*
|
|
295
|
-
|
|
322
|
+
/** Params for `videoToVideoSound`, and the base every `videoToSound` param
|
|
323
|
+
* also has. The two endpoints are identical except that only the audio one
|
|
324
|
+
* accepts `outputFormat` — `videoToVideoSound` always muxes the mix into an
|
|
325
|
+
* mp4 — so `VideoToSoundParams` extends this rather than the two sharing a
|
|
326
|
+
* single type, and passing `outputFormat` to the video endpoint is a
|
|
327
|
+
* compile error instead of a value the server silently ignores. */
|
|
328
|
+
interface VideoToVideoSoundParams {
|
|
296
329
|
video?: VideoInput;
|
|
297
330
|
videoUrl?: string;
|
|
298
331
|
/** Style hint for the generated music bed. */
|
|
@@ -313,6 +346,15 @@ interface VideoToSoundParams {
|
|
|
313
346
|
* one entry per variant. */
|
|
314
347
|
variantsNum?: number;
|
|
315
348
|
}
|
|
349
|
+
/** Params for `videoToSound`. Everything `videoToVideoSound` takes, plus the
|
|
350
|
+
* delivery container for the combined track. */
|
|
351
|
+
interface VideoToSoundParams extends VideoToVideoSoundParams {
|
|
352
|
+
/** Container for the combined music + SFX track. Defaults to `wav`;
|
|
353
|
+
* `mp3` is 320 kbps. Applies to the combined output only — the `music`
|
|
354
|
+
* and `sfx` stems keep their native formats. Not available on
|
|
355
|
+
* `videoToVideoSound`, which always returns an mp4. */
|
|
356
|
+
outputFormat?: "wav" | "m4a" | "mp3";
|
|
357
|
+
}
|
|
316
358
|
/** One variant's outputs on a `videoToSound` / `videoToVideoSound` result.
|
|
317
359
|
* Present even at the default `variantsNum` of 1, as a single-entry array. */
|
|
318
360
|
interface SoundOutputEntry {
|
|
@@ -421,7 +463,7 @@ declare class TextToMusic {
|
|
|
421
463
|
/**
|
|
422
464
|
* Submit an async text-to-music task; poll with
|
|
423
465
|
* `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
|
|
424
|
-
* `outputFormat
|
|
466
|
+
* a non-m4a `outputFormat` and `variantsNum` above 1. `stream()`/`generate()`
|
|
425
467
|
* remain the streaming path.
|
|
426
468
|
*/
|
|
427
469
|
submit(params: TextToMusicParams): Promise<SfxTask>;
|
|
@@ -435,7 +477,7 @@ declare class VideoToMusic {
|
|
|
435
477
|
/**
|
|
436
478
|
* Submit an async video-to-music task; poll its result with
|
|
437
479
|
* `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
|
|
438
|
-
* `isolateVocals`/`preserveSpeech`, `outputFormat
|
|
480
|
+
* `isolateVocals`/`preserveSpeech`, a non-m4a `outputFormat`, and
|
|
439
481
|
* `variantsNum` above 1 — the backend rejects all of these on the plain
|
|
440
482
|
* stream, and they only ever run in async mode.
|
|
441
483
|
*/
|
|
@@ -489,8 +531,8 @@ declare class VideoToSound {
|
|
|
489
531
|
declare class VideoToVideoSound {
|
|
490
532
|
private readonly client;
|
|
491
533
|
constructor(client: SoniloClient);
|
|
492
|
-
submit(params:
|
|
493
|
-
generate(params:
|
|
534
|
+
submit(params: VideoToVideoSoundParams): Promise<SfxTask>;
|
|
535
|
+
generate(params: VideoToVideoSoundParams, opts?: WaitOptions): Promise<SoundResult>;
|
|
494
536
|
}
|
|
495
537
|
|
|
496
538
|
/** Dub a video into one or more target languages. Async only; the result
|
|
@@ -621,6 +663,6 @@ declare class RequestTimeoutError extends SoniloError {
|
|
|
621
663
|
declare function download(media: SfxMedia | string | undefined, fetchFn?: typeof globalThis.fetch, timeout?: number): Promise<Uint8Array>;
|
|
622
664
|
|
|
623
665
|
/** The SDK's own version. Generated by scripts/sync-versions.mjs — do not edit. */
|
|
624
|
-
declare const VERSION = "0.
|
|
666
|
+
declare const VERSION = "0.10.0";
|
|
625
667
|
|
|
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 };
|
|
668
|
+
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
|
|
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`
|
|
57
|
-
|
|
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`
|
|
97
|
-
|
|
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,10 +273,35 @@ 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 depends on `ducking` and `preserveSpeech`:
|
|
279
|
+
*
|
|
280
|
+
* | Request | Audio in the returned video |
|
|
281
|
+
* | --- | --- |
|
|
282
|
+
* | neither set | source speech + music ducked under it |
|
|
283
|
+
* | `ducking: false` | music only |
|
|
284
|
+
* | `preserveSpeech: true` | isolated vocals + music ducked under them |
|
|
285
|
+
* | both (`ducking: false`) | static vocal-forward mix of vocals + music |
|
|
286
|
+
*
|
|
287
|
+
* The source picture is copied without re-encoding, so the input must carry
|
|
288
|
+
* H.264, H.265/HEVC, VP9 or AV1 video in an mp4, mov, m4v or webm container —
|
|
289
|
+
* animated gif and VP8 webm are rejected. Maximum input duration is 360
|
|
290
|
+
* seconds. */
|
|
272
291
|
interface VideoToVideoMusicParams {
|
|
273
292
|
video?: VideoInput;
|
|
274
293
|
videoUrl?: string;
|
|
275
294
|
prompt?: string;
|
|
295
|
+
/** How the music should develop over time. Same shape as
|
|
296
|
+
* `videoToMusic`'s: the first `start` must be 0. Supplying these skips the
|
|
297
|
+
* prompt-service plan the server would otherwise derive from `prompt`. */
|
|
298
|
+
segments?: Segment[];
|
|
299
|
+
/** Duck the generated music under the source's speech — or, with
|
|
300
|
+
* `preserveSpeech`, under the isolated vocals. Default-ON server-side:
|
|
301
|
+
* leave unset to keep it on, pass `false` for music-only audio. Free and
|
|
302
|
+
* best-effort; silently falls back to music-only if the source has no
|
|
303
|
+
* usable audio track, voice isolation fails, or the duck mix fails. */
|
|
304
|
+
ducking?: boolean;
|
|
276
305
|
/** Keep the source speech/vocals in the output. Both this and the legacy
|
|
277
306
|
* `isolateVocals` are accepted and OR'd server-side. */
|
|
278
307
|
preserveSpeech?: boolean;
|
|
@@ -290,9 +319,13 @@ interface VideoToVideoSfxParams {
|
|
|
290
319
|
prompt?: string;
|
|
291
320
|
segments?: SfxSegment[];
|
|
292
321
|
}
|
|
293
|
-
/** Params for `
|
|
294
|
-
*
|
|
295
|
-
|
|
322
|
+
/** Params for `videoToVideoSound`, and the base every `videoToSound` param
|
|
323
|
+
* also has. The two endpoints are identical except that only the audio one
|
|
324
|
+
* accepts `outputFormat` — `videoToVideoSound` always muxes the mix into an
|
|
325
|
+
* mp4 — so `VideoToSoundParams` extends this rather than the two sharing a
|
|
326
|
+
* single type, and passing `outputFormat` to the video endpoint is a
|
|
327
|
+
* compile error instead of a value the server silently ignores. */
|
|
328
|
+
interface VideoToVideoSoundParams {
|
|
296
329
|
video?: VideoInput;
|
|
297
330
|
videoUrl?: string;
|
|
298
331
|
/** Style hint for the generated music bed. */
|
|
@@ -313,6 +346,15 @@ interface VideoToSoundParams {
|
|
|
313
346
|
* one entry per variant. */
|
|
314
347
|
variantsNum?: number;
|
|
315
348
|
}
|
|
349
|
+
/** Params for `videoToSound`. Everything `videoToVideoSound` takes, plus the
|
|
350
|
+
* delivery container for the combined track. */
|
|
351
|
+
interface VideoToSoundParams extends VideoToVideoSoundParams {
|
|
352
|
+
/** Container for the combined music + SFX track. Defaults to `wav`;
|
|
353
|
+
* `mp3` is 320 kbps. Applies to the combined output only — the `music`
|
|
354
|
+
* and `sfx` stems keep their native formats. Not available on
|
|
355
|
+
* `videoToVideoSound`, which always returns an mp4. */
|
|
356
|
+
outputFormat?: "wav" | "m4a" | "mp3";
|
|
357
|
+
}
|
|
316
358
|
/** One variant's outputs on a `videoToSound` / `videoToVideoSound` result.
|
|
317
359
|
* Present even at the default `variantsNum` of 1, as a single-entry array. */
|
|
318
360
|
interface SoundOutputEntry {
|
|
@@ -421,7 +463,7 @@ declare class TextToMusic {
|
|
|
421
463
|
/**
|
|
422
464
|
* Submit an async text-to-music task; poll with
|
|
423
465
|
* `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
|
|
424
|
-
* `outputFormat
|
|
466
|
+
* a non-m4a `outputFormat` and `variantsNum` above 1. `stream()`/`generate()`
|
|
425
467
|
* remain the streaming path.
|
|
426
468
|
*/
|
|
427
469
|
submit(params: TextToMusicParams): Promise<SfxTask>;
|
|
@@ -435,7 +477,7 @@ declare class VideoToMusic {
|
|
|
435
477
|
/**
|
|
436
478
|
* Submit an async video-to-music task; poll its result with
|
|
437
479
|
* `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
|
|
438
|
-
* `isolateVocals`/`preserveSpeech`, `outputFormat
|
|
480
|
+
* `isolateVocals`/`preserveSpeech`, a non-m4a `outputFormat`, and
|
|
439
481
|
* `variantsNum` above 1 — the backend rejects all of these on the plain
|
|
440
482
|
* stream, and they only ever run in async mode.
|
|
441
483
|
*/
|
|
@@ -489,8 +531,8 @@ declare class VideoToSound {
|
|
|
489
531
|
declare class VideoToVideoSound {
|
|
490
532
|
private readonly client;
|
|
491
533
|
constructor(client: SoniloClient);
|
|
492
|
-
submit(params:
|
|
493
|
-
generate(params:
|
|
534
|
+
submit(params: VideoToVideoSoundParams): Promise<SfxTask>;
|
|
535
|
+
generate(params: VideoToVideoSoundParams, opts?: WaitOptions): Promise<SoundResult>;
|
|
494
536
|
}
|
|
495
537
|
|
|
496
538
|
/** Dub a video into one or more target languages. Async only; the result
|
|
@@ -621,6 +663,6 @@ declare class RequestTimeoutError extends SoniloError {
|
|
|
621
663
|
declare function download(media: SfxMedia | string | undefined, fetchFn?: typeof globalThis.fetch, timeout?: number): Promise<Uint8Array>;
|
|
622
664
|
|
|
623
665
|
/** The SDK's own version. Generated by scripts/sync-versions.mjs — do not edit. */
|
|
624
|
-
declare const VERSION = "0.
|
|
666
|
+
declare const VERSION = "0.10.0";
|
|
625
667
|
|
|
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 };
|
|
668
|
+
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
|
|
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
|
|
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 ||
|
|
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 "
|
|
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,10 @@ 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.ducking !== void 0) form.set("ducking", String(params.ducking));
|
|
532
539
|
if (params.preserveSpeech !== void 0) {
|
|
533
540
|
form.set("preserve_speech", String(params.preserveSpeech));
|
|
534
541
|
}
|
|
@@ -603,6 +610,9 @@ async function buildSoundForm(params) {
|
|
|
603
610
|
form.set("preserve_speech", String(params.preserveSpeech));
|
|
604
611
|
}
|
|
605
612
|
if (params.ducking !== void 0) form.set("ducking", String(params.ducking));
|
|
613
|
+
if (params.outputFormat !== void 0) {
|
|
614
|
+
form.set("output_format", params.outputFormat);
|
|
615
|
+
}
|
|
606
616
|
if (params.variantsNum !== void 0) {
|
|
607
617
|
form.set("variants_num", String(params.variantsNum));
|
|
608
618
|
}
|
|
@@ -689,7 +699,7 @@ var Dubbing = class {
|
|
|
689
699
|
};
|
|
690
700
|
|
|
691
701
|
// src/version.ts
|
|
692
|
-
var VERSION = "0.
|
|
702
|
+
var VERSION = "0.10.0";
|
|
693
703
|
|
|
694
704
|
// src/client.ts
|
|
695
705
|
var DEFAULT_BASE_URL = "https://api.sonilo.com";
|