You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add STK to the WASM package with embedded samples - #50
Adds plugins.stk to @csound/plugins. Its single stkops.wasm file includes all 41 bundled raw-wave samples, so STK instruments work without extra downloads or wave-path setup.
CMake generates byte arrays from the samples. At module initialization, the adapter writes them to Csound's virtual filesystem and sets STK's wave path. An explicit RAWWAVE_PATH takes precedence. The STK_EMBED_RAWWAVES option defaults to on for WASM and off for native builds.
STK keeps its C++ exception handling. Nix builds a separate static libc++/libc++abi runtime and the LLVM WASM unwinder, and removes the compiler wrapper's forced -fno-exceptions flag so CMake can choose the mode per target. A small CMake target builds the unwinder's WASM source because LLVM 21's main target also selects unsupported assembly. This adds no source patches and works with the currently pinned Csound SDK and browser releases.
Validation: the Nix WASM build and npm pack pass. All 11 runtime tests pass, covering four sampled STK instruments, STK loaded alone, a custom sample directory, a caught missing-sample error, and the existing plugins loaded together. The npm archive includes the STK and LLVM unwinder license notices.
Summary by CodeRabbit
New Features
Added the STK plugin to the WebAssembly package.
STK instruments can use bundled raw-wave samples without requiring separate sample files. A custom RAWWAVE_PATH continues to take precedence.
Bug Fixes
Improved handling of missing STK samples so errors are reported instead of escaping as WebAssembly exceptions.
Reviewing files that changed from the base of the PR and between 50c0e81 and 3833218.
📒 Files selected for processing: 12
7.x/cmake/WasmPlugins.cmake
7.x/src/stk/CMakeLists.txt
7.x/src/stk/EmbedRawwaves.cmake
7.x/src/stk/stkOpcodes.cpp
THIRD_PARTY.md
index.d.ts
index.js
wasm/README.md
wasm/default.nix
wasm/libunwind/CMakeLists.txt
wasm/scripts/build.sh
wasm/tests/runtime.test.js
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
📝 Walkthrough
The WASM build now enables STK with exception support and bundled raw-wave samples. The package exports and stages the STK plugin, and runtime tests cover rendering, sample-path overrides, and missing samples.
The build can generate embedded data from bundled .raw files. When embedding is enabled and RAWWAVE_PATH is empty, initialization stages the files in .csound-stk-rawwaves; a supplied path bypasses staging.
The package exports and stages stkops.wasm. Tests cover STK rendering, standalone loading, custom sample paths, and missing samples. Documentation and notices include STK and libunwind.
sequenceDiagram
participant Csound as Csound module initialization
participant Path as RAWWAVE_PATH
participant Samples as Embedded raw-wave table
participant VFS as Csound virtual filesystem
Csound->>Path: Check configured path
alt Path is empty
Csound->>Samples: Read embedded sample data
Samples->>VFS: Write samples to .csound-stk-rawwaves
Csound->>Path: Use .csound-stk-rawwaves
else Path is nonempty
Csound->>Path: Use supplied path
end
Loading
Merge Risk:⚪ Minimal · up to 38332
No actionable merge-blocking issue is established; the change is mergeable after normal checks.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 5 files. (7 skipped: 7…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely summarizes the primary change: adding STK to the WASM package with embedded samples.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 5 files. (7 skipped: 7 unsupported.)
Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
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
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.
Adds
plugins.stkto@csound/plugins. Its singlestkops.wasmfile includes all 41 bundled raw-wave samples, so STK instruments work without extra downloads or wave-path setup.CMake generates byte arrays from the samples. At module initialization, the adapter writes them to Csound's virtual filesystem and sets STK's wave path. An explicit
RAWWAVE_PATHtakes precedence. TheSTK_EMBED_RAWWAVESoption defaults to on for WASM and off for native builds.STK keeps its C++ exception handling. Nix builds a separate static libc++/libc++abi runtime and the LLVM WASM unwinder, and removes the compiler wrapper's forced
-fno-exceptionsflag so CMake can choose the mode per target. A small CMake target builds the unwinder's WASM source because LLVM 21's main target also selects unsupported assembly. This adds no source patches and works with the currently pinned Csound SDK and browser releases.Validation: the Nix WASM build and
npm packpass. All 11 runtime tests pass, covering four sampled STK instruments, STK loaded alone, a custom sample directory, a caught missing-sample error, and the existing plugins loaded together. The npm archive includes the STK and LLVM unwinder license notices.Summary by CodeRabbit
RAWWAVE_PATHcontinues to take precedence.