feat: stems option and CLI flag (0.15.0 / cli 0.14.0) - #31
Merged
Conversation
Propagates the API's new `stems` boolean to the SDK and the CLI: passed with an async text-to-music or video-to-music task, it also splits the GENERATED music — on video-to-music never the video's own audio — into drums/bass/vocals/other. Free of charge. The request side mirrors the existing async-only options: the field is tri-state (omitted unless passed; an explicit false goes on the wire, same as ducking) and requesting stems joins _resolve_music_mode's fail-fast via bool(stems) — stems=False asks for nothing finalize-time, so unlike ducking's `is not None` it must not force async. text-to-music's builder is already async-only, so it needs no per-field guard. The result side adds two INDEPENDENT fields to MusicResult, parsed unconditionally because the contract lets them coexist: - `stems`: one MusicStems entry per stream that separated successfully, looked up by stream_index and NEVER list position — the list can be shorter than `audio`, so stems[i] would silently pair the wrong stems with a track. stems_for() does the lookup; save_stem()/asave_stem() download one stem, and the missing-entry error names the API's own stems_error so it explains itself. - `stems_error`: present when separation failed wholly or in part, or was skipped. It can accompany a PARTIAL stems list, so nothing treats it as "no stems". Malformed stems entries are coerced-and-dropped like parse_dubbing_result's outputs, for the same reason. Separation runs after generation, typically adds 2-6 minutes and gives up after 30 — long past DEFAULT_WAIT_TIMEOUT's 600 seconds. Following the dubbing precedent, the SDK keeps the generic default and documents passing timeout=2400, while the CLI's new --stems flag switches its wait to STEMS_WAIT_TIMEOUT (2400 s) so it never abandons a task it is already waiting on. The CLI saves stems next to the output (take.drums.m4a; per variant take.1.drums.m4a, named by the entry's own stream_index) and reports stems_error as a stderr warning — a partial separation of a free add-on must not turn a succeeded generation into an error exit — while still writing everything that did come back. sonilo-cli's narrow pin on the core moves to >=0.15.0,<0.16 with the bump. Core sonilo 0.14.0 -> 0.15.0, sonilo-cli 0.13.0 -> 0.14.0. pytest: 289 passed (core), 154 passed (sonilo-cli), 53 passed (sonilo-video-kit, unaffected).
Lightsage docs evalsWaiting for the staging docs URL before running evals. Lightsage will start the selected PR evals automatically when GitHub reports a successful docs deployment for this PR. This usually happens within 15 minutes. Commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the API's new
stemsoption to the core SDK and the CLI.stems=Trueontext_to_music/video_to_musicsubmit()/generate_async()returns the generated track split into four separated instrument tracks —drums,bass,vocals,other— asMusicResult.stemsalongside the clean audio. Free of charge; async-only (bool(stems)joins the async guard — an explicitstems=Falserequests nothing finalize-time and is allowed on a stream, which the backend accepts). On video-to-music it splits the generated music, never the video's own audio.Result contract:
stems_for(stream_index)looks entries up bystream_index, never position (a stream whose separation failed is absent), andstems_erroris independent — it can accompany a partial list.save_stem/asave_stemdownload one stem; a missing entry's error message surfacesstems_error. Separation adds 2-6 min typically with a 30-min ceiling, so the CLI's--stemsruns use a 2400s wait timeout, following the dubbing precedent, and the README advisestimeout=2400for SDK polling.CLI:
--stemson both music commands (forces async), stems written astake.drums.m4a/ per-varianttake.1.drums.m4anamed by each entry's ownstream_index; partial failure warns on stderr without failing the run. Core pin widened to>=0.15.0,<0.16as in #30.Tests: core 289, cli 154, video-kit 53 — all green.