Repository navigation
feat: add adaptive silence drain and flush lifecycle - #65
Closed
google-labs-stitch[bot] wants to merge 6 commits into
Closed
google-labs-stitch[bot] wants to merge 6 commits into
google-labs-stitch[bot] wants to merge 6 commits into
Conversation
- Initialize Punch with the configured gain at construction. - Calibrate reverb tail budgets from the loop delays of each mode. - Stop active drains after 17,000 silent frames past the initial delays. - Defer the post-drain reset to the next non-empty drain call. - Expose drain_remaining and flush in Rust, WebAssembly and TypeScript. - Reset all DSP, keyboard and random state without memory allocation.
- Merge the latest commits from main. - Keep telemetry, flush and i64 arithmetic notes in src/lib.rs.
- Merge the latest commits from main. - Share process_into, downmix and flush_post_resynthesis in Processor. - Cancel the drain and the silence counters in process_into.
- Merge the latest commits from main. - Refer to drain for completion in the begin_drain Wasm comment. - Refer to processMono and drain in the drain_mono Wasm comment.
…-jm1-aa17d16b-ecf2-4ecb-bb5f-6ea1aa1c040d
- Merge the latest commits from main - Keep the dirty flag across flush and reset in Reverb - Track audio and analysis changes separately in Formant - Clear only the active sample and period spans in PitchTracker - Clear only the active sample and period spans in Resynthesis
Contributor
byteland-app
deleted the
stitch/adaptive-silence-drain-lifecycle-apis-jm1-aa17d16b-ecf2-4ecb-bb5f-6ea1aa1c040d
branch
November 25, 2026 08:06
Contributor
Author
|
Acknowledged — leaving #65 closed with no further changes in favor of #75, which calibrates the |
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
Punchdirectly withPunch::new(rate, config.punch)inProcessor::new, soPunch.drivestarts atconfig.punch.gain_dbfrom sample zero without an initial0 dBtransient.reverb::tail_framesto the per-mode loop delays fromreverb_layoutplus one17,000-frame (DELAY_CAPACITY) ring pass as a finite upper bound againstQ14limit cycles.Processorafterresynthesis.tail_frames() + alien::tail_frames(config.alien)frames pass, which stops positive drain blocks early after17,000consecutive stereo frames within±24PCM on both channels.drain_remainingtoSome(0)at the end of the final positive drain block, preservesFeedbackandTelemetrypeaks andprocessed_frames, and defersself.reset()to the next non-empty (frames > 0) drain call that returnsOk(0).Processor::drain_remainingandTunelet.drainRemaining(Option<usize>in Rust,number | undefinedin TypeScript).Processor::reset,Tunelet.resetandControlEvent::Resetto restore all DSP histories, filter memories, pitch tracker buffers, formant banks, keyboard state (0..=127) andNumericContextwithout memory allocation, matchingProcessor::newsample for sample from frame zero.Processor::flush,ControlEvent::FlushandTunelet.flushto clear delay lines, held notes0..=126and meters while preservingNumericContext, reverb damping filter memories, harmony release envelopes, choir drift, modulation phase, control timing, pitchprevious_periodandformant_generation.Verification
cargo fmt --check,cargo build --locked --release,cargo clippy --locked --lib -- -D warnings,cargo clippy --locked --target wasm32-unknown-unknown --features wasm --lib -- -D warnings,RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-depsandnpm run build).0allocations /0bytes via a customGlobalAllocharness) acrossprocess*,begin_drain,drain*,reset,flushandTimedEventcontrols.44.1 kHzand48 kHzacross all sixReverbModetopologies and Node.js WebAssembly bindings that:Punchat-96.0 dBemits zero nonzero PCM frames from sample zero.17,000frames after holdoff or last frame above±24PCM, and post-stop output never exceeds-58 dBFS(41PCM).drain_remaining/drainRemainingtransitionsNone/undefined→ decreasingSome(n)/n→Some(0)/0→None/undefined, empty drain slices neither advance counters nor run the deferred reset, andFeedback/Telemetrystay intact after the final positive block.reset()matchesProcessor::newbit for bit from frame zero across maximal multi-stage configurations,flush()preserves live controller continuity, andControlEvent::Flushvalidates atomically before any state or buffer change.Automated PR initiated by user @byteland-app via Stitch Loop.