Skip to content

feat!: add vocal presets, scales and semitone helpers - #36

Open
google-labs-stitch[bot] wants to merge 7 commits into
mainfrom
stitch/add-presets-scales-semitones-jm1-c2d62c65-9332-49b8-8501-69ac6df29920
Open

google-labs-stitch[bot] wants to merge 7 commits into
mainfrom
stitch/add-presets-scales-semitones-jm1-c2d62c65-9332-49b8-8501-69ac6df29920

Conversation

@google-labs-stitch

@google-labs-stitch google-labs-stitch Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This pull request adds musical scales, vocal presets and semitone conversion helpers across the Rust, WebAssembly and TypeScript APIs.

  • Scales (src/scale.rs): Mark CorrectionScale as #[non_exhaustive] (feat!:), add HarmonicMinor, MelodicMinor, Dorian, Mixolydian, MajorPentatonic, MinorPentatonic and Blues, document their semitone offsets in rustdoc, and rotate 12-flag scale masks in NoteMask::from_key_scale without heap allocation.
  • Presets and semitone helpers (src/config.rs, src/lib.rs): Add #[non_exhaustive] Preset (NaturalTune, HardPopTune, LushChoir, DiatonicHarmony, WarmBroadcast), ProcessorConfig::from_preset, semitones_to_ratio (-24..=24) and ratio_to_semitones (0.25..=4), and re-export them at the crate root. Preset::LushChoir sets output_gain to 0.35 so that eight summed choir voices do not overload the output.
  • WebAssembly, package checks and documentation (src/wasm.rs, scripts/normalize-jsdoc.mjs, scripts/verify-pack.mjs, README.md): Export presetConfig, noteMaskFromKeyScale, semitonesToRatio and ratioToSemitones, normalize Preset and CorrectionScale JSDoc comments, check the four helpers at runtime and in TypeScript consumer profiles in scripts/verify-pack.mjs, update the TypeScript quick start to use noteMaskFromKeyScale("a", "minor") and semitonesToRatio(4), and list the new helpers in the TypeScript API table.

Verification

  • cargo fmt --check
  • cargo clippy --locked --lib -- -D warnings (native and wasm32-unknown-unknown --features wasm)
  • RUSTFLAGS="-D warnings" cargo build --locked --release and MSRV 1.88
  • RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps (native and wasm32-unknown-unknown --features wasm)
  • cargo package --locked
  • npm run check:wasm
  • npm run verify:pack
  • Verified all 120 key and scale pairs, all five presets at 44.1 kHz and 48 kHz, #[non_exhaustive] enforcement in an external crate, and semitone and ratio boundary and non-finite checks in Rust and Node.js.

Automated PR initiated by user @byteland-app via Stitch Loop.

- Add seven musical scales to CorrectionScale and NoteMask.
- Add Preset and ProcessorConfig::from_preset for five vocal chains.
- Add semitones_to_ratio and ratio_to_semitones with range checks.
- Export the scale, preset and semitone helpers from Wasm.
- Update the README quick start and the TypeScript API table.
@byteland-app

Copy link
Copy Markdown
Contributor

Review: Clean additions for vocal presets, 7 new scales, and semitone helpers. Please rebase onto current main (21 commits behind, no CI run yet) and note two SemVer items for the 0.4.0 breaking window:

  1. CorrectionScale is not #[non_exhaustive], so adding 7 variants is a Rust breaking change — please mark the commit as 'feat!:' and consider adding #[non_exhaustive] to CorrectionScale.
  2. Add #[non_exhaustive] to the new Preset enum so future presets remain non-breaking.

- Keep ControlEvent and MidiEvent alongside the new Wasm imports.
- Add #[non_exhaustive] to CorrectionScale in src/scale.rs.
- Add #[non_exhaustive] to Preset in src/config.rs.
@google-labs-stitch google-labs-stitch Bot changed the title feat: add vocal presets, scales and semitone helpers feat!: add vocal presets, scales and semitone helpers Nov 25, 2026
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Addressed all items from your review:

  1. Synced with current main (0.3.3): Merged the latest main into the branch (resolving the src/wasm.rs import list alongside ControlEvent and MidiEvent; fast-forward push since force-pushing is disabled in this environment) so CI runs cleanly against .github/workflows/ci.yml.
  2. CorrectionScale & feat!:: Added #[non_exhaustive] to CorrectionScale in src/scale.rs and marked both the commit and the PR title with feat!: for the 0.4.0 breaking window.
  3. Preset #[non_exhaustive]: Added #[non_exhaustive] to Preset in src/config.rs so future preset variants remain SemVer non-breaking.

- Keep ControlActivity alongside the preset and scale exports.
- Keep controlActivity() alongside the preset and scale table rows.
@byteland-app

Copy link
Copy Markdown
Contributor

Round 3 review: Approved for 0.4.0 — scales, presets, semitone helpers, and #[non_exhaustive] enums are verified. Please rebase onto updated main after #107 and #117 (adding any new Preset/CorrectionScale rustdoc mappings in scripts/normalize-jsdoc.mjs).

- Keep the preset, scale and semitone exports in src/wasm.rs
- Update the TypeScript API table in README.md with the Float32 rows
- Normalize the Preset and CorrectionScale JSDoc comments
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Synced with updated main (0850e25, including #107, #117, and #45):

  1. Resolved the merge conflicts in src/wasm.rs and README.md alongside the new Float32Array / TuneletAudioViews APIs and aligned # Errors JSDoc wording on the four new exports.
  2. Added Preset, Preset::LushChoir, and CorrectionScale rustdoc-to-JSDoc mappings in scripts/normalize-jsdoc.mjs.
  3. Verified all CI gates locally (cargo fmt --check, cargo clippy, cargo doc, cargo package, npm run check:wasm, npm run verify:pack, and MSRV 1.88).

@byteland-app

Copy link
Copy Markdown
Contributor

Review: Scale masks, presets, semitone helpers, and #[non_exhaustive] enums are verified and ready for 0.4.0.

Please sync onto updated main (#139, #131, #104, #61) and add runtime smoke checks in scripts/verify-pack.mjs for presetConfig, noteMaskFromKeyScale, semitonesToRatio, and ratioToSemitones.

- Keep the preset, scale and semitone exports with ParameterControl.
- Update the module documentation in src/wasm.rs for parameter events.
- Check preset, scale and semitone helpers at runtime.
- Check TypeScript types for presets, scales and semitone helpers.
- Check @throws JSDoc tags on the four helper exports.
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Synced with updated main (8880205, including #139, #131, #104 and #61) and added package checks in scripts/verify-pack.mjs:

  1. Merged main into the branch and resolved the src/wasm.rs conflict alongside ParameterControl scalar parameter events.
  2. Added runtime smoke checks in scripts/verify-pack.mjs for presetConfig, noteMaskFromKeyScale, semitonesToRatio and ratioToSemitones (covering all five presets, scale masks, semitone/ratio conversions, processor configuration application, and invalid/non-finite/out-of-range error rejection), plus TypeScript consumer profile and @throws JSDoc checks.
  3. Verified all CI gates locally (cargo fmt --check, cargo clippy, RUSTFLAGS="-D warnings" cargo build --locked --release, cargo doc, cargo package --locked, npm run check:wasm, npm run verify:pack and MSRV 1.88).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant