feat: keep_original_sound on video_to_video_music and video_to_video_sound (0.11.0) - #23
Merged
Merged
Conversation
…sound (0.11.0) The server flipped both endpoints' defaults, so a request that does not set keep_original_sound now returns the generated audio alone. This adds the parameter that opts back in. keep_original_sound picks the voice source and supersedes preserve_speech; ducking independently picks how that voice is combined with the generated audio. Both are emitted only when explicitly passed, so each server default stands on its own — and they run in opposite directions: ducking is default-ON, keep_original_sound default-OFF. The field is video-only, following the pattern already used for output_format in reverse: keyword-only with a None default on the shared build_v2s_parts, and the resource that must not send it simply never passes it. Tests assert that on the public signatures, so adding it to VideoToSound by reflex fails. Also corrects two README claims and two SoundOutput/SoundResult docstrings that described the old default and the old music_processed condition.
Sapient docs evalsWaiting for the staging docs URL before running evals. Sapient will start the selected PR evals automatically when GitHub reports a successful docs deployment for this PR. This usually happens within 15 minutes. Commit: |
… to it CI caught that this repo ships three packages, not one: sonilo-cli pinned sonilo>=0.10.0,<0.11, so bumping the core to 0.11.0 made the editable install unresolvable. Widened to >=0.11.0,<0.12 and bumped sonilo-cli to 0.8.0. sonilo-video-kit's >=0.3,<1.0 already covers it. That also surfaced that the Python CLI needed the same treatment as the JS one: --keep-original-sound on both video-to-video-music and video-to-video-sound, plus --no-ducking on video-to-video-music, which the SDK supported but the CLI never exposed -- without it the static-mix combination was unreachable. _run_sound is shared by video-to-sound and video-to-video-sound, so the flag is forwarded only when the parser actually defined it: video_to_sound.generate() does not accept the keyword at all, so it must be omitted rather than passed as None.
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.
Follows the API change deployed today (sonilo-api-dashboard #198, live on
backend-public rev 77 / backend-mcp rev 33).
Why this matters even without upgrading
The server flipped both endpoints' defaults. A request that does not set
keep_original_soundnow returns the generated audio alone, where it previouslyreturned the source video's speech with the generated music ducked underneath.
video_to_video_sound's default result therefore carries nomusic_processedstem, since with no voice source there is no processed track.
That is already true in production for current users of this SDK. This release
is what lets them opt back in.
The contract
Two independent knobs:
keep_original_soundpicks the voice source — the whole original track,or
preserve_speechfor the isolated speech only, or neither.duckingpicks how that voice is combined with the generated audio —the dynamic duck (default), or
ducking=Falsefor a static voice-forward mix.keep_original_sound=Truekeep_original_sound=True, ducking=Falsepreserve_speech=Truepreserve_speech=True, ducking=Falsekeep_original_soundsupersedespreserve_speech(the voice source is a singlechoice). No combination is rejected, so nothing here raises.
Video-only, enforced the same way
output_formatalready isbuild_v2s_partsis shared by both sound endpoints, and it already had onefield they do not share —
output_format, audio-only, keyword-only with aNonedefault, whichVideoToVideoSoundsimply never passes.keep_original_soundis the mirror image, so it follows the identical patternand
VideoToSoundnever passes it. No type gymnastics needed.tests/test_keep_original_sound.pyasserts that on the public signatures ofall four classes (sync and async,
submitandgenerate), so adding the fieldto
VideoToSoundby reflex fails the suite rather than silently shipping aparameter the server drops.
Verification
becomes neither
"true"nor"false"— the default belongs to the server),an explicit
Falsestill being sent (a real request, distinct from unset),the
keep_original_sound + ducking=Falsestatic-mix row, both flags senttogether with precedence deliberately left to the server, and the
signature-level guard in both directions.
Stale copy corrected
The README asserted the old default ("By default the returned video keeps the
source's speech with the music ducked under it") and described
duckingas ifit decided whether speech was kept rather than how it is mixed. The
SoundOutput/SoundResultdocstrings saidmusic_processedis present "whenpreserve_speech or ducking altered the music bed", which no longer holds. All
four are rewritten.