Repository navigation
feat(resynthesis): add humanize and flex-tune controls - #45
Merged
byteland-app merged 5 commits intoNov 26, 2026
Conversation
- Add humanize and flex_tune fields to CorrectionConfig. - Accept absent humanize and flexTune fields in JavaScript. - Validate both fields in 0..=1 before state changes. - Relax the correction decay on sustained target bins. - Reset the dwell progress on target changes and restarts. - Reduce the target pull outside the inner flex-tune zone. - Preserve the default audio output at both sample rates. - Document the controls in rustdoc, wasm and the README.
Contributor
|
Review: Good humanize and flex-tune additions, non-breaking and bit-exact when both are 0.0. Please make these adjustments before merge:
|
…m0-6bdd1b4d-19b4-4af9-8033-69151f60266e
- Interpolate the humanize half-life in Q20 with a Hermite ramp. - Convert the half-life to Q14 decay with a Pade (1, 1) quotient. - Factor select_target_ratio and reset dwell on pitch_ratio changes. - Describe flex_tune as an outer soft zone, not a deadband.
Contributor
Author
|
Addressed all three points in
|
Contributor
|
Round 2 review: Approved — the Q20 Hermite + Pade (1,1) humanize ramp, clarified flex_tune docs, and dwell reset are solid and bit-exact at 0.0. Please rebase onto updated main after #123. |
…nd-flex-tune-controls-jm0-6bdd1b4d-19b4-4af9-8033-69151f60266e # Conflicts: # README.md
- Decode undefined humanize and flexTune values to 0 in Wasm. - Emit number | undefined for humanize and flexTune in tsify. - Check absent and undefined correction fields in verify-pack.mjs.
Contributor
Author
|
Synced with updated
|
byteland-app
deleted the
stitch/add-humanize-and-flex-tune-controls-jm0-6bdd1b4d-19b4-4af9-8033-69151f60266e
branch
November 26, 2026 03:20
This was referenced Nov 26, 2026
This was referenced Nov 26, 2026
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.
Summary
humanize(0.0..=1.0, default0.0) andflex_tune(0.0..=1.0, default0.0) toCorrectionConfigin Rust, WebAssembly and TypeScript.humanizeandflexTunewithserde(default, deserialize_with = "deserialize_zero_f32")andtsify(optional, type = "number | undefined")underall(feature = "wasm", target_arch = "wasm32")so both omitted andundefinedJavaScript values decode to0and passexactOptionalPropertyTypesalongsideHarmonyConfig.voices.resynthesis.correction.humanizeandresynthesis.correction.flex_tunein0.0..=1.0before state changes inProcessorandTunelet.humanizetransition in half-life space: interpolateQ20half-life milliseconds fromretune_mstoretune_ms + (400 - retune_ms) * humanizewith the Hermite rampu^3 * (4 - 3 * u), and convert to aQ14decay coefficient with a Padé(1, 1)quotient clamped tocorrection_decay..=sustained_decay. Reset dwell on(scale_index, octave)bin changes, non-positive shifted periods,step.restarted,pitch_ratiochanges, target reloads and audio resets.select_target_ratioinupdate_correctionto apply full pull inside the inner1 - flex_tunefraction of each half-bin aroundperiods[scale_index]and soften pull toward0across the outerflex_tunefraction up tomidpoints.humanize == 0.0andflex_tune == 0.0to preserve bit-identical PCM output at44.1 kHzand48 kHz.Verification
0sample differences across4,974,288renderedi16PCM samples againstmain(v0.3.4) at44.1 kHzand48 kHz(latency_frames = 1,593,tail_framesunchanged).Q14dwell steps0..=16,384(ramping smoothly through125 msatdwell = 0.5and379 msatdwell = 0.9up to400 mswith zero jump atdwell = 1.0).retune_ms = 10.0on a sustainedD4vocal with5.5 Hz,70-cent vibrato,humanize = 0.0retains41.8%depth (37.3%at48 kHz), whilehumanize = 0.8andhumanize = 1.0retain98.0%at44.1 kHzand98.3%at48 kHz(> 80%threshold).retune_ms = 10.0, scale-note step transitions reach90%convergence in22.1 msat44.1 kHzand21.1 msat48 kHz(<= 35 mstarget).1 - flex_tunezone near the target and softened pull toward0near midpoint boundaries viaProcessor::set_configandControlEvent::Resynthesis.cargo fmt --check,cargo clippy --locked --lib -- -D warnings,cargo build --locked --release,RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps,cargo package --locked,RUSTDOCFLAGS="-D warnings" npm run check:wasmandnpm run verify:pack(all fourexactOptionalPropertyTypesprofiles, omitted andundefinedoptional fields, HTTP loaders, and both.tgzarchives).Automated PR initiated by user @byteland-app via Stitch Loop.