Add native Rust demucs-rs build for stem separation - #35
Open
ains wants to merge 1 commit into
Open
Conversation
Stem separation now has two engines behind the same job interface: - Native: the demucs CLI built from nikhilunni/demucs-rs, spawned in the main process on the source audio file. Much faster than WASM; coarse download/separate progress is parsed from the CLI's stderr, and cancellation kills the child process. - WebGPU WASM (existing): used whenever the native binary is absent (web build, dev without it) or a native run fails. `npm run build:demucs` clones demucs-rs at a pinned tag, cargo-builds demucs-cli, and stages the binary at resources/demucs/ (gitignored), which ships asar-unpacked. The Release workflow now builds it on macOS and Windows with cargo caching, so production builds always bundle it; in development it is optional, with NOTA_DEMUCS_CLI as an escape hatch to point at an existing binary. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T6sm1K8qgKZBkaPehBpQmz
ains
force-pushed
the
claude/rust-demucs-build-66fxh4
branch
from
July 19, 2026 03:58
86a4fac to
81a5cad
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stem separation now has two engines behind the same job interface, preferring the much faster native one when it's available:
demucsCLI built from nikhilunni/demucs-rs, spawned in the main process on the project's source audio file (src/main/demucsCli.ts). Coarse download/separate progress is parsed from the CLI's plain stderr lines (its interactive bars are hidden off-TTY), cancellation kills the child process, and the resulting stem WAVs are decoded back to PCM at the playback buffer's sample rate so everything downstream (bundle persistence, transport) is unchanged.Build & packaging
npm run build:demucs(scripts/build-demucs-cli.mjs) clones demucs-rs at a pinned tag (v0.3.4, overridable viaDEMUCS_RS_REPO/DEMUCS_RS_REF), runscargo build --release -p demucs-cli, and stages the binary atresources/demucs/(gitignored).resources/**already ships asar-unpacked, so the binary is bundled whenever it's present at package time and the app finds it viaapp.getAppPath()in dev and theapp.asar.unpackedtwin when packaged.NOTA_DEMUCS_CLI=/path/to/demucspoints the app at an existing binary without staging.Details
stems:nativeAvailable), so the existing synchronousstemSeparationSupported()UI gating keeps working; it now returns true when either engine can run.tests/demucsStderr.test.ts).Verified with format, lint, both typecheck projects, and the vitest suite (45 passing).
🤖 Generated with Claude Code
https://claude.ai/code/session_01T6sm1K8qgKZBkaPehBpQmz
Generated by Claude Code