Repository navigation
feat(resynthesis): add causal low-latency formant mode - #114
google-labs-stitch[bot] wants to merge 6 commits into
Conversation
- Export LatencyMode with Standard and LowLatency variants - Add the optional latency_mode field to ResynthesisConfig - Add causal 128-frame LPC analysis with zero inverse delay - Store resampled choir lead periods in preallocated lead_periods - Bypass the overlap buffer in LowLatency resynthesis - Align Choir and Harmony formant stamps with zero offset in LowLatency - Clear lead_periods on reset and on latency_mode changes - Return 50 or 1,593 nominal frames from latency_frames - Document LatencyMode in the crate docs, Wasm docs and README.md
Integrate upstream changes from v0.3.3 (#21, #126 and #128) with LatencyMode::LowLatency. The dry delay uses latency_frames(latency_mode): 1,593 frames in Standard mode and 50 frames in LowLatency mode. Causal formant analysis writes pre-emphasized samples into the reverse-order mirrored input history from #126. Resynthesis keeps the post-filter bypass path from #128 when pitch_ratio is at or below 1.0.
|
Updated the branch with
Verified |
|
Updated the branch with
Verified |
- Use HISTORY in process_causal_analysis after the formant cleanup. - Use lead_period_for in move_choir_reader for choir voices. - Update README and wasm.rs for latencyMode, humanize and flexTune. - Add LatencyMode JSDoc replacements and pack checks.
|
Updated the branch with
Verified |
|
Review: Causal 128-frame Formant analysis, 50-frame Please sync onto updated |
- Keep ParameterControl validation, handlers and aspiration_muted. - Update Telemetry docs and formant_generation for low-latency mode. - Merge LatencyMode JSDoc replacements and pack checks with Telemetry. - Update README for latencyMode, ParameterControl and Telemetry.
|
Synced the branch onto
Verified |
Summary
This change adds a causal low-latency resynthesis and LPC formant mode (
LatencyMode::LowLatency) that reduces the nominal resynthesis and formant delay from1,593frames (33.19 msat48 kHz) to50frames (1.04 msat48 kHz) at44.1 kHzand48 kHz.LatencyMode(#[non_exhaustive],Standard,LowLatency) fromsrc/resynthesis.rs,src/lib.rs, and the generated TypeScript declarations.latency_modetoResynthesisConfig(LatencyMode::Standardby default; optional"standard"default in JavaScript when absent orundefined, withLatencyMode | undefinedTypeScript typing forexactOptionalPropertyTypes,#123).128-frame LPC model updates and zero-delay inverse analysis (Formant::process_causal_analysis) insrc/formant.rs, aligned with the reverse-order mirrored input buffer (#126), unifiedStamphelpers (#20), fused envelope rotations / cache epochs (#30), andaspiration_muted/ scalar parameter setters (#61).lead_periods: Box<[Q6; HISTORY]>inResynthesis::newand uselead_period_forinmove_choir_reader(#22), soself.periodskeeps unmodified input periods forFormant::designandResynthesis::estimate, and adaptreset_audiotoclear_dirty_ring(#92).self.overlapinResynthesis::process_sampleinLowLatency, keep the post-filter bypass path (#128),humanize/flex_tunecontrols (#45), scalarParameterControlevents (#61), and single-channel mono Choir and Harmony synthesis (#102), setdelayed = write, delaydrybylatency_frames(latency_mode)(1,593or50frames,#21), and align Choir and Harmonyformant_positionwith zero offset.2 * sample_rateformant tail inResynthesis::tail_frames, clearlead_periodsinreset_audio, and reset audio and post-resynthesis state onlatency_modechanges.50or1,593fromProcessor::latency_frames,Processor::feedback, andTunelet.latencyFramesalongsideTelemetrypitch fields andFloat32Arrayvoice slices (#104),ControlActivity(#135), andFloat32audio methods (#117), add JSDoc normalization rules and pack checks (#107), and update crate, Wasm, andREADME.mddocumentation.Verification
LatencyMode::Standard(ProcessorConfig::default()) reports1,593frames and renders bit-identicali16PCM,process_planar_f32(#117), mono in-place,Telemetry(#104),formant_envelope, and meter output compared tomain(8880205) across14 / 14golden vectors (includinghumanize/flex_tune,#45, andParameterControlevents,#61) at44.1 kHzand48 kHz.LatencyMode::LowLatencyreports50frames fromProcessor::latency_frames(),Processor::feedback().latency_frames, andTunelet.latencyFrameswithformant.enabledoff and on.220 Hzvocal inputs at44.1 kHzand48 kHzmeasure50wet and dry frames (1.13 msat44.1 kHz,1.04 msat48 kHz) acrossi16andf32, mono and stereo Choir and Harmony with active formants (width = 0.75,stretch = 1.25),0.0009 dBdry/wet phase difference at480 Hz, validformant_envelope()outputs, unmodified pitch feedback andTelemetry(formant_generation = 129) in multi-voice Choir, and zero runtime heap allocations..githooks/pre-commit,.githooks/commit-msg,cargo fmt --check,cargo rustc --locked --lib --release -- -D warnings,RUSTFLAGS="-D warnings" cargo build --locked --release,cargo clippy --locked --lib -- -D warnings,RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps,cargo rustdoc --locked --lib -- -D warnings,cargo package --locked,npm run check:wasm,npm run verify:pack,npm run verify:pack -- --ignore-scripts, and MSRV1.88native/Wasm builds.