Skip to content

feat(wasm): build wasm32 and wasm64 Preview 2 plugins - #65

Draft
hlolli wants to merge 4 commits into
csound:developfrom
hlolli:feat/wasm-preview2-targets
Draft

hlolli wants to merge 4 commits into
csound:developfrom
hlolli:feat/wasm-preview2-targets

Conversation

@hlolli

@hlolli hlolli commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Depends on csound/csound#3556. Keep this draft until that PR merges and matching npm releases can replace the temporary source checkout in CI.

The current wasm32 double plugins do not match either new engine. Build Chua, image, linear algebra, and STK for both wasm32-wasip2 with float samples and wasm64-wasip2 with double samples, using the matching Csound SDKs and source-built Nix toolchains. Wasm64 assets use the -wasm64.wasm suffix.

@csound/plugins selects wasm32 float to match the default browser engine. The /wasm32 and /wasm64 entry points each export one plugins object. Use /wasm64 with the opt-in @csound/browser/wasm64.js module. Static dependencies follow the selected target, and the linear-algebra code now accepts float samples.

Each plugin keeps its own Preview 2 file descriptors while following the engine's working directory. Wasm64 plugins embed adapters for their WASI imports, including STK's directory creation. CI pins csound/csound#3556 at 23eaa7fa28cadf26b2c453d53b8e789986e3bdf5, which includes WASI 0.2.12, LLVM 23.1.3, the loader support, and the wasm32 browser default. Keep the same nixpkgs pin and use libc++'s stream-copy fallback where WASI lacks Linux's copy_file_range.

The existing npm dependency versions predate Preview 2. Until matching releases exist, CSOUND_WASM_PACKAGE selects a built upstream source tree; the README describes that setup and the release steps.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@hlolli
hlolli force-pushed the feat/wasm-preview2-targets branch from df9d1de to 1565d2e Compare November 6, 2026 06:26
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