Skip to content

feat!: add parallel mix controls and smoothed bypass - #116

Open
google-labs-stitch[bot] wants to merge 6 commits into
mainfrom
stitch/add-parallel-mix-and-smoothed-bypass-jm1-f14df4e6-b0d8-4a0f-984b-296e07570f3d
Open

google-labs-stitch[bot] wants to merge 6 commits into
mainfrom
stitch/add-parallel-mix-and-smoothed-bypass-jm1-f14df4e6-b0d8-4a0f-984b-296e07570f3d

Conversation

@google-labs-stitch

@google-labs-stitch google-labs-stitch Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add mix (0.0..=1.0, default 1.0) to PunchConfig, WarmConfig and AlienConfig with Q14 wet/dry blends ((dry * dry_w + wet * wet_w) >> 14) integrated into the Q28 Punch and Warm pipelines (#111), old.mix != config.mix setter guards alongside #61 scalar parameter helpers, range validation and continuous internal state updates at all mix values when enabled.
  • Return 0 tail frames from alien::tail_frames when alien.mix == 0.0 to match reverb::tail_frames.
  • Add global mix (0.0..=1.0, default 1.0) and bypass (bool, default false) to ProcessorConfig, plus ControlEvent::Mix and ControlEvent::Bypass integrated into #[non_exhaustive] ControlEvent, ValidatedEvents and Processor::apply alongside #61 ParameterControl, #104 Telemetry pitch fields and #135 ControlActivity.
  • Preallocate the 1,593-frame raw i16 delay buffer (3,186 bytes, aligned with LATENCY_FRAMES and resynthesis.dry_mix from #21) one time in Processor::new, clear it in Processor::reset, and crossfade bypass changes over 200 frames in Q14 before the OutputLayout::Mono downmix while all internal stages advance.
  • Update docs/images/signal-chain.svg and README.md to show both the post-Warm dry_mix path and the pre-Punch 1,593-frame raw dry path into Mix and Bypass.
  • Expose optional serde defaults, undefined deserializers (deserialize_mix, deserialize_false) and tsify(optional, type = "... | undefined") declarations (#123) in WebAssembly and TypeScript (defaultConfig(), Tunelet, setConfig, and zero-allocation scalar event decoding in src/wasm.rs from #99 and #61), and update the rustdoc and README.md in ASD-STE100.

Breaking Change

  • Add public mix fields to PunchConfig, WarmConfig, AlienConfig and ProcessorConfig, add bypass to ProcessorConfig, and add ControlEvent::Mix(f32) and ControlEvent::Bypass(bool).

DSP Verification

DSP Verification Charts

  • Bit-exact main (8880205) defaults & zero post-construction allocation: Verified identical sample-for-sample stereo and mono i16 and f32 PCM output, feedback(), telemetry() (#104) and control_activity() (#135) against main across 44.1 kHz and 48 kHz for default Choir, multi-effect chains (Punch, Warm, Formant, Choir, Alien, Reverb, output_gain) and drain / drain_mono, with +3,186 bytes in Processor::new and 0 post-construction heap allocations.
  • Alien tail budget & impulse alignment: Verified Processor::tail_frames() excludes Alien's 2 * loop_frames + 200 tail when alien.mix == 0.0, and verified one single pulse at frame 1,593 across resynthesis.dry_mix and global mix values 0.0, 0.25, 0.5, 0.75 and 1.0 and bypass = true at both 44.1 kHz and 48 kHz.
  • Zero comb loss: Verified 0.00 dB comb loss across 220 Hz..882 Hz (with 440 Hz, 441 Hz and 480 Hz unshifted sine tones).
  • 200-frame bypass crossfade & validation: Verified click-free 200-frame Q14 crossfades, mid-fade reversals, dry-buffer reset and pre-mutation Error::InvalidConfig / Error::InvalidEvent rejection in Rust and WebAssembly.
  • CI Gates: Passed 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:wasm, npm run verify:pack and the Rust 1.88 MSRV build (#120).

Automated PR initiated by user @byteland-app via Stitch Loop.

- Align the resynthesis dry path to 1,593 frames.
- Add Q14 mix controls to Punch, Warm and Alien.
- Add global mix and 200-frame bypass to ProcessorConfig.
- Add ControlEvent::Mix and ControlEvent::Bypass.
- Preallocate the 1,593-frame raw dry buffer in Processor::new.
- Clear the global dry buffer in Processor::reset.
- Accept absent optional mix and bypass fields in JavaScript.
- Update the rustdoc, signal-chain diagram and README.md.
@byteland-app

Copy link
Copy Markdown
Contributor

Review: Preferred over #100 — full parallel mix controls and smooth 200-frame Q14 bypass crossfades with bit-exact default output. Please update before merge:

  1. ControlEvent is not #[non_exhaustive], so adding ControlEvent::Mix and ControlEvent::Bypass is a Rust breaking change: either target the 0.4.0 breaking window with 'feat!:' (and add #[non_exhaustive] to ControlEvent), or drop those two event variants to ship non-breaking in 0.3.x.
  2. Rebase onto updated main (fix: align dry delay, stereo reverb and mono meters #21 dry-tap alignment and fix(effects): use per-sample envelopes and normalize ceiling #111 Q28 Punch/Warm pipelines).

- Blend Q14 mix into the Q28 Punch and Warm pipelines.
- Apply the mono downmix after global mix and bypass.
- Decode mix and bypass events in the Wasm event buffer.
- Reconcile the signal-chain docs and README with v0.3.3.
- Add #[non_exhaustive] to ControlEvent.
- Update the ControlEvent::validate error documentation.

BREAKING CHANGE: ControlEvent adds Mix, Bypass and #[non_exhaustive].
@google-labs-stitch google-labs-stitch Bot changed the title feat: add parallel mix controls and smoothed bypass feat!: add parallel mix controls and smoothed bypass Nov 25, 2026
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Updated both items:

  1. 0.4.0 breaking window & #[non_exhaustive] ControlEvent (3c2e282): Added #[non_exhaustive] to ControlEvent in src/events.rs, kept ControlEvent::Mix and ControlEvent::Bypass with updated ControlEvent::validate rustdoc, marked the commit feat(events)!: with a BREAKING CHANGE: footer, and updated the PR title to feat!: add parallel mix controls and smoothed bypass for release-please 0.4.0.
  2. Updated main (v0.3.3) integration (210c0fd): Synced with latest main (451ea1e, including #21 1,593-frame dry-tap alignment and OutputLayout::Mono downmix, #111 Q28 per-sample Punch/Warm pipelines, and #99 reusable Wasm event decoding — merged via fast-forward push since force-pushing is disabled on the bot branch) and verified bit-exact v0.3.3 default PCM output and all Rust/Wasm/npm CI gates.

@byteland-app

Copy link
Copy Markdown
Contributor

Round 2 review: Approved for the 0.4.0 breaking window — ControlEvent #[non_exhaustive], #21 mono metering order, and #111 Q28 Punch/Warm mix pipelines are all cleanly integrated. Please rebase onto updated main (after #46 and #123).

- Merge main at v0.3.4 into the mix and bypass branch.
- Keep the correction key reset documentation from #46 in Processor.
- Decode undefined mix and bypass fields in Wasm as in #123.
- Add undefined to optional mix and bypass TypeScript declarations.
- Update README.md for undefined optional fields and v0.3.4 queries.
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Synced with updated main at v0.3.4 (720690b, commit 5b5b228 — fast-forward merge since force-pushing is disabled on the bot branch):

  • #46 & #135 integration: Resolved Processor::reset rustdoc with #46 (0..=127 correction key release and mask reload) alongside the global dry buffer and bypass crossfade reset, and preserved ControlActivity / controlActivity() from #135 and envelope_cache from #30.
  • #123 TypeScript declarations & undefined deserialization: Added deserialize_mix and deserialize_false in src/wasm.rs and updated mix (ProcessorConfig, PunchConfig, WarmConfig, AlienConfig) and bypass (ProcessorConfig) to tsify(optional, type = "number | undefined") / tsify(optional, type = "boolean | undefined") so both absent and undefined optional fields decode to defaults under exactOptionalPropertyTypes: true and scripts/postbuild-wasm.mjs.
  • Verification: Verified bit-exact v0.3.4 default PCM output and zero post-construction allocations, plus verify, msrv (1.88), and npm run verify:pack all green.

@byteland-app

Copy link
Copy Markdown
Contributor

Round 3 review: Approved for 0.4.0 — parallel stage/global mix, 200-frame smoothed bypass, ControlEvent #[non_exhaustive], and optional Wasm undefined handling are verified. Please rebase onto updated main after #45, #107, and #117. (Note: once #114 low-latency mode lands, the global dry ring in Processor should also follow latency_frames(latency_mode).)

- Merge main into the feature branch.
- Combine the mix, bypass, humanize and flex-tune docs in README.md.
- List humanize and flexTune in the defaultConfig Wasm docs.
- Check optional mix and bypass fields in scripts/verify-pack.mjs.
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Synced with main at 0850e25 (commit fb0c162 — fast-forward merge since force-pushing is disabled on the bot branch):

  • #45, #107 & #117 integration: Reconciled README.md and src/wasm.rs with resynthesis.correction.humanize / flexTune (#45) and the f32 / Float32 in-place audio paths (#117), verified clean JSDoc normalization via scripts/normalize-jsdoc.mjs (#107), and extended scripts/verify-pack.mjs to check omitted and undefined optional mix and bypass fields and ControlEvent variants across Int16Array and Float32Array calls.
  • Verification: Verified bit-exact i16 and f32 default PCM/drain output and zero post-construction allocations against 0850e25, plus .githooks, build-wasm, check-os, verify:pack, and msrv (1.88) locally. (Noted on #114: if main updates again with latency_frames(latency_mode), we will align the Processor dry ring to it as well.)

@byteland-app

Copy link
Copy Markdown
Contributor

Review: Parallel stage/global mix, 1,593-frame pre-Punch dry alignment, 200-frame smoothed bypass, and bit-exact defaults look solid. Three items before merge:

  1. Update docs/images/signal-chain.svg and its README.md alt text: The diagram does not yet show the pre-Punch dry path, global mix, or bypass (this update appears to have been lost in an earlier merge).
  2. Minor consistency (src/effects/alien.rs): Check whether alien::tail_frames should return 0 when alien.mix == 0.0 to match reverb::tail_frames.
  3. Sync onto updated main (build(cargo): bump the cargo group with 2 updates #139, ci: deny compiler and rustdoc warnings in scripts and docs #131, feat!: add pitch fields to Telemetry and trim Wasm voice slices #104, feat(events)!: add scalar parameter control events #61): Integrate ControlEvent::{Mix, Bypass} alongside feat(events)!: add scalar parameter control events #61's #[non_exhaustive] ControlEvent and ParameterControl, add old.mix != config.mix guards in Punch::set_config / Warm::set_config, and preserve feat!: add pitch fields to Telemetry and trim Wasm voice slices #104's Telemetry. (Note: if feat(resynthesis): add causal low-latency formant mode #114 lands first, also align the pre-Punch dry ring delay dynamically with latency_mode — 1,593 vs 50 frames.)

- Merge main with scalar parameter events and pitch telemetry.
- Guard unchanged mix values in Punch, Warm and Alien.
- Return zero tail frames from Alien if alien.mix is zero.
- Update signal-chain.svg and README.md for global mix and bypass.
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Addressed in b82c811:

  1. docs/images/signal-chain.svg & README.md: Added the pre-Punch 1,593-frame raw dry path (dry path (1,593 frames): mix, bypass) alongside the post-Warm dry_mix path, plus Mix (0..=1) and Bypass (crossfade) stages before Output, and updated the README.md alt text and TimedEvent discriminant documentation.
  2. alien::tail_frames: Updated src/effects/alien.rs to return 0 when !config.enabled || config.mix == 0.0 (matching reverb::tail_frames).
  3. Merged main (8880205): Reconciled ControlEvent::{Mix, Bypass} with #61 (#[non_exhaustive] ControlEvent, ParameterControl, ValidatedEvents, Wasm decode_control_event, and scripts/verify-pack.mjs), added old.mix != config.mix setter guards in Punch::set_config, Warm::set_config, and Alien::set_config, and preserved #104 Telemetry pitch fields and trimmed active voice slices. (If #114 lands before this merges, we will align the raw dry delay length to PrepareConfig::latency_frames() as noted.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant