Repository navigation
feat!: add per-voice channel strips and formant banks - #133
google-labs-stitch[bot] wants to merge 8 commits into
Conversation
- Add lead_gain to ResynthesisConfig with 0..=1 range validation - Add per-voice mix and formant controls to HarmonyConfig - Preallocate five forward synthesis banks and histories in Formant - Convert LPC tract areas into five forward models at each design step - Run stamped per-voice LPC synthesis before the Harmony stereo pan sum - Read at most one aspiration random word per frame in Harmony mode - Expose optional camelCase TypeScript fields with serde defaults - Document the new Harmony controls and optional fields in README.md
|
Review: Preferred over #40 and #62 for per-voice channel strips and independent formant banks. Please address three items before merge:
|
- Mirror the five formant feedback rings for contiguous tap sums
- Clear previous_output[1..] when ResynthesisConfig::mode changes - Call Formant::bypass_voice for slots 1..5 on mode changes BREAKING CHANGE: default Harmony pan and formant paths change samples.
- State that harmony gains report controller envelopes before mix gains - List lead_gain, harmony_gain, voice_gains, voice_mutes and stereo pan
|
Addressed all three items and merged the latest
|
- Keep five formant synthesis banks with fused envelope rotations - Add mono Harmony voice sums into channel zero only - Map undefined optional Wasm voice controls to their defaults
|
Round 3 review: Approved for 0.4.0 — per-voice channel strips, 5 formant banks with deduplication, mono mix path, and optional Wasm undefined handling are verified. Please rebase onto updated main after #20, #22, #45, and #107. (Note: once #114 lands, replace FORMANT_OFFSET_FRAMES in the per-voice harmony loop with self.formant_offset_frames().) |
…nel-strips-formant-banks-jm1-909086ee-3bd5-4c5a-a80b-35856bd26631 - Unify five-voice formant banks with `Stamp` and `ring` helpers. - Use `apply_glottal` for per-voice Harmony synthesis. - Normalize new voice and formant intra-doc links for JSDoc. - Combine optional correction and harmony defaults in docs.
|
Synced with updated
|
|
Review: The 5-bank formant deduplication, pre-mix Harmony formant synthesis, single-RNG-per-frame aspiration, and default Choir/mono bit-exactness look solid. Four items before merge:
|
…nel-strips-formant-banks-jm1-909086ee-3bd5-4c5a-a80b-35856bd26631 - Keep Formant::aspiration_muted inside prepare_noise. - Update all five voice banks on scalar formant width and stretch. - Guard lead gain and voice channel-strip changes in Resynthesis. - Keep per-voice envelope docs and Float32Array Telemetry slices.
- Add lead_gain and per-voice harmony flags to ControlActivity. - Clarify that formant_envelope reports the lead slot 0 model. - Normalize new ControlActivity JSDoc links and update README. - Check optional per-voice fields and activity in verify-pack.
|
Addressed all four review items and merged
|
Summary
Adds per-voice channel strip controls and five preallocated LPC synthesis banks for
Harmonymode:ResynthesisConfig,HarmonyConfig,ControlActivity):resynthesis.lead_gain(0.0..=1.0, default1.0) scales or mutes the lead voice inHarmonymode.resynthesis.harmony.voice_gains(0.0..=1.0, default[1.0; 4]),voice_pans(-1.0..=1.0, default[-1.0 / 3.0, 1.0 / 3.0, -1.0, 1.0]), andvoice_mutes(default[false; 4]) configure independent gain, constant-power stereo pan, and sample-accurate mute on each harmony voice.ControlActivity(ProcessorConfig::control_activityandProcessor::control_activity) exposeslead_gain,harmony_voice_gains,harmony_voice_pans,harmony_voice_mutes,harmony_voice_formant_stretch, andharmony_voice_formant_width, reflectingHarmonymode,HarmonyConfig::voicesin interval modes,ResynthesisConfig::stereo_output, andFormantConfig::enabled.HarmonyConfig,Formant,Resynthesis):resynthesis.harmony.voice_formant_stretchandvoice_formant_width(0.5..=2.0, default[1.0; 4]) scale vocal-tract length and width per harmony voice, validated byHarmonyConfig::validate.Formantretains one shared 50th-order LPC inverse analysis (ANALYSIS_FRAMES = 441) and preallocates five forward synthesis banks (66KB total) and mirrored 220-entry feedback rings inProcessor::new.areasinto five Q14 forward PEF models and stamps per-voice synthesis at each reader's center frame before the stereo pan sum (or single-channel mono sum) inHarmonymode, while keepingFormant::set_widthandFormant::set_stretch(ControlEvent::Parameter) synchronized across all five slots.MAX_ORDERsynthesis filter pass and clear feedback history cleanly on mute transitions,Choir↔Harmonymode switches (Resynthesis::apply_config), andreset.NumericContextsorandom_seedsequences stay deterministic, and honorsFormant::aspiration_mutedduringdrain.Choirmode keeps its single lead formant path inrender_leadbit-identical,Processor::formant_envelopeand Wasm envelope caching document and report the lead (slot 0) analysis and synthesis envelopes (width[0]),Telemetry::voice_gainsdocuments that it reports controller envelopes before channel-strip gain/mute/pan, and nominal latency (1,593frames) and tail budget remain unchanged.src/wasm.rs,scripts/verify-pack.mjs,README.md):camelCaseTypeScript fields (leadGain,voiceGains,voicePans,voiceMutes,voiceFormantStretch,voiceFormantWidth) with| undefinedtypes (exactOptionalPropertyTypes: true), serde deserializers mapping absent orundefinedvalues to defaults, andControlActivityflags (leadGain,harmonyVoiceGains,harmonyVoicePans,harmonyVoiceMutes,harmonyVoiceFormantStretch,harmonyVoiceFormantWidth).SemVer Impact
ResynthesisConfig,HarmonyConfig, andControlActivityare#[non_exhaustive], and the new Wasm/TypeScript config fields are optional (| undefined) with serde defaults, so existing Rust and JS/TS callers compile and run without code changes.feat!:→0.4.0):Choirmode (mono/stereo, with or without formants and aspiration) and default monoHarmonymode (formant.enabled = false) remain 100% bit-identical to0.3.4.Harmony(formant.enabled = false) now derives pan fractions fromf32voice_pans = [-1.0 / 3.0, 1.0 / 3.0, -1.0, 1.0]instead of hard-codedf64thirds, shiftingQ14pan quantization on voices0and1by up to1Q14 LSB (2PCMi16LSB atharmony_gain = 0.5).Harmony+Formant(formant.enabled = true) now runs stampedFormant::forward_voiceandmodel_glottalper active voice before channel-strip gain and pan summation rather than a single post-mixforward_stereopass, changing renderedHarmony+Formantsamples even at unityvoice_formant_stretchandvoice_formant_width.AGENTS.md, sample-level output changes on existing configurations are marked as breaking (feat!:/BREAKING CHANGE:), sorelease-please("bump-minor-pre-major": true) bumps0.3.4→0.4.0and records the change underBREAKING CHANGES.Verification
cargo fmt --checkcargo clippy --locked --lib -- -D warningscargo build --locked --releaseRUSTDOCFLAGS="-D warnings" cargo doc --locked --no-depscargo package --lockedRUSTDOCFLAGS="-D warnings" npm run check:wasmnpm run verify:pack1.88(cargo build --locked --libandcargo build --locked --lib --target wasm32-unknown-unknown --features wasm)process(withTimedEventandControlEvent::Parameter),control_activity,formant_envelope,feedback,telemetry,set_config(includingChoir↔Harmonymode switch),drain, andreset(CountingAllocglobal allocator).Choirmode (6 stereo voices, formants and aspiration enabled), default monoHarmonymode (formants disabled),Harmony→Choir→Harmonymode switches with formants enabled,ControlEvent::ParametervsControlEvent::Resynthesis, andHarmonydrain tail aspiration muting.voice_formant_stretch = [0.75, 1.50, 1.0, 1.0]-> spectral centroids655.9 Hzvs521.2 Hz;voice_formant_width0.60vs1.80->10.01 dBmean spectral difference).lead_gain = 0.0andvoice_mutesstereo stem isolation, deterministicrandom_seedaspiration noise across mute states, absent and explicitundefinedWasm option deserialization,ControlActivityflags across modes,Telemetry::voice_gainscontroller-envelope reporting, andProcessor::formant_envelopelead-model reporting.Automated PR initiated by user @byteland-app via Stitch Loop.