Repository navigation
perf: guard unchanged stage controls and mute drain aspiration - #24
Conversation
- Add an aspiration mute flag on Formant for tail drains. - Mute formant aspiration in Processor::drain_into directly. - Initialize all stage tables and filters at construction. - Guard sub-stage setters and coefficients in Resynthesis. - Guard width, stretch and aspiration updates in Formant. - Guard envelope decays and gains in Punch::set_config. - Guard mix, diffusion, decay and brightness in Reverb. - Preserve exact fixed-point audio, feedback and telemetry.
- Merge upstream changes from main into the feature branch. - Update configure_harmony_gain for the mono and stereo harmony paths.
…ion-jm0-e5600251-1222-49bc-b4d9-8fc2e935020d
|
Review: Bit-exact stage diff-guards and Formant::aspiration_muted give great CPU savings on drain and frequent control events. Please rebase onto main to resolve conflicts with 7490b83 (dirty flags in Formant::new / Reverb::new) and squash the merge commits. Note: if #61 is merged in 0.4.0, it supersedes these same optimizations. |
- Merge main at 0.3.3 into the feature branch - Keep the dirty flags in Formant::new and Reverb::new - Update the Punch helpers for per-sample Q30 and Q28 controls - Pass OutputLayout in Processor::drain_into - Keep the scale_initialized reset in Resynthesis::apply_config
|
Synced with
(Note: force-pushing is disabled in this automated environment, so |
|
Round 2 review: Approved — all stage diff-guards and Formant::aspiration_muted are bit-exact and properly adapted to v0.3.3. Please rebase onto updated main after #46 and #86 (placing hall_diffuse updates inside Reverb::prepare_diffusion). Note: if we move straight to 0.4.0 with #61, #61 subsumes these same optimizations. |
- Merge main at 0.3.4 into the feature branch - Update hall_diffuse in Reverb::prepare_diffusion - Keep the updated reset comment in Resynthesis::reset
|
Synced with updated
|
- Initialize decay_half_step once in Resynthesis::new. - Guard configure_humanize and configure_flex_tune in apply_config. - Update configure_humanize when retune_ms or humanize changes. - Preserve exact audio, feedback, telemetry and f32 drain output.
|
Synced with updated
|
|
Closing as superseded by #61, which is now merged into main for 0.4.0 and includes the same stage diff-guards and Formant::aspiration_muted drain optimization. Thank you for the bit-exact implementation and verification! |
Summary
aspiration_mutedflag onFormantand a crate-privateResynthesis::set_aspiration_mutedhelper soFormant::add_noisereturnssampleimmediately while muted and keepsNumericContextandnoise_filterunchanged acrossforward,forward_mono, andforward_stereo.Resynthesis::apply_configcalls inProcessor::drain_into(used bydrain,drain_planar,drain_mono,drain_f32,drain_planar_f32, anddrain_mono_f32) withset_aspiration_muted(true)before thenext(0, layout)frame loop andset_aspiration_muted(false)after it, while preserving host-visibleProcessor::configandProcessor::control_activity.Resynthesis::new,Formant::new,Punch::new, andReverb::newfrom incremental stage setters while keepingdirty: falseinFormant::newandReverb::new.pitch.set_config,formant.set_config,harmony.apply_config, and split coefficient helpers inResynthesis::apply_config(includingconfigure_humanizeandconfigure_flex_tune), withdecay_half_stepanddrift_decaycomputed once at construction andscale_initializedanddwellcleared as before.width/width_squared,stretch_map,noise_gain, andDesign::high_passby field inFormant::set_config.PunchConfigonPunch, computefast_decayanddrive_decayonce inPunch::new, and guard per-sample Q30/Q28slow_decay,attack_decay,gain, andceiling_gainupdates by field.mix,diffuse+hall_diffuse(insideReverb::prepare_diffusion),decay, andDesign::low_pass_one_poleby field inReverb::set_config.Verification
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,.githooks/pre-commit,.githooks/commit-msg, and MSRV1.88builds (cargo +1.88 build --locked --liband--target wasm32-unknown-unknown --features wasm) pass.f32PCM frames,humanizeandflex_tuneautomation, monoChoirandHarmonyforward_monodrains,MediumHallandLargeHallhall_diffuseupdates,Feedback,Telemetry,ControlActivity,formant_envelope, mid-drain cancellation continuation, and full tail drains at 44.1 kHz and 48 kHz matchmain(0850e25) bit for bit (12,726,860bytes,fnv1a64 = 0x65b56afb7b530310).Processor::config()returns the configuredformant.aspiration_mixunchanged before, during, and afterdrain,drain_planar,drain_mono,drain_f32,drain_planar_f32, anddrain_mono_f32.0850e25confirm elimination of stage recomputation overhead on 120,000dry_mixControlEvent::Resynthesisupdates across 480,000 frames (506.320 ms→436.061 ms,-68.532 msrecomputation overhead) and elimination of reconfiguration overhead across 1,863 64-frameProcessor::draincalls withformant.aspiration_mix = 0.2(+2.279 ms→ noise floor).Automated PR initiated by user @byteland-app via Stitch Loop.