Repository navigation
feat: support native multi-rate DSP from 8 kHz to 192 kHz - #73
Closed
google-labs-stitch[bot] wants to merge 4 commits into
Closed
google-labs-stitch[bot] wants to merge 4 commits into
google-labs-stitch[bot] wants to merge 4 commits into
Conversation
- Load the prepared SampleRate periods in Resynthesis::new. - Add eight SampleRate variants in config.rs and wasm.rs. - Scale the PitchTracker stride and lag limits for each rate. - Scale the Formant buffers and LPC orders for each rate. - Preallocate the resynthesis histories as boxed slices. - Scale the choir SEEDS offsets for each sample rate. - Scale the reverb layout for all ten sample rates. - Scale the frame windows in Punch, Warm and Alien. - Update the documentation for the ten sample rates.
- Keep i64 saturated sums in rate-scaled Formant filters. - Keep slice interpolation with i64 bounds in Resynthesis. - Use i64 Fixed operations for Q6 periods at all sample rates. - Keep mono harmony_gain in Resynthesis and README.md.
- Sum contiguous slices with the rate-scaled history in PitchTracker. - Keep the rate-scaled lag count in PitchTracker::track_contiguous. - Use the rate-scaled reader margin in Resynthesis::reader_bounds. - Share reader_bounds and step_reader in Resynthesis::move_reader.
- Keep the rate-scaled lag count in PitchTracker::detect. - Allow clippy::needless_range_loop in PitchTracker::detect. - Iterate the active voice positions as a slice in Resynthesis. - Document the rate-scaled latency in WasmProcessor::latency_frames.
Contributor
|
Closing as superseded by #53. Native 192 kHz LPC (order 218 / max 480) inflates CPU cost ~17–19x and memory to ~9+ MB, adds an i32 wrapping_shl(14) overflow risk in Q24 Durbin, silently alters 48 kHz latency/output without a breaking marker, and conflicts with recent main fixes. |
byteland-app
deleted the
stitch/native-multi-rate-dsp-jm1-35672d43-f9ea-47bf-900f-4063eb75af52
branch
November 25, 2026 08:05
Contributor
Author
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
This change adds native multi-rate DSP parameter scaling across all ten standard voice, WebRTC, and studio sample rates (
8000,16000,22050,24000,32000,44100,48000,88200,96000, and192000Hz) and fixes the initial 48 kHz chromatic correction table.Changes
src/resynthesis.rs,src/scale.rs):Resynthesis::newnow initializesCorrectionTable::new(rate, config.correction.notes)directly with the preparedSampleRate, so default chromatic correction at 48 kHz loads 48 kHz periods immediately instead of 44.1 kHz periods (+46.70 cents sharp detune).src/config.rs,src/wasm.rs): AddedHz8000,Hz16000,Hz22050,Hz24000,Hz32000,Hz88200,Hz96000, andHz192000toSampleRateandWasmProcessor::new(Tunelet), while unsupported rates such as44056returnError::UnsupportedSampleRatebefore allocation.src/pitch/tracker.rs,src/pitch/search.rs,src/pitch.rs): Scaled the acquisition decimation stride (2..=32), low-pass prefilter cutoff, acquisition lag count (105..=160), full-rate tracking lag window (8..=176), and minimum lag threshold (3..=82), while leveragingi64Fixed::mulandFixed::divforQ6periods up to 192 kHz.src/formant.rs,src/lpc.rs): Scaledanalysis_frames(80..=1,920),history_frames, LPCpredictor_order(9..=218, keeping the ~882 Hz vocal-tract pole interval),max_synthesis_order(20..=480), andblend_stepwithi64saturated Q28 filter sums, and added a 32-bit Q24 internal recursion path inlpc::durbinfororder > 50(48, 88.2, 96, and 192 kHz).src/numeric.rs,src/resynthesis/history.rs,src/resynthesis.rs,src/processor.rs): Replaced fixedHISTORYandOVERLAP_FRAMESarray storage with preallocated boxed slices (2,100..=50,368history frames and280..=6,718overlap frames), scaled choirSEEDSand reader lag/margin/crossfade windows, and exposed rate-scaledProcessor::latency_frames().src/effects/reverb.rs,src/effects/punch.rs,src/effects/warm.rs,src/effects/alien.rs): Scaledbase(scale(9000.0)) andcapacity(scale(17000.0)) inreverb_layout, scaled peak windows inPunchandWarm, and scaledAlienhistory capacity (32,000..=768,000frames), boundary fades, andAlienConfig::loop_frames(1..=384,000).Verification
114,688PCM bytes across default Choir, 8-voice Choir + Formant + Punch + Warm + Alien + LargeHall Reverb + drain, Harmony + MIDI + Binaural Reverb, and mono Harmony +FixedInterval+ portamento +harmony_gainmatchmainbit-for-bit (0byte differences).target_midi_note == Some(69.0)withresample_ratio == 0.999695(-0.528cents, within 1 cent of1.0).Formantstability across0.5..=2.0widthandstretch, all sixReverbModetopologies up to 192 kHz, zero heap allocations afterProcessor::new, and Node.js WebAssembly execution across all 10 sample rates.cargo build --locked --release,cargo fmt --check,cargo clippy --locked --lib -- -D warnings,cargo doc --locked --no-deps,npm run build, andnpm run verify:packpass with zero warnings.Automated PR initiated by user @byteland-app via Stitch Loop.