Skip to content

Commit 5c2621d

Browse files
hi-ogawa-agentOpenCode
andcommitted
Merge origin/main into model-download-links
Co-authored-by: OpenCode <noreply@opencode.ai>
2 parents a789ead + 0c18517 commit 5c2621d

19 files changed

Lines changed: 291 additions & 70 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
--two-stems-mix minus \
6363
fixtures/sine-10s.wav data/ci-output/native
6464
test -s data/ci-output/native/bass.wav
65-
test -s data/ci-output/native/no_bass.wav
65+
test -s data/ci-output/native/backing.wav
6666
6767
- run: pnpm build-wasm
6868

.github/workflows/pkg-pr-new.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: pkg.pr.new
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: pkg-pr-new-${{ github.event.pull_request.number }}
8+
cancel-in-progress: true
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 10
17+
18+
steps:
19+
- uses: actions/checkout@v6
20+
21+
- uses: actions/setup-node@v6
22+
with:
23+
node-version: "lts/*"
24+
25+
- run: corepack enable
26+
27+
- run: pnpm install --frozen-lockfile
28+
29+
- run: pnpm build-wasm
30+
31+
- run: pnpm exec pkg-pr-new publish --no-compact ./crates/wasm

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pnpm model-release download models-2026-07-11 htdemucs_ft_bass
3939
pnpm cli-separate --name htdemucs_ft --two-stems bass --two-stems-mix minus data/input/song.wav data/output/song
4040
```
4141

42-
This creates `bass.wav` and `no_bass.wav`.
42+
This creates `bass.wav` and `backing.wav`.
4343

4444
Run the same separation flow through the Rust/WASM driver and
4545
`onnxruntime-web`'s Node WASM runtime with:
@@ -81,6 +81,8 @@ pnpm dev
8181

8282
Open `http://localhost:5173`, choose a local audio file and the required model files from `data/onnx-lean/`, then run separation. Audio and models stay in the browser.
8383

84+
When separation finishes, the app automatically downloads all generated stems as a source-named archive such as `song_wav.stems.zip`. Individual stem previews and WAV downloads remain available in the results.
85+
8486
Build the static app with:
8587

8688
```bash

crates/cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fn separate(args: SeparateArgs) -> Result<()> {
129129
complement,
130130
} => vec![
131131
(source.name().to_string(), target),
132-
(format!("no_{}", source.name()), complement),
132+
("backing".to_string(), complement),
133133
],
134134
};
135135
std::fs::create_dir_all(&args.out_dir)?;

crates/core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl Source {
8383
}
8484

8585
/// What a separation yields, exactly; each track is stereo, `[channel][sample]`.
86-
/// How tracks are spelled (e.g. `no_bass.wav`) is the driver's concern.
86+
/// How tracks are spelled (e.g. `backing.wav`) is the driver's concern.
8787
pub enum Outputs {
8888
/// All four stems, in [`Source::ALL`] order.
8989
Full([[Vec<f32>; CHANNELS]; NUM_SOURCES]),

crates/wasm/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@hiogawa/demucs-onnx-wasm",
3+
"version": "0.0.0",
4+
"files": [
5+
"pkg"
6+
],
7+
"type": "module",
8+
"exports": "./pkg/demucs_wasm.js",
9+
"scripts": {
10+
"build": "wasm-pack build . --target web --no-pack --release && rm -f pkg/.gitignore"
11+
},
12+
"devDependencies": {
13+
"wasm-pack": "0.15.0"
14+
}
15+
}

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,23 @@
99
"build-model": "uv run python tools/model-export/build_models.py",
1010
"verify-parity": "uv run python tools/model-export/verify_parity.py",
1111
"model-release": "uv run --no-sync tools/model_release.py",
12-
"build-wasm": "wasm-pack build crates/wasm --target web --release",
12+
"build-wasm": "pnpm -C crates/wasm build",
1313
"wasm-separate": "pnpm -C packages/app wasm-separate",
1414
"build": "pnpm build-wasm && pnpm -C packages/app build",
1515
"build-cf": "(command -v cargo >/dev/null || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal) && PATH=\"$HOME/.cargo/bin:$PATH\" pnpm build",
1616
"cli-separate": "cargo run --release -p demucs-cli -- separate --models data/onnx-lean",
1717
"dev": "pnpm -C packages/app dev",
18-
"lint": "cargo fmt --all && vp check --fix && pnpm -C packages/app lint",
19-
"lint-check": "cargo fmt --all -- --check && vp check && pnpm -C packages/app lint",
18+
"typecheck": "tsc -b packages/app",
19+
"lint-dead-code": "fallow dead-code --unused-exports --unused-types",
20+
"lint": "cargo fmt --all && vp check --fix && pnpm lint-dead-code && pnpm typecheck",
21+
"lint-check": "cargo fmt --all -- --check && vp check && pnpm lint-dead-code && pnpm typecheck",
2022
"test-e2e": "pnpm -C packages/app test-e2e"
2123
},
2224
"devDependencies": {
25+
"fallow": "^3.3.0",
26+
"pkg-pr-new": "0.0.75",
27+
"typescript": "^7.0.2",
2328
"vite-plus": "^0.2.4",
24-
"wasm-pack": "0.15.0",
2529
"wrangler": "4.110.0"
2630
},
2731
"packageManager": "pnpm@11.11.0+sha512.4463f65fd80ed80d69bc1d4bf163ee94f605c7380fc318bb5b2ebe15f8cd12d49c51a4d59e951b401e764d3b6ca751cbf51bc50ed7001a6bcb4935e684c34882"

packages/app/e2e/preferences.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test("restores and updates configuration preferences", async ({ page }) => {
1919
await expect(page.locator("#method")).toHaveValue("minus");
2020
await expect(page.locator("#method")).toBeEnabled();
2121
await expect(page.locator("#outputSummary")).toContainText(
22-
"Creates bass.wav and no_bass.wav.",
22+
"Creates bass.wav and backing.wav.",
2323
);
2424
await expect(page.locator("#shifts")).toHaveValue("3");
2525
await expect(page.getByLabel("Select htdemucs_ft_bass.onnx")).toBeAttached();

packages/app/e2e/separate.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ test("separates a clip fully client-side", async ({ page }) => {
2020
await page.setInputFiles("#file", FIXTURE);
2121
await expect(page.locator("#audio-status")).toContainText("Decoded: 2.00s");
2222

23+
const downloadPromise = page.waitForEvent("download");
2324
await page.click("#run");
2425
await expect(
2526
page.getByRole("progressbar", { name: "Overall separation progress" }),
@@ -31,6 +32,8 @@ test("separates a clip fully client-side", async ({ page }) => {
3132
timeout: 300_000,
3233
});
3334
await expect(page.getByTestId("timing-summary")).toContainText("Inference");
35+
const download = await downloadPromise;
36+
expect(download.suggestedFilename()).toBe("sine-2s_wav.stems.zip");
3437

3538
const stems = page.locator("#stems > div");
3639
await expect(stems).toHaveCount(4);
@@ -39,4 +42,7 @@ test("separates a clip fully client-side", async ({ page }) => {
3942
}
4043
await expect(page.locator("#stems audio")).toHaveCount(4);
4144
await expect(page.locator("#stems a")).toHaveCount(4);
45+
await expect(
46+
page.getByRole("link", { name: "Download ZIP" }),
47+
).toHaveAttribute("download", "sine-2s_wav.stems.zip");
4248
});

0 commit comments

Comments
 (0)